Skip to content

Commit

Permalink
- Fix Global messages stripping their colour.
Browse files Browse the repository at this point in the history
  • Loading branch information
LlmDl committed Oct 1, 2021
1 parent a891dd5 commit 42140f6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>Towny</artifactId>
<packaging>jar</packaging>
<version>0.97.2.3</version>
<version>0.97.2.4</version>

<licenses>
<license>
Expand Down
4 changes: 3 additions & 1 deletion resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6770,4 +6770,6 @@ v0.92.0.11:
0.97.2.3:
- Change PlayerCacheUtil to once again check for a fakeplayer resident.
- Fix PlayerCacheUtil preventing plot permissions from working properly.
- Fix missing command feedback on many /tw toggle commands.
- Fix missing command feedback on many /tw toggle commands.
0.97.2.4:
- Fix Global messages stripping their colour.
6 changes: 3 additions & 3 deletions src/com/palmergames/bukkit/towny/TownyMessaging.java
Original file line number Diff line number Diff line change
Expand Up @@ -869,18 +869,18 @@ public static void sendGlobalMessage(Translatable translatable) {
LOGGER.info("[Global Message] " + translatable.stripColors(true).translate());
for (Player player : Bukkit.getOnlinePlayers())
if (player != null && TownyAPI.getInstance().isTownyWorld(player.getWorld()))
sendMsg(player, translatable);
sendMessage(player, translatable);
}

public static void sendMessage(Object sender, Translatable message) {
if (sender instanceof Player player) {
sendTranslatedMessage(player, message.translate(Translation.getLocale(player)));
sendTranslatedMessage(player, message.stripColors(false).translate(Translation.getLocale(player)));
} else if (sender instanceof CommandSender commandSender) {
sendTranslatedMessage(commandSender, message.stripColors(true).translate(Translation.getLocale(commandSender)));
} else if (sender instanceof Resident resident) {
Player p = TownyAPI.getInstance().getPlayer(resident);
if (p != null)
sendTranslatedMessage(p, message.stripColors(true).translate(Translation.getLocale(p)));
sendTranslatedMessage(p, message.stripColors(false).translate(Translation.getLocale(p)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/com/palmergames/bukkit/towny/command/PlotCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ else if (split[0].equalsIgnoreCase("town"))
townBlock.setChanged(true);
townBlock.save();
if (!townBlock.hasPlotObjectGroup()) {
TownyMessaging.sendMsg(player, Translatable.of("msg_set_perms").forLocale(player));
TownyMessaging.sendMsg(player, Translatable.of("msg_set_perms"));
TownyMessaging.sendMessage(player, Colors.Green + Translatable.of("status_perm").forLocale(player) + " " + ((townBlockOwner instanceof Resident) ? perm.getColourString().replace("n", "t") : perm.getColourString().replace("f", "r")));
TownyMessaging.sendMessage(player, Colors.Green + Translatable.of("status_pvp").forLocale(player) + " " + ((perm.pvp) ? Colors.Red + "ON" : Colors.LightGreen + "OFF") +
Colors.Green + Translatable.of("explosions").forLocale(player) + " " + ((perm.explosion) ? Colors.Red + "ON" : Colors.LightGreen + "OFF") +
Expand Down

0 comments on commit 42140f6

Please sign in to comment.