Compact all menu cards and clarify Exchange navigation #12
10 changed files with 44 additions and 21 deletions
|
|
@ -16,3 +16,5 @@
|
|||
- Keep text inside measured card bounds. Essential price and stock remain visible before purchase; optional details must not execute or confirm a purchase.
|
||||
- Use verified item artwork from actual item metadata. Same-ID block textures are flat surface previews, not native 3D renders. Unsupported complex/dynamic icons require an explicit fallback; never infer quality or MK from a title.
|
||||
- Use the canonical illustrated website logo with proportional containment. Package/cache artwork locally and keep remote requests out of menu opening.
|
||||
|
||||
- Owner approved compact card density across Java menus: standard cards approximately 25% smaller, Exchange navigation as a toolbar, and mission cards in a grid. Preserve readable prices and click targets.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import java.security.MessageDigest
|
||||
plugins { java }
|
||||
group = "com.dunerealms"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
|
|
@ -19,7 +19,7 @@ dependencies {
|
|||
java { toolchain.languageVersion.set(JavaLanguageVersion.of(21)) }
|
||||
tasks.withType<JavaCompile> { options.encoding = "UTF-8" }
|
||||
tasks.jar { archiveFileName.set("DuneMenus.jar") }
|
||||
tasks.processResources { filesMatching("plugin.yml") { expand("version" to project.version) } }
|
||||
tasks.processResources { inputs.property("pluginVersion",project.version.toString()); filesMatching("plugin.yml") { expand("version" to project.version) } }
|
||||
|
||||
tasks.test { useJUnitPlatform() }
|
||||
|
||||
|
|
|
|||
15
DuneMenus/docs/COMPACT-MENU-FOLLOWUP.md
Normal file
15
DuneMenus/docs/COMPACT-MENU-FOLLOWUP.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Compact menu follow-up
|
||||
|
||||
Owner connected-client feedback requested cards approximately 25% smaller across all Java full-screen menus, compact Exchange navigation and one unambiguous working sell action.
|
||||
|
||||
Menus 2.0.3 reduces standard card width from 22.5% to 16.875% and height from 186 to 140 CSS pixels, with smaller framed centred icons, padding and readable text. Mission/war journals use a compact grid rather than full-width rows. Council, bank and travel families retain their distinct layouts with reduced dimensions. Full text remains accessible through Details; price and stock stay first in summaries.
|
||||
|
||||
Exchange navigation uses small toolbar controls. The misleading Sell navigation label is now My listings, preserving existing listing withdrawal/management. Add held item is the sole Sell item action and invokes the original working draft callback. No payment, JARVIS or retry semantics change. Empty own-listing results explicitly say No own listings and direct the player to Sell item.
|
||||
|
||||
GUI version 1.1.37; actual plugin descriptor must agree. Pack content and backend JARs remain unchanged. Local renderer verification covers 15 families and 152 action hitboxes, text containment, centred icons, 28 long listings, Details and toolbar controls. Synthetic previews are not connected-client acceptance. Exact canonical CI and guarded rollout are required before live claims.
|
||||
|
||||
Blocked claim-expansion buttons now report the same existing capacity/home/permission reason and reopen the claims view, rather than silently closing. No guard, entitlement, deed or claim record is bypassed. The specific Arrakis report (North worked, All did not) still requires actual estate/capacity evidence before attributing it to a backend fault.
|
||||
|
||||
Owner-selected blocked-expansion feedback uses: I'm sorry, Dave. I cannot let you do that: <actual existing reason>. Required resulting size and unlocked limit remain accurate; a too-large expansion is not mislabelled as an already-full estate.
|
||||
|
||||
A single adviser description includes the owner-requested subtle 'Indeed.' reference; no new action or repeated message.
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -27,9 +27,9 @@ public class RendererVerification {
|
|||
var actualIcon=Path.of("../network/resource-pack/central/overlay/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png");Path iconTarget=dir.resolve("pack/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png");Files.createDirectories(iconTarget.getParent());Files.copy(actualIcon,iconTarget,StandardCopyOption.REPLACE_EXISTING);
|
||||
for(String name:List.of("item/iron_sword","block/cobblestone")){Path target=dir.resolve("pack/assets/minecraft/textures/"+name+".png");Files.createDirectories(target.getParent());Files.copy(Path.of("../network/resource-pack/vanilla-art/overlay/assets/minecraft/textures/"+name+".png"),target,StandardCopyOption.REPLACE_EXISTING);}
|
||||
var listing=new Card(13,"\uE400§6Paul's chopper",List.of("LEGENDARY | MK XIV","Used by Paul himself.","Efficiency VIII","Fortune IV","Mending I","Unbreaking IV","Seller: J.A.R.V.I.S. HQ","1 available · 500.00 DM each"),"netherite_axe");
|
||||
String listingHtml=SuppliedDocument.html("exchange","Exchange · Buy","Authoritative item artwork",List.of(new Card(9,"Buy",List.of("Browse available items"),"emerald"),listing,new Card(14,"Cobblestone",List.of("64 available · 1.00 DM each"),"cobblestone"),new Card(15,"Iron sword",List.of("1 available · 10.00 DM each"),"iron_sword")),List.of(),Map.of(13,"pack/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png",14,"pack/assets/minecraft/textures/block/cobblestone.png",15,"pack/assets/minecraft/textures/item/iron_sword.png"),13);
|
||||
String listingHtml=SuppliedDocument.html("exchange","Exchange · Buy","Authoritative item artwork",List.of(new Card(1,"Buy",List.of("Browse available items"),"emerald"),new Card(4,"Kits",List.of(),"netherite_chestplate"),new Card(7,"My listings",List.of(),"chest"),new Card(49,"Sell item",List.of(),"hopper"),new Card(50,"Collect purchases",List.of(),"chest_minecart"),listing,new Card(14,"Cobblestone",List.of("64 available · 1.00 DM each"),"cobblestone"),new Card(15,"Iron sword",List.of("1 available · 10.00 DM each"),"iron_sword")),List.of(),Map.of(13,"pack/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png",14,"pack/assets/minecraft/textures/block/cobblestone.png",15,"pack/assets/minecraft/textures/item/iron_sword.png"),13);
|
||||
var listingPage=Page.of(listingHtml,dir.resolve("exchange-item.html"),loader);var listingFrame=HtmlRenderer.render(listingPage,1536,896,1.5,0,Selector.State.NONE);if(!listingPage.problems.isEmpty())throw new AssertionError(listingPage.problems.toString());ImageIO.write(listingFrame.image(),"png",dir.resolve("exchange-item-engine.png").toFile());
|
||||
for(var element:listingPage.document.select("[data-slot='1013']")){var bounds=listingFrame.boundsOf(element);var at=listingFrame.elementAt(bounds.getCenterX(),bounds.getCenterY());if(at==null||!at.closest("[data-slot]").attr("data-slot").equals("1013"))throw new AssertionError("Detail control hitbox");}
|
||||
for(var element:listingPage.document.select(".market-tool,[data-slot='1013']")){var bounds=listingFrame.boundsOf(element);var at=listingFrame.elementAt(bounds.getCenterX(),bounds.getCenterY());if(at==null||!at.closest("[data-slot]").attr("data-slot").equals(element.attr("data-slot")))throw new AssertionError("Detail control hitbox");}
|
||||
System.out.println("PASS: "+checked+" direct action hitboxes across15 menu families.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ class SuppliedDocumentTest {
|
|||
}
|
||||
@Test void pagingControlsDoNotOverlapTheBackAction(){
|
||||
String html=SuppliedDocument.html("exchange","Market","",List.of(new Card(45,"Previous",List.of(),"arrow"),new Card(46,"Back",List.of(),"arrow"),new Card(53,"Next",List.of(),"arrow")),List.of());
|
||||
assertTrue(html.contains("class='pager n0' data-slot='45'"));
|
||||
assertTrue(html.contains("class='back n1' data-slot='46'"));
|
||||
assertTrue(html.contains("class='pager n2' data-slot='53'"));
|
||||
assertTrue(html.contains("class='market-tool' data-slot='45'"));
|
||||
assertTrue(html.contains("class='back n0' data-slot='46'"));
|
||||
assertTrue(html.contains("class='market-tool' data-slot='53'"));
|
||||
}
|
||||
@Test void legacyHitboxAliasesBecomeOneCardWithoutDroppingDistinctActions(){
|
||||
Runnable same=()->{};Runnable different=()->System.nanoTime();
|
||||
|
|
@ -54,4 +54,8 @@ class SuppliedDocumentTest {
|
|||
String html=SuppliedDocument.html("exchange","Buy","",List.of(first,second),List.of(),java.util.Map.of(),14);
|
||||
assertEquals(1,html.split("class='item-details'",-1).length-1);assertTrue(html.contains("data-slot='1013'"));assertTrue(html.contains("data-slot='1014'"));assertTrue(html.contains("<div class='item-details'><h2>Second</h2>"));
|
||||
}
|
||||
@Test void exchangeControlsUseCompactToolbarWithoutDuplicatingSell(){
|
||||
var sell=new Card(49,"Sell item",List.of("List the item in your main hand"),"hopper");var mine=new Card(7,"My listings",List.of("Manage existing listings"),"chest");var item=new Card(13,"Real item",List.of("100 DM"),"iron_sword");
|
||||
String html=SuppliedDocument.html("exchange","Buy","",List.of(sell,mine,item),List.of());assertTrue(html.contains("class='market-tool' data-slot='49'"));assertTrue(html.contains("class='market-tool' data-slot='7'"));assertTrue(html.contains("class='card n0' data-slot='13'"));assertEquals(1,html.split("data-slot='49'",-1).length-1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
plugins { java }
|
||||
group = "com.dunerealms"
|
||||
version = "1.1.36"
|
||||
version = "1.1.37"
|
||||
repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://repo.opencollab.dev/main/") }
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ final class ExchangeMenus implements Listener,AutoCloseable {
|
|||
}
|
||||
private void request(Player p,JsonObject input,Consumer<JsonObject> done){request(p,input,done,p::sendMessage);}
|
||||
private JsonObject action(String action){var q=new JsonObject();q.addProperty("action",action);return q;}
|
||||
private void list(Player p,boolean mine,int page){var q=action("read");q.addProperty("mine",mine);q.addProperty("page",page);request(p,q,data->{var s=panel(p,mine?"Exchange · Your listings":"Exchange · Buy");button(s,1,Material.EMERALD,"Buy","Browse all available items",()->list(p,false,0));button(s,4,Material.NETHERITE_CHESTPLATE,"Kits","Published organisation stillsuit kits",()->kits(p,0));button(s,7,Material.CHEST,"Sell","Your listings and add held item",()->list(p,true,0));int index=0;for(var value:data.getAsJsonArray("listings")){var row=value.getAsJsonObject();int slot=10+(index/6)*9+index%6;index++;try{var item=bridge.exchangeIcon(row);var meta=item.getItemMeta();List<Component> lore=new ArrayList<>(meta.hasLore()?meta.lore():List.of());lore.add(Component.text(" "));lore.add(Component.text("Seller: "+row.get("seller").getAsString(),NamedTextColor.GRAY));lore.add(Component.text(row.get("quantity").getAsInt()+" available · "+money(row.get("priceMinor").getAsLong())+" each",NamedTextColor.GOLD));meta.lore(lore);item.setItemMeta(meta);s.inventory.setItem(slot,item);Runnable pick=()->{if(row.get("sellerUuid").getAsString().equals(p.getUniqueId().toString()))withdraw(p,row);else purchase(p,new Purchase(row,1,UUID.randomUUID()));};s.actions.put(slot,pick);s.choices.add(new BedrockForms.Choice(row.get("title").getAsString(),money(row.get("priceMinor").getAsLong())+" · "+row.get("quantity").getAsInt()+" available",pick));}catch(Exception unsupported){s.inventory.setItem(slot,icon(Material.BARRIER,"Unsupported item","This version cannot display the stored item."));}}
|
||||
if(index==0)s.inventory.setItem(22,icon(Material.PAPER,"No listings",mine?"Hold an item and choose Add held item.":"Check again after players publish goods."));
|
||||
if(page>0)button(s,45,Material.ARROW,"Previous","Page "+page,()->list(p,mine,page-1));if(data.get("hasNext").getAsBoolean())button(s,53,Material.ARROW,"Next","More listings",()->list(p,mine,page+1));button(s,48,Material.BOOK,"Imperial Codex","Return to your services",()->back.accept(p));button(s,49,Material.HOPPER,"Add held item","List an item from your main hand",()->draft(p));button(s,50,Material.CHEST_MINECART,"Collect purchases","Deliver paid items waiting for inventory space",()->{deliver(p,true);list(p,mine,page);});show(p,s);
|
||||
private void list(Player p,boolean mine,int page){var q=action("read");q.addProperty("mine",mine);q.addProperty("page",page);request(p,q,data->{var s=panel(p,mine?"Exchange · Your listings":"Exchange · Buy");button(s,1,Material.EMERALD,"Buy","Browse all available items",()->list(p,false,0));button(s,4,Material.NETHERITE_CHESTPLATE,"Kits","Published organisation stillsuit kits",()->kits(p,0));button(s,7,Material.CHEST,"My listings","Manage your existing listings",()->list(p,true,0));int index=0;for(var value:data.getAsJsonArray("listings")){var row=value.getAsJsonObject();int slot=10+(index/6)*9+index%6;index++;try{var item=bridge.exchangeIcon(row);var meta=item.getItemMeta();List<Component> lore=new ArrayList<>(meta.hasLore()?meta.lore():List.of());lore.add(Component.text(" "));lore.add(Component.text("Seller: "+row.get("seller").getAsString(),NamedTextColor.GRAY));lore.add(Component.text(row.get("quantity").getAsInt()+" available · "+money(row.get("priceMinor").getAsLong())+" each",NamedTextColor.GOLD));meta.lore(lore);item.setItemMeta(meta);s.inventory.setItem(slot,item);Runnable pick=()->{if(row.get("sellerUuid").getAsString().equals(p.getUniqueId().toString()))withdraw(p,row);else purchase(p,new Purchase(row,1,UUID.randomUUID()));};s.actions.put(slot,pick);s.choices.add(new BedrockForms.Choice(row.get("title").getAsString(),money(row.get("priceMinor").getAsLong())+" · "+row.get("quantity").getAsInt()+" available",pick));}catch(Exception unsupported){s.inventory.setItem(slot,icon(Material.BARRIER,"Unsupported item","This version cannot display the stored item."));}}
|
||||
if(index==0)s.inventory.setItem(22,icon(Material.PAPER,"No listings",mine?"No own listings. Hold an item and choose Sell item.":"Check again after players publish goods."));
|
||||
if(page>0)button(s,45,Material.ARROW,"Previous","Page "+page,()->list(p,mine,page-1));if(data.get("hasNext").getAsBoolean())button(s,53,Material.ARROW,"Next","More listings",()->list(p,mine,page+1));button(s,48,Material.BOOK,"Imperial Codex","Return to your services",()->back.accept(p));button(s,49,Material.HOPPER,"Sell item","List the item in your main hand",()->draft(p));button(s,50,Material.CHEST_MINECART,"Collect purchases","Deliver paid items waiting for inventory space",()->{deliver(p,true);list(p,mine,page);});show(p,s);
|
||||
});}
|
||||
private void draft(Player p){var item=p.getInventory().getItemInMainHand();if(item.isEmpty()){p.sendMessage("Hold the item you want to sell first.");return;}sell(p,new Draft(item.clone(),p.getInventory().getHeldItemSlot(),Math.min(64,item.getAmount()),100));}
|
||||
private void sell(Player p,Draft draft){var s=panel(p,"Exchange · Add item");s.description=draft.item.getType().name()+" · "+draft.amount+" items\n"+money(draft.price)+" per item\nTotal: "+money(draft.price*draft.amount);s.inventory.setItem(13,draft.item.clone());quantityPresets(s,Math.min(64,draft.item.getAmount()),amount->sell(p,draft.quantity(amount)));button(s,30,Material.RED_DYE,"− Quantity","Sell "+draft.amount+" items",()->sell(p,draft.quantity(Math.max(1,draft.amount-1))));button(s,31,Material.PAPER,"Quantity: "+draft.amount,"Maximum "+Math.min(64,draft.item.getAmount()),()->sell(p,draft));button(s,32,Material.LIME_DYE,"+ Quantity","Add one item",()->sell(p,draft.quantity(Math.min(Math.min(64,draft.item.getAmount()),draft.amount+1))));button(s,40,Material.GOLD_INGOT,"Price: "+money(draft.price),"Price per item · total "+money(draft.price*draft.amount),()->editPrice(p,draft));button(s,45,Material.ARROW,"Back","Return to your listings",()->list(p,true,0));button(s,49,Material.EMERALD,"Confirm listing","Move "+draft.amount+" items into the Exchange",()->{UUID id=UUID.randomUUID();var q=action("prepare_sale");q.addProperty("requestId",id.toString());q.addProperty("amount",draft.amount);q.addProperty("priceMinor",draft.price);request(p,q,permit->{try{bridge.exchangePublish(p,permit,id,draft.item,draft.slot,draft.amount,draft.price);p.sendMessage("Listing published. Items are held by the Exchange until sold or withdrawn.");list(p,true,0);}catch(Exception e){p.sendMessage(e.getMessage()==null?"The listing was not confirmed.":e.getMessage());}});});show(p,s);}
|
||||
|
|
@ -71,7 +71,7 @@ final class ExchangeMenus implements Listener,AutoCloseable {
|
|||
priceInputs.put(owner,conversation);conversation.begin();
|
||||
}
|
||||
private void purchase(Player p,Purchase purchase){if(purchase.row.has("kitsetId")){kitPurchase(p,purchase);return;}var row=purchase.row;var s=panel(p,"Exchange · Confirm purchase");s.description=row.get("title").getAsString()+"\nSeller: "+row.get("seller").getAsString()+"\nQuantity: "+purchase.amount+" · Total: "+money(row.get("priceMinor").getAsLong()*purchase.amount);try{s.inventory.setItem(13,bridge.exchangeIcon(row));}catch(Exception bad){p.sendMessage("This item cannot be delivered by your current version.");return;}quantityPresets(s,Math.min(64,row.get("quantity").getAsInt()),amount->purchase(p,retries.containsKey(p.getUniqueId())?purchase:purchase.quantity(amount)));button(s,30,Material.RED_DYE,"− Quantity","Buy "+purchase.amount,()->purchase(p,retries.containsKey(p.getUniqueId())?purchase:purchase.quantity(Math.max(1,purchase.amount-1))));button(s,31,Material.PAPER,"Quantity: "+purchase.amount,money(row.get("priceMinor").getAsLong())+" per item",()->purchase(p,purchase));button(s,32,Material.LIME_DYE,"+ Quantity","Maximum "+Math.min(64,row.get("quantity").getAsInt()),()->purchase(p,retries.containsKey(p.getUniqueId())?purchase:purchase.quantity(Math.min(Math.min(64,row.get("quantity").getAsInt()),purchase.amount+1))));button(s,45,Material.ARROW,"Back","Return to the Exchange",()->{if(retries.containsKey(p.getUniqueId())){p.sendMessage("Resolve the previous purchase by retrying the same confirmation first.");purchase(p,purchase);}else list(p,false,0);});button(s,49,Material.EMERALD,(retries.containsKey(p.getUniqueId())?"Retry purchase · ":"Buy · ")+money(row.get("priceMinor").getAsLong()*purchase.amount),"Pay from your central personal bank account",()->{retries.put(p.getUniqueId(),purchase);var q=action("buy");q.addProperty("requestId",purchase.request.toString());q.addProperty("listingId",row.get("id").getAsString());q.addProperty("amount",purchase.amount);q.addProperty("priceMinor",row.get("priceMinor").getAsLong());q.addProperty("confirmed",true);request(p,q,receipt->{retries.remove(p.getUniqueId());p.sendMessage("Purchase confirmed: "+money(receipt.get("totalMinor").getAsLong())+". Your items are ready for delivery.");if(receipt.has("rebateMinor")&&receipt.get("rebateMinor").getAsLong()>0)p.sendMessage("Ordos trade incentive credited: "+money(receipt.get("rebateMinor").getAsLong())+".");deliver(p,true);list(p,false,0);},error->{p.sendMessage(error+" Retry this confirmation with the same purchase reference.");purchase(p,purchase);});});show(p,s);}
|
||||
private void kits(Player p,int page){var q=action("read_kits");q.addProperty("page",page);request(p,q,data->{var s=panel(p,"Exchange · Kits");button(s,1,Material.EMERALD,"Buy items","Browse loose goods",()->list(p,false,0));button(s,4,Material.NETHERITE_CHESTPLATE,"Kits","Published organisation designs",()->kits(p,0));button(s,7,Material.CHEST,"Sell","Your listings",()->list(p,true,0));int index=0;for(var value:data.getAsJsonArray("listings")){var row=value.getAsJsonObject();int slot=10+(index/6)*9+index%6;index++;String title=row.get("title").getAsString(),description=row.get("seller").getAsString()+" · "+row.get("items").getAsInt()+" items · "+money(row.get("priceMinor").getAsLong());if(row.get("purchaseAvailable").getAsBoolean())button(s,slot,Material.NETHERITE_CHESTPLATE,title,description,()->kitPurchase(p,new Purchase(row.deepCopy(),1,UUID.randomUUID())));else{s.inventory.setItem(slot,icon(Material.GRAY_DYE,title,description,"Organisation banking is unavailable"));s.description+="\n"+title+" · unavailable";}}if(page>0)button(s,45,Material.ARROW,"Previous","Previous kits",()->kits(p,page-1));button(s,49,Material.ARROW,"Back","Imperial Codex",()->back.accept(p));if(data.get("hasNext").getAsBoolean())button(s,53,Material.ARROW,"Next","More kits",()->kits(p,page+1));show(p,s);});}
|
||||
private void kits(Player p,int page){var q=action("read_kits");q.addProperty("page",page);request(p,q,data->{var s=panel(p,"Exchange · Kits");button(s,1,Material.EMERALD,"Buy items","Browse loose goods",()->list(p,false,0));button(s,4,Material.NETHERITE_CHESTPLATE,"Kits","Published organisation designs",()->kits(p,0));button(s,7,Material.CHEST,"My listings","Manage your existing listings",()->list(p,true,0));int index=0;for(var value:data.getAsJsonArray("listings")){var row=value.getAsJsonObject();int slot=10+(index/6)*9+index%6;index++;String title=row.get("title").getAsString(),description=row.get("seller").getAsString()+" · "+row.get("items").getAsInt()+" items · "+money(row.get("priceMinor").getAsLong());if(row.get("purchaseAvailable").getAsBoolean())button(s,slot,Material.NETHERITE_CHESTPLATE,title,description,()->kitPurchase(p,new Purchase(row.deepCopy(),1,UUID.randomUUID())));else{s.inventory.setItem(slot,icon(Material.GRAY_DYE,title,description,"Organisation banking is unavailable"));s.description+="\n"+title+" · unavailable";}}if(page>0)button(s,45,Material.ARROW,"Previous","Previous kits",()->kits(p,page-1));button(s,49,Material.ARROW,"Back","Imperial Codex",()->back.accept(p));if(data.get("hasNext").getAsBoolean())button(s,53,Material.ARROW,"Next","More kits",()->kits(p,page+1));show(p,s);});}
|
||||
private void kitPurchase(Player p,Purchase purchase){var row=purchase.row;var s=panel(p,"Exchange · Confirm purchase");s.description=row.get("title").getAsString()+"\nOrganisation: "+row.get("seller").getAsString()+"\n"+row.get("items").getAsInt()+" items · "+money(row.get("priceMinor").getAsLong());s.inventory.setItem(13,icon(Material.NETHERITE_CHESTPLATE,row.get("title").getAsString(),row.get("seller").getAsString(),row.get("items").getAsInt()+" items"));button(s,45,Material.ARROW,"Back","Kit catalogue",()->{if(retries.containsKey(p.getUniqueId())){p.sendMessage("Resolve the previous purchase with the same reference first.");kitPurchase(p,purchase);}else kits(p,0);});button(s,49,Material.EMERALD,(retries.containsKey(p.getUniqueId())?"Retry kit · ":"Buy kit · ")+money(row.get("priceMinor").getAsLong()),"Pay personally; proceeds go to the organisation",()->{retries.put(p.getUniqueId(),purchase);var q=action("buy_kit");q.addProperty("requestId",purchase.request.toString());q.addProperty("kitsetId",row.get("kitsetId").getAsString());q.add("listingVersion",row.get("listingVersion"));q.add("priceMinor",row.get("priceMinor"));q.addProperty("confirmed",true);request(p,q,receipt->{retries.remove(p.getUniqueId());p.sendMessage("Kit purchased: "+money(receipt.get("totalMinor").getAsLong())+". Delivery follows automatically; make room for the complete kit.");try{bridge.refreshKits(p);}catch(Exception unavailable){p.sendMessage("Your kit remains owed until the next inventory sync.");}kits(p,0);},error->{p.sendMessage(error+" Retry this confirmation with the same reference.");kitPurchase(p,purchase);});});show(p,s);}
|
||||
private void withdraw(Player p,JsonObject row){var s=panel(p,"Exchange · Withdraw listing");try{s.inventory.setItem(13,bridge.exchangeIcon(row));}catch(Exception bad){p.sendMessage("This stored item cannot be decoded.");return;}button(s,45,Material.ARROW,"Back","Your listings",()->list(p,true,0));button(s,49,Material.CHEST,"Withdraw "+row.get("quantity").getAsInt()+" items","Return all unsold stock to your inventory",()->{UUID id=UUID.randomUUID();var q=action("prepare_cancel");q.addProperty("requestId",id.toString());request(p,q,permit->{try{int quantity=bridge.exchangeCancel(p,permit,id,Long.parseLong(row.get("id").getAsString()));p.sendMessage("Listing withdrawn. Returned "+quantity+" items.");list(p,true,0);}catch(Exception e){p.sendMessage(e.getMessage()==null?"The listing was not withdrawn.":e.getMessage());}});});show(p,s);}
|
||||
private void deliver(Player p,boolean explain){if(!p.isOnline()||!delivering.add(p.getUniqueId()))return;UUID id=p.getUniqueId();var q=action("pending");Bukkit.getScheduler().runTaskAsynchronously(plugin,()->{JsonObject response=null;try{response=bridge.exchange(id,q);}catch(Exception ignored){}var data=response;if(!plugin.isEnabled())return;Bukkit.getScheduler().runTask(plugin,()->{delivering.remove(id);if(!p.isOnline())return;if(data==null||!data.has("pending")){if(explain)p.sendMessage("Paid deliveries remain queued. Reopen the Exchange to try again.");return;}if(data.getAsJsonArray("pending").isEmpty()){if(explain)p.sendMessage("No paid items are waiting for delivery.");return;}try{int count=bridge.exchangeDeliver(p);if(explain||count>0)p.sendMessage(count>0?"J.A.R.V.I.S. delivered "+count+" purchased items.":"Make inventory space. Your paid items remain queued.");}catch(Exception unavailable){if(explain)p.sendMessage("Paid items remain queued until your shared inventory is ready.");}});});}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ final class OrganisationMenus implements Listener {
|
|||
public Inventory getInventory(){return inventory;}
|
||||
}
|
||||
OrganisationMenus(JavaPlugin plugin,HouseBridge bridge,Consumer<Player> mentat,Consumer<Player> travel,Consumer<Player> house,Consumer<Player> quests,Consumer<Player> exchange,Consumer<Player> spice,java.util.function.Predicate<Player> artwork){this.plugin=plugin;this.bridge=bridge;this.mentat=mentat;this.travel=travel;this.house=house;this.quests=quests;this.exchange=exchange;this.spice=spice;this.artwork=artwork;Bukkit.getPluginManager().registerEvents(this,plugin);}
|
||||
void console(Player p){var panel=panel(p,"Imperial Codex",0);if(p.getWorld().getName().equals("arrakis"))put(panel,28,"Spice buyers","Spacing Guild · Smuggler · P&O payout",Material.ORANGE_DYE,()->spice.accept(p));put(panel,34,"Exchange","Buy, sell and collect your purchases",Material.CHEST,()->exchange.accept(p));var exchangeIcon=new ItemStack(Material.CHEST);var exchangeMeta=exchangeIcon.getItemMeta();exchangeMeta.displayName(Component.text("Exchange",NamedTextColor.GOLD));exchangeMeta.lore(List.of(Component.text("Buy · Sell · Add held item",NamedTextColor.GRAY)));exchangeIcon.setItemMeta(exchangeMeta);panel.inventory.setItem(34,exchangeIcon);put(panel,31,"Mission journal","Personal Experience and Reputation",Material.WRITABLE_BOOK,()->quests.accept(p));put(panel,4,"Item lore archive","Preview the shared item lore cards",Material.WRITABLE_BOOK,()->lore(p));put(panel,19,"Clan","Your clan and Home Block",Material.GREEN_BANNER,()->open(p,"clans"));put(panel,22,"Company","Your companies and Home Blocks",Material.CYAN_BANNER,()->open(p,"companies"));put(panel,25,"POL","Your current political offices",Material.PURPLE_BANNER,()->open(p,"offices"));put(panel,37,"Your Mentat","Your personal briefing",Material.BOOK,()->mentat.accept(p));put(panel,40,"Spacing Guild","Transport and boarding windows",Material.COMPASS,()->travel.accept(p));put(panel,43,"Your House","Your allegiance and adviser",Material.NETHER_STAR,()->house.accept(p));close(panel,p);show(p,panel);}
|
||||
void console(Player p){var panel=panel(p,"Imperial Codex",0);if(p.getWorld().getName().equals("arrakis"))put(panel,28,"Spice buyers","Spacing Guild · Smuggler · P&O payout",Material.ORANGE_DYE,()->spice.accept(p));put(panel,34,"Exchange","Buy, sell and collect your purchases",Material.CHEST,()->exchange.accept(p));var exchangeIcon=new ItemStack(Material.CHEST);var exchangeMeta=exchangeIcon.getItemMeta();exchangeMeta.displayName(Component.text("Exchange",NamedTextColor.GOLD));exchangeMeta.lore(List.of(Component.text("Buy · Sell · Add held item",NamedTextColor.GRAY)));exchangeIcon.setItemMeta(exchangeMeta);panel.inventory.setItem(34,exchangeIcon);put(panel,31,"Mission journal","Personal Experience and Reputation",Material.WRITABLE_BOOK,()->quests.accept(p));put(panel,4,"Item lore archive","Preview the shared item lore cards",Material.WRITABLE_BOOK,()->lore(p));put(panel,19,"Clan","Your clan and Home Block",Material.GREEN_BANNER,()->open(p,"clans"));put(panel,22,"Company","Your companies and Home Blocks",Material.CYAN_BANNER,()->open(p,"companies"));put(panel,25,"POL","Your current political offices",Material.PURPLE_BANNER,()->open(p,"offices"));put(panel,37,"Your Mentat","Your personal briefing. Indeed.",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;
|
||||
|
|
@ -91,8 +91,8 @@ final class OrganisationMenus implements Listener {
|
|||
int width=1,height=1;if(row.has("claimedChunks")&&row.getAsJsonArray("claimedChunks").size()>0){int minX=Integer.MAX_VALUE,maxX=Integer.MIN_VALUE,minZ=Integer.MAX_VALUE,maxZ=Integer.MIN_VALUE;for(var v:row.getAsJsonArray("claimedChunks")){var c=v.getAsJsonObject();int x=c.get("x").getAsInt(),z=c.get("z").getAsInt();minX=Math.min(minX,x);maxX=Math.max(maxX,x);minZ=Math.min(minZ,z);maxZ=Math.max(maxZ,z);}width=maxX-minX+1;height=maxZ-minZ+1;}
|
||||
String[] directions={"north","east","south","west","all"};int[] slots={13,23,31,21,22};int[] additions={width,height,width,height,2*width+2*height+4};
|
||||
boolean manage=row.get("canManage").getAsBoolean(),home=row.has("homeBlock")&&!row.get("homeBlock").isJsonNull();
|
||||
for(int i=0;i<directions.length;i++){String direction=directions[i];int addition=additions[i],next=used+addition;boolean allowed=manage&&home&&capacity>0&&next<=capacity;
|
||||
put(screen,slots[i],"Expand "+direction,allowed?"Add "+addition+" adjacent chunks\nResult: "+next+" / "+capacity+"\nReview before applying":!manage?"Current organisation management required":!home?"Set your Home Block first":capacity==0?"Claim entitlement unavailable":"Needs "+next+" chunks; unlocked limit "+capacity,allowed?Material.LIME_DYE:Material.GRAY_DYE,()->{if(!allowed)return;var confirm=panel(p,"Confirm claim expansion",!kind.equals("clans"));put(confirm,13,"Expand "+direction,"Add "+addition+" chunks around the current estate\nResult: "+next+" / "+capacity+" chunks\nExisting Home Block stays in place\nForeign claims and active wars are checked",Material.MAP,()->claims(p,data,kind,row));put(confirm,30,"Confirm expansion","Use unlocked capacity; no new tier purchase",Material.LIME_DYE,()->perform(p,kind,row,"expand-claim",direction));put(confirm,32,"Cancel","Leave the estate unchanged",Material.ARROW,()->claims(p,data,kind,row));show(p,confirm);});
|
||||
for(int i=0;i<directions.length;i++){String direction=directions[i];int addition=additions[i],next=used+addition;boolean allowed=manage&&home&&capacity>0&&next<=capacity;String blocked=!manage?"Current organisation management required":!home?"Set your Home Block first":capacity==0?"Claim entitlement unavailable":"Needs "+next+" chunks; unlocked limit "+capacity;
|
||||
put(screen,slots[i],"Expand "+direction,allowed?"Add "+addition+" adjacent chunks\nResult: "+next+" / "+capacity+"\nReview before applying":blocked,allowed?Material.LIME_DYE:Material.GRAY_DYE,()->{if(!allowed){p.sendMessage("I'm sorry, Dave. I cannot let you do that: "+blocked+".");claims(p,data,kind,row);return;}var confirm=panel(p,"Confirm claim expansion",!kind.equals("clans"));put(confirm,13,"Expand "+direction,"Add "+addition+" chunks around the current estate\nResult: "+next+" / "+capacity+" chunks\nExisting Home Block stays in place\nForeign claims and active wars are checked",Material.MAP,()->claims(p,data,kind,row));put(confirm,30,"Confirm expansion","Use unlocked capacity; no new tier purchase",Material.LIME_DYE,()->perform(p,kind,row,"expand-claim",direction));put(confirm,32,"Cancel","Leave the estate unchanged",Material.ARROW,()->claims(p,data,kind,row));show(p,confirm);});
|
||||
}
|
||||
put(screen,45,"Back","Organisation",Material.ARROW,()->organisation(p,data,kind,row));show(p,screen);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
name: DunerealmsGUI
|
||||
main: com.dunerealms.gui.DuneGUI
|
||||
version: 1.1.36
|
||||
version: 1.1.37
|
||||
api-version: '1.21.8'
|
||||
depend: [JarvisTranslator]
|
||||
softdepend: [Citizens, MCGUI, DecentHolograms, DuneLobby, DuneCore, DuneEss, DuneNPC, Vault, floodgate, ViaVersion]
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff