Build four native planet profiles and retire legacy menu tokens
This commit is contained in:
parent
49c428b328
commit
bcf2b3761e
1 changed files with 2959 additions and 8 deletions
|
|
@ -69,7 +69,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
departure=Bukkit.createBossBar("Spacing Guild · next Imperial departure",BarColor.YELLOW,BarStyle.SOLID);
|
||||
Bukkit.getScheduler().runTaskTimer(this,this::tick,20L,20L);
|
||||
Bukkit.getScheduler().runTaskLater(this,this::ensureRegistrar,40L);
|
||||
Bukkit.getScheduler().runTaskTimer(this,()->{for(Player p:Bukkit.getOnlinePlayers())if(sidebar.enabled(p))refreshSidebar(p);},80L,600L);
|
||||
Bukkit.getScheduler().runTaskTimer(this,()->{for(Player p:Bukkit.getOnlinePlayers()){removeOldNavigators(p);if(sidebar.enabled(p))refreshSidebar(p);}},80L,600L);
|
||||
getLogger().info("House selector and Mentat screens enabled; central J.A.R.V.I.S. bridge; no Core/Lobby replacement.");
|
||||
}
|
||||
@Override public void onDisable(){if(exchange!=null)exchange.close();if(itemPreviews!=null)itemPreviews.close();if(quests!=null)quests.close();requests.clear();records.clear();bookings.clear();boarding.clear();if(guild!=null)guild.close();GuiSession.clear();if(sidebar!=null)sidebar.clear();for(var controller:detached.values())try{controller.restore();}catch(ReflectiveOperationException ignored){}detached.clear();if(departure!=null)departure.removeAll();for(Player p:Bukkit.getOnlinePlayers())if(p.getOpenInventory().getTopInventory().getHolder() instanceof Screen)p.closeInventory();}
|
||||
|
|
@ -93,11 +93,18 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
fetch(p,null,0,null,data->{if(command.getName().equals("mentat")&&selection(data)!=null)mentat(p,data);else select(p,data,null);});return true;
|
||||
}
|
||||
private void giveCodex(Player p,boolean explain){
|
||||
removeOldNavigators(p);
|
||||
NamespacedKey itemId=new NamespacedKey("executableitems","ei-id");
|
||||
for(ItemStack item:p.getInventory().getContents())if(item!=null&&item.hasItemMeta()&&"dr_imperial_codex".equals(item.getItemMeta().getPersistentDataContainer().get(itemId,PersistentDataType.STRING))){if(explain)p.sendMessage("Your Imperial Codex is already in your inventory.");return;}
|
||||
if(p.getInventory().firstEmpty()<0){if(explain)p.sendMessage("Make one inventory slot available, then use /drgui item.");return;}
|
||||
try{var item=bridge.menuItem(p);int slot=p.getInventory().firstEmpty();p.getInventory().addItem(item);try{bridge.addedItem(p,item,slot);}catch(Exception eventFailure){getLogger().warning("ExecutableItems inventory hook unavailable: "+eventFailure.getClass().getSimpleName());}if(explain)p.sendMessage("Imperial Codex received. Right-click to open DuneRealms.");}catch(Exception unavailable){if(explain)p.sendMessage("The Imperial Codex item is temporarily unavailable. /drgui still opens your console.");getLogger().warning("Imperial Codex item could not be built: "+unavailable.getClass().getSimpleName());}
|
||||
}
|
||||
private void removeOldNavigators(Player p){
|
||||
var inventory=p.getInventory();for(int slot=0;slot<inventory.getSize();slot++){
|
||||
var item=inventory.getItem(slot);if(item==null||!item.hasItemMeta()||(item.getType()!=Material.NETHER_STAR&&item.getType()!=Material.BLAZE_ROD))continue;
|
||||
var data=item.getItemMeta().getPersistentDataContainer();for(var key:data.getKeys())if(data.has(key,PersistentDataType.STRING)&&"menu_opener".equals(data.get(key,PersistentDataType.STRING))){inventory.setItem(slot,null);break;}
|
||||
}
|
||||
}
|
||||
private void openGuild(Player p,String requested){if(!lobby(p)){p.sendMessage("Imperial House passage departs from the Spacing Guild lobby.");return;}fetch(p,null,0,null,data->{String house=selection(data);if(house==null){p.sendMessage("Choose and confirm your House before Guild passage.");select(p,data,null);return;}if(requested!=null&&!GuildRoutes.allowed(house,requested))p.sendMessage("Other House worlds are unavailable through this Guild passage.");travelMenu(p,data);});}
|
||||
private static GuildBookings.Permit permit(JsonObject data){String house=selection(data);if(house==null||!data.has("keyId")||data.get("keyId").isJsonNull())return null;try{return new GuildBookings.Permit(house,UUID.fromString(data.get("keyId").getAsString()),data.get("version").getAsInt());}catch(RuntimeException invalid){return null;}}
|
||||
private void travelMenu(Player p,JsonObject data){var q=new JsonObject();q.addProperty("action","quote");guildRequest(p,q,quote->{data.add("guildQuote",quote);renderTravelMenu(p,data);});}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff