From de0df4fe9a224efe2b4e35d255fe8c920be42aa0 Mon Sep 17 00:00:00 2001 From: ThiagoROX Date: Wed, 25 Feb 2026 23:58:23 -0300 Subject: [PATCH 1/3] Fix non-breaking space handling and placeholders Update I18n.java to improve nbsp handling and restore temporary placeholders. - Use explicit Unicode escape for non-breaking space (\u00A0) when normalizing spaces. - Add logic to replace temporary "{i}" placeholders with the original processed argument strings so MiniMessage tags/values are preserved. - Mark caught exceptions and some method parameters as final for clarity/immutability. These changes prevent loss of MiniMessage content during formatting and tidy up variable declarations. --- .../main/java/com/earth2me/essentials/I18n.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/I18n.java b/Essentials/src/main/java/com/earth2me/essentials/I18n.java index c7ae82eaada..247661938a2 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/I18n.java +++ b/Essentials/src/main/java/com/earth2me/essentials/I18n.java @@ -141,10 +141,10 @@ public void blockingLoadBundle(final Locale locale) { ResourceBundle bundle; try { bundle = ResourceBundle.getBundle(MESSAGES, locale, new FileResClassLoader(I18n.class.getClassLoader(), ess), new UTF8PropertiesControl()); - } catch (MissingResourceException ex) { + } catch (final MissingResourceException ex) { try { bundle = ResourceBundle.getBundle(MESSAGES, locale, new UTF8PropertiesControl()); - } catch (MissingResourceException ex2) { + } catch (final MissingResourceException ex2) { bundle = NULL_BUNDLE; } } @@ -190,7 +190,14 @@ private String format(final Locale locale, final String string, final Object... return ess.getAdventureFacet().legacyToMini(ess.getAdventureFacet().escapeTags(arg.toString())); }); - return messageFormat.format(processedArgs).replace(' ', ' '); // replace nbsp with a space + String result = messageFormat.format(processedArgs).replace('\u00A0', ' '); // replace nbsp with a spaceeplace(' ', ' '); // replace nbsp with a space + + // Replace temporary placeholders back to actual values for MiniMessage tags + for (int i = 0; i < processedArgs.length; i++) { + result = result.replace("{" + i + "}", processedArgs[i].toString()); + } + + return result; } public static Object[] mutateArgs(final Object[] objects, final Function mutator) { @@ -312,7 +319,7 @@ public ResourceBundle newBundle(final String baseName, final Locale locale, fina } @Override - public Locale getFallbackLocale(String baseName, Locale locale) { + public Locale getFallbackLocale(final String baseName, final Locale locale) { if (baseName == null || locale == null) { throw new NullPointerException(); } From b4d03480eae57e9c2bf008842c34a45c173be1cb Mon Sep 17 00:00:00 2001 From: ThiagoROX Date: Wed, 25 Feb 2026 23:58:31 -0300 Subject: [PATCH 2/3] Include requester name in tpa messages Pass the requesting player's display name to localization messages for tpa actions. Updated sendTl calls for typeTpaccept, typeTpdeny, and typeTpacancel to include user.getDisplayName(), so prompts indicate who initiated the teleport request. --- .../java/com/earth2me/essentials/commands/Commandtpa.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java index 151d5654130..0fa08e2dbda 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java @@ -65,8 +65,8 @@ public void run(final Server server, final User user, final String commandLabel, } player.requestTeleport(user, false); player.sendTl("teleportRequest", user.getDisplayName()); - player.sendTl("typeTpaccept"); - player.sendTl("typeTpdeny"); + player.sendTl("typeTpaccept", user.getDisplayName()); + player.sendTl("typeTpdeny", user.getDisplayName()); if (ess.getSettings().getTpaAcceptCancellation() != 0) { player.sendTl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation()); } @@ -74,7 +74,7 @@ public void run(final Server server, final User user, final String commandLabel, user.sendTl("requestSent", player.getDisplayName()); if (user.isAuthorized("essentials.tpacancel")) { - user.sendTl("typeTpacancel"); + user.sendTl("typeTpacancel", player.getDisplayName()); } } From 88dc3da9948713549e09d186e5a8e2409911d0bf Mon Sep 17 00:00:00 2001 From: ThiagoROX Date: Thu, 26 Feb 2026 04:54:34 -0300 Subject: [PATCH 3/3] Include player names in tpa messages Pass plain usernames alongside display names to various messaging calls in Commandtpa. Updated sendTl calls and a TranslatableException to include user.getName()/player.getName() for requestAcceptedAuto, requestAcceptedFromAuto, teleportRequestCancelled, teleportRequest, typeTpaccept, typeTpdeny, requestSent and typeTpacancel so message templates can use both displayName and name. --- .../earth2me/essentials/commands/Commandtpa.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java index 0fa08e2dbda..76d3eb88c6f 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpa.java @@ -50,8 +50,8 @@ public void run(final Server server, final User user, final String commandLabel, teleport.teleport(player.getBase(), charge, PlayerTeleportEvent.TeleportCause.COMMAND, future); future.thenAccept(success -> { if (success) { - player.sendTl("requestAcceptedAuto", user.getDisplayName()); - user.sendTl("requestAcceptedFromAuto", player.getDisplayName()); + player.sendTl("requestAcceptedAuto", user.getDisplayName(), user.getName()); + user.sendTl("requestAcceptedFromAuto", player.getDisplayName(), player.getName()); } }); throw new NoChargeException(); @@ -61,20 +61,20 @@ public void run(final Server server, final User user, final String commandLabel, final TPARequestEvent tpaEvent = new TPARequestEvent(user.getSource(), player, false); ess.getServer().getPluginManager().callEvent(tpaEvent); if (tpaEvent.isCancelled()) { - throw new TranslatableException("teleportRequestCancelled", player.getDisplayName()); + throw new TranslatableException("teleportRequestCancelled", player.getDisplayName(), player.getName()); } player.requestTeleport(user, false); - player.sendTl("teleportRequest", user.getDisplayName()); - player.sendTl("typeTpaccept", user.getDisplayName()); - player.sendTl("typeTpdeny", user.getDisplayName()); + player.sendTl("teleportRequest", user.getDisplayName(), user.getName()); + player.sendTl("typeTpaccept", user.getDisplayName(), user.getName()); + player.sendTl("typeTpdeny", user.getDisplayName(), user.getName()); if (ess.getSettings().getTpaAcceptCancellation() != 0) { player.sendTl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation()); } } - user.sendTl("requestSent", player.getDisplayName()); + user.sendTl("requestSent", player.getDisplayName(), player.getName()); if (user.isAuthorized("essentials.tpacancel")) { - user.sendTl("typeTpacancel", player.getDisplayName()); + user.sendTl("typeTpacancel", player.getDisplayName(), player.getName()); } }