Connect verified Fremen, careers, starter and native quest evidence

This commit is contained in:
Dev 2026-11-25 13:49:36 +01:00
commit df7132c444
3 changed files with 546 additions and 96 deletions

View file

@ -73,7 +73,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
new PlanetTexturePacks(this);
sidebar=new PersonalSidebar(this);nameplates=new PublicNameplates(this);
for(String command:List.of("spice","sellall","exchange","house","mentat","drgui","drscoreboard","guildtravel","clan","company","polgui"))Objects.requireNonNull(getCommand(command)).setExecutor(this);
for(String command:List.of("start","spice","sellall","exchange","house","mentat","drgui","drscoreboard","guildtravel","clan","company","polgui"))Objects.requireNonNull(getCommand(command)).setExecutor(this);
try{guild=new ExistingGuildService(p->spice.open(p),(p,world)->openGuild(p,world),p->exchange.open(p),p->quests.open(p),p->organisations.console(p),p->{if(!sidebar.enabled(p))sidebar.toggle(p);refreshSidebar(p);p.sendMessage("Your central bank balance appears in your personal scoreboard.");});getLogger().info("Spacing Guild lobby entry connected to current House keys and twenty-minute boarding windows.");}catch(RuntimeException unavailable){getLogger().warning("Spacing Guild travel consumer unavailable; no journeys can be booked.");}
getServer().getPluginManager().registerEvents(this,this);
departure=Bukkit.createBossBar("Spacing Guild · next Imperial departure",BarColor.YELLOW,BarStyle.SOLID);
@ -96,6 +96,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
if(sender instanceof Player player&&command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("item")){giveCodex(player,true);return true;}
if(sender instanceof Player member&&List.of("clan","company","polgui").contains(command.getName())){organisations.open(member,command.getName().equals("clan")?"clans":command.getName().equals("company")?"companies":"offices");return true;}
if(!(sender instanceof Player p))return true;
if(command.getName().equals("start")){quests.starterJournal(p);return true;}
if(command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("organisations")){organisations.open(p,null);return true;}
if(command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("pack")){
p.closeInventory();offerGuiPack(p);

View file

@ -39,6 +39,7 @@ final class HouseBridge {
JsonObject refitSnapshot(org.bukkit.entity.Player p)throws Exception{return (JsonObject)call(translator.getClass().getMethod("refitSnapshot",org.bukkit.entity.Player.class),p);}
boolean refitEquipment(org.bukkit.entity.Player p,JsonObject permit)throws Exception{return Boolean.TRUE.equals(call(translator.getClass().getMethod("refitEquipment",org.bukkit.entity.Player.class,JsonObject.class),p,permit));}
void starterKit(org.bukkit.entity.Player player,JsonObject permit)throws Exception{call(translator.getClass().getMethod("starterKit",org.bukkit.entity.Player.class,JsonObject.class),player,permit);}
void husbandryTurnin(org.bukkit.entity.Player player,JsonObject permit)throws Exception{call(translator.getClass().getMethod("husbandryTurnin",org.bukkit.entity.Player.class,JsonObject.class),player,permit);}
void smugglerIntroduction(org.bukkit.entity.Player player)throws Exception{call(translator.getClass().getMethod("smugglerIntroduction",org.bukkit.entity.Player.class),player);}
void citizenIntroduction(org.bukkit.entity.Player player)throws Exception{call(translator.getClass().getMethod("citizenIntroduction",org.bukkit.entity.Player.class),player);}
JsonObject itemPreview(UUID player,UUID id,int revision)throws Exception{return (JsonObject)call(translator.getClass().getMethod("requestItemPreview",UUID.class,UUID.class,int.class),player,id,revision);}

View file

@ -37,6 +37,7 @@ final class QuestMenus implements Listener {
private void show(Player p,Panel screen){if(BedrockForms.isBedrock(p)){BedrockForms.show(plugin,p,screen.title,screen.description,List.copyOf(screen.choices));return;}if(MCGUIMenus.show(p,screen.title,screen.description,screen.inventory,screen.actions,screen.gate))return;p.openInventory(screen.inventory);Bukkit.getScheduler().runTaskLater(plugin,screen.gate::expire,2400L);}
void close(){pending.clear();for(Player p:Bukkit.getOnlinePlayers())if(p.getOpenInventory().getTopInventory().getHolder() instanceof Panel)p.closeInventory();}
void open(Player p){var screen=panel(p,"Mission journal");put(screen,20,"Personal Experience","Your personal mission branches",Material.BOOK,()->load(p,"personal",null,null,0));put(screen,24,"Reputation","Your Reputation mission branches",Material.ENCHANTED_BOOK,()->load(p,"pol",null,null,0));put(screen,45,"Website Mentat Report","Open your full online journal",Material.MAP,()->website(p));put(screen,49,"Back","Imperial Codex",Material.ARROW,()->back.accept(p));show(p,screen);}
void starterJournal(Player p){load(p,"personal","h",null,0);}
private void website(Player p){p.closeInventory();p.sendMessage(Component.text("Open your Mentat Report →",NamedTextColor.GOLD).clickEvent(ClickEvent.openUrl("https://clans.dunerealms.com/#quests/quests")));}
private void workshop(Player p,int page){var input=new JsonObject();input.addProperty("action","read_refits");input.addProperty("kind","pol");request(p,input,data->{var screen=panel(p,"Organisation workshop");var owners=data.getAsJsonArray("owners");int offset=page*36;for(int i=offset;i<Math.min(owners.size(),offset+36);i++){var owner=owners.get(i).getAsJsonObject();put(screen,i-offset,text(owner,"label","Organisation"),"Use your specialist’s researched MK and rarity for this organisation",Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE,()->prepareRefit(p,owner));}if(owners.isEmpty())put(screen,22,"Specialist required","Your current organisation deed must grant equipment research authority.",Material.GRAY_DYE,null);if(page>0)put(screen,45,"Previous","Earlier organisations",Material.ARROW,()->workshop(p,page-1));if(offset+36<owners.size())put(screen,53,"Next","More organisations",Material.ARROW,()->workshop(p,page+1));put(screen,49,"Back","Mission journal",Material.ARROW,()->open(p));show(p,screen);});}
private void prepareRefit(Player p,JsonObject owner){try{var input=new JsonObject();input.addProperty("action","prepare_refit");input.addProperty("kind","pol");var selected=new JsonObject();selected.add("kind",owner.get("kind"));selected.add("id",owner.get("id"));input.add("owner",selected);input.add("snapshot",bridge.refitSnapshot(p));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.starterNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{var plan=permit.getAsJsonObject("plan");var output=plan.getAsJsonObject("output");var screen=panel(p,"Review equipment refit");StringBuilder cost=new StringBuilder("Surrender the held original and:");for(var token:plan.getAsJsonObject("consume").getAsJsonArray("templates"))cost.append("\n1 ").append(token.getAsJsonObject().get("id").getAsString().replace("dr_","").replace('_',' '));Material material=Material.matchMaterial(output.get("material").getAsString());put(screen,13,"MK "+output.get("equipmentMark").getAsString()+" · "+output.get("quality").getAsString().replace('_',' '),"Original identity, name, lore and wear retained.\nExisting enchantments scale with the next tier.\nReputation level "+plan.get("requiredReputationLevel").getAsString()+" required.\n"+cost,material==null?Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE:material,null);put(screen,30,"Refit original",cost+"\nOne minute between refits. Review expires after 30 seconds.",Material.LIME_DYE,()->confirmRefit(p,input));put(screen,32,"Back","Return without consuming anything",Material.ARROW,()->workshop(p,0));show(p,screen);});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Hold your original near Gurney’s quartermaster.":failure.getMessage(),NamedTextColor.RED));}}
@ -60,10 +61,13 @@ final class QuestMenus implements Listener {
private void quests(Player p,String kind,JsonObject data,String branch,int page){
var rows=new ArrayList<JsonObject>();for(var entry:data.getAsJsonArray("quests")){var row=entry.getAsJsonObject();if(branch.equals(text(row,"branch","")))rows.add(row);}
int offset=page*36;var screen=panel(p,"Missions · "+branch);for(int i=offset;i<Math.min(rows.size(),offset+36);i++){var row=rows.get(i);boolean web=website(row);put(screen,i-offset,text(row,"title","Quest"),text(row,"state","Pending")+"\n"+(web?"Website quest":"Minecraft / website quest")+"\n"+text(row,"progress","0")+" / "+text(row,"target","0"),web?Material.WRITABLE_BOOK:Material.LIGHT_BLUE_DYE,()->details(p,kind,data,branch,page,row));}
if(kind.equals("personal")&&branch.equals("e")){put(screen,36,"Official Spice Harvesting","Reputation careers · genuine harvested spice",Material.ORANGE_DYE,()->load(p,"pol","spice-harvesting",null,0));put(screen,38,"Smuggling Jobs","Native roaming smuggler contracts",Material.CHEST,()->load(p,"pol","smugglers",null,0));put(screen,40,"Bounty Jobs","Accept and complete an actual bounty",Material.MAP,()->load(p,"pol","bounty-jobs",null,0));}
if(kind.equals("pol")&&branch.equals("bounty-jobs"))put(screen,40,"View active bounties","Open /dune bounty on Arrakis",Material.PAPER,()->{p.closeInventory();p.performCommand("dune bounty");});
put(screen,45,"Branches","Choose another branch",Material.ARROW,()->branches(p,kind,data));if(page>0)put(screen,47,"Previous","Previous missions",Material.PAPER,()->quests(p,kind,data,branch,page-1));put(screen,49,"Refresh","Read current verified quest records",Material.CLOCK,()->load(p,kind,branch,null,page));if(offset+36<rows.size())put(screen,51,"Next","More missions",Material.PAPER,()->quests(p,kind,data,branch,page+1));show(p,screen);
}
private void details(Player p,String kind,JsonObject data,String branch,int page,JsonObject row){
var screen=panel(p,"Quest dossier");String title=text(row,"title","Quest"),state=text(row,"state","Pending"),description=text(row,"objective","Complete the verified objective.")+"\nProgress: "+text(row,"progress","0")+" / "+text(row,"target","0")+"\nState: "+state+"\n"+(kind.equals("pol")?"Reputation: ":"XP: ")+text(row,"xp","Not configured");
if(row.has("personalXP")&&!row.get("personalXP").isJsonNull())description+="\nBase Personal XP: "+row.get("personalXP").getAsInt();if(row.has("baseDMMinor")&&!row.get("baseDMMinor").isJsonNull())description+="\nBase funded reward: "+String.format(Locale.ROOT,"%.2f DM",row.get("baseDMMinor").getAsLong()/100.0);
put(screen,13,title,description,website(row)?Material.WRITABLE_BOOK:Material.LIGHT_BLUE_DYE,null);
if(website(row))put(screen,31,"Open website journal","This objective belongs to the website",Material.MAP,()->website(p));
else if(yes(row,"canClaim"))put(screen,31,"Claim verified reward","Revalidate the objective and current reward",Material.LIME_DYE,()->act(p,kind,branch,page,row,"claim"));
@ -72,19 +76,22 @@ final class QuestMenus implements Listener {
else if(row.has("cooldownUntil")&&!row.get("cooldownUntil").isJsonNull()&&row.get("cooldownUntil").getAsLong()>System.currentTimeMillis())put(screen,31,"Mission cooling down","Available after "+java.time.Instant.ofEpochMilli(row.get("cooldownUntil").getAsLong()),Material.CLOCK,null);
else if(yes(row,"canStart")&&!state.equals("active")&&!state.equals("claimed")&&!state.equals("completed"))put(screen,31,"Start mission","Accept this objective through J.A.R.V.I.S.",Material.LIME_DYE,()->act(p,kind,branch,page,row,"start"));
else put(screen,31,state.equals("claimed")?"Reward claimed":"Awaiting verified progress","No reward can be issued from an unverified objective",Material.GRAY_DYE,null);
if(kind.equals("pol")&&Set.of("POL-ELYTRA-REFINE","POL-ELYTRA-CONTAMINATE").contains(text(row,"id",""))&&(yes(row,"canStart")||Set.of("active","completed","claimed").contains(state)))put(screen,33,"Refine at NPC","Stand near an Arrakis Smuggler.\nTurn in the ingredients shown in this quest.",Material.ORANGE_DYE,()->refine(p,kind,data,branch,page,row));
if(kind.equals("pol")&&Set.of("POL-ELYTRA-REFINE","POL-ELYTRA-CONTAMINATE","POL-SPICE-UPGRADE-REFINE","POL-SPICE-UPGRADE-CONTAMINATE").contains(text(row,"id",""))&&(yes(row,"canStart")||Set.of("active","completed","claimed").contains(state)))put(screen,33,"Refine at NPC","Stand near an Arrakis Smuggler.\nTurn in the ingredients shown in this quest.",Material.ORANGE_DYE,()->refine(p,kind,data,branch,page,row));
if(kind.equals("pol")&&text(row,"id","").equals("POL-SMUGGLERS-01")&&!state.equals("claimed")&&(yes(row,"canStart")||state.equals("active")))put(screen,33,"Meet the underground network","Stand near an Arrakis Smuggler.\nAccept Esmar Tuek’s introduction, then claim the quest.",Material.ORANGE_DYE,()->{try{bridge.smugglerIntroduction(p);p.sendMessage("Introduction recorded. Refresh this quest in a few seconds.");}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Visit an Arrakis Smuggler first.":failure.getMessage());}});
if(kind.equals("pol")&&Set.of("POL-BOUNTY-01","POL-BOUNTY-02").contains(text(row,"id",""))&&!state.equals("claimed"))put(screen,33,"View active bounty jobs","On Arrakis, use the native bounty list and accept a target.",Material.MAP,()->{p.closeInventory();p.performCommand("dune bounty");});
if(kind.equals("pol")&&row.has("research")&&!state.equals("claimed")&&(yes(row,"canStart")||state.equals("active")||state.equals("completed")))put(screen,33,"Submit research samples","Stand near Gurney Halleck.\nSurrender the materials shown in this quest.",Material.SMITHING_TABLE,()->research(p,kind,branch,page,row));
if(kind.equals("pol")&&Set.of("pol-jerboa-meat-25","pol-jerboa-meat-50").contains(text(row,"metric",""))&&!state.equals("claimed")&&!yes(row,"canClaim")&&(yes(row,"canStart")||state.equals("active")))put(screen,33,"Surrender cooked Jerboa meat","Stand near Gurney Halleck on Arrakis.\nSurrender the required genuine cooked Jerboa meat; no reuse of previous turn-ins.",Material.COOKED_RABBIT,()->meatTurnin(p,kind,branch,page,row));
if(kind.equals("personal")&&(yes(row,"canStart")||Set.of("active","completed","claimed").contains(state))){
if(text(row,"id","").equals("S1-H-01"))put(screen,33,"Collect House T0 kit","Visit Gurney's quartermaster.\nFour Common MK 0 stillsuit pieces at half durability.\nOne Uncommon MK I wooden spice shovel.\nOne original kit per account and season.",Material.NETHERITE_CHESTPLATE,()->starter(p,kind,branch,page,row,"obtain"));
if(text(row,"id","").equals("S1-H-02")){put(screen,29,"Prepare four repair parts","Turn in one iron ingot, leather, copper ingot and quartz.\nEach becomes one Uncommon MK I repair component.",Material.IRON_INGOT,()->starter(p,kind,branch,page,row,"parts"));put(screen,33,"Surrender original kit & parts","Hand in the four original bound armour pieces\nand all four prepared parts.\nThen claim this quest to receive the intact kit.",Material.ANVIL,()->starter(p,kind,branch,page,row,"repair"));}
if(text(row,"id","").equals("S1-H-01"))put(screen,33,"Collect House T0 kit","Available directly from /start.\nFour Common MK 0 stillsuit pieces at half durability.\nOne Uncommon MK I wooden spice shovel.\nOne original kit per account and season.",Material.NETHERITE_CHESTPLATE,()->starter(p,kind,branch,page,row,"obtain"));
if(text(row,"id","").equals("S1-H-02")){put(screen,29,"Prepare four repair parts","Buy, craft with genuine spice or collect native 5% mob drops.\nRepair plate, Binding patch, Tool fitting, Calibration piece.\nOptional: prepare all four from the ordinary materials.",Material.IRON_INGOT,()->starter(p,kind,branch,page,row,"parts"));put(screen,33,"Surrender original kit & parts","Hand in the four original bound armour pieces\nand all four verified repair parts.\nThen claim this quest to receive the intact kit.",Material.ANVIL,()->starter(p,kind,branch,page,row,"repair"));}
}
if(row.has("recipe")&&!row.get("recipe").isJsonNull())put(screen,22,"Revealed recipe","Craft on Arrakis · Very Rare · MK XI\nNetherite | Membrane | Netherite\nIron | Diamond | Iron\nContaminated spice | Membrane | Contaminated spice",Material.ELYTRA,null);
put(screen,45,"Back","Mission branch",Material.ARROW,()->quests(p,kind,data,branch,page));put(screen,49,"Refresh","Read current progress",Material.CLOCK,()->load(p,kind,branch,text(row,"id",""),page));show(p,screen);
}
private void refine(Player p,String kind,JsonObject data,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_refine");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.refinerNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.refineSpice(p,permit);p.sendMessage(Component.text("Spice refined. Your quest receipt is queued for confirmation.",NamedTextColor.GREEN));load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Refinement unavailable. Reopen the quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Visit an Arrakis Smuggler first.":failure.getMessage(),NamedTextColor.RED));}}
private void research(Player p,String kind,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_research");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.starterNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.research(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Research receipt pending. Refresh your quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Visit Gurney Halleck.":failure.getMessage(),NamedTextColor.RED));}}
private void starter(Player p,String kind,String branch,int page,JsonObject row,String operation){try{var input=new JsonObject();input.addProperty("action","prepare_starter");input.addProperty("kind","personal");input.addProperty("definitionId",text(row,"id",""));input.addProperty("operation",operation);input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.starterNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.starterKit(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Your equipment exchange remains available. Reopen the quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Visit the quest quartermaster first.":failure.getMessage(),NamedTextColor.RED));}}
private void meatTurnin(Player p,String kind,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_husbandry_turnin");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.starterNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.husbandryTurnin(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Meat turn-in not confirmed.":failure.getMessage());}});}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Visit Gurney Halleck on Arrakis.":failure.getMessage());}}
private void starter(Player p,String kind,String branch,int page,JsonObject row,String operation){try{var input=new JsonObject();input.addProperty("action","prepare_starter");input.addProperty("kind","personal");input.addProperty("definitionId",text(row,"id",""));input.addProperty("operation",operation);input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("access","journal");input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.starterKit(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Your equipment exchange remains available. Reopen the quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Open /start in Survival or Adventure mode.":failure.getMessage(),NamedTextColor.RED));}}
private void introduction(Player p,String kind,JsonObject data,String branch,int page,JsonObject row){
var screen=panel(p,"Imperial Citizen briefing");
put(screen,13,"Welcome, Imperial Citizen","Your House determines normal travel authority.\nGuild travel uses boarding windows and your central bank.\nClan and company actions follow current deeds.\nBlue missions require ingame actions or item turn-ins.\nWebsite missions use your linked website account.\nRead your Mentat Report for current news and duties.",Material.WRITTEN_BOOK,null);