- Handle channelTag being null.

This commit is contained in:
Llm Dl committed 2021-12-21 14:25:59 -06:00
1 parent 5f8715ce10
commit 27f46966a6
3 files changed
+11 -5

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
<groupId>com.palmergames.bukkit</groupId>
<artifactId>TownyChat</artifactId>
<packaging>jar</packaging>
<version>0.91</version>
<version>0.92</version>
<licenses>
<license>
+3 -1
View File
@@ -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.
- Minimum Towny version set to 0.97.2.18.
v0.92:
- Handle channelTag being null.
@@ -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);