-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: [UX improvement] Add return button tooltips in AcShop and MedalCabinet #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,10 @@ public MedalsGui(String playerID) { | |
| // back button | ||
| back = new ItemStack(Material.GOLD_NUGGET); | ||
| ItemMeta meta = back.getItemMeta(); | ||
| meta.setDisplayName("返回"); | ||
| meta.setDisplayName("\u00a7e返回"); | ||
| ArrayList<String> lore = new ArrayList<>(); | ||
| lore.add("\u00a77点击返回主菜单"); | ||
| meta.setLore(lore); | ||
| back.setItemMeta(meta); | ||
| gui.setItem(53, back); | ||
| } | ||
|
|
@@ -63,13 +66,19 @@ public void onInventoryClick(InventoryClickEvent e) { | |
| e.setCancelled(true); | ||
| ItemStack clickedItem = e.getCurrentItem(); | ||
| if (clickedItem == null || clickedItem.getType() == Material.AIR) return; | ||
| if (clickedItem.equals(back)) { | ||
|
|
||
| if (clickedItem.hasItemMeta() && | ||
| clickedItem.getItemMeta().hasDisplayName() && | ||
| clickedItem.getItemMeta().getDisplayName().endsWith("返回")) { | ||
| ((Player) e.getWhoClicked()).chat("/menu"); | ||
|
Comment on lines
+70
to
73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The back-button check now triggers on any display name that Useful? React with 👍 / 👎. |
||
| return; | ||
| } | ||
|
|
||
| Medal medal = iconMap.get(clickedItem); | ||
| SQLManager.getInstance().setMainMedal(e.getWhoClicked().getName(), medal.getId()); | ||
| e.getWhoClicked().sendMessage("§e已将勋章 " + medal.getName() + " §e设为主勋章"); | ||
| if (medal != null) { | ||
| SQLManager.getInstance().setMainMedal(e.getWhoClicked().getName(), medal.getId()); | ||
| e.getWhoClicked().sendMessage("§e已将勋章 " + medal.getName() + " §e设为主勋章"); | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
endsWith("返回")to detect the back button means any clicked item whose display name ends with that suffix will execute/menu_shopand bypass the purchase path. In this GUI, display names are data-driven from shop items, so a legitimate item name that ends with返回is misclassified as navigation; this should be an exact normalized match (or a slot/material check) to avoid blocking purchases.Useful? React with 👍 / 👎.