mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
Add extra null check to ensure color isn't null
This commit is contained in:
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));
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-12
@@ -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) {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user