mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +00:00
- Handle channelTag being null.
This commit is contained in:
1 parent
5f8715ce10
commit
27f46966a6
3 files changed
+10
-4
No files matched your search
@@ -7,7 +7,7 @@
|
|||||||
<groupId>com.palmergames.bukkit</groupId>
|
<groupId>com.palmergames.bukkit</groupId>
|
||||||
<artifactId>TownyChat</artifactId>
|
<artifactId>TownyChat</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>0.91</version>
|
<version>0.92</version>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
|
|||||||
@@ -385,3 +385,5 @@ v0.90:
|
|||||||
v0.91:
|
v0.91:
|
||||||
- Implemented sounds for channels and toggling, courtesy of Glare with PR #34.
|
- 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.
|
* Only modify GLOBAL channelType chat (general and local chat channels) if isModifyChat() is true.
|
||||||
*/
|
*/
|
||||||
if (!(channelType.equals(channelTypes.GLOBAL) && !ChatSettings.isModify_chat())) {
|
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);
|
LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident);
|
||||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
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
|
* 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);
|
Town town = TownyAPI.getInstance().getResidentTownOrNull(resident);
|
||||||
Nation nation = TownyAPI.getInstance().getResidentNationOrNull(resident);
|
Nation nation = TownyAPI.getInstance().getResidentNationOrNull(resident);
|
||||||
|
|
||||||
String format = ChatColor.translateAlternateColorCodes('&', getChannelTag());
|
String format = ChatColor.translateAlternateColorCodes('&', getChannelTag() != null ? getChannelTag() : getName());
|
||||||
if (Towny.is116Plus())
|
if (Towny.is116Plus())
|
||||||
format = HexFormatter.translateHexColors(format);
|
format = HexFormatter.translateHexColors(format);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user