Add extra null check to ensure color isn't null

This commit is contained in:
Draycia committed 2020-08-19 05:49:20 -07:00
1 parent 628b2599e2
commit f75d2af11a
2 files changed
+6

No files matched your search

@@ -334,6 +334,10 @@ public class CarbonChatChannel extends ChatChannel {
public TextColor getChannelColor(ChatUser user) { public TextColor getChannelColor(ChatUser user) {
String color = getString("color"); String color = getString("color");
if (color == null) {
color = "white";
}
if (user.isOnline()) { if (user.isOnline()) {
return TextColor.fromHexString(PlaceholderAPI.setPlaceholders(user.asPlayer(), color)); return TextColor.fromHexString(PlaceholderAPI.setPlaceholders(user.asPlayer(), color));
} }
@@ -33,6 +33,7 @@ public class BungeeMessageService implements MessageService {
api = BungeeChannelApi.of(carbonChat); api = BungeeChannelApi.of(carbonChat);
api.registerForwardListener((String channel, Player player, byte[] bytes) -> { api.registerForwardListener((String channel, Player player, byte[] bytes) -> {
try {
ByteArrayDataInput input = ByteStreams.newDataInput(bytes); ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
// Separated out for ease of debugging. // Separated out for ease of debugging.
@@ -51,6 +52,7 @@ public class BungeeMessageService implements MessageService {
UUID userUUID = new UUID(mostUser, leastUser); UUID userUUID = new UUID(mostUser, leastUser);
this.receiveMessage(userUUID, channel, input); this.receiveMessage(userUUID, channel, input);
} catch (IllegalStateException ignored) {}
}); });
} }