From d9f16172350f91f95f2a105f9ee67d99d0e30100 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 22 Nov 2020 08:49:54 +0100 Subject: [PATCH] Fix chat-msgs Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/BungeeCore.java | 2 ++ src/de/steamwar/bungeecore/Message.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index a6a9ccad..682741f0 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -170,6 +170,8 @@ public class BungeeCore extends Plugin { send(player, ChatMessageType.SYSTEM, msg, onHover, onClick); } public static void send(ProxiedPlayer player, ChatMessageType type, String msg, String onHover, ClickEvent onClick){ + if(type == ChatMessageType.CHAT && player.getChatMode() != ProxiedPlayer.ChatMode.SHOWN) + return; TextComponent message = stringToText(msg); if(onHover != null) message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(onHover))); diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 2646045a..1e5e0c06 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -88,6 +88,8 @@ public class Message { } public static void send(String message, boolean prefixed, CommandSender sender, ChatMessageType type, String onHover, ClickEvent onClick, Object... params){ + if(type == ChatMessageType.CHAT && sender instanceof ProxiedPlayer && ((ProxiedPlayer)sender).getChatMode() != ProxiedPlayer.ChatMode.SHOWN) + return; TextComponent msg = parseToComponent(message, prefixed, sender, params); if(onHover != null) msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(onHover)));