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
+18 -12

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,24 +33,26 @@ 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) -> {
ByteArrayDataInput input = ByteStreams.newDataInput(bytes); try {
ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
// Separated out for ease of debugging. // Separated out for ease of debugging.
long mostServer = input.readLong(); long mostServer = input.readLong();
long leastServer = input.readLong(); long leastServer = input.readLong();
UUID messageUUID = new UUID(mostServer, leastServer); UUID messageUUID = new UUID(mostServer, leastServer);
if (messageUUID.equals(serverUUID)) { if (messageUUID.equals(serverUUID)) {
return; return;
} }
long mostUser = input.readLong(); long mostUser = input.readLong();
long leastUser = input.readLong(); long leastUser = input.readLong();
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) {}
}); });
} }