Skip to content

Commit 43cb76a

Browse files
Fix MiniMessage and color formatting in disposal GUI title (#6616)
### Information This PR fixes #6606. ### Details **Proposed fix:** Passes the localized `disposal` string through `AdventureFacet#miniToLegacy` before creating the chest inventory view in both `Commanddisposal.java` and `SignDisposal.java`. This ensures both legacy formatting codes (`&a&l`) and Adventure/MiniMessage tags (`<green><bold>`) parse and render correctly in the inventory title bar. **Environments tested:** OS: Windows 11 Java version: Java 21 - [x] Most recent Paper version (26.2) - [ ] CraftBukkit/Spigot/Paper 1.12.2 - [ ] CraftBukkit 1.8.8 **Demonstration:** <img width="554" height="76" alt="image" src="https://github.com/user-attachments/assets/6bb5b6a2-2a7b-4cf8-8d54-15776e63e2dd" /> <img width="388" height="223" alt="image" src="https://github.com/user-attachments/assets/bc8f5dee-9faa-4a03-937e-37d64a283e4c" />
1 parent 4600c72 commit 43cb76a

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎Essentials/src/main/java/com/earth2me/essentials/commands/Commanddisposal.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public Commanddisposal() {
1212
@Override
1313
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
1414
user.sendTl("openingDisposal");
15-
user.getBase().openInventory(ess.getServer().createInventory(user.getBase(), 36, user.playerTl("disposal")));
15+
final String title = ess.getAdventureFacet().miniToLegacy(user.playerTl("disposal"));
16+
user.getBase().openInventory(ess.getServer().createInventory(user.getBase(), 36, title));
1617
}
1718

1819
}

‎Essentials/src/main/java/com/earth2me/essentials/signs/SignDisposal.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ protected boolean onSignCreate(final ISign sign, final User player, final String
2121

2222
@Override
2323
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) {
24-
String title = (sign.getLine(1) + " " + sign.getLine(2) + " " + sign.getLine(3)).trim();
25-
if (title.isEmpty()) {
26-
title = player.playerTl("disposal");
27-
}
24+
final String customTitle = (sign.getLine(1) + " " + sign.getLine(2) + " " + sign.getLine(3)).trim();
25+
final String title = customTitle.isEmpty() ? ess.getAdventureFacet().miniToLegacy(player.playerTl("disposal")) : customTitle;
2826
player.getBase().openInventory(ess.getServer().createInventory(player.getBase(), 36, title));
2927
return true;
3028
}

0 commit comments

Comments
 (0)