From 01562bf7696273f6e6eb1081f90e3055c48f3f85 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 15 Jul 2018 02:22:40 +0200 Subject: [PATCH] Using the CG object on chat This means user data will be available (again) if talking from Discord, for example. --- src/main/java/buttondevteam/chat/ChatProcessing.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/buttondevteam/chat/ChatProcessing.java b/src/main/java/buttondevteam/chat/ChatProcessing.java index 59e64a8..c323ded 100644 --- a/src/main/java/buttondevteam/chat/ChatProcessing.java +++ b/src/main/java/buttondevteam/chat/ChatProcessing.java @@ -104,9 +104,11 @@ public class ChatProcessing { doFunStuff(sender, e, message); - ChatPlayer mp = null; + ChatPlayer mp; if (player != null) mp = TBMCPlayerBase.getPlayer(player.getUniqueId(), ChatPlayer.class); + else //Due to the online player map, getPlayer() can be more efficient than getAs() + mp = e.getUser().getAs(ChatPlayer.class); //May be null Color colormode = channel.color; if (mp != null && mp.OtherColorMode != null)