diff --git a/.forgejo/workflows/resourcepack-ci.yml b/.forgejo/workflows/resourcepack-ci.yml index 59109b1a..179997f7 100644 --- a/.forgejo/workflows/resourcepack-ci.yml +++ b/.forgejo/workflows/resourcepack-ci.yml @@ -4,7 +4,7 @@ on: push: branches: [main] paths: - - 'DuneRealmsGUI/**' + - 'network/content-assets/**' - 'tools/build-resourcepack-repair.py' - 'tools/test_resourcepack_repair.py' - 'tools/build-arrakis-fauna-pack.mjs' diff --git a/DuneEss/src/main/java/com/example/duneess/DuneEss.java b/DuneEss/src/main/java/com/example/duneess/DuneEss.java index ac743255..eb140197 100644 --- a/DuneEss/src/main/java/com/example/duneess/DuneEss.java +++ b/DuneEss/src/main/java/com/example/duneess/DuneEss.java @@ -291,7 +291,7 @@ public final class DuneEss extends JavaPlugin implements CommandExecutor, TabCom String command=entry.getItemMeta().getPersistentDataContainer().get(helpActionKey,PersistentDataType.STRING); if(command!=null) actions.put(slot,()->player.performCommand(command.substring(1))); } - com.example.dunegui.NativeMenus.inventory(this,player,"Dune Field Guide · "+(index+1),menu,actions); + com.example.dunegui.MenuPresentation.inventory(this,player,"Dune Field Guide · "+(index+1),menu,actions); } private ItemStack helpItem(Material material, String name, List lore) { @@ -348,7 +348,7 @@ public final class DuneEss extends JavaPlugin implements CommandExecutor, TabCom if(!economy.withdrawPlayer(player,price).transactionSuccess()){player.sendMessage("Not enough Dunemarks, or economy unavailable.");return;} player.getInventory().addItem(spice);player.sendMessage(ChatColor.GOLD+"Bought 16 spice for "+economy.format(price)+"."); }); - com.example.dunegui.NativeMenus.inventory(this,player,"Spice Seller · +35%",menu,actions); + com.example.dunegui.MenuPresentation.inventory(this,player,"Spice Seller · +35%",menu,actions); } private void sellSpice(Player player) { @@ -393,7 +393,7 @@ public final class DuneEss extends JavaPlugin implements CommandExecutor, TabCom } java.util.Map actions=new java.util.HashMap<>(); for(int i=0;itravel(player,planet)); } - com.example.dunegui.NativeMenus.inventory(this,player,"Vaerkring Travel",inventory,actions); + com.example.dunegui.MenuPresentation.inventory(this,player,"Vaerkring Travel",inventory,actions); } @EventHandler public void onTravelMenuClick(InventoryClickEvent event) { diff --git a/DuneEss/src/main/java/com/example/duneess/EssentialsBasics.java b/DuneEss/src/main/java/com/example/duneess/EssentialsBasics.java index 598e9165..5b9625e9 100644 --- a/DuneEss/src/main/java/com/example/duneess/EssentialsBasics.java +++ b/DuneEss/src/main/java/com/example/duneess/EssentialsBasics.java @@ -1,6 +1,6 @@ package com.example.duneess; -import com.example.dunegui.NativeMenus; +import com.example.dunegui.MenuPresentation; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.command.*; @@ -79,20 +79,20 @@ final class EssentialsBasics implements CommandExecutor, TabCompleter, Listener p.teleportAsync(location).thenAccept(success->{ if(!success) p.sendMessage("Teleportation failed. Try again."); }); } void menu(Player p) { - List choices=new ArrayList<>(); - choices.add(new NativeMenus.Choice("Set home","Save your current position as home.",()->p.performCommand("sethome"))); - choices.add(new NativeMenus.Choice("Homes","Choose a saved home on this backend.",()->homeMenu(p))); - choices.add(new NativeMenus.Choice("Spawn","Return to this world's spawn.",()->p.performCommand("spawn"))); - choices.add(new NativeMenus.Choice("Guild servers","Travel using existing Solaris fares and permissions.",()->p.performCommand("duneess travel"))); - choices.add(new NativeMenus.Choice("Solaris","Show your balance.",()->p.performCommand("duneess balance"))); - choices.add(new NativeMenus.Choice("Koopkring Exchange","Buy, list and reclaim items.",()->p.performCommand("exchange"))); - choices.add(new NativeMenus.Choice("Help","Open the Dune Field Guide.",()->p.performCommand("duneess help menu"))); - NativeMenus.show(plugin,p,"DuneRealms Essentials","Solaris: "+plugin.economy().format(plugin.economy().getBalance(p)),choices); + List choices=new ArrayList<>(); + choices.add(new MenuPresentation.Choice("Set home","Save your current position as home.",()->p.performCommand("sethome"))); + choices.add(new MenuPresentation.Choice("Homes","Choose a saved home on this backend.",()->homeMenu(p))); + choices.add(new MenuPresentation.Choice("Spawn","Return to this world's spawn.",()->p.performCommand("spawn"))); + choices.add(new MenuPresentation.Choice("Guild servers","Travel using existing Solaris fares and permissions.",()->p.performCommand("duneess travel"))); + choices.add(new MenuPresentation.Choice("Solaris","Show your balance.",()->p.performCommand("duneess balance"))); + choices.add(new MenuPresentation.Choice("Koopkring Exchange","Buy, list and reclaim items.",()->p.performCommand("exchange"))); + choices.add(new MenuPresentation.Choice("Help","Open the Dune Field Guide.",()->p.performCommand("duneess help menu"))); + MenuPresentation.show(plugin,p,"DuneRealms Essentials","Solaris: "+plugin.economy().format(plugin.economy().getBalance(p)),choices); } private void homeMenu(Player p) { - List choices=names(p).stream().sorted().map(name->new NativeMenus.Choice(name,"Teleport to this saved home.",()->p.performCommand("home "+name))).toList(); + List choices=names(p).stream().sorted().map(name->new MenuPresentation.Choice(name,"Teleport to this saved home.",()->p.performCommand("home "+name))).toList(); if(choices.isEmpty()) p.sendMessage("You have no homes. Use /sethome [name]."); - else NativeMenus.show(plugin,p,"Your homes",choices); + else MenuPresentation.show(plugin,p,"Your homes",choices); } @Override public boolean onCommand(CommandSender sender,Command command,String label,String[] args) { if(!(sender instanceof Player p)) { sender.sendMessage("Use this command in-game."); return true; } diff --git a/DuneEss/src/main/java/com/example/duneess/ExchangeMenu.java b/DuneEss/src/main/java/com/example/duneess/ExchangeMenu.java index 8c64d9bc..b7098dc6 100644 --- a/DuneEss/src/main/java/com/example/duneess/ExchangeMenu.java +++ b/DuneEss/src/main/java/com/example/duneess/ExchangeMenu.java @@ -110,7 +110,7 @@ final class ExchangeMenu implements Listener, CommandExecutor, TabCompleter { }); if(p.hasPermission("dune.admin")) button(s,42,Material.COMMAND_BLOCK,"Exchange Administration",()->admin(p)); button(s,49,Material.BARRIER,"Close",p::closeInventory); - com.example.dunegui.NativeMenus.inventory(plugin,p,s.title,s.inventory,s.actions); + com.example.dunegui.MenuPresentation.inventory(plugin,p,s.title,s.inventory,s.actions); } private void planetMenu(Player p) { Screen s=screen(p,"Planet Filter"); @@ -118,7 +118,7 @@ final class ExchangeMenu implements Listener, CommandExecutor, TabCompleter { String planet=PLANETS.get(i); button(s,11+i,Material.COMPASS,planet,()->{planets.put(p.getUniqueId(),planet); browse(p,"all",0,false,false);}); } - com.example.dunegui.NativeMenus.inventory(plugin,p,s.title,s.inventory,s.actions); + com.example.dunegui.MenuPresentation.inventory(plugin,p,s.title,s.inventory,s.actions); } private void admin(Player p) { if(!p.hasPermission("dune.admin")) return; @@ -127,7 +127,7 @@ final class ExchangeMenu implements Listener, CommandExecutor, TabCompleter { button(s,24,Material.REDSTONE,"Check Database",()->{ if(connected(p)) p.sendMessage(ChatColor.GREEN+"Shared Koopkring database connected."); }); - com.example.dunegui.NativeMenus.inventory(plugin,p,s.title,s.inventory,s.actions); + com.example.dunegui.MenuPresentation.inventory(plugin,p,s.title,s.inventory,s.actions); } private ItemStack decode(ExchangeStore.Listing offer) { ItemStack item; @@ -162,7 +162,7 @@ final class ExchangeMenu implements Listener, CommandExecutor, TabCompleter { if(rows.isEmpty()) s.inventory.setItem(22,icon(Material.PAPER,"No matching listings","Try another planet or list a held item.")); if(current>0) button(s,45,Material.ARROW,"Previous",()->browse(p,category,current-1,mine,admin)); if(rows.size()>28) button(s,53,Material.ARROW,"Next",()->browse(p,category,current+1,mine,admin)); - com.example.dunegui.NativeMenus.inventory(plugin,p,s.title,s.inventory,s.actions); + com.example.dunegui.MenuPresentation.inventory(plugin,p,s.title,s.inventory,s.actions); }); } private void confirm(Player p,long id,boolean reclaim) { @@ -175,7 +175,7 @@ final class ExchangeMenu implements Listener, CommandExecutor, TabCompleter { button(s,30,Material.LIME_CONCRETE,reclaim?"Confirm Reclaim":"Confirm Purchase",()->{ p.closeInventory(); if(reclaim) cancel(p,id); else buy(p,id); }); - button(s,32,Material.RED_CONCRETE,"Never Mind",()->home(p)); com.example.dunegui.NativeMenus.inventory(plugin,p,s.title,s.inventory,s.actions); + button(s,32,Material.RED_CONCRETE,"Never Mind",()->home(p)); com.example.dunegui.MenuPresentation.inventory(plugin,p,s.title,s.inventory,s.actions); }); } private boolean fits(Player p,ItemStack item,int amount) { diff --git a/DuneEss/src/test/java/com/example/dunegui/MenuPresentationTest.java b/DuneEss/src/test/java/com/example/dunegui/MenuPresentationTest.java new file mode 100644 index 00000000..bd607c92 --- /dev/null +++ b/DuneEss/src/test/java/com/example/dunegui/MenuPresentationTest.java @@ -0,0 +1,31 @@ +package com.example.dunegui; +import static org.mockito.Mockito.*; +import java.util.Map; +import org.bukkit.Bukkit; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; +import org.junit.jupiter.api.Test; + +public class MenuPresentationTest { + public static class Receiver extends JavaPlugin { public void openSharedMenu(Player p,String title,Inventory model,Map actions){} } + @Test void delegatesExistingActionsToReplacement(){ + try(var b=mockStatic(Bukkit.class)){ + var manager=mock(PluginManager.class);b.when(Bukkit::getPluginManager).thenReturn(manager); + var receiver=mock(Receiver.class);when(receiver.isEnabled()).thenReturn(true);when(manager.getPlugin("DuneMenus")).thenReturn(receiver); + var player=mock(Player.class);var model=mock(Inventory.class);Map actions=Map.of(13,()->{}); + MenuPresentation.inventory(mock(JavaPlugin.class),player,"Exchange",model,actions); + verify(receiver).openSharedMenu(player,"Exchange",model,actions);verifyNoInteractions(player); + } + } + @Test void absentProviderNeverOpensAnotherGui(){ + try(var b=mockStatic(Bukkit.class)){ + var manager=mock(PluginManager.class);b.when(Bukkit::getPluginManager).thenReturn(manager); + var player=mock(Player.class); + MenuPresentation.inventory(mock(JavaPlugin.class),player,"Exchange",mock(Inventory.class),Map.of()); + verify(player).sendMessage("DuneMenus is currently unavailable.");verifyNoMoreInteractions(player); + } + } +} diff --git a/DuneLobby/src/main/java/com/example/dunelobby/DuneLobby.java b/DuneLobby/src/main/java/com/example/dunelobby/DuneLobby.java index 1181cdae..ef9e8863 100644 --- a/DuneLobby/src/main/java/com/example/dunelobby/DuneLobby.java +++ b/DuneLobby/src/main/java/com/example/dunelobby/DuneLobby.java @@ -202,8 +202,8 @@ public final class DuneLobby extends JavaPlugin implements Listener, CommandExec for(int i=0;i=p[1]-9 && z<=p[1]-7) { departure(e.getPlayer(),LobbyBuilder.PLANETS.get(i)); return; } } if(b.getType()==Material.LECTERN) { boolean rules=z>0; List text=getConfig().getStringList(rules?"rules":"news"); - com.example.dunegui.NativeMenus.show(this,e.getPlayer(),rules?"Guild Charter":"Guild News",String.join("\n\n",text),List.of( - new com.example.dunegui.NativeMenus.Choice("Close","",e.getPlayer()::closeInventory))); + com.example.dunegui.MenuPresentation.show(this,e.getPlayer(),rules?"Guild Charter":"Guild News",String.join("\n\n",text),List.of( + new com.example.dunegui.MenuPresentation.Choice("Close","",e.getPlayer()::closeInventory))); } } @@ -211,9 +211,9 @@ public final class DuneLobby extends JavaPlugin implements Listener, CommandExec TravelMenu menu=new TravelMenu(planet); ItemStack confirm=new ItemStack(Material.LIME_CONCRETE); ItemMeta meta=confirm.getItemMeta(); meta.setDisplayName("Confirm departure: "+planet); meta.setLore(List.of("DuneEss fares and access rules apply when installed.")); confirm.setItemMeta(meta); menu.inventory.setItem(4,confirm); - com.example.dunegui.NativeMenus.show(this,player,"Guild departure",List.of( - new com.example.dunegui.NativeMenus.Choice("Confirm departure: "+planet,"DuneEss fares and access rules apply.",()->depart(player,planet)), - new com.example.dunegui.NativeMenus.Choice("Cancel","",player::closeInventory))); + com.example.dunegui.MenuPresentation.show(this,player,"Guild departure",List.of( + new com.example.dunegui.MenuPresentation.Choice("Confirm departure: "+planet,"DuneEss fares and access rules apply.",()->depart(player,planet)), + new com.example.dunegui.MenuPresentation.Choice("Cancel","",player::closeInventory))); } private void depart(Player player,String planet) { long now=System.currentTimeMillis(); if(now-travelCooldown.getOrDefault(player.getUniqueId(),0L)<5000) return; diff --git a/DuneMenus/src/main/java/com/dunerealms/menus/DuneMenusPlugin.java b/DuneMenus/src/main/java/com/dunerealms/menus/DuneMenusPlugin.java index 2aeeb03a..47c65ffe 100644 --- a/DuneMenus/src/main/java/com/dunerealms/menus/DuneMenusPlugin.java +++ b/DuneMenus/src/main/java/com/dunerealms/menus/DuneMenusPlugin.java @@ -92,6 +92,13 @@ public final class DuneMenusPlugin extends DuneServicesPlugin implements TabExec new WarObjectiveMenu(this, player, target.deepCopy(), capture).open(); } + public void openSharedMenu(Player player, String title, org.bukkit.inventory.Inventory model, Map actions) { + if (!getServer().isPrimaryThread() || !player.isOnline() || !player.hasPermission("dunemenus.use")) return; + String lower=title.toLowerCase(java.util.Locale.ROOT); + String section=lower.contains("travel")||lower.contains("guild")?"travel":lower.contains("exchange")?"exchange":lower.contains("spice")?"spice":lower.contains("quest")?"missions":"hub"; + new ServiceMenu(this,player,section,title,"",model,actions).open(); + } + void requestPackStatus(Player player) { if (player.isOnline()) player.sendPluginMessage(this, PACK_CONTROL, "common-status".getBytes(java.nio.charset.StandardCharsets.US_ASCII)); diff --git a/DuneMenus/src/main/java/com/dunerealms/services/DecisionsViewTransport.java b/DuneMenus/src/main/java/com/dunerealms/services/DecisionsViewTransport.java deleted file mode 100644 index 1deebab2..00000000 --- a/DuneMenus/src/main/java/com/dunerealms/services/DecisionsViewTransport.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.dunerealms.services; - -import java.util.List; -import java.util.function.IntConsumer; -import org.bukkit.entity.Player; - -/** - * Bukkit service for an optional Java fullscreen roleplay provider. It owns its - * runtime-specific packet support and closes its scene before returning input. - */ -public interface DecisionsViewTransport { - record Card(int slot, String title, List lore, boolean actionable, String material) { - public Card(int slot, String title, List lore, boolean actionable) { - this(slot, title, lore, actionable, ""); - } - - public Card { - lore = List.copyOf(lore); - } - } - - enum Style { AUTO, ORGANISATION, EXCHANGE, EXCHANGE_CHECKOUT, HOUSE, JOURNAL, CODEX, ITEM_ARCHIVE, GUILD, SPICE, WORKSHOP, DECISION_DETAIL, WAR_MUSTER } - record Identity(String logo, String mentat, int portrait) {} - - record Document(String title, String description, List cards, Style style, Identity identity) { - public Document(String title, String description, List cards) { - this(title, description, cards, Style.AUTO, null); - } - - public Document { - cards = List.copyOf(cards); - } - } - - /** - * Called on the server thread. Return false on an unsupported runtime or if - * opening fails. Release partial state before returning false. After a - * successful open, call exactly one terminal callback on the server thread: - * select a visible actionable slot, or close without selecting. Finish - * transport cleanup before the callback. Never invoke it inside open. - */ - boolean open(Player viewer, Document document, IntConsumer select, Runnable close); -} diff --git a/DuneMenus/src/main/java/com/dunerealms/services/DuneServicesPlugin.java b/DuneMenus/src/main/java/com/dunerealms/services/DuneServicesPlugin.java index edadf394..29e560bb 100644 --- a/DuneMenus/src/main/java/com/dunerealms/services/DuneServicesPlugin.java +++ b/DuneMenus/src/main/java/com/dunerealms/services/DuneServicesPlugin.java @@ -190,7 +190,7 @@ public abstract class DuneServicesPlugin extends JavaPlugin implements Listener, String title="Spacing Guild · Imperial passage"; int own=Arrays.asList(IDS).indexOf(house);Screen screen=screen(p,title,0xE330+own); var allowedDestinations=quotedDestinations(data.getAsJsonObject("guildQuote")); - var routeCards=new ArrayList(); + for(int i=0;ibookPassage(p,data,route.world())); } - routeCards.add(new DecisionsViewTransport.Card(centre,route.name(),List.of(allowed? - (route.house().equals(house)?"Your House":"Imperial passage"):unavailable),allowed, - "guild_world_"+route.world()+(allowed?"":"_locked"))); } String cancellation="No fare is taken for a cancelled booking"; String adviser="Return to your House adviser"; button(screen,p,45,"Your Mentat",adviser,Material.ARROW,()->mentat(p,data));screen.actions.put(46,screen.actions.get(45)); - routeCards.add(new DecisionsViewTransport.Card(45,"Your Mentat",List.of(adviser),true)); button(screen,p,49,"Cancel booking",cancellation,Material.BARRIER,()->{cancelBooking(p);travelMenu(p,data);}); for(int slot:new int[]{48,50})screen.actions.put(slot,screen.actions.get(49)); - routeCards.add(new DecisionsViewTransport.Card(49,"Cancel booking",List.of(cancellation),true)); if(guild!=null){ String bookingLabel=booked==null?"Book passage":"Review booked passage"; button(screen,p,53,bookingLabel,detail,Material.EMERALD,()->bookPassage(p,data));screen.actions.put(52,screen.actions.get(53)); - routeCards.add(new DecisionsViewTransport.Card(53,bookingLabel,List.of(),true)); } String nativeDetail=detail; if(booked!=null)nativeDetail+="\nBooked to "+booked.world()+" · "+String.format(Locale.ROOT,"%.2f DM",booked.fare()/100.0); @@ -338,7 +332,7 @@ public abstract class DuneServicesPlugin extends JavaPlugin implements Listener, } private static void menuArt(ItemStack item,String artwork){var meta=item.getItemMeta();meta.getPersistentDataContainer().set(new NamespacedKey("dunerealms","menu_art"),PersistentDataType.STRING,artwork);item.setItemMeta(meta);} private void report(Player p){p.closeInventory();p.sendMessage(Component.text("Open your Mentat Report →",NamedTextColor.GOLD).clickEvent(net.kyori.adventure.text.event.ClickEvent.openUrl("https://clans.dunerealms.com/#quests/quests")));} - private Screen screen(Player p,String title,int glyph){Screen s=new Screen(p);Component heading=guiPackLoaded.contains(p.getUniqueId())?Component.text(GuiArtwork.background(glyph),NamedTextColor.WHITE).font(Key.key("dunerealms:house_selector")):Component.text(title,NamedTextColor.GOLD);s.inventory=Bukkit.createInventory(s,54,heading);return s;} + private Screen screen(Player p,String title,int glyph){Screen s=new Screen(p);Component heading=Component.text(title,NamedTextColor.GOLD);s.inventory=Bukkit.createInventory(s,54,heading);return s;} private ItemStack icon(String title,String description,Material material){ItemStack item=new ItemStack(material);var meta=item.getItemMeta();meta.displayName(Component.text(title,NamedTextColor.GOLD));meta.lore(List.of(Component.text(description,NamedTextColor.GRAY)));item.setItemMeta(meta);return item;} private void button(Screen s,Player p,int slot,String title,String description,Material material,Runnable action){s.inventory.setItem(slot,icon(title,description,material));s.actions.put(slot,action);} private void expire(Screen screen){Bukkit.getScheduler().runTaskLater(this,screen.gate::expire,2400L);} diff --git a/DuneMenus/src/main/java/com/dunerealms/services/ExchangeArtwork.java b/DuneMenus/src/main/java/com/dunerealms/services/ExchangeArtwork.java deleted file mode 100644 index c3b10e44..00000000 --- a/DuneMenus/src/main/java/com/dunerealms/services/ExchangeArtwork.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.dunerealms.services; -final class ExchangeArtwork { - static String background(int screen){if(screen<0||screen>4)throw new IllegalArgumentException("Unknown Exchange screen");var out=new StringBuilder("\uE7FF");for(int row=0;row<4;row++){for(int col=0;col<4;col++)out.append((char)(0xE700+screen*16+row*4+col)).append('\uE7FE');out.append('\uE7FD');}return out.toString();} - private ExchangeArtwork(){} -} diff --git a/DuneMenus/src/main/java/com/dunerealms/services/ExchangeMenus.java b/DuneMenus/src/main/java/com/dunerealms/services/ExchangeMenus.java index 4dd69959..8a3a668d 100644 --- a/DuneMenus/src/main/java/com/dunerealms/services/ExchangeMenus.java +++ b/DuneMenus/src/main/java/com/dunerealms/services/ExchangeMenus.java @@ -22,7 +22,7 @@ final class ExchangeMenus implements Listener,AutoCloseable { private record Purchase(JsonObject row,int amount,UUID request){Purchase quantity(int n){return new Purchase(row,n,UUID.randomUUID());}} private static final class Panel implements DuneMenuInventory { final UUID owner,world;final GuiSession gate;final Map actions=new HashMap<>();final List choices=new ArrayList<>();final Inventory inventory;final String title;final boolean artwork;String description="Central bank · J.A.R.V.I.S. Exchange"; - Panel(Player p,String title,boolean artwork,int screen){owner=p.getUniqueId();world=p.getWorld().getUID();gate=new GuiSession(owner);this.title=title;this.artwork=artwork;inventory=Bukkit.createInventory(this,54,artwork?Component.text(ExchangeArtwork.background(screen),NamedTextColor.WHITE).font(net.kyori.adventure.key.Key.key("dunerealms:exchange")):Component.text(title,NamedTextColor.GOLD));} + Panel(Player p,String title,boolean artwork,int screen){owner=p.getUniqueId();world=p.getWorld().getUID();gate=new GuiSession(owner);this.title=title;this.artwork=artwork;inventory=Bukkit.createInventory(this,54,Component.text(title,NamedTextColor.GOLD));} public Inventory getInventory(){return inventory;} } private final java.util.concurrent.ConcurrentMap priceInputs=new java.util.concurrent.ConcurrentHashMap<>(); diff --git a/DuneMenus/src/main/java/com/dunerealms/services/GuiArtwork.java b/DuneMenus/src/main/java/com/dunerealms/services/GuiArtwork.java deleted file mode 100644 index f19f3972..00000000 --- a/DuneMenus/src/main/java/com/dunerealms/services/GuiArtwork.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.dunerealms.services; -/** Four by four bounded bitmap glyphs, each <=256px, compose one crisp screen. */ -final class GuiArtwork { - static String background(int oldGlyph){ - int index=oldGlyph>=0xE340?oldGlyph-0xE340+16:oldGlyph>=0xE330?oldGlyph-0xE330+11:oldGlyph>=0xE310?oldGlyph-0xE310+6:oldGlyph-0xE300; - if(index<0||index>19)throw new IllegalArgumentException("Unknown GUI screen"); - StringBuilder result=new StringBuilder("\uE32F"); - for(int row=0;row<4;row++){for(int column=0;column<4;column++)result.append((char)(0xE400+index*16+row*4+column)).append('\uE32E');result.append('\uE32D');} - return result.toString(); - } -} diff --git a/DuneMenus/src/main/java/com/dunerealms/services/OrganisationMenus.java b/DuneMenus/src/main/java/com/dunerealms/services/OrganisationMenus.java index 9ba24670..dca4c615 100644 --- a/DuneMenus/src/main/java/com/dunerealms/services/OrganisationMenus.java +++ b/DuneMenus/src/main/java/com/dunerealms/services/OrganisationMenus.java @@ -22,12 +22,12 @@ final class OrganisationMenus implements Listener { private static final class Panel implements DuneMenuInventory { - final UUID owner;final GuiSession gate;final Map actions=new HashMap<>();final Set nativeReadOnly=new HashSet<>();final Map choices=new TreeMap<>();String title;String nativeSetting;DecisionsViewTransport.Style nativeStyle;boolean artwork;Inventory inventory; + final UUID owner;final GuiSession gate;final Map actions=new HashMap<>();final Set nativeReadOnly=new HashSet<>();final Map choices=new TreeMap<>();String title;String nativeSetting;boolean artwork;Inventory inventory; Panel(Player p){owner=p.getUniqueId();gate=new GuiSession(owner);} public Inventory getInventory(){return inventory;} } OrganisationMenus(DuneServicesPlugin 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);panel.nativeStyle=DecisionsViewTransport.Style.CODEX;panel.nativeSetting="development.fullscreen-codex-viewers";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 console(Player p){var panel=panel(p,"Imperial Codex",0);panel.nativeSetting="development.fullscreen-codex-viewers";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; @@ -96,7 +96,7 @@ final class OrganisationMenus implements Listener { }); } void lore(Player p){ - var panel=panel(p,"Item lore archive · Preview",false);panel.nativeStyle=DecisionsViewTransport.Style.ITEM_ARCHIVE;panel.nativeSetting="development.fullscreen-codex-viewers";String[] kinds={"MENU","EQUIPMENT","KIT","COMPONENT","TICKET","CASH","RIHLA","DEED","QUEST"};Material[] materials={Material.COMPASS,Material.IRON_SWORD,Material.CHEST,Material.AMETHYST_SHARD,Material.PAPER,Material.GOLD_NUGGET,Material.WRITABLE_BOOK,Material.MAP,Material.BOOK}; + var panel=panel(p,"Item lore archive · Preview",false);panel.nativeSetting="development.fullscreen-codex-viewers";String[] kinds={"MENU","EQUIPMENT","KIT","COMPONENT","TICKET","CASH","RIHLA","DEED","QUEST"};Material[] materials={Material.COMPASS,Material.IRON_SWORD,Material.CHEST,Material.AMETHYST_SHARD,Material.PAPER,Material.GOLD_NUGGET,Material.WRITABLE_BOOK,Material.MAP,Material.BOOK}; for(int i=0;i facts=switch(kind){case "EQUIPMENT"->Map.of("Grade","From issued equipment key","House","From House key","Durability","From actual item");case "KIT"->Map.of("Contents","From kit definition","State","Design preview");case "COMPONENT"->Map.of("Recipe","From crafting definition");case "TICKET"->Map.of("Route","From passage key","Departure",":00 / :20 / :40");case "CASH"->Map.of("Value","From bank withdrawal","State","Design preview");case "RIHLA"->Map.of("Recipient","From RIA key","Amount","From transfer record");case "DEED"->Map.of("Organisation","From registered deed","Holder","From current authority");case "QUEST"->Map.of("Objective","From mission key","Progress","From verified events");default->Map.of("Service","DuneRealms","Access","Current JARVIS keys");};try{panel.inventory.setItem(18+i,bridge.lorePreview(kind,materials[i],kind.replace('_',' '),facts));}catch(Exception unavailable){p.sendMessage("The lore renderer is temporarily unavailable.");return;}} put(panel,45,"Back","Imperial Codex",Material.ARROW,()->console(p));close(panel,p);show(p,panel); } @@ -182,7 +182,7 @@ final class OrganisationMenus implements Listener { }); } private void warStatus(Player p,Runnable back){ - var screen=panel(p,"War report",false);screen.nativeStyle=DecisionsViewTransport.Style.ORGANISATION;screen.nativeSetting="development.fullscreen-organisation-viewers";JsonObject result; + var screen=panel(p,"War report",false);screen.nativeSetting="development.fullscreen-organisation-viewers";JsonObject result; try{result=bridge.warReport(p.getUniqueId());}catch(Exception unavailable){p.sendMessage("War reports are temporarily unavailable.");return;} var campaigns=result.getAsJsonArray("campaigns"); if(campaigns==null||campaigns.isEmpty())put(screen,22,"No active deployment","No current roster lease.\nArrange wars through your Clan or POL control panel.",Material.MAP,()->warStatus(p,back)); @@ -223,11 +223,11 @@ final class OrganisationMenus implements Listener { private Panel organisationPanel(Player player,String title,boolean company){ var screen=panel(player,title,company); screen.nativeSetting="development.fullscreen-organisation-viewers"; - screen.nativeStyle=DecisionsViewTransport.Style.ORGANISATION; + return screen; } private Panel panel(Player p,String title,boolean company){var panel=new Panel(p);panel.title=title;panel.inventory=Bukkit.createInventory(panel,54,Component.text(title,company?NamedTextColor.AQUA:NamedTextColor.GOLD));for(int slot=0;slot<54;slot++)if(slot<9||slot>=45||slot%9==0||slot%9==8){var trim=new ItemStack(company?Material.CYAN_STAINED_GLASS_PANE:Material.GREEN_STAINED_GLASS_PANE);var meta=trim.getItemMeta();meta.displayName(Component.empty());trim.setItemMeta(meta);panel.inventory.setItem(slot,trim);}return panel;} - private Panel panel(Player p,String title,int screen){if(!artwork.test(p)||BedrockForms.isBedrock(p))return panel(p,title,screen==2);var panel=new Panel(p);panel.title=title;panel.artwork=true;panel.inventory=Bukkit.createInventory(panel,54,Component.text(GuiArtwork.background(0xE340+screen),NamedTextColor.WHITE).font(net.kyori.adventure.key.Key.key("dunerealms:house_selector")));return panel;} + private Panel panel(Player p,String title,int screen){if(!artwork.test(p)||BedrockForms.isBedrock(p))return panel(p,title,screen==2);var panel=new Panel(p);panel.title=title;panel.artwork=true;panel.inventory=Bukkit.createInventory(panel,54,Component.text(title,NamedTextColor.GOLD));return panel;} private void put(Panel panel,int slot,String title,String description,Material material,Runnable action){var item=new ItemStack(material);var meta=item.getItemMeta();meta.displayName(Component.text(title,NamedTextColor.GOLD));meta.lore(Arrays.stream(description.split("\n")).map(line->Component.text(line,NamedTextColor.GRAY)).toList());item.setItemMeta(meta);panel.inventory.setItem(slot,item);panel.actions.put(slot,action);panel.choices.put(slot,new BedrockForms.Choice(title,description,action));} private void close(Panel panel,Player p){put(panel,53,"Close","Return to the game",Material.BARRIER,p::closeInventory);} private void show(Player p,Panel panel){plugin.showService(p,"politics",panel.title,"Current organisation keys",panel.inventory,panel.actions,panel.gate);} diff --git a/DuneMenus/src/main/resources/gui-pack.yml b/DuneMenus/src/main/resources/gui-pack.yml index bc912b50..2723092a 100644 --- a/DuneMenus/src/main/resources/gui-pack.yml +++ b/DuneMenus/src/main/resources/gui-pack.yml @@ -2,7 +2,7 @@ id: a7b5ab7d-d8d8-5b51-b016-71a5f4c00008 world: url: https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v7.zip - sha1: 2ff3d59b43c4cd876f14d58d2e77e1b60b12cfe3 + sha1: 0fa04f02f8c3e7a462f34c760233bec9b28b71c4 lobby: url: https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v7.zip - sha1: 2ff3d59b43c4cd876f14d58d2e77e1b60b12cfe3 + sha1: 0fa04f02f8c3e7a462f34c760233bec9b28b71c4 diff --git a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/ConfigurableGui.java b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/ConfigurableGui.java index c6ae13de..3310e72f 100644 --- a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/ConfigurableGui.java +++ b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/ConfigurableGui.java @@ -112,7 +112,7 @@ final class ConfigurableGui { } opened.put(p.getUniqueId(),page); actions.put(p.getUniqueId(),slots); - Map nativeActions=new HashMap<>(); slots.forEach((slot,action)->nativeActions.put(slot,()->execute(p,action))); com.example.dunegui.NativeMenus.inventory(plugin,p,title,inv,nativeActions); + Map nativeActions=new HashMap<>(); slots.forEach((slot,action)->nativeActions.put(slot,()->execute(p,action))); com.example.dunegui.MenuPresentation.inventory(plugin,p,title,inv,nativeActions); } void click(InventoryClickEvent e) { if(!(e.getWhoClicked() instanceof Player p)) return; @@ -136,7 +136,7 @@ final class ConfigurableGui { inventory.setItem(15,officeItem("water","Welvaart House",List.of("Landsraad appointment · water rights",officeHolder(offices,"houseOfWater","Not appointed")))); inventory.setItem(13,officeItem("crown","By appointment of the Emperor",List.of(officeHolder(offices,"emperor","Not elected"),"Appointments retain their existing election rules"))); inventory.setItem(22,item(player,"ARROW","&eBack",List.of())); - opened.put(player.getUniqueId(),"appointments");actions.put(player.getUniqueId(),Map.of(22,"open:main"));com.example.dunegui.NativeMenus.inventory(plugin,player,color("&6Landsraad appointments"),inventory,Map.of(22,()->open(player,"main"))); + opened.put(player.getUniqueId(),"appointments");actions.put(player.getUniqueId(),Map.of(22,"open:main"));com.example.dunegui.MenuPresentation.inventory(plugin,player,color("&6Landsraad appointments"),inventory,Map.of(22,()->open(player,"main"))); } private String officeHolder(Map offices,String key,String empty){Object value=offices.get(key);return value==null?empty:com.example.dunegui.PublicNames.text(String.valueOf(value));} void drag(InventoryDragEvent e) { diff --git a/DuneRealmsGUI/assets/menu/spice-portraits.json b/DuneRealmsGUI/assets/menu/spice-portraits.json deleted file mode 100644 index 0495841f..00000000 --- a/DuneRealmsGUI/assets/menu/spice-portraits.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "guild_navigator": { - "cell": 6, - "file": "spice_guild.png" - }, - "esmar_tuek": { - "file": "spice_smuggler.png", - "state": "existing-profile-placeholder", - "cell": 7 - }, - "source": "website/web/assets/mentat-portraits-atlas-v1.png" -} diff --git a/DuneRealmsGUI/assets/menu/spice_guild.png b/DuneRealmsGUI/assets/menu/spice_guild.png deleted file mode 100644 index 62bbfcba..00000000 Binary files a/DuneRealmsGUI/assets/menu/spice_guild.png and /dev/null differ diff --git a/DuneRealmsGUI/assets/menu/spice_smuggler.png b/DuneRealmsGUI/assets/menu/spice_smuggler.png deleted file mode 100644 index 43f73730..00000000 Binary files a/DuneRealmsGUI/assets/menu/spice_smuggler.png and /dev/null differ diff --git a/DuneRealmsGUI/beta-artwork/manifest.json b/DuneRealmsGUI/beta-artwork/manifest.json deleted file mode 100644 index f238751b..00000000 --- a/DuneRealmsGUI/beta-artwork/manifest.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "baseId": "a7b5ab7d-d8d8-5b51-b016-71a5f4c00008", - "base": { - "world": { - "filename": "DuneRealms-Network-Artwork-v6.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip", - "sha1": "f86189d72abc0690a08e01b7707998fabd961b8d", - "sha256": "ed2533646ee5e19a1dbfeec66e5791d1011a5107e6fcc4153372e431dfc5f56a", - "bytes": 29291488, - "entries": 842, - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v5.zip", - "sha1": "4699d6b181d72a64265c48e82427dd670a8c3fac", - "sha256": "40346e07f5d46d9ae6172a968c3a661ab22fa5563fe928d66f3daecbac78276d" - } - }, - "lobby": { - "filename": "DuneRealms-Network-Artwork-v6.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip", - "sha1": "f86189d72abc0690a08e01b7707998fabd961b8d", - "sha256": "ed2533646ee5e19a1dbfeec66e5791d1011a5107e6fcc4153372e431dfc5f56a", - "bytes": 29291488, - "entries": 842, - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v5.zip", - "sha1": "4699d6b181d72a64265c48e82427dd670a8c3fac", - "sha256": "40346e07f5d46d9ae6172a968c3a661ab22fa5563fe928d66f3daecbac78276d" - } - } - }, - "planets": { - "arrakis": { - "filename": "DuneRealms-Materials-arrakis-v7.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v7.zip", - "sha1": "ff44f19f160a9fc7ef076a80557d27f8283afe13", - "sha256": "e73bfadeb46332ff2220a193cb4676cf119feb79a4d7d0c1afc3d32922f46e07", - "bytes": 961957, - "entries": 1471, - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v6.zip", - "sha1": "2ad1703e99de297e72663fdd5d02bf928b53b0de", - "sha256": "ced65b0b686b09a8561c0fda675a45589db9b8cfcfca61207932db54c7f5c930" - } - }, - "guild": { - "filename": "DuneRealms-Materials-guild-v4.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v4.zip", - "sha1": "2f7dc54ade43353feb3dffddaec45398b2f11f0a", - "sha256": "6e732b0545b37bacd695d3f834d256ff9e06b28f1f540c6432c31162451ebf8f", - "bytes": 985384, - "entries": 1457, - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v3.zip", - "sha1": "2e37e41aaeb80f6eac97fb40dc08572708d2644f", - "sha256": "fbe7be9aadb62805ab68ec86603aeacb7b49b56da6685ba36052b97562d7835c" - } - } - } -} diff --git a/DuneRealmsGUI/fancyui/README.md b/DuneRealmsGUI/fancyui/README.md deleted file mode 100644 index 8919646a..00000000 --- a/DuneRealmsGUI/fancyui/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Fancy UI migration - -Historical comparison only. The selected implementation uses MCGUI; see -[the active menu integration](../mcgui/README.md). - -Requested replacement: https://builtbybit.com/resources/fancy-ui.115209/ -Documentation checked 2026-11-23: https://nusse.dev/docs/fancyui - -## Deployment prerequisite - -The licensed FancyUI JAR has not been supplied. Do not remove or disable the -working DuneRealms menus until the replacement has been loaded and its generated -pack has been verified. PacketEvents is required by FancyUI. PlaceholderAPI is -optional according to the creator's documentation; use it only for actual data -bindings that need it. - -## Presentation and authority - -FancyUI supplies the presentation. DunerealmsGUI retains the existing player -sessions and actions; JarvisTranslator retains the central key and transaction -checks. Buttons must invoke the same current-player action as the existing menu. -They must not issue native give, money, claim, membership or teleport commands. - -| Screen | Existing action owner | Required live state | -| --- | --- | --- | -| Imperial Codex | OrganisationMenus.console | Current player | -| House selector | DuneGUI.select / fetch | Current House key, selected House, confirmation | -| Mentat | DuneGUI.mentat | Current House and adviser | -| Spacing Guild | DuneGUI.openGuild / travelMenu | House, boarding window, central bank quote, reservation | -| Exchange | ExchangeMenus | Current catalogue revision, bank quote, durable delivery | -| Quests / quartermaster | QuestMenus | Verified journal, prerequisites, physical turn-in | -| Clan / company / POL | OrganisationMenus | Current deed, role, home world and claim capacity | - -Preserve the DuneRealms green/gold theme, distinct company/POL colours, and blue -for quests that require an ingame interaction. Reuse existing House seals, -adviser portraits and item artwork. Dynamic text must be treated as text rather -than interpreted MiniMessage supplied by a player. - -## Pack and client migration - -1. Inspect the supplied JAR and exact API signatures; pin its version and digest. -2. Load it with PacketEvents in an isolated Paper instance first. -3. Generate the pages and run `fui reload`, `fui pack`, then `fui packinfo`. -4. Check the generated font/shader namespaces against the current GUI, lorecard - and item pack. Preserve current item models, lorecards and entity textures. -5. Publish a versioned pack with a new checksum and confirm the loaded-pack - acknowledgement before switching the Imperial Codex entry point. -6. Test mouse, controller/keyboard, small screens and Geyser/Floodgate. Keep the - existing Bedrock forms until FancyUI compatibility is actually established. -7. Roll out the verified build and pack together. Keep Jarvis actions unchanged - and switch the remaining screens only after their actual interactions pass. - -The creator documents `api.open`, per-player `setText`/`setVisible`/`setItem` and -cancellable click events. These support using the existing action callbacks -without making the page configuration a second authority or data store. Do not -guess the API package names before inspecting the licensed JAR. diff --git a/DuneRealmsGUI/mcgui/README.md b/DuneRealmsGUI/mcgui/README.md deleted file mode 100644 index 9b2188fd..00000000 --- a/DuneRealmsGUI/mcgui/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# DuneRealms market menus - -Uses [MC GUI by resourcepack.ai](https://github.com/resourcepack-ai/mcgui), -unmodified release 0.8.6 (`ab8df61f0fd754008a4bf5bde37dbaa6d1911be5`). -MCGUI remains a separate plugin. Its renderer, shaders and framework are not -bundled or renamed as DuneRealms code. - -The shared market presentation covers the Codex, House selector, Mentat, Guild -travel, organisation panels, quest cards, Exchange and saved item previews. -It follows the bundled market's shelves and large selected-item showcase, with -DuneRealms artwork, compact season logo, green/gold borders and buttons. Ingame -quests retain their blue accent. All text is escaped; page content cannot -introduce commands or permissions. - -Cards select a preview. Only the showcase action button executes the existing -menu callback. The original player/world/session gate still enforces one action. -Purchases, research samples, quests, House changes and claims keep their existing -Jarvis authorization and transactions. Prices are still entered through chat. - -Enable only after installing MCGUI and its current resource pack: - -```yaml -# plugins/DunerealmsGUI/config.yml -mcgui: - enabled: true -``` - -Open the new menu with `/menu`. `/drgui pack` requests both the item artwork -and the MCGUI pack without removing either from the client's pack stack. -Java players who have not loaded the new pack are offered it rather than -silently opening the old menu. Without MCGUI, or on Floodgate/Bedrock, -the current inventory menus or Bedrock forms remain available. MC GUI requires -a 1.21.11+ server. The initial rollout is the lobby only; no world regeneration. - -Home and Back stay in the header. Trade quantity presets (16/32/64) and -price +/- controls act directly, without first selecting a showcase card. -Price changes are bounded to 0.01–1,000,000 DM; listing confirmation still -uses the existing central transaction. Exact private text entry is optional. -The Java runtime needs fontconfig, HarfBuzz and a system font installed. - -`art-manifest.json` pins existing DuneRealms PNG artwork for the runtime's -`plugins/DunerealmsGUI/mcgui/art/` folder. Vanilla icon PNGs come from the existing -Minecraft 1.21.8 client assets; no external browser or second Jarvis connection -is introduced. - -Validation uses the actual MCGUI HTML renderer, including its hit testing, plus -the normal GUI build/session tests. An isolated Paper probe checked the current -network inventory stream through 1.21.8 → 1.21.11 → 1.21.8 with three sample -items. This is a compatibility sample, not a claim that every item was tested. diff --git a/DuneRealmsGUI/mcgui/art-manifest.json b/DuneRealmsGUI/mcgui/art-manifest.json deleted file mode 100644 index f4bdb47f..00000000 --- a/DuneRealmsGUI/mcgui/art-manifest.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "path": "art/banner.png", - "url": "https://www.dunerealms.com/assets/exchange-political-positions-v1.png", - "sha256": "25284e507cc352aacc4ff7b4b59c3cb74de1eb4bd4d9e378c5eccae75f0869d6" - }, - { - "path": "art/clan.png", - "url": "https://www.dunerealms.com/assets/seals/order-crysknife-v1.png", - "sha256": "527c1b6f566ce423190b90240d6af25a8da76cb2338392d1c0ff161fd968a82c" - }, - { - "path": "art/company.png", - "url": "https://www.dunerealms.com/assets/items/office_water.png", - "sha256": "a11d9404b98834d113f97f657e333fdc92d10020e82366732d660464c609f90c" - }, - { - "path": "art/house.png", - "url": "https://www.dunerealms.com/assets/seals/office-house_leader.png", - "sha256": "f1664138efaf925b0cdd3329893cf9ac376b714c98cbe2227ee92338542122ed" - }, - { - "path": "art/house_atreides.png", - "url": "https://www.dunerealms.com/assets/seals/house-aerdrecht-v1.png", - "sha256": "6a41b52c1371d54f1b51444333851503b544af663c933110162f6bd5508d1975" - }, - { - "path": "art/house_corrino.png", - "url": "https://www.dunerealms.com/assets/seals/house-korenholt-v1.png", - "sha256": "49db2d1c6879f5802fb24dacc7f08621882f5559938434659d782e4fab286d9d" - }, - { - "path": "art/house_fremen.png", - "url": "https://www.dunerealms.com/assets/seals/office-house_leader.png", - "sha256": "f1664138efaf925b0cdd3329893cf9ac376b714c98cbe2227ee92338542122ed" - }, - { - "path": "art/house_harkonnen.png", - "url": "https://www.dunerealms.com/assets/seals/house-harkveen-v1.png", - "sha256": "cbe223385c57e7b14501f84f5d278cc24a472a833e7dda823bee4c9a02d979da" - }, - { - "path": "art/house_ordos.png", - "url": "https://www.dunerealms.com/assets/seals/house-oordwijk-v1.png", - "sha256": "fc34eb0626a9d6b17d21b385158d6c95db8665091335aae7154ba0a0919ef984" - }, - { - "path": "art/logo.png", - "url": "https://www.dunerealms.com/assets/dunerealms-season-logo-v2.png", - "sha256": "267fe0d0b5adb4f2fb657d1d6827d030e7f837c94335d0a3643210b908f47931" - }, - { - "path": "art/mentat.png", - "url": "https://www.dunerealms.com/assets/gui/mentat-atreides-v1.png", - "sha256": "84015c0c9bb79873e9233312cedf41582ab2e253477e0ea0ff28b5c09351ed1d" - }, - { - "path": "art/mentat_atreides.png", - "url": "https://www.dunerealms.com/assets/gui/mentat-atreides-v1.png", - "sha256": "84015c0c9bb79873e9233312cedf41582ab2e253477e0ea0ff28b5c09351ed1d" - }, - { - "path": "art/mentat_corrino.png", - "url": "https://www.dunerealms.com/assets/gui/mentat-corrino-v1.png", - "sha256": "d63d9accbe3d88ccadc11e47eae0611f2abb4953cf113ad45cbc920d0f1ffb0f" - }, - { - "path": "art/mentat_fremen.png", - "url": "https://www.dunerealms.com/assets/gui/mentat-fremen-v1.png", - "sha256": "3e65c3a14cf8b1a3eb00b19befbd6a7aadf64873ceb15aca9ad104a04bb4ed95" - }, - { - "path": "art/mentat_harkonnen.png", - "url": "https://www.dunerealms.com/assets/gui/mentat-harkonnen-v1.png", - "sha256": "c3602848e1a5f35ac4eb75eb1be64bf59922e37863d5951e7cd4f1231211c1b3" - }, - { - "path": "art/mentat_ordos.png", - "url": "https://www.dunerealms.com/assets/gui/mentat-ordos-v1.png", - "sha256": "d7db44e2bf2c5547c59deb870f52b9667ca3ba8b755edd1ccdbab77d1480e259" - }, - { - "path": "art/politics.png", - "url": "https://www.dunerealms.com/assets/seals/office-landsraad.png", - "sha256": "b66f41ae47b616bc3e79c7af463c129dedfe2fbfbabffa525be3a6e7b8fbc3c5" - }, - { - "path": "art/quests.png", - "url": "https://www.dunerealms.com/assets/exchange-quests-v1.png", - "sha256": "3c3b03cafdfd37e371fc4791183b20483a4fe9b89832d11ac207fff89c697190" - } -] diff --git a/DuneRealmsGUI/network-artwork.json b/DuneRealmsGUI/network-artwork.json deleted file mode 100644 index e7b0d3f2..00000000 --- a/DuneRealmsGUI/network-artwork.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": 6, - "delivery": "World and lobby use scope-specific network artwork under one stable ID; separate planet material layer.", - "packId": "a7b5ab7d-d8d8-5b51-b016-71a5f4c00008", - "world": { - "filename": "DuneRealms-Network-Artwork-v6.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip", - "sha1": "f86189d72abc0690a08e01b7707998fabd961b8d", - "sha256": "ed2533646ee5e19a1dbfeec66e5791d1011a5107e6fcc4153372e431dfc5f56a", - "bytes": 29291488, - "entries": 842, - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v5.zip", - "sha1": "4699d6b181d72a64265c48e82427dd670a8c3fac", - "sha256": "40346e07f5d46d9ae6172a968c3a661ab22fa5563fe928d66f3daecbac78276d" - } - }, - "lobby": { - "filename": "DuneRealms-Network-Artwork-Lobby-v6.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-Lobby-v6.zip", - "sha1": "dfa8b458f306f61ecae490d5503924a63cea9a75", - "sha256": "a2019d77a32f2782e927319e82a5cb23a00d1da986db5598089c787d413d8b24", - "bytes": 29389598, - "entries": 872, - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-Lobby-v5.zip", - "sha1": "e4b937a0af2ea7eebd790c661b4703f899fedf2d", - "sha256": "74d1052adfed5ecd43d0c05cad7c14ddc1bdd2e9a05ae83c9b56269167675826" - } - }, - "baselineNetworkSha256": "15dfd24bbb1760e04a1df1e0556c15b759353be705fbf2bcc9b377704abcf560", - "builder": "tools/build-quest-npc-pack.py", - "manifest": "DuneRealmsGUI/npc-skins/manifest.json", - "creatureCarriers": { - "jerboa": "GOLD rabbit (legacy lobby only)", - "wormPet": "SNOWY wolf (legacy lobby only)", - "arrakis": "Native item-display geometry, unchanged" - } -} diff --git a/DuneRealmsGUI/resourcepack-repair/README.md b/DuneRealmsGUI/resourcepack-repair/README.md deleted file mode 100644 index a63216a0..00000000 --- a/DuneRealmsGUI/resourcepack-repair/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Java 26.3 artwork and planet-layer repair - -This release corrects delivery and render references, not game mechanics. -Java 26.3 uses resource-pack format 97.1. The published network v3 and -materials v2 / Arrakis v4 archives advertised a maximum of 97.0. In addition, -the GUI plugin offered the network artwork exclusively in the Guild lobby; -planet material packs use a distinct UUID and do not contain equipment models. -Arrakis v4 includes the original jerboa PNG and item-display geometry, but the -entity sprite is not in either vanilla model atlas and the models omit particle -references. - -The repair builds two immutable network packs from the exact, SHA-256-pinned -v3 archive. The world pack retains the existing custom namespace, item models, -spice carrier, fonts, and GUI artwork; lobby-only sand and vanilla entity -overrides are excluded. The lobby variant preserves every v3 asset as-is. -Every material pack retains its existing block/item pixels. Arrakis v5 only -adds the sprite to both model atlases, fixes particle aliases, and corrects -metadata; all five fauna models retain their exact element geometry, face UVs -and original jerboa PNG. No equipment definitions are repainted. - -## Rebuild and test - -Download the two immutable input archives from the existing public downloads: -`DuneRealms-Network-Artwork-v3.zip` and -`DuneRealms-Materials-arrakis-v4.zip`. The seven other profile inputs are -checked-in material v2 archives. From the repository root: - -```sh -python3 tools/build-resourcepack-repair.py INPUT/DuneRealms-Network-Artwork-v3.zip INPUT/DuneRealms-Materials-arrakis-v4.zip OUTPUT -DUNE_REPAIR_BASELINE_DIR=INPUT python3 tools/test_resourcepack_repair.py -v -gradle --no-daemon -p DuneRealmsGUI test jar -``` - -Optional `DUNE_REPAIR_CLIENT_JAR` points to a local Java 26.3 client JAR, -enabling validation of all custom item/model references against actual vanilla -files. Stored ZIP entries, fixed order and timestamps make the archive hashes -independent of the compressor implementation. The checked-in manifest is the -source of the immutable URL and hash pins. The new resourcepack CI performs -the same baseline check and builds an artifact after the approved merge. - -## Publication (only after approval) - -1. Verify all artifact SHA-1 and SHA-256 values against this manifest. Publish - every archive at its new URL, never overwrite a previous immutable download. - Verify each public URL returns the entire exact pinned archive before changing - plugin/configuration. -2. Confirm the active lobby and five planet backend locations from the current - proxy inventory. Confirm installed GUI plugin versions, existing material - aliases, pack pins, and previously configured pack IDs; backup each actual - target file. Preserve existing gameplay plugins and unrelated settings. -3. Deploy the tested GUI plugin on each Java backend. Keep the world and lobby - artwork configurations separate; the new bundled defaults upgrade the - known old network configuration, while exact old material pins upgrade - without changing enabled flags or custom aliases. If the lobby sends the - base pack during vanilla configuration, change its `server.properties` - network URL and SHA-1 to the **lobby** manifest pin with the same network UUID - to avoid an old/new double offer. Do not configure the planet pack as the - global network pack. Bedrock and the lobby's native MCGUI renderer are unchanged. -4. Verify real 26.3 Java joins and proxy transfers: Guild → Arrakis → Kaladam → - Giedermark → Kaiterhof → Sigmadraken IV → Guild; also the two configured - dimension profiles. Client logs must show the network pack UUID and the - current material UUID, both loaded with no missing jerboa sprite/particle - warnings. Inspect live jerboa standing/walking/curled geometry, tiny worm, - equipment icons, correct spice tools and compressed spice, walls and distinct - planet textures. No manual legacy DuneResourcePack.zip should be required. - Verify the Bedrock fallback and existing native lobby menus. - -Do not claim a live repair from the archive tests alone. Before owner-approved -publication, the new immutable URLs are intentionally unpublished. diff --git a/DuneRealmsGUI/resourcepack-repair/manifest.json b/DuneRealmsGUI/resourcepack-repair/manifest.json deleted file mode 100644 index fa7dc077..00000000 --- a/DuneRealmsGUI/resourcepack-repair/manifest.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "resourcePackVersion": [ - 97, - 1 - ], - "baseId": "a7b5ab7d-d8d8-5b51-b016-71a5f4c00008", - "planetId": "59f34b30-6a86-5e58-a813-6e776f726c64", - "baseline": { - "networkSha256": "15dfd24bbb1760e04a1df1e0556c15b759353be705fbf2bcc9b377704abcf560", - "arrakisSha256": "4a906b4e292221997d7870d63d70303d37d7cd41d872cba6bb7c2a170bd88adc" - }, - "base": { - "world": { - "filename": "DuneRealms-Network-Artwork-v4.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v4.zip", - "sha1": "ec3848da559768e5ac3aeec631f10035ac44c055", - "sha256": "bee9f66ab9356450594da308124db3ee921566c44cb190c4246e522be7dd2e81", - "bytes": 29918832, - "entries": 800 - }, - "lobby": { - "filename": "DuneRealms-Network-Artwork-Lobby-v4.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-Lobby-v4.zip", - "sha1": "c0c2e36a438242b253cdaaeeec36529210cf4220", - "sha256": "6150c394a79a54c85686a55140ae18ae64f7d881c04242be4bb786cf3985fbb4", - "bytes": 30016942, - "entries": 830 - } - }, - "planets": { - "guild": { - "filename": "DuneRealms-Materials-guild-v3.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v3.zip", - "sha1": "2e37e41aaeb80f6eac97fb40dc08572708d2644f", - "sha256": "fbe7be9aadb62805ab68ec86603aeacb7b49b56da6685ba36052b97562d7835c", - "bytes": 895047, - "entries": 1445, - "name": "Vaerkring", - "aliases": [ - "guild_lobby" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v2.zip", - "sha1": "c26c95ae25146fca3e3aec11a703919a001de607" - } - }, - "arrakis": { - "filename": "DuneRealms-Materials-arrakis-v5.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v5.zip", - "sha1": "d9daf43f4589374a881928e631465556cb6dfaf6", - "sha256": "5eae8062fb13b7f5ef48ba32b8ea2cf732e589d407f45bf4e44680cacb84a9b0", - "bytes": 2046201, - "entries": 1464, - "name": "Arrakduin", - "aliases": [ - "arrakis", - "arrakduin" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v4.zip", - "sha1": "694cad97caf75ac00f4e6f819a7172a0cf1b83ef" - } - }, - "caladan": { - "filename": "DuneRealms-Materials-caladan-v3.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-caladan-v3.zip", - "sha1": "13b7b5862925c081965ee3e591d050d3a65e515a", - "sha256": "bf35f6a3ff72528e9ca93d7d55220c5a6d8ee844abcfc02ef80dcab7277b2c4a", - "bytes": 896122, - "entries": 1447, - "name": "Kaladam", - "aliases": [ - "caladan", - "kaladam" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-caladan-v2.zip", - "sha1": "3f5b1674dfeb5761a9253ae411463a3e7a2e6b32" - } - }, - "giedi_prime": { - "filename": "DuneRealms-Materials-giedi_prime-v3.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime-v3.zip", - "sha1": "171ea53dbcc90c98c630ea78ed74c1e478314dd8", - "sha256": "efc67c17911a3bb719f8749a384f5ac14eeb92eca6b5402df8a1372448c19a4c", - "bytes": 896018, - "entries": 1448, - "name": "Giedermark", - "aliases": [ - "giedi_prime", - "giedermark" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime-v2.zip", - "sha1": "f7c734ee98086e5b96cd566599640c6514377f81" - } - }, - "kaitain": { - "filename": "DuneRealms-Materials-kaitain-v3.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-kaitain-v3.zip", - "sha1": "a7082cb260ce3e1bd2f134fabcfa925f615c312b", - "sha256": "0147e9852c9ea28106a0d803490afa10fddc9f51d734d7e4f6dbdb752273269a", - "bytes": 896010, - "entries": 1447, - "name": "Kaiterhof", - "aliases": [ - "kaitain", - "kaiterhof" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-kaitain-v2.zip", - "sha1": "b06c9dc895c99aae2ccaaddfac0ffcba4ba6a534" - } - }, - "sigma_draconis_iv": { - "filename": "DuneRealms-Materials-sigma_draconis_iv-v3.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv-v3.zip", - "sha1": "ed1ca07f8cfa759f3f1059ab785c03bb6a54ff77", - "sha256": "9a04f3aa972ac376a36cd879f7218e66a90270411a20cda99f4858d31f64dacf", - "bytes": 896420, - "entries": 1448, - "name": "Sigmadraken IV", - "aliases": [ - "sigma_draconis_iv", - "sigmadraken_iv", - "sigmadraken iv" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv-v2.zip", - "sha1": "ede1901098d763738d713e5a71508c9b53680989" - } - }, - "giedi_prime_nether": { - "filename": "DuneRealms-Materials-giedi_prime_nether-v3.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime_nether-v3.zip", - "sha1": "12a51f0d19ffd5493e6be8c4395a2d3df2742736", - "sha256": "ea18019727964503cd3c60e50fe29aa92288d6f9a19a3504a846df25cf616065", - "bytes": 895453, - "entries": 1446, - "name": "Giedermark Nether", - "aliases": [ - "giedi_prime_nether", - "giedermark_nether" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime_nether-v2.zip", - "sha1": "67b0119916a21130dd8000df62a2e8d718888bac" - } - }, - "sigma_draconis_iv_the_end": { - "filename": "DuneRealms-Materials-sigma_draconis_iv_the_end-v3.zip", - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv_the_end-v3.zip", - "sha1": "a8a23316a0537176dc65072204544d5d5cb8376b", - "sha256": "9cd3be10c7e12f63a794e4731c3b97457ab73e9ba578f4f277b58d4c9d70e00d", - "bytes": 895066, - "entries": 1445, - "name": "Sigmadraken IV End", - "aliases": [ - "sigma_draconis_iv_the_end", - "sigmadraken_iv_the_end", - "sigmadraken_iv_end" - ], - "previous": { - "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv_the_end-v2.zip", - "sha1": "26fcb853b3f71a1c126cd0ed6c19a00a7bea5cb1" - } - } - } -} diff --git a/JarvisConnector/build.gradle.kts b/JarvisConnector/build.gradle.kts index 1bbdd05e..440a84eb 100644 --- a/JarvisConnector/build.gradle.kts +++ b/JarvisConnector/build.gradle.kts @@ -15,7 +15,7 @@ tasks.jar { archiveFileName.set("jarvistranslator.jar") } tasks.processResources { - from(rootProject.file("../DuneRealmsGUI/planet-artwork/profiles.json")) { + from(rootProject.file("../network/content-assets/planet-artwork/profiles.json")) { rename { "planet-item-profiles.json" } } } diff --git a/gui-common/src/main/java/com/example/dunegui/MenuPresentation.java b/gui-common/src/main/java/com/example/dunegui/MenuPresentation.java new file mode 100644 index 00000000..6c73f3dc --- /dev/null +++ b/gui-common/src/main/java/com/example/dunegui/MenuPresentation.java @@ -0,0 +1,41 @@ +package com.example.dunegui; + +import java.util.*; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import net.kyori.adventure.text.Component; + +/** Compatibility entry point. Presentation belongs exclusively to the supplied DuneMenus module. */ +public final class MenuPresentation { + private MenuPresentation() {} + public record Choice(String label,String description,Runnable action,String imageUrl) { + public Choice(String label,String description,Runnable action){this(label,description,action,null);} + } + public static void inventory(JavaPlugin caller,Player player,String title,Inventory model,Map actions){ + var owner=Bukkit.getPluginManager().getPlugin("DuneMenus"); + if(owner==null||!owner.isEnabled()){player.sendMessage("DuneMenus is currently unavailable.");return;} + try {owner.getClass().getMethod("openSharedMenu",Player.class,String.class,Inventory.class,Map.class) + .invoke(owner,player,title,model,Map.copyOf(actions));} + catch(ReflectiveOperationException failure){caller.getLogger().warning("DuneMenus presentation contract unavailable");player.sendMessage("The menu is currently unavailable.");} + } + public static void show(JavaPlugin caller,Player player,String title,List choices){show(caller,player,title,"",choices);} + public static void show(JavaPlugin caller,Player player,String title,String content,List choices){page(caller,player,title,content,choices,0);} + private static void page(JavaPlugin caller,Player player,String title,String content,List choices,int page){ + Inventory model=Bukkit.createInventory(null,54,Component.text(title)); + Map actions=new HashMap<>(); + if(!content.isBlank())model.setItem(4,item(title,content)); + int start=page*36,end=Math.min(start+36,choices.size()); + for(int i=start;i0){model.setItem(45,item("Previous",""));actions.put(45,()->page(caller,player,title,content,choices,page-1));} + if(endpage(caller,player,title,content,choices,page+1));} + inventory(caller,player,title,model,actions); + } + private static ItemStack item(String name,String description){ + var item=new ItemStack(Material.PAPER);var meta=item.getItemMeta();meta.displayName(Component.text(name)); + meta.lore(description.lines().map(Component::text).toList());item.setItemMeta(meta);return item; + } +} diff --git a/gui-common/src/main/java/com/example/dunegui/NativeMenus.java b/gui-common/src/main/java/com/example/dunegui/NativeMenus.java deleted file mode 100644 index 8cf88de8..00000000 --- a/gui-common/src/main/java/com/example/dunegui/NativeMenus.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.example.dunegui; - -import io.papermc.paper.dialog.Dialog; -import io.papermc.paper.registry.data.dialog.ActionButton; -import io.papermc.paper.registry.data.dialog.DialogBase; -import io.papermc.paper.registry.data.dialog.body.DialogBody; -import io.papermc.paper.registry.data.dialog.action.DialogAction; -import io.papermc.paper.registry.data.dialog.type.DialogType; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.event.ClickCallback; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; -import java.time.Duration; -import java.util.*; - - -/** Shared presentation layer. All gameplay callbacks run once on the server thread. */ -public final class NativeMenus { - private NativeMenus() {} - public static boolean isBedrock(Player player) { - return Bukkit.getPluginManager().isPluginEnabled("floodgate") && Bedrock.isPlayer(player); - } - public record Choice(String label, String description, Runnable action, String imageUrl) { - public Choice(String label,String description,Runnable action) { this(label,description,action,null); } - } - public static void inventory(JavaPlugin plugin, Player player, String title, Inventory model, Map actions) { - List choices = new ArrayList<>(); - List information = new ArrayList<>(); - List illustrations = new ArrayList<>(); - for(int slot=0;slot choices) { - show(plugin,player,title,"",choices); - } - public static void show(JavaPlugin plugin, Player player, String title, String content, List choices) { - show(plugin,player,title,content,choices,List.of()); - } - private static void show(JavaPlugin plugin, Player player, String title, String content, List choices,List illustrations) { - MenuSession session=new MenuSession(player.getUniqueId()); - Bukkit.getScheduler().runTaskLater(plugin,session::expire,2400L); - List guarded=choices.stream().map(c->new Choice(c.label(),c.description(),()-> { - if(!session.claim(player.getUniqueId())) return; - Bukkit.getScheduler().runTask(plugin,()-> { if(player.isOnline()) c.action().run(); }); - },c.imageUrl())).toList(); - if(isBedrock(player)) { - Bedrock.show(player,title,content,guarded); return; - } - // Dialogs were introduced with protocol 771 (Java 1.21.6). Fail closed if Via cannot identify a client. - if(protocol(player)>=771) { - List buttons=guarded.stream().map(c->ActionButton.builder(Component.text(c.label())) - .tooltip(Component.text(c.description())) - .action(DialogAction.customClick((view,audience)-> { - if(audience instanceof Player actor && actor.getUniqueId().equals(player.getUniqueId())) c.action().run(); - },ClickCallback.Options.builder().uses(1).lifetime(Duration.ofMinutes(2)).build())).build()).toList(); - List body=new ArrayList<>(); - if(!content.isBlank())body.add(DialogBody.plainMessage(Component.text(content))); - for(ItemStack illustration:illustrations)body.add(DialogBody.item(illustration,null,false,true,48,48)); - player.showDialog(Dialog.create(builder->builder.empty() - .base(DialogBase.builder(Component.text(title)).body(body).build()) - .type(DialogType.multiAction(buttons).build()))); - return; - } - player.sendMessage(Component.text(title+" (select an option below)")); - if(!content.isBlank()) player.sendMessage(Component.text(content)); - for(Choice choice:guarded) player.sendMessage(Component.text("["+choice.label()+"] "+choice.description()) - .clickEvent(net.kyori.adventure.text.event.ClickEvent.callback(audience->{ - if(audience instanceof Player actor && actor.getUniqueId().equals(player.getUniqueId())) choice.action().run(); - },ClickCallback.Options.builder().uses(1).lifetime(Duration.ofMinutes(2)).build()))); - } - static int protocol(Player player) { - if(Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) { - try { - Class via=Class.forName("com.viaversion.viaversion.api.Via"); - Object api=via.getMethod("getAPI").invoke(null); - return (int)Class.forName("com.viaversion.viaversion.api.ViaAPI") - .getMethod("getPlayerVersion",UUID.class).invoke(api,player.getUniqueId()); - } catch(ReflectiveOperationException | LinkageError ex) { return -1; } - } - return player.getProtocolVersion(); - } - /** Loaded only when the optional Floodgate plugin is enabled. Never shades Cumulus/API classes. */ - private static final class Bedrock { - static boolean isPlayer(Player player) { return org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId()); } - static void show(Player player,String title,String content,List choices) { - var form=org.geysermc.cumulus.form.SimpleForm.builder().title(title).content(content); - for(Choice choice:choices) { - String label=choice.label()+ (choice.description().isBlank()?"":"\n"+choice.description()); - if(choice.imageUrl()==null)form.button(label); - else form.button(label,org.geysermc.cumulus.util.FormImage.Type.URL,choice.imageUrl()); - } - form.validResultHandler(response->{ int index=response.clickedButtonId(); if(index>=0 && index[`jerboa.${name}`,{sounds:[`dunerealms:jerboa_${name}`]}]))))); - entries.set('licenses/Runes-and-Dunes-MIT.txt',fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)),'../DuneRealmsGUI/ecology/vendor/runes-and-dunes/NOTICE.txt'))); + entries.set('licenses/Runes-and-Dunes-MIT.txt',fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)),'../network/content-assets/ecology/vendor/runes-and-dunes/NOTICE.txt'))); // Local Windows checkouts and Linux release workers must produce equal bytes. for(const [name,bytes]of entries)if(/\.(?:txt|md)$/.test(name))entries.set(name,Buffer.from(bytes.toString('utf8').replaceAll('\r\n','\n'))); // v5 is the separately pinned, byte-preserving repair of published v4. diff --git a/tools/build-chukka-art.py b/tools/build-chukka-art.py index 490fdbf9..32234e0c 100644 --- a/tools/build-chukka-art.py +++ b/tools/build-chukka-art.py @@ -4,7 +4,7 @@ No game texture pixels are reused; the UV canvas follows the native chicken mode from PIL import Image, ImageDraw from pathlib import Path import random -ROOT=Path(__file__).resolve().parents[1]/'DuneRealmsGUI/ecology' +ROOT=Path(__file__).resolve().parents[1]/'network/content-assets/ecology' FOOD=ROOT/'food-icons'; FOOD.mkdir(exist_ok=True) TEX=ROOT/'textures'; TEX.mkdir(exist_ok=True) def save(name,draw): diff --git a/tools/build-desert-jerboa-pack.py b/tools/build-desert-jerboa-pack.py index 7ed986df..aeb316d8 100644 --- a/tools/build-desert-jerboa-pack.py +++ b/tools/build-desert-jerboa-pack.py @@ -6,7 +6,7 @@ UV='assets/dunerealms/textures/entity/jerboa.png' def build(baseline,output): if hashlib.sha1(baseline.read_bytes()).hexdigest()!='2ad1703e99de297e72663fdd5d02bf928b53b0de':raise ValueError('Expected immutable Arrakis v6') old=repair.read_pack(baseline,hashlib.sha256(baseline.read_bytes()).hexdigest()) - texture=(ROOT/'DuneRealmsGUI/ecology/textures/jerboa-beta.png').read_bytes(); assert texture[:8]==b'\x89PNG\r\n\x1a\n' and texture[16:24]==b'\x00\x00\x00@\x00\x00\x00@' and UV in old + texture=(ROOT/'network/content-assets/ecology/textures/jerboa-beta.png').read_bytes(); assert texture[:8]==b'\x89PNG\r\n\x1a\n' and texture[16:24]==b'\x00\x00\x00@\x00\x00\x00@' and UV in old output.mkdir(parents=True,exist_ok=True);record=repair.write_pack(output,'DuneRealms-Materials-arrakis-v7.zip',{**old,UV:texture}) with zipfile.ZipFile(output/record['filename']) as pack: assert pack.testzip() is None and set(pack.namelist())==set(old) and {n for n in old if old[n]!=pack.read(n)}=={UV} diff --git a/tools/build-dunemenus-release.py b/tools/build-dunemenus-release.py index 7bad4cda..3952cf8e 100644 --- a/tools/build-dunemenus-release.py +++ b/tools/build-dunemenus-release.py @@ -3,9 +3,8 @@ from pathlib import Path import hashlib, io, json, shutil, subprocess, sys, urllib.request, zipfile root=Path(__file__).resolve().parents[1] out=Path(sys.argv[1]);out.mkdir(parents=True,exist_ok=True) -url='https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip' -baseline=urllib.request.urlopen(url,timeout=90).read() -assert hashlib.sha1(baseline).hexdigest()=='f86189d72abc0690a08e01b7707998fabd961b8d','Pinned pack differs' +baseline=(root/'network/resource-pack/clean-base.zip').read_bytes() +assert hashlib.sha256(baseline).hexdigest()=='b52b89a6d437fccc56db756bf7d628839efa76c2a45ab9308db2afc6f8058e55','Clean base differs' with zipfile.ZipFile(io.BytesIO(baseline)) as z: entries={n:z.read(n) for n in z.namelist() if not n.endswith('/')} art=root/'network/resource-pack/shared' @@ -21,7 +20,8 @@ pack=out/'DuneRealms-Network-Artwork-v7.zip' with zipfile.ZipFile(pack,'w',zipfile.ZIP_DEFLATED,compresslevel=9) as z: for name,data in sorted(entries.items()): zi=zipfile.ZipInfo(name,(2026,11,28,0,0,0));zi.compress_type=zipfile.ZIP_DEFLATED;z.writestr(zi,data) -shutil.copy2(root/'DuneMenus/build/libs/DuneMenus.jar',out/'DuneMenus.jar') +for module,name in [('DuneMenus','DuneMenus.jar'),('DuneEss','DuneRealms-Essentials.jar'),('DuneLobby','DuneRealms-Lobby.jar'),('DuneRealms-minecraft-only','DuneRealms-Core.jar'),('JarvisConnector','jarvistranslator.jar')]: + shutil.copy2(root/module/'build/libs'/name,out/name) shutil.copy2(root/'tools/install-dunemenus-release.py',out/'install-dunemenus-release.py') manifest={'source':subprocess.check_output(['git','rev-parse','HEAD'],cwd=root,text=True).strip(),'input_zip_sha256':'6d3cde343ba09fb7088a3a07b0c54c96eeb629c82c527993a76000013c305b60','pack_url':'https://www.dunerealms.com/downloads/'+pack.name,'files':{}} for p in sorted(out.iterdir()): diff --git a/tools/build-ecology-packs.py b/tools/build-ecology-packs.py index 3b200e61..6740b86b 100644 --- a/tools/build-ecology-packs.py +++ b/tools/build-ecology-packs.py @@ -2,7 +2,7 @@ import hashlib, json, pathlib, struct, sys, zipfile ROOT = pathlib.Path(__file__).resolve().parents[1] -ART = ROOT / 'DuneRealmsGUI/ecology' +ART = ROOT / 'network/content-assets/ecology' ITEMS = ('jerboa_raw_meat', 'jerboa_cooked_meat', 'jerboa_hide', 'jerboa_stew', 'jerboa_water_vial') FOOD_ITEMS = ('jerboa_hide_paste', 'jerboa_leather', 'rehydrated_steak', 'spice_paste', 'bio_paste', 'spice_bread', 'spice_dough', 'jerboa_egg', 'spice_cake') RABBITS = ('salt', 'white_splotched', 'brown', 'toast', 'gold', 'caerbannog', 'black', 'white') diff --git a/tools/build-fauna-models.mjs b/tools/build-fauna-models.mjs index f95af9f4..7ed96eee 100644 --- a/tools/build-fauna-models.mjs +++ b/tools/build-fauna-models.mjs @@ -3,7 +3,7 @@ import {mkdir,writeFile} from 'node:fs/promises'; import {fileURLToPath} from 'node:url'; import path from 'node:path'; import {redPandaJerboaModels} from './build-jerboa-red-panda.mjs'; -const root=fileURLToPath(new URL('../DuneRealmsGUI/ecology/models/',import.meta.url)); +const root=fileURLToPath(new URL('../network/content-assets/ecology/models/',import.meta.url)); const faces=texture=>Object.fromEntries(['north','south','east','west','up','down'].map(face=>[face,{texture:'#'+texture,uv:[0,0,16,16]}])); const box=(from,to,texture)=>({from,to,faces:faces(texture)}); export function faunaModels(){ diff --git a/tools/build-fauna-pack-update.py b/tools/build-fauna-pack-update.py index f7d4e38e..513f1925 100644 --- a/tools/build-fauna-pack-update.py +++ b/tools/build-fauna-pack-update.py @@ -3,8 +3,8 @@ import argparse,json,pathlib,importlib.util,hashlib ROOT=pathlib.Path(__file__).resolve().parents[1] SPEC=importlib.util.spec_from_file_location('repair',ROOT/'tools/build-resourcepack-repair.py') repair=importlib.util.module_from_spec(SPEC);SPEC.loader.exec_module(repair) -OLD=json.loads((ROOT/'DuneRealmsGUI/resourcepack-repair/manifest.json').read_text()) -ART=ROOT/'DuneRealmsGUI/ecology' +OLD=json.loads((ROOT/'network/content-assets/resourcepack-repair/manifest.json').read_text()) +ART=ROOT/'network/content-assets/ecology' ITEMS=('jerboa_egg','chukka_egg','chukka_raw_meat','chukka_cooked_meat','dunesponge','dunesponge_filled','farmers_bucket','blood_vial','water_of_life') JERBOAS=('jerboa','jerboa_walk_left','jerboa_walk_right','jerboa_curled') def add_items(entries): diff --git a/tools/build-jerboa-meerkat.mjs b/tools/build-jerboa-meerkat.mjs index 7be9736d..c16f64cd 100644 --- a/tools/build-jerboa-meerkat.mjs +++ b/tools/build-jerboa-meerkat.mjs @@ -5,7 +5,7 @@ import path from 'node:path'; import {fileURLToPath} from 'node:url'; const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'); export function meerkatModels(){ - const source=fs.readFileSync(path.join(root,'DuneRealmsGUI/ecology/vendor/runes-and-dunes/MeerkatModel.java.txt'),'utf8'); + const source=fs.readFileSync(path.join(root,'network/content-assets/ecology/vendor/runes-and-dunes/MeerkatModel.java.txt'),'utf8'); const parts=new Map([['partdefinition',{at:[0,0,0],rotation:[0,0,0]}]]),elements=[]; const numbers=s=>s.split(',').map(x=>Number(x.trim().replace(/F$/,''))); for(const statement of source.split(';')){ diff --git a/tools/build-jerboa-recipes.mjs b/tools/build-jerboa-recipes.mjs index 48124a4d..5259d840 100644 --- a/tools/build-jerboa-recipes.mjs +++ b/tools/build-jerboa-recipes.mjs @@ -31,7 +31,7 @@ const definitions=[ const roman={1:'I',2:'II',3:'III',4:'IV',6:'VI',7:'VII',8:'VIII',9:'IX',14:'XIV'},colours={common:'&f',uncommon:'&a',rare:'&9',very_rare:'&5',legendary:'&6'}; const extraIds=new Set(definitions.slice(7).map(d=>d[0])); const cakeEffects=[{id:'minecraft:strength',amplifier:0,duration:1200},{id:'minecraft:regeneration',amplifier:0,duration:1200}]; -const itemDir=root+'DuneRealmsGUI/executableitems/arrakis',recipeDir=root+'DuneRealmsGUI/executablecrafting/recipes';mkdirSync(itemDir,{recursive:true});mkdirSync(recipeDir,{recursive:true}); +const itemDir=root+'network/content-assets/executableitems/arrakis',recipeDir=root+'network/content-assets/executablecrafting/recipes';mkdirSync(itemDir,{recursive:true});mkdirSync(recipeDir,{recursive:true}); function lore(d){return [d[3].replace('_',' ').toUpperCase()+' | MK '+roman[d[4]],'S1 · ARRAKIS',...(d[0]==='jerboa_stew'?['Jerboa meat, enriched with contaminated spice.']:[])];} function stack(id){ const d=definitions.find(d=>d[0]===id);if(!d)throw Error('Unknown ingredient'); diff --git a/tools/build-jerboa-red-panda.mjs b/tools/build-jerboa-red-panda.mjs index 0c26eead..69fe23b2 100644 --- a/tools/build-jerboa-red-panda.mjs +++ b/tools/build-jerboa-red-panda.mjs @@ -8,7 +8,7 @@ const bounds=points=>({from:[0,1,2].map(i=>Math.min(...points.map(p=>p[i]))),to: const uv=(...n)=>n.map(v=>v/4); const scaleVec=([x,y,z])=>[8+(x-8)*.68,y*.68,8+(z-8)*.68]; export function redPandaJerboaModels(){ - const source=fs.readFileSync(path.join(root,'DuneRealmsGUI/ecology/vendor/runes-and-dunes/RedPandaModel.java.txt'),'utf8'); + const source=fs.readFileSync(path.join(root,'network/content-assets/ecology/vendor/runes-and-dunes/RedPandaModel.java.txt'),'utf8'); const parts=new Map([['partdefinition',{at:[0,0,0]}]]),elements=[]; const numbers=s=>s.split(',').map(x=>Number(x.trim().replace(/F$/,''))); for(const statement of source.split(';')){ diff --git a/tools/build-npc-account-avatars.py b/tools/build-npc-account-avatars.py index d5750ce4..f9c9b6cb 100644 --- a/tools/build-npc-account-avatars.py +++ b/tools/build-npc-account-avatars.py @@ -4,7 +4,7 @@ from PIL import Image root=Path(__file__).resolve().parents[1] atlas=Image.open(root/'website/web/assets/mentat-portraits-atlas-v1.png').convert('RGBA') -out=root/'DuneRealmsGUI/src/main/resources/mcgui-npc-avatars' +out=root/'network/content-assets/src/main/resources/mcgui-npc-avatars' out.mkdir(parents=True,exist_ok=True) width,height=atlas.size for i in range(8): diff --git a/tools/build-planet-texture-packs.mjs b/tools/build-planet-texture-packs.mjs index 72c39e21..8b132489 100644 --- a/tools/build-planet-texture-packs.mjs +++ b/tools/build-planet-texture-packs.mjs @@ -7,7 +7,7 @@ import {deflateRawSync} from 'node:zlib'; import {sandEntries} from './flat-sand.mjs'; const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'); -const art=path.join(root,'DuneRealmsGUI/planet-artwork'); +const art=path.join(root,'network/content-assets/planet-artwork'); const source=path.join(art,'pixel-perfection-ce'); export const profiles=JSON.parse(fs.readFileSync(path.join(art,'profiles.json'),'utf8')); const prefix='assets/minecraft/textures/'; diff --git a/tools/build-quest-npc-pack.py b/tools/build-quest-npc-pack.py index e8d042b7..e6343da3 100644 --- a/tools/build-quest-npc-pack.py +++ b/tools/build-quest-npc-pack.py @@ -9,8 +9,8 @@ ROOT = pathlib.Path(__file__).resolve().parents[1] SPEC = importlib.util.spec_from_file_location('repair', ROOT / 'tools/build-resourcepack-repair.py') repair = importlib.util.module_from_spec(SPEC) SPEC.loader.exec_module(repair) -OLD = json.loads((ROOT / 'DuneRealmsGUI/fauna-pack/manifest.json').read_text()) -SKINS = ROOT / 'DuneRealmsGUI/npc-skins' +OLD = json.loads((ROOT / 'network/content-assets/fauna-pack/manifest.json').read_text()) +SKINS = ROOT / 'network/content-assets/npc-skins' def build(inputs, output): output.mkdir(parents=True, exist_ok=True) diff --git a/tools/build-quest-npc-skins.mjs b/tools/build-quest-npc-skins.mjs index 3379be9b..9bf0a5b2 100644 --- a/tools/build-quest-npc-skins.mjs +++ b/tools/build-quest-npc-skins.mjs @@ -4,7 +4,7 @@ import {mkdirSync,writeFileSync} from 'node:fs'; import {deflateSync} from 'node:zlib'; import {dirname,resolve} from 'node:path'; import {fileURLToPath} from 'node:url'; -const root=resolve(dirname(fileURLToPath(import.meta.url)),'..'),out=resolve(root,'DuneRealmsGUI/npc-skins');mkdirSync(out,{recursive:true}); +const root=resolve(dirname(fileURLToPath(import.meta.url)),'..'),out=resolve(root,'network/content-assets/npc-skins');mkdirSync(out,{recursive:true}); const colors={ thufir_hawat:['ba8964','51463f','a0a0a0','25352b','929c65','d6bb77','trim'], piter_de_vries:['a69586','433f40','50454c','332d35','6b394f','b9957b','trim'], diff --git a/tools/build-resourcepack-repair.py b/tools/build-resourcepack-repair.py index fe700c52..1671bcac 100644 --- a/tools/build-resourcepack-repair.py +++ b/tools/build-resourcepack-repair.py @@ -9,7 +9,7 @@ import re import zipfile ROOT = pathlib.Path(__file__).resolve().parents[1] -OLD_PLANETS = ROOT / 'DuneRealmsGUI/planet-artwork/release-v2' +OLD_PLANETS = ROOT / 'network/content-assets/planet-artwork/release-v2' OLD_NETWORK = '15dfd24bbb1760e04a1df1e0556c15b759353be705fbf2bcc9b377704abcf560' OLD_ARRAKIS = '4a906b4e292221997d7870d63d70303d37d7cd41d872cba6bb7c2a170bd88adc' BASE_ID = 'a7b5ab7d-d8d8-5b51-b016-71a5f4c00008' diff --git a/tools/build-survival-food-pack.py b/tools/build-survival-food-pack.py index 07b3f305..e6096ef7 100644 --- a/tools/build-survival-food-pack.py +++ b/tools/build-survival-food-pack.py @@ -7,7 +7,7 @@ def build(base,output): with zipfile.ZipFile(base) as source:entries={name:source.read(name) for name in source.namelist() if not name.endswith('/')} original=dict(entries) for item in ITEMS: - data=(ROOT/'DuneRealmsGUI/ecology/food-icons'/f'{item}.png').read_bytes();assert data[:8]==b'\x89PNG\r\n\x1a\n' and data[25]==6 + data=(ROOT/'network/content-assets/ecology/food-icons'/f'{item}.png').read_bytes();assert data[:8]==b'\x89PNG\r\n\x1a\n' and data[25]==6 entries[f'assets/dunerealms/textures/item/ecology/{item}.png']=data entries[f'assets/dunerealms/models/item/ecology/{item}.json']=json.dumps({'parent':'minecraft:item/generated','textures':{'layer0':f'dunerealms:item/ecology/{item}'}}).encode() entries[f'assets/dunerealms/items/ecology/{item}.json']=json.dumps({'model':{'type':'minecraft:model','model':f'dunerealms:item/ecology/{item}'}}).encode() diff --git a/tools/flat-sand.mjs b/tools/flat-sand.mjs index 81b7194a..81c726f7 100644 --- a/tools/flat-sand.mjs +++ b/tools/flat-sand.mjs @@ -1,7 +1,7 @@ import fs from 'node:fs'; import {fileURLToPath} from 'node:url'; -const source=fs.readFileSync(fileURLToPath(new URL('../DuneRealmsGUI/planet-artwork/flat-sand/default_sand.png',import.meta.url))); +const source=fs.readFileSync(fileURLToPath(new URL('../network/content-assets/planet-artwork/flat-sand/default_sand.png',import.meta.url))); const table=Array.from({length:256},(_,n)=>{for(let i=0;i<8;i++)n=(n&1)?0xedb88320^(n>>>1):n>>>1;return n>>>0;}); function crc(bytes){let n=0xffffffff;for(const b of bytes)n=table[(n^b)&255]^(n>>>8);return (n^0xffffffff)>>>0;} // Palette-only build transform: preserve the source's exact grain and seamless tile. diff --git a/tools/install-dunemenus-release.py b/tools/install-dunemenus-release.py index 31338afd..486f3053 100644 --- a/tools/install-dunemenus-release.py +++ b/tools/install-dunemenus-release.py @@ -12,11 +12,14 @@ for name,record in manifest['files'].items(): assert '/' not in name and hashlib.sha256((bundle/name).read_bytes()).hexdigest()==record['sha256'],name plugins=root/'plugins';target=plugins/'DuneMenus.jar';data=plugins/'DuneMenus' assert target.is_file() and (data/'config.yml').is_file() +jars=[name for name in manifest['files'] if name.endswith('.jar') and (plugins/name).exists()] +assert 'DuneMenus.jar' in jars stamp=datetime.datetime.now(datetime.timezone.utc).strftime('%Y%m%dT%H%M%SZ') backup=Path('/root/dunemenus-before-'+stamp+'-'+root.name);backup.mkdir(mode=0o700) -for p in [target,data/'config.yml',data/'gui-pack.yml']: +for p in [*[plugins/name for name in jars],data/'config.yml',data/'gui-pack.yml']: if p.exists():shutil.copy2(p,backup/p.name) -others={p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in plugins.glob('*.jar') if p.name not in ['DuneMenus.jar','DunerealmsGUI.jar','DuneFullscreenPaper.jar','MCGUI.jar']} +excluded=set(jars)|{'DunerealmsGUI.jar','DuneFullscreenPaper.jar','MCGUI.jar'} +others={p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in plugins.glob('*.jar') if p.name not in excluded} (backup/'other-jars.json').write_text(json.dumps(others,indent=2)) config=yaml.safe_load((data/'config.yml').read_text()) or {} config.setdefault('fullscreen',{})['enabled']=True @@ -34,17 +37,19 @@ for name in ['DunerealmsGUI.jar','DuneFullscreenPaper.jar','MCGUI.jar','Dunereal for name in ['mcgui']: p=data/name if p.is_dir():shutil.move(str(p),str(backup/('DuneMenus-'+name)));removed.append('DuneMenus/'+name) -tmp=target.with_suffix('.jar.build-staged');shutil.copy2(bundle/'DuneMenus.jar',tmp);os.chown(tmp,owner.st_uid,owner.st_gid);os.replace(tmp,target) +for name in jars: + dst=plugins/name;tmp=dst.with_suffix('.jar.build-staged');shutil.copy2(bundle/name,tmp);os.chown(tmp,owner.st_uid,owner.st_gid);os.replace(tmp,dst) for name,content in [('config.yml',config),('gui-pack.yml',pack)]: p=data/name;p.write_text(yaml.safe_dump(content,sort_keys=False,allow_unicode=True));os.chown(p,owner.st_uid,owner.st_gid) cache=plugins/'.paper-remapped' if cache.is_dir(): for p in cache.glob('*.jar'): - if any(x in p.name.lower() for x in ['dunemenus','dunerealmsgui','dunefullscreen','mcgui']): + if p.name in jars or any(x in p.name.lower() for x in ['dunemenus','dunerealmsgui','dunefullscreen','mcgui']): shutil.move(str(p),str(backup/('remapped-'+p.name))) -after={p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in plugins.glob('*.jar') if p.name not in ['DuneMenus.jar','DunerealmsGUI.jar','DuneFullscreenPaper.jar','MCGUI.jar']} +after={p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in plugins.glob('*.jar') if p.name not in excluded} assert others==after,'Unrelated plugins changed' assert hashlib.sha256(target.read_bytes()).hexdigest()==manifest['files']['DuneMenus.jar']['sha256'] +for name in jars:assert hashlib.sha256((plugins/name).read_bytes()).hexdigest()==manifest['files'][name]['sha256'] subprocess.run(['systemctl','start',unit],check=True,timeout=120) -report={'source':manifest['source'],'server':str(root),'unit':unit,'backup':str(backup),'removed':removed,'jar_sha256':manifest['files']['DuneMenus.jar']['sha256'],'pack':pin,'other_plugins_unchanged':True,'runtime_verified':False} +report={'source':manifest['source'],'server':str(root),'unit':unit,'backup':str(backup),'removed':removed,'jars':{name:manifest['files'][name]['sha256'] for name in jars},'pack':pin,'other_plugins_unchanged':True,'runtime_verified':False} (backup/'deployment.json').write_text(json.dumps(report,indent=2));print(json.dumps(report)) diff --git a/tools/jerboa-recipes.test.mjs b/tools/jerboa-recipes.test.mjs index e7231ec3..1c0c1ad9 100644 --- a/tools/jerboa-recipes.test.mjs +++ b/tools/jerboa-recipes.test.mjs @@ -3,12 +3,12 @@ import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; const root=new URL('../',import.meta.url),read=p=>JSON.parse(readFileSync(new URL(p,root))); test('worm feed compresses nine genuine contaminated spice into Rare MK IV without accepting ordinary dye',()=>{ - const recipe=read('DuneRealmsGUI/executablecrafting/recipes/contaminated_spice_block.yml'),ingredients=Object.entries(recipe).filter(([k])=>/^input\d$/.test(k)).map(([,v])=>v); + const recipe=read('network/content-assets/executablecrafting/recipes/contaminated_spice_block.yml'),ingredients=Object.entries(recipe).filter(([k])=>/^input\d$/.test(k)).map(([,v])=>v); assert.equal(ingredients.length,9);assert.ok(ingredients.every(v=>v.includes('"ei-id"')||v.includes('executableitems:ei-id')));assert.ok(ingredients.every(v=>v.includes('polluted_refined_spice')));assert.equal(recipe.itemCheckers.checkExecutableItemID,true); const grade=read('JarvisConnector/src/main/resources/item-templates.json').templates.contaminated_spice_block;assert.equal(grade.equipmentMark,4);assert.equal(grade.quality,'rare');assert.ok(recipe.result.includes('contaminated_spice_block')); }); test('stew consumes custom cooked Jerboa meat and contaminated spice; no mushroom',()=>{ - const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_stew.yml'),inputs=Object.entries(r).filter(([k])=>/^input\d$/.test(k)).map(([,v])=>v); + const r=read('network/content-assets/executablecrafting/recipes/jerboa_stew.yml'),inputs=Object.entries(r).filter(([k])=>/^input\d$/.test(k)).map(([,v])=>v); assert.equal(inputs.length,5);assert.ok(inputs[0].includes('jerboa_cooked_meat'));assert.ok(inputs[3].includes('polluted_refined_spice'));assert.ok(inputs.includes('minecraft:bowl'));assert.ok(!inputs.some(v=>v.includes('mushroom'))); assert.equal(r.itemCheckers.checkExecutableItemID,true);assert.equal(r.itemCheckers.checkMaterial,true); for(const item of [...inputs,r.result].filter(v=>v.includes('minecraft:custom_data'))) { @@ -18,15 +18,15 @@ test('stew consumes custom cooked Jerboa meat and contaminated spice; no mushroo }); test('native food configuration uses the integer fields required by EI',()=>{ for(const id of ['jerboa_raw_meat','jerboa_cooked_meat','jerboa_stew']){ - const item=read('DuneRealmsGUI/executableitems/arrakis/'+id+'.yml');assert.ok(Number.isInteger(item.foodFeatures.saturation));assert.ok(Number.isInteger(item.consumableFeatures.consumeSeconds)); + const item=read('network/content-assets/executableitems/arrakis/'+id+'.yml');assert.ok(Number.isInteger(item.foodFeatures.saturation));assert.ok(Number.isInteger(item.consumableFeatures.consumeSeconds)); } }); test('cooking retains the custom item identity and Rare MK VI grade',()=>{ - const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_cooked_meat.yml');assert.equal(r.recipeType,'FURNACE');assert.ok(r.input1.includes('jerboa_raw_meat'));assert.ok(r.result.includes('jerboa_cooked_meat'));assert.ok(r.result.includes('"dunerealms:equipment_mark":"6"')); + const r=read('network/content-assets/executablecrafting/recipes/jerboa_cooked_meat.yml');assert.equal(r.recipeType,'FURNACE');assert.ok(r.input1.includes('jerboa_raw_meat'));assert.ok(r.result.includes('jerboa_cooked_meat'));assert.ok(r.result.includes('"dunerealms:equipment_mark":"6"')); }); test('a Farmer’s Bucket requires six genuine water vials and an empty bucket',()=>{ - const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_water_bucket.yml'); + const r=read('network/content-assets/executablecrafting/recipes/jerboa_water_bucket.yml'); const inputs=Object.entries(r).filter(([key])=>/^input\d$/.test(key)).map(([,value])=>value); assert.equal(r.typeOfCraftingTableRecipe,'SHAPELESS');assert.equal(inputs.length,7); assert.equal(inputs.filter(value=>value.includes('"executableitems:ei-id":"jerboa_water_vial"')).length,6); @@ -35,40 +35,40 @@ test('a Farmer’s Bucket requires six genuine water vials and an empty bucket', assert.match(r.result,/^minecraft:water_bucket\[/);assert.ok(r.result.includes('farmers_bucket'));assert.ok(r.result.includes('"dunerealms:equipment_mark":"7"'));assert.ok(r.result.includes('"dunerealms:quality":"rare"')); }); test('DuneSponge uses one dry sponge and genuine spice',()=>{ - const r=read('DuneRealmsGUI/executablecrafting/recipes/dunesponge.yml'); + const r=read('network/content-assets/executablecrafting/recipes/dunesponge.yml'); assert.equal(r.typeOfCraftingTableRecipe,'SHAPELESS');assert.equal(r.input1,'minecraft:sponge');assert.equal(r.input2,'minecraft:orange_dye');assert.equal(r.input3,undefined);assert.ok(r.result.includes('"executableitems:ei-id":"dunesponge"')); - const s=read('DuneRealmsGUI/executablecrafting/recipes/dunesponge_smuggled.yml');assert.ok(s.input2.includes('smuggled_spice'));assert.equal(s.result,r.result); + const s=read('network/content-assets/executablecrafting/recipes/dunesponge_smuggled.yml');assert.ok(s.input2.includes('smuggled_spice'));assert.equal(s.result,r.result); }); test('stew and memorial grades agree with the shared lore catalogue',()=>{ const p=read('JarvisConnector/src/main/resources/item-templates.json').templates; for(const [id,quality,mark] of [['jerboa_stew','very_rare',9],['worm_memorial_bone','legendary',14]]){ - const item=read('DuneRealmsGUI/executableitems/arrakis/'+id+'.yml');assert.equal(p[id].quality,quality);assert.equal(p[id].equipmentMark,mark);assert.ok(item.lore[0].includes(quality.replace('_',' ').toUpperCase())); + const item=read('network/content-assets/executableitems/arrakis/'+id+'.yml');assert.equal(p[id].quality,quality);assert.equal(p[id].equipmentMark,mark);assert.ok(item.lore[0].includes(quality.replace('_',' ').toUpperCase())); } }); test('hide becomes paste then four separate, ordinary-crafting-compatible Jerboa Leather',()=>{ - const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_leather.yml'); + const r=read('network/content-assets/executablecrafting/recipes/jerboa_leather.yml'); assert.ok(r.input1.includes('jerboa_hide'));assert.ok(r.input2.includes('jerboa_water_vial'));assert.equal(r.input3,undefined);assert.ok(r.result.includes('jerboa_hide_paste')); const native=read('JarvisConnector/src/main/resources/survival-food-recipes.json').smoker.find(r=>r.id==='jerboa_leather');assert.equal(native.input,'jerboa_hide_paste');assert.equal(native.amount,4); - const paste=read('DuneRealmsGUI/executableitems/arrakis/jerboa_hide_paste.yml'),leather=read('DuneRealmsGUI/executableitems/arrakis/jerboa_leather.yml');assert.equal(leather.material,'LEATHER');assert.match(paste.lore[0],/COMMON \| MK II$/);assert.match(leather.lore[0],/UNCOMMON \| MK III$/); + const paste=read('network/content-assets/executableitems/arrakis/jerboa_hide_paste.yml'),leather=read('network/content-assets/executableitems/arrakis/jerboa_leather.yml');assert.equal(leather.material,'LEATHER');assert.match(paste.lore[0],/COMMON \| MK II$/);assert.match(leather.lore[0],/UNCOMMON \| MK III$/); }); test('Spice Bread inherits the exact enchanted golden apple consumable without scripted effects',()=>{ - const bread=read('DuneRealmsGUI/executableitems/arrakis/spice_bread.yml');assert.equal(bread.material,'ENCHANTED_GOLDEN_APPLE');assert.equal(bread.consumableFeatures,undefined);assert.equal(bread.foodFeatures,undefined);assert.deepEqual(bread.activators,{});assert.equal(bread.itemModel,'dunerealms:ecology/spice_bread'); + const bread=read('network/content-assets/executableitems/arrakis/spice_bread.yml');assert.equal(bread.material,'ENCHANTED_GOLDEN_APPLE');assert.equal(bread.consumableFeatures,undefined);assert.equal(bread.foodFeatures,undefined);assert.deepEqual(bread.activators,{});assert.equal(bread.itemModel,'dunerealms:ecology/spice_bread'); }); test('Spice Cake requires three custom eggs and water, keeps Rare MK VII and rich food effects',()=>{ - const r=read('DuneRealmsGUI/executablecrafting/recipes/spice_cake.yml');assert.equal([r.input2,r.input3,r.input4].filter(x=>x.includes('chukka_egg')).length,3);assert.ok(r.input1.includes('spice_dough'));assert.ok(r.input5.includes('jerboa_water_vial'));assert.ok(r.result.includes('"dunerealms:equipment_mark":"7"')); - const cake=read('DuneRealmsGUI/executableitems/arrakis/spice_cake.yml');assert.equal(cake.foodFeatures.nutrition,16);assert.equal(cake.foodFeatures.saturation,20);assert.deepEqual(Object.values(cake.consumableFeatures.potionEffects).map(x=>x.potionEffectType).sort(),['REGENERATION','STRENGTH']); + const r=read('network/content-assets/executablecrafting/recipes/spice_cake.yml');assert.equal([r.input2,r.input3,r.input4].filter(x=>x.includes('chukka_egg')).length,3);assert.ok(r.input1.includes('spice_dough'));assert.ok(r.input5.includes('jerboa_water_vial'));assert.ok(r.result.includes('"dunerealms:equipment_mark":"7"')); + const cake=read('network/content-assets/executableitems/arrakis/spice_cake.yml');assert.equal(cake.foodFeatures.nutrition,16);assert.equal(cake.foodFeatures.saturation,20);assert.deepEqual(Object.values(cake.consumableFeatures.potionEffects).map(x=>x.potionEffectType).sort(),['REGENERATION','STRENGTH']); }); test('Chukka and the legacy Weirding Module have distinct identities and grades',()=>{ - const egg=read('DuneRealmsGUI/executableitems/arrakis/chukka_egg.yml'),module=read('DuneRealmsGUI/executableitems/arrakis/jerboa_egg.yml'); + const egg=read('network/content-assets/executableitems/arrakis/chukka_egg.yml'),module=read('network/content-assets/executableitems/arrakis/jerboa_egg.yml'); assert.equal(egg.material,'EGG');assert.equal(egg.disableStack,false);assert.deepEqual(egg.activators,{}); assert.equal(module.material,'EGG');assert.equal(module.disableStack,true);assert.equal(module.name,'&aWeirding Module'); - const recipe=read('DuneRealmsGUI/executablecrafting/recipes/weirding_module.yml');assert.ok(recipe.input1.includes('jerboa_hide_paste'));assert.equal(recipe.input2,'minecraft:orange_dye');assert.ok(recipe.result.includes('"minecraft:fake"')===false);assert.ok(recipe.result.includes('minecraft:max_stack_size=1'));assert.ok(recipe.result.includes('"seconds":3')); - const cook=read('DuneRealmsGUI/executablecrafting/recipes/chukka_cooked_meat.yml');assert.ok(cook.input1.includes('chukka_raw_meat'));assert.ok(cook.result.includes('chukka_cooked_meat'));assert.ok(cook.result.includes('"dunerealms:equipment_mark":"2"')); + const recipe=read('network/content-assets/executablecrafting/recipes/weirding_module.yml');assert.ok(recipe.input1.includes('jerboa_hide_paste'));assert.equal(recipe.input2,'minecraft:orange_dye');assert.ok(recipe.result.includes('"minecraft:fake"')===false);assert.ok(recipe.result.includes('minecraft:max_stack_size=1'));assert.ok(recipe.result.includes('"seconds":3')); + const cook=read('network/content-assets/executablecrafting/recipes/chukka_cooked_meat.yml');assert.ok(cook.input1.includes('chukka_raw_meat'));assert.ok(cook.result.includes('chukka_cooked_meat'));assert.ok(cook.result.includes('"dunerealms:equipment_mark":"2"')); }); test('normal and smuggled spice have separate native ingredient checks for both plant recipes',()=>{ - for(const id of ['spice_paste','spice_dough']){const ordinary=read('DuneRealmsGUI/executablecrafting/recipes/'+id+'.yml'),smuggled=read('DuneRealmsGUI/executablecrafting/recipes/'+id+'_smuggled.yml');assert.equal(ordinary.input2,'minecraft:orange_dye');assert.ok(smuggled.input2.includes('"executableitems:ei-id":"smuggled_spice"'));assert.equal(ordinary.result,smuggled.result);assert.equal(ordinary.itemCheckers.checkExecutableItemID,true);} + for(const id of ['spice_paste','spice_dough']){const ordinary=read('network/content-assets/executablecrafting/recipes/'+id+'.yml'),smuggled=read('network/content-assets/executablecrafting/recipes/'+id+'_smuggled.yml');assert.equal(ordinary.input2,'minecraft:orange_dye');assert.ok(smuggled.input2.includes('"executableitems:ei-id":"smuggled_spice"'));assert.equal(ordinary.result,smuggled.result);assert.equal(ordinary.itemCheckers.checkExecutableItemID,true);} }); diff --git a/tools/test_fauna_pack_update.py b/tools/test_fauna_pack_update.py index c447f5bf..e6a9bfc0 100644 --- a/tools/test_fauna_pack_update.py +++ b/tools/test_fauna_pack_update.py @@ -27,7 +27,7 @@ class FaunaPackTest(unittest.TestCase): baseline=pathlib.Path(os.environ['DUNE_FAUNA_BASELINE_DIR']) with tempfile.TemporaryDirectory() as tmp: output=pathlib.Path(tmp);manifest=fauna.build(baseline,output) - self.assertEqual(manifest,json.loads((ROOT/'DuneRealmsGUI/fauna-pack/manifest.json').read_text())) + self.assertEqual(manifest,json.loads((ROOT/'network/content-assets/fauna-pack/manifest.json').read_text())) for category in ('base','planets'): for scope,record in manifest[category].items(): path=output/record['filename'];self.assertEqual(hashlib.sha256(path.read_bytes()).hexdigest(),record['sha256']) diff --git a/tools/test_quest_npc_pack.py b/tools/test_quest_npc_pack.py index 0a5ec331..c1e77a0f 100644 --- a/tools/test_quest_npc_pack.py +++ b/tools/test_quest_npc_pack.py @@ -10,7 +10,7 @@ class NPCPackTest(unittest.TestCase): baseline=pathlib.Path(os.environ['DUNE_NPC_BASELINE_DIR']) with tempfile.TemporaryDirectory() as tmp: output=pathlib.Path(tmp);manifest=npc.build(baseline,output) - self.assertEqual(manifest,json.loads((ROOT/'DuneRealmsGUI/npc-skins/manifest.json').read_text())) + self.assertEqual(manifest,json.loads((ROOT/'network/content-assets/npc-skins/manifest.json').read_text())) for scope,record in manifest['base'].items(): old=npc.OLD['base'][scope];path=output/record['filename'] self.assertEqual(hashlib.sha256(path.read_bytes()).hexdigest(),record['sha256']) diff --git a/tools/test_resourcepack_repair.py b/tools/test_resourcepack_repair.py index e3665237..b55ca4fd 100644 --- a/tools/test_resourcepack_repair.py +++ b/tools/test_resourcepack_repair.py @@ -38,20 +38,20 @@ def model_refs(value): class RepairTest(unittest.TestCase): def test_delivery_pins_match_the_immutable_manifest(self): - manifest=json.loads((ROOT/'DuneRealmsGUI/resourcepack-repair/manifest.json').read_text()) - active=json.loads((ROOT/'DuneRealmsGUI/fauna-pack/manifest.json').read_text()) + manifest=json.loads((ROOT/'network/content-assets/resourcepack-repair/manifest.json').read_text()) + active=json.loads((ROOT/'network/content-assets/fauna-pack/manifest.json').read_text()) manifest['base'].update(active['base']) manifest['planets'].update(active['planets']) - npc=json.loads((ROOT/'DuneRealmsGUI/npc-skins/manifest.json').read_text()) + npc=json.loads((ROOT/'network/content-assets/npc-skins/manifest.json').read_text()) self.assertEqual(npc['baseId'],manifest['baseId']) manifest['base'].update(npc['base']) - beta=json.loads((ROOT/'DuneRealmsGUI/beta-artwork/manifest.json').read_text()) + beta=json.loads((ROOT/'network/content-assets/beta-artwork/manifest.json').read_text()) self.assertEqual(beta['baseId'],manifest['baseId']) self.assertEqual(beta['base']['world'],beta['base']['lobby']) manifest['base'].update(beta['base']) manifest['planets'].update(beta['planets']) - resources=ROOT/'DuneRealmsGUI/src/main/resources' - java=ROOT/'DuneRealmsGUI/src/main/java/com/dunerealms/gui' + resources=ROOT/'network/content-assets/src/main/resources' + java=ROOT/'network/content-assets/src/main/java/com/dunerealms/gui' network=(resources/'gui-pack.yml').read_text() policy=(java/'NetworkArtworkPolicy.java').read_text() material=(resources/'planet-textures.yml').read_text() @@ -105,7 +105,7 @@ class RepairTest(unittest.TestCase): old=unpack(network); old_arrakis=unpack(arrakis) with tempfile.TemporaryDirectory() as tmp: out=pathlib.Path(tmp); manifest=repair.build(network,arrakis,out) - self.assertEqual(manifest,json.loads((ROOT/'DuneRealmsGUI/resourcepack-repair/manifest.json').read_text())) + self.assertEqual(manifest,json.loads((ROOT/'network/content-assets/resourcepack-repair/manifest.json').read_text())) world=unpack(out/manifest['base']['world']['filename']) lobby=unpack(out/manifest['base']['lobby']['filename']) self.assertEqual({k:v for k,v in lobby.items() if k!='pack.mcmeta'},{k:v for k,v in old.items() if k!='pack.mcmeta'}) diff --git a/website/scripts/recipe-catalogue.mjs b/website/scripts/recipe-catalogue.mjs index 1b8c9ddf..e6710fc5 100644 --- a/website/scripts/recipe-catalogue.mjs +++ b/website/scripts/recipe-catalogue.mjs @@ -1,10 +1,10 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs'; -const source = new URL('../../DuneRealmsGUI/executablecrafting/recipes/', import.meta.url); +const source = new URL('../../network/content-assets/executablecrafting/recipes/', import.meta.url); const smoker = new URL('../../JarvisConnector/src/main/resources/survival-food-recipes.json', import.meta.url); const repairParts = new URL('../../DuneTerrain/src/main/resources/starter-repair-parts.json', import.meta.url); -const arrakisItems = new URL('../../DuneRealmsGUI/executableitems/arrakis/', import.meta.url); +const arrakisItems = new URL('../../network/content-assets/executableitems/arrakis/', import.meta.url); const vanillaFoodSaturation = { beef: 1.8, enchanted_golden_apple: 9.6 }; const itemSummaries = { bio_paste: 'A concentrated blend of Spice Paste and Rehydrated Steak. Process it in a smoker to make Spice Bread.', @@ -34,7 +34,7 @@ const itemSummaries = { spice_boosted_potion: 'An imported potion enhanced with spice on Arrakis. Drink it for stronger effects where the rounded effect level increases.', }; const foodIds = new Set(['chukka_cooked_meat', 'jerboa_cooked_meat', 'jerboa_stew', 'rehydrated_steak', 'spice_bread', 'spice_cake']); -const ecologyIcons = new URL('../../DuneRealmsGUI/ecology/food-icons/', import.meta.url); +const ecologyIcons = new URL('../../network/content-assets/ecology/food-icons/', import.meta.url); function entry(id, name, material = id, custom = false) { return { id, name, material, custom };