From 88ddf3fde3942427e8933e016c2d26dbb724a451 Mon Sep 17 00:00:00 2001 From: unimatrixgit <95320811+unimatrixgit@users.noreply.github.com> Date: Sat, 28 Nov 2026 01:13:11 +0100 Subject: [PATCH] Give organisation, House and Exchange menus distinct layouts --- .../java/com/dunerealms/gui/MCGUIMenus.java | 5 ++- .../java/com/dunerealms/gui/MenuDocument.java | 37 ++++++++++++++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java index b3fa2d3b..3632b3d2 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java @@ -65,7 +65,7 @@ final class MCGUIMenus implements AutoCloseable, Listener { for(int slot=0;slot lore=meta!=null&&meta.hasLore()?meta.lore().stream().map(plain::serialize).map(MenuDocument::clean).filter(s->!s.isBlank()).toList():List.of(); if(meta!=null&&meta.hasItemModel()&&meta.getItemModel().getKey().equals("drgui_transparent")&&!transparent.add(name+lore))continue;Runnable action=actions.get(slot);if(action!=null&&!aliases.add(action)||action==null&&!decorations.add(name+item.getType()+lore))continue; String material=item.getType().name().toLowerCase(Locale.ROOT),quality="";if(meta!=null){String art=meta.getPersistentDataContainer().get(new NamespacedKey("dunerealms","menu_art"),org.bukkit.persistence.PersistentDataType.STRING);if(art!=null&&art.matches("[a-z0-9_]{1,70}"))material=art;} @@ -75,7 +75,8 @@ final class MCGUIMenus implements AutoCloseable, Listener { GuiSession gate=suppliedGate==null?new GuiSession(p.getUniqueId()):suppliedGate; Session old=sessions.remove(p.getUniqueId());if(old!=null)old.finish(); try{ - Session s=new Session(p,title,description,cards,Map.copyOf(actions),gate);sessions.put(p.getUniqueId(),s);p.closeInventory();s.schedule(); + Map callbacks=new HashMap<>(actions);callbacks.values().removeIf(Objects::isNull); + Session s=new Session(p,title,description,cards,Map.copyOf(callbacks),gate);sessions.put(p.getUniqueId(),s);p.closeInventory();s.schedule(); Bukkit.getScheduler().runTaskLater(plugin,()->{if(sessions.get(p.getUniqueId())==s){s.finish();sessions.remove(p.getUniqueId());}},2400L);return true; }catch(Exception failure){gate.expire();plugin.getLogger().warning("MC GUI menu unavailable: "+failure.getClass().getSimpleName());p.sendMessage("This menu is temporarily unavailable. Reopen your Imperial Codex.");return true;} } diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MenuDocument.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MenuDocument.java index 36d1ac01..dfc60656 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MenuDocument.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MenuDocument.java @@ -23,22 +23,22 @@ final class MenuDocument { if(title.startsWith("NPC dashboard · ")||title.startsWith("NPC turn-in · ")||title.startsWith("NPC next quest · ")||title.startsWith("NPC dashboard decision · ")||title.startsWith("NPC turn-in decision · ")||title.startsWith("NPC next quest decision · "))return roleplay(title,description,cards,selected,root); int back=cards.stream().filter(c->c.action&&(c.title.equalsIgnoreCase("Back")||c.title.toLowerCase(Locale.ROOT).startsWith("back to "))).mapToInt(Card::slot).findFirst().orElse(-3); List controls=cards.stream().filter(MenuDocument::compactControl).toList();cards=cards.stream().filter(c->!compactControl(c)).toList(); - String lower=title.toLowerCase(Locale.ROOT),theme=lower.contains("quest")||lower.contains("mission")||lower.contains("research")||lower.contains("gurney")?"quest":"realm"; + String theme=theme(title,cards); Card detail=cards.stream().filter(c->c.slot==selected).findFirst().orElse(cards.isEmpty()?null:cards.get(0)); - StringBuilder b=new StringBuilder("DuneRealms
CHOAM · IMPERIAL SERVICES

").append(escape(title)).append("

").append(escape(player)).append("
J.A.R.V.I.S. · Your realm, connectedInspect a card · Scroll for more · Sneak to close
");return b.toString(); } static String warMusterRoom(String description,String player,List cards,Path root){ Map positions=new HashMap<>();for(Card card:cards)positions.put(card.slot,card);Card own=cards.stream().filter(c->c.lore.stream().anyMatch(l->l.equals("Your team"))).findFirst().orElse(null);String side=own!=null&&own.title.startsWith("Red")?"red":"blue"; @@ -66,6 +66,33 @@ final class MenuDocument { private static final String ROLEPLAY_CSS=""" *{box-sizing:border-box}body{margin:0;color:#f8edcf;background:#061c13;font-family:'Source Serif 4',Georgia,serif}.frame{position:relative;min-height:597px;width:100%;display:grid;grid-template-columns:30% 70%;background-image:url('art/quest-dialogue-frame.png');background-size:100% 100%;background-repeat:no-repeat;padding:18px 22px 42px}.portrait{position:relative;padding:17px 27px 122px 17px;display:flex;align-items:center;justify-content:center;min-height:500px}.avatar{width:100%;height:auto;max-height:370px;object-fit:contain;image-rendering:pixelated}.nameplate{position:absolute;bottom:10px;left:18px;right:36px;text-align:center}.nameplate h2{font-size:25px;line-height:1.08;margin:0;color:#f6e2a8}.nameplate p{font-style:italic;font-size:14px;color:#e5cb8f;margin:8px 4px}.content{padding:0 40px 30px 33px;min-width:0;text-align:center}header{display:flex;align-items:center;justify-content:center;gap:16px;color:#cfa94c}h1{margin:0 0 7px;color:#fff2cd;font-size:32px;letter-spacing:1px;line-height:1.1}.dialogue-art{width:80%;max-height:140px;object-fit:cover;border:1px solid #b59b58;margin:8px auto}.dialogue{font-size:17px;color:#f2dfb1;font-style:italic;margin:7px auto 12px;line-height:1.3;max-width:95%}.summary,.record{border:2px solid #bc9f52;border-radius:6px;padding:8px 14px;margin:9px auto;background:#05251bd9;max-width:96%}.bar{height:15px;border:1px solid #d9ba68;background:#09291d;margin:5px 20px}.bar div{height:100%;background:linear-gradient(#ffe17c,#c69a32)}.summary p,.record p{margin:4px 0;line-height:1.25;font-size:14px}.record h3{margin:2px 0 6px;font-size:20px;color:#f1d293}.paths{color:#f5e0a5;font-size:20px;letter-spacing:1px;margin:12px 0 6px}.mission,.primary,.secondary{background:linear-gradient(#113a29,#08281d);border:2px solid #c0a150;color:#f9ecc6;min-height:36px;padding:7px 15px;border-radius:7px;font:600 16px 'Source Serif 4',Georgia,serif;display:block;width:96%;margin:7px auto;box-shadow:inset 0 1px 0 #f5e0a450}.mission{text-align:left;display:flex;justify-content:space-between;gap:12px}.mission span{font-size:13px;color:#e8d09b}.mission.selected span{color:#3a2c0b}.mission.selected,.primary{background:linear-gradient(#ffe082,#c99a2d);color:#1b1a0b;border:2px solid #fff1b3;box-shadow:0 0 10px #e0ad4b66,inset 0 1px 0 #fff0b9}.primary{font-size:20px;font-weight:700;width:80%;text-transform:uppercase;min-height:43px}.secondary{width:72%;font-size:15px;min-height:33px}.mission:hover,.secondary:hover{border-color:#fff0b9}.hint{color:#cbb47d;font-style:italic;font-size:13px}footer{position:absolute;bottom:13px;left:32%;right:3%;text-align:center;font-size:13px;letter-spacing:3px;color:#f5dd98;font-weight:700} """; + private static String theme(String title,List cards){ + String name=title.toLowerCase(Locale.ROOT); + if(name.startsWith("exchange"))return "exchange"; + if(name.equals("choose your house")||name.startsWith("your mentat"))return "house"; + if(name.contains("quest")||name.contains("mission")||name.contains("research")||name.contains("gurney"))return "quest"; + if(name.contains("clan")||name.contains("compan")||name.contains("organisation")|| + cards.stream().anyMatch(card->card.title.equals("Set Home Block")))return "organisation"; + return "realm"; + } + private static final String THEME_CSS=""" + .organisation{--accent:#9ee3d7;--edge:#578f8e;--glow:#7dcab832;background:linear-gradient(160deg,#152d34,#0b2025)} + .organisation .awning{height:8px;background:#578f8e;border:0} + .organisation .goods{grid-template-columns:repeat(2,minmax(0,1fr))} + .organisation .slot{flex-direction:row;text-align:left;gap:10px;padding:7px;background:#1a3840;border:1px solid #578f8e} + .organisation .cubby{width:44px;height:44px;flex-shrink:0} + .organisation .cubby img{width:36px;height:36px} + .organisation .board,.house .board{display:none} + .organisation h1,.organisation .slot strong{color:#d4efe9} + .exchange{--accent:#f5d18c;--edge:#ae8755;background:linear-gradient(160deg,#372b20,#17130f)} + .exchange aside{background:linear-gradient(180deg,#473524,#251b14)} + .exchange .cubby{background:#1d1710;border-color:#9c754a} + .house{--accent:#eed49a;--edge:#ae8a56;background:linear-gradient(160deg,#332c37,#191722)} + .house .awning{height:8px;background:#ae8a56;border:0} + .house aside{background:linear-gradient(180deg,#3c3142,#211a2b)} + .house .cubby{border-radius:50%;background:#281f31;border-color:#ae8a56} + .house .cubby img{width:54px;height:54px} + """; private static final String CONTROL_CSS=".menu-nav,.quick-controls{display:flex;gap:6px;flex-wrap:wrap}.menu-nav button,.quick-controls button{border:1px solid #b69a50;border-radius:3px;background:linear-gradient(180deg,#28553b,#102f24);color:#f1d797;font-size:12px;padding:7px 10px;min-width:42px}.menu-nav button:hover,.quick-controls button:hover{background:#3a7149}.quick-controls{margin-bottom:12px;padding:9px;background:#071f17;border:1px solid #8c743d}"; private static final String CSS=""" *{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,sans-serif}body{border:3px solid #b69a50;box-shadow:inset 0 0 0 2px #122d1e;position:relative;color:#e9dfc1;--accent:#e1bc65;--edge:#8c743d;--glow:#e5bd5c30;background:radial-gradient(ellipse at 12% 20%,#a2803930,transparent 60%),linear-gradient(180deg,#09251de8,#041711fa),url(art/banner.png) center/cover}.ingame{--accent:#88c5e4;--edge:#477e93;--glow:#4babc330}.ingame .cubby{border-color:#477e93}.awning{height:22px;background:repeating-linear-gradient(90deg,#163d2b 0px,#163d2b 30px,#b69750 30px,#b69750 45px);box-shadow:inset 0 -8px 10px #0006,0 3px 4px #0005;border-bottom:4px solid #8e763f}header{height:91px;display:flex;align-items:center;gap:22px;padding:9px 30px}.logo{width:174px;height:66px;object-fit:contain;filter:drop-shadow(0 4px 8px #0008)}.heading{flex:1}.heading small{color:#aab89a;font-size:9px;letter-spacing:2.6px}h1{font:600 27px 'Source Serif 4',serif;color:#f1d797;margin:4px 0 0;line-height:1.15}.viewer{font-size:11px;color:#b9c6ac;white-space:nowrap}button{font-family:Inter,sans-serif;color:inherit;cursor:pointer}.close{font-family:Minecraft,monospace;background:#061c1688;border:1px solid #8e763f66;border-radius:2px;width:33px;height:33px;font-size:23px;color:#d9c798}.close:hover{background:#744633}main{display:grid;grid-template-columns:300px minmax(0,1fr);gap:22px;padding:0 30px;align-items:start}aside{position:relative;background:linear-gradient(180deg,#153629e8,#061c16f5);border:2px solid var(--edge);border-radius:2px;padding:15px 17px 18px;box-shadow:0 16px 35px #0007;min-height:430px;display:flex;flex-direction:column}aside:before,aside:after{content:"";position:absolute;width:10px;height:10px;border:3px solid #e6c575;pointer-events:none}aside:before{left:3px;top:3px;border-right:0;border-bottom:0}aside:after{right:3px;bottom:3px;border-left:0;border-top:0}.stage{height:140px;border-radius:10px;display:flex;align-items:center;justify-content:center;margin-bottom:13px;background:radial-gradient(circle at 50% 50%,var(--glow),transparent 68%),repeating-conic-gradient(from 0deg at 50% 60%,#dbc07118 0deg 12deg,transparent 12deg 36deg);overflow:hidden}.stage img{width:126px;height:126px;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 10px 8px #0009)}.stage span{font-size:80px;color:var(--accent)}h2{font:600 23px 'Source Serif 4',serif;color:var(--accent);margin:0 0 7px;line-height:1.25}.quality{font-size:10px;letter-spacing:2px;margin:0 0 10px;padding:6px 8px;border:1px solid currentColor;border-radius:4px}.lore-box{margin-bottom:12px}.lore{font-size:12px;color:#b8c9b8;line-height:1.45;margin:7px 0;overflow-wrap:break-word}.section-title{font-size:11px;font-weight:600;color:var(--accent);border-top:1px solid #8b794644;padding-top:9px}.primary{margin-top:auto;min-height:41px;width:100%;border:1px solid #d9ba68;border-radius:2px;padding:10px;background:linear-gradient(180deg,#2f8d36,#145324);color:#fff1bd;font-family:Minecraft,monospace;font-weight:600;font-size:15px;box-shadow:inset 0 2px 0 #f6e9a96b,0 3px 0 #5f4e2b}.primary:hover{background:linear-gradient(180deg,#45a643,#20732f)}.shelves{min-width:0}.intro{font-size:11px;color:#b0c0af;line-height:1.45;margin:0 0 10px}.shelf{margin-bottom:14px}.goods{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;align-items:end;padding:0 9px 10px}.slot{display:flex;align-items:center;flex-direction:column;text-align:center;border:0;background:transparent;padding:3px 0;min-width:0}.cubby{height:75px;width:91px;display:flex;align-items:center;justify-content:center;border-radius:2px;border:2px solid #b69c5f66;background:linear-gradient(180deg,#03110eaa,#0b251b88);box-shadow:inset 0 5px 10px #0007}.cubby img{width:60px;height:60px;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 4px 4px #0007)}.sigil{font-size:38px;color:var(--accent)}.slot:hover .cubby,.slot.selected .cubby{border-color:var(--accent);box-shadow:0 0 14px var(--glow),inset 0 0 20px var(--glow)}.slot strong{font-size:11px;line-height:1.25;color:#dfd0a7;margin:6px 0;max-height:29px;overflow:hidden}.tag{font:10px Minecraft,monospace;background:#e5d3a5;color:#282317;border-radius:4px;padding:4px 6px;box-shadow:0 2px 0 #7f6c3b;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.board{height:15px;border-radius:3px;padding:2px 11px;font:9px Minecraft,monospace;letter-spacing:1.5px;color:#d7c698;background:linear-gradient(180deg,#a7915b,#5a502f 40%,#353a21 75%,#1e291c);box-shadow:0 7px 10px #0007,inset 0 1px 0 #e2d2a66b}footer{display:flex;justify-content:space-between;gap:15px;padding:14px 32px 15px;color:#8eaa94;font-size:9px;line-height:1.4}.common{color:#eee}.uncommon{color:#7cda8a}.rare{color:#7dbaf0}.very_rare{color:#c08aec}.legendary{color:#edc45d}.mythic{color:#f28fe4}.relic{color:#fff1b6}@media(max-width:850px){main{grid-template-columns:250px minmax(0,1fr);padding:0 20px;gap:15px}.goods{grid-template-columns:repeat(3,minmax(0,1fr))}.logo{width:140px}header{padding:8px 20px;gap:12px}h1{font-size:24px}}@media(max-width:600px){main{grid-template-columns:1fr}.goods{grid-template-columns:repeat(3,minmax(0,1fr))}aside{min-height:0}aside:before,aside:after{content:"";position:absolute;width:10px;height:10px;border:3px solid #e6c575;pointer-events:none}aside:before{left:3px;top:3px;border-right:0;border-bottom:0}aside:after{right:3px;bottom:3px;border-left:0;border-top:0}.stage{height:100px}.viewer{display:none}.logo{width:120px}h1{font-size:19px}header{height:82px}.heading small{display:none}}