From e56f3e7392cf9adbe222a2efb849de03c3e42ca0 Mon Sep 17 00:00:00 2001 From: unimatrixgit <95320811+unimatrixgit@users.noreply.github.com> Date: Sat, 28 Nov 2026 01:51:57 +0100 Subject: [PATCH] Open the shared decision list from player and organisation menus --- .../main/java/com/dunerealms/gui/DuneGUI.java | 2 +- .../com/dunerealms/gui/OrganisationMenus.java | 7 ++++--- .../java/com/dunerealms/gui/QuestMenus.java | 20 ++++++++++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java index e16e1184..c33612a0 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java @@ -70,7 +70,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto exchange=new ExchangeMenus(this,bridge,p->organisations.console(p),p->guiPackLoaded.contains(p.getUniqueId())); quests=new QuestMenus(this,bridge,p->organisations.console(p));warMenus=new WarMenus(this,bridge); itemPreviews=new ItemPreviewMenu(this,bridge,p->guiPackLoaded.contains(p.getUniqueId())); - organisations=new OrganisationMenus(this,bridge,p->fetch(p,null,0,null,data->mentat(p,data)),p->openGuild(p,null),p->fetch(p,null,0,null,data->select(p,data,null)),p->quests.open(p),p->exchange.open(p),p->spice.open(p),p->guiPackLoaded.contains(p.getUniqueId())); + organisations=new OrganisationMenus(this,bridge,p->fetch(p,null,0,null,data->mentat(p,data)),p->openGuild(p,null),p->fetch(p,null,0,null,data->select(p,data,null)),p->quests.open(p),p->quests.openDecisions(p,0),p->exchange.open(p),p->spice.open(p),p->guiPackLoaded.contains(p.getUniqueId())); registrar=new NamespacedKey(this,"house_registrar"); modernMenus=new MCGUIMenus(this); ecologyArtwork=new EcologyArtwork(this); diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java index 1fb01779..0fe1beac 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java @@ -15,7 +15,7 @@ import net.kyori.adventure.text.event.ClickEvent; /** One organisation panel, with separate Clan and Guild/Company presentation. */ final class OrganisationMenus implements Listener { - private final JavaPlugin plugin;private final HouseBridge bridge;private final Consumer mentat,travel,house,quests,exchange,spice; + private final JavaPlugin plugin;private final HouseBridge bridge;private final Consumer mentat,travel,house,quests,decisions,exchange,spice; private final java.util.function.Predicate artwork; private final Set busy=new HashSet<>(); private final Map brandingRequests=new HashMap<>(); @@ -26,8 +26,8 @@ final class OrganisationMenus implements Listener { Panel(Player p){owner=p.getUniqueId();gate=new GuiSession(owner);} public Inventory getInventory(){return inventory;} } - OrganisationMenus(JavaPlugin plugin,HouseBridge bridge,Consumer mentat,Consumer travel,Consumer house,Consumer quests,Consumer exchange,Consumer spice,java.util.function.Predicate artwork){this.plugin=plugin;this.bridge=bridge;this.mentat=mentat;this.travel=travel;this.house=house;this.quests=quests;this.exchange=exchange;this.spice=spice;this.artwork=artwork;Bukkit.getPluginManager().registerEvents(this,plugin);} - void console(Player p){var panel=panel(p,"Imperial Codex",0);put(panel,8,"Emergency rescue · 1,000 DM","Teleport to safety and heal · 24-hour cooldown",Material.TOTEM_OF_UNDYING,()->p.performCommand("duneess:rescue"));if(p.getWorld().getName().equals("arrakis"))put(panel,28,"Spice buyers","Spacing Guild · Smuggler · P&O payout",Material.ORANGE_DYE,()->spice.accept(p));put(panel,34,"Exchange","Buy, sell and collect your purchases",Material.CHEST,()->exchange.accept(p));var exchangeIcon=new ItemStack(Material.CHEST);var exchangeMeta=exchangeIcon.getItemMeta();exchangeMeta.displayName(Component.text("Exchange",NamedTextColor.GOLD));exchangeMeta.lore(List.of(Component.text("Buy · Sell · Add held item",NamedTextColor.GRAY)));exchangeIcon.setItemMeta(exchangeMeta);panel.inventory.setItem(34,exchangeIcon);put(panel,31,"Mission journal","Personal Experience and Reputation",Material.WRITABLE_BOOK,()->quests.accept(p));put(panel,4,"Item lore archive","Preview the shared item lore cards",Material.WRITABLE_BOOK,()->lore(p));put(panel,19,"Clan","Your clan and Home Block",Material.GREEN_BANNER,()->open(p,"clans"));put(panel,22,"Company","Your companies and Home Blocks",Material.CYAN_BANNER,()->open(p,"companies"));put(panel,25,"POL","Your current political offices",Material.PURPLE_BANNER,()->open(p,"offices"));put(panel,37,"Your Mentat","Your personal briefing",Material.BOOK,()->mentat.accept(p));put(panel,40,"Spacing Guild","Transport and boarding windows",Material.COMPASS,()->travel.accept(p));put(panel,43,"Your House","Your allegiance and adviser",Material.NETHER_STAR,()->house.accept(p));close(panel,p);show(p,panel);} + OrganisationMenus(JavaPlugin plugin,HouseBridge bridge,Consumer mentat,Consumer travel,Consumer house,Consumer quests,Consumer decisions,Consumer exchange,Consumer spice,java.util.function.Predicate artwork){this.plugin=plugin;this.bridge=bridge;this.mentat=mentat;this.travel=travel;this.house=house;this.quests=quests;this.decisions=decisions;this.exchange=exchange;this.spice=spice;this.artwork=artwork;Bukkit.getPluginManager().registerEvents(this,plugin);} + void console(Player p){var panel=panel(p,"Imperial Codex",0);put(panel,8,"Emergency rescue · 1,000 DM","Teleport to safety and heal · 24-hour cooldown",Material.TOTEM_OF_UNDYING,()->p.performCommand("duneess:rescue"));if(p.getWorld().getName().equals("arrakis"))put(panel,28,"Spice buyers","Spacing Guild · Smuggler · P&O payout",Material.ORANGE_DYE,()->spice.accept(p));put(panel,34,"Exchange","Buy, sell and collect your purchases",Material.CHEST,()->exchange.accept(p));var exchangeIcon=new ItemStack(Material.CHEST);var exchangeMeta=exchangeIcon.getItemMeta();exchangeMeta.displayName(Component.text("Exchange",NamedTextColor.GOLD));exchangeMeta.lore(List.of(Component.text("Buy · Sell · Add held item",NamedTextColor.GRAY)));exchangeIcon.setItemMeta(exchangeMeta);panel.inventory.setItem(34,exchangeIcon);put(panel,31,"Mission journal","Personal Experience and Reputation",Material.WRITABLE_BOOK,()->quests.accept(p));put(panel,32,"Decisions","Your current J.A.R.V.I.S. decisions",Material.ENCHANTED_BOOK,()->decisions.accept(p));put(panel,4,"Item lore archive","Preview the shared item lore cards",Material.WRITABLE_BOOK,()->lore(p));put(panel,19,"Clan","Your clan and Home Block",Material.GREEN_BANNER,()->open(p,"clans"));put(panel,22,"Company","Your companies and Home Blocks",Material.CYAN_BANNER,()->open(p,"companies"));put(panel,25,"POL","Your current political offices",Material.PURPLE_BANNER,()->open(p,"offices"));put(panel,37,"Your Mentat","Your personal briefing",Material.BOOK,()->mentat.accept(p));put(panel,40,"Spacing Guild","Transport and boarding windows",Material.COMPASS,()->travel.accept(p));put(panel,43,"Your House","Your allegiance and adviser",Material.NETHER_STAR,()->house.accept(p));close(panel,p);show(p,panel);} void open(Player p,String kind){ if(!busy.add(p.getUniqueId()))return; Bukkit.getScheduler().runTaskAsynchronously(plugin,()->{JsonObject data=null;try{data=bridge.organisations(p.getUniqueId());}catch(Exception ignored){}JsonObject result=data;if(!plugin.isEnabled())return; @@ -140,6 +140,7 @@ final class OrganisationMenus implements Listener { put(panel,19,"Set Home Block",manage?"Register your current planet position\nExisting deed and claim revision are rechecked":"Current organisation management required",manage?Material.GOLD_BLOCK:Material.GRAY_DYE,()->{if(manage)perform(p,kind,row,"set-home",null);else{p.sendMessage("Current organisation management is required.");organisation(p,data,kind,row);}}); put(panel,22,"Travel Home",home==null?"Unavailable · no registered game Home Block":"Registered game Home Block\nBoarding :00–:05, :20–:25, :40–:45\nOrganisation passage · no fare charged",home==null?Material.GRAY_DYE:Material.ENDER_PEARL,()->{if(home!=null)perform(p,kind,row,"travel-home",null);else organisation(p,data,kind,row);}); put(panel,25,"Members","View current key-linked roster",Material.PLAYER_HEAD,()->members(p,data,kind,row)); + put(panel,32,"Decisions","Your current J.A.R.V.I.S. decisions",Material.ENCHANTED_BOOK,()->decisions.accept(p)); put(panel,37,"MOTD","Read your organisation message",Material.WRITABLE_BOOK,()->motd(p,data,kind,row)); put(panel,40,"Your Mentat","Your existing personal briefing",Material.BOOK,()->mentat.accept(p)); put(panel,49,"War report","Home Blocks conquered · Campaign progress\nWar control remains on the website",Material.IRON_SWORD,()->warStatus(p,()->organisation(p,data,kind,row))); diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java index 73096438..dffbe264 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java @@ -57,10 +57,28 @@ final class QuestMenus implements Listener { private void smugglerMenu(Player p,JsonObject data,PolQuestNpc.Role role){var input=new JsonObject();input.addProperty("action","smuggler_quote");smugglerRequest(p,input,quote->{var screen=panel(p,"NPC turn-in · "+role.name());screen.description="A personal smuggler passage is distinct from sanctioned Guild travel. Unsanctioned arrival may carry the existing in-game bounty.";roleAvatar(screen,data,role);if(!yes(quote,"eligible")){put(screen,13,"Ordinary Guild passage","Your current lawful route is available. Use the normal Guild Navigator.",Material.COMPASS,null);}else if(!yes(quote,"allowed")){put(screen,13,"Personal passage","Opt in with Esmar if ordinary Arrakis passage is unavailable. One hour from the verified introduction.",Material.COMPASS,null);put(screen,31,"Opt in to smuggling","Register the existing smuggler introduction and personal permission.",Material.LIME_DYE,()->{var introduction=data.getAsJsonArray("quests").asList().stream().map(JsonElement::getAsJsonObject).filter(q->text(q,"id","").equals("POL-SMUGGLERS-01")).findFirst().orElse(null);if(introduction==null){p.sendMessage("The current smuggler mission is unavailable.");return;}Runnable emit=()->{try{bridge.smugglerIntroduction(p);p.sendMessage("Introduction recorded. Reopen personal passage after J.A.R.V.I.S. verifies it.");}catch(Exception error){p.sendMessage("Meet Esmar Tuek in the Guild lobby.");}};if(yes(introduction,"canStart")&&!Set.of("active","completed","claimed").contains(text(introduction,"state",""))){var start=new JsonObject();start.addProperty("action","start");start.addProperty("kind","pol");start.addProperty("definitionId","POL-SMUGGLERS-01");start.addProperty("requestId",UUID.randomUUID().toString());start.addProperty("confirmed",true);request(p,start,ignored->emit.run());}else emit.run();});}else{long expiry=quote.get("permitExpiresAt").getAsLong();int price=quote.get("fareMinor").getAsInt();put(screen,13,"Personal passage to Arrakis","Fare: "+String.format(Locale.ROOT,"%.2f DM",price/100.0)+"\nPermission expires: "+java.time.Instant.ofEpochMilli(expiry)+"\nExisting unsanctioned-arrival rules apply.",Material.COMPASS,null);if(yes(quote,"affordable"))put(screen,31,"Book passage","Reserve this exact fare; payment settles only after arrival.",Material.LIME_DYE,()->{var board=new JsonObject();board.addProperty("action","smuggler_board");board.addProperty("requestId",UUID.randomUUID().toString());board.add("keyId",quote.get("keyId"));board.add("version",quote.get("version"));board.add("fareMinor",quote.get("fareMinor"));board.addProperty("destination","arrakis");smugglerRequest(p,board,ticket->{try{bridge.dispatchGuild(p,ticket);}catch(Exception error){p.sendMessage("The transfer was not dispatched; unused reservation expires.");}});});else put(screen,31,"Insufficient funds","Your personal central bank account must cover the fare.",Material.CLOCK,null);}put(screen,33,"Starter spice shovel","Open the existing starter objective for your original shovel; no duplicate issue.",Material.WOODEN_SHOVEL,()->{p.closeInventory();p.performCommand("start");});put(screen,49,"Back","Return to Esmar's missions",Material.ARROW,()->load(p,"pol",null,null,0));show(p,screen);});} void decisionCommand(Player player,String[] args){ if(args.length==0){openDecisions(player,0);return;} - if(args.length!=1||!args[0].equalsIgnoreCase("list")){player.sendMessage("Use /decisions [list].");return;} + if(args.length!=1||!args[0].matches("[A-Za-z0-9-]{1,32}")){player.sendMessage("Use /decisions [list|decision-id].");return;} + String requested=args[0].toUpperCase(Locale.ROOT); var input=new JsonObject();input.addProperty("action","read"); request(player,input,data->{ var decisions=data.getAsJsonArray("decisions"); + if(!requested.equals("LIST")){ + for(var value:decisions){ + var decision=value.getAsJsonObject(); + if(!requested.equals(text(decision,"id","")))continue; + player.sendMessage(text(decision,"title","Decision")+" · "+requested); + String description=dialogue(decision,"introduction",""); + if(!description.isBlank())player.sendMessage(description); + String fee=text(decision,"feeMinor",""); + if(fee.matches("[0-9]+"))player.sendMessage("Base cost: "+new java.math.BigDecimal(fee).movePointLeft(2).toPlainString()+" DM"); + var contact=PolQuestNpc.decisionContact(text(decision,"npcRole","")); + if(text(decision,"kind","").equals("website"))decisionWebsite(player,requested); + else if(contact!=null)player.sendMessage("Contact: "+contact.name()); + return; + } + player.sendMessage("That decision is not currently available to you."); + return; + } if(decisions.isEmpty()){player.sendMessage("No political decisions are currently available to you.");return;} for(var value:decisions){ var decision=value.getAsJsonObject();