diff --git a/pom.xml b/pom.xml index 03c382d..e3a6497 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.palmergames.bukkit TownyChat jar - 0.91 + 0.92 diff --git a/resources/changelog.txt b/resources/changelog.txt index 07a6e3f..24ea3f0 100644 --- a/resources/changelog.txt +++ b/resources/changelog.txt @@ -384,4 +384,6 @@ v0.90: - Closes https://github.com/TownyAdvanced/Towny/issues/4984 v0.91: - Implemented sounds for channels and toggling, courtesy of Glare with PR #34. - - Minimum Towny version set to 0.97.2.18. \ No newline at end of file + - Minimum Towny version set to 0.97.2.18. +v0.92: + - Handle channelTag being null. \ No newline at end of file diff --git a/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java b/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java index c8200d2..e36cd2e 100644 --- a/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java +++ b/src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java @@ -125,7 +125,7 @@ public class StandardChannel extends Channel { * Only modify GLOBAL channelType chat (general and local chat channels) if isModifyChat() is true. */ if (!(channelType.equals(channelTypes.GLOBAL) && !ChatSettings.isModify_chat())) { - event.setFormat(format.replace("{channelTag}", Colors.translateColorCodes(getChannelTag())).replace("{msgcolour}", Colors.translateColorCodes(getMessageColour()))); + event.setFormat(getFormat(format)); LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident); event.setFormat(TownyChatFormatter.getChatFormat(chatEvent)); } @@ -215,7 +215,11 @@ public class StandardChannel extends Channel { } - + private String getFormat(String format) { + return format + .replace("{channelTag}", Colors.translateColorCodes(getChannelTag() != null ? getChannelTag() : "")) + .replace("{msgcolour}", Colors.translateColorCodes(getMessageColour() != null ? getMessageColour() : "")); + } /** * Check the distance between players and return a result based upon the range setting @@ -353,7 +357,7 @@ public class StandardChannel extends Channel { Town town = TownyAPI.getInstance().getResidentTownOrNull(resident); Nation nation = TownyAPI.getInstance().getResidentNationOrNull(resident); - String format = ChatColor.translateAlternateColorCodes('&', getChannelTag()); + String format = ChatColor.translateAlternateColorCodes('&', getChannelTag() != null ? getChannelTag() : getName()); if (Towny.is116Plus()) format = HexFormatter.translateHexColors(format);