From 6d38b5b9f18b89831aae3b33ce7ed25da26de1fd Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 4 Dec 2016 20:16:53 +0100 Subject: [PATCH] Added sender indicator for chat msgs https://github.com/TBMCPlugins/DiscordPlugin/issues/12 --- .../java/buttondevteam/chat/ChatProcessing.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/buttondevteam/chat/ChatProcessing.java b/src/main/java/buttondevteam/chat/ChatProcessing.java index 4701dd3..1f43e9c 100644 --- a/src/main/java/buttondevteam/chat/ChatProcessing.java +++ b/src/main/java/buttondevteam/chat/ChatProcessing.java @@ -191,12 +191,14 @@ public class ChatProcessing { json.addExtra(new TellrawPart("[C]").setHoverEvent( TellrawEvent.create(TellrawEvent.HoverAC, TellrawEvent.HoverAction.SHOW_TEXT, "Chat only"))); } - json.addExtra( - new TellrawPart(("[" + currentchannel.DisplayName) + "]" + (mp != null && !mp.RPMode ? "[OOC]" : "")) - .setHoverEvent(TellrawEvent.create(TellrawEvent.HoverAC, TellrawEvent.HoverAction.SHOW_TEXT, - new TellrawPart("Copy message").setColor(Color.Blue))) - .setClickEvent(TellrawEvent.create(TellrawEvent.ClickAC, - TellrawEvent.ClickAction.SUGGEST_COMMAND, suggestmsg))); + json.addExtra(new TellrawPart( + ("[" + (sender instanceof Player ? "" : sender.getClass().getSimpleName().toLowerCase().charAt(0)) + + currentchannel.DisplayName) + "]" + (mp != null && !mp.RPMode ? "[OOC]" : "")) + .setHoverEvent( + TellrawEvent.create(TellrawEvent.HoverAC, TellrawEvent.HoverAction.SHOW_TEXT, + new TellrawPart("Copy message").setColor(Color.Blue))) + .setClickEvent(TellrawEvent.create(TellrawEvent.ClickAC, + TellrawEvent.ClickAction.SUGGEST_COMMAND, suggestmsg))); json.addExtra(new TellrawPart(" <")); json.addExtra( new TellrawPart(