From 2774ac7ab11b1afe0a60b31b761383b4f77ded25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bro=C4=8Dko?= Date: Sat, 8 Sep 2018 22:40:49 +0200 Subject: [PATCH] ChatNotifier: gave up on highlights --- .../mc/essentials/features/ChatNotifier.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cz/marwland/mc/essentials/features/ChatNotifier.java b/src/cz/marwland/mc/essentials/features/ChatNotifier.java index faa4267..8d35b26 100644 --- a/src/cz/marwland/mc/essentials/features/ChatNotifier.java +++ b/src/cz/marwland/mc/essentials/features/ChatNotifier.java @@ -4,6 +4,7 @@ import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerChatEvent; import com.connorlinfoot.bountifulapi.BountifulAPI; @@ -12,18 +13,19 @@ import cz.marwland.mc.core.features.Feature; import net.md_5.bungee.api.ChatColor; public class ChatNotifier extends Feature { - + + // TODO: Per-player highlighting @EventHandler public void onPlayerChat(AsyncPlayerChatEvent e) { for (Player p : Bukkit.getServer().getOnlinePlayers()) { String msg = e.getMessage(); - if (e.getMessage().toLowerCase().contains(p.getName().toLowerCase()) && p.getPlayer() != e.getPlayer()) { - e.getRecipients().remove(p); - msg = ChatColor.RED + msg; + if (msg.toLowerCase().contains(p.getName().toLowerCase()) && p.getPlayer() != e.getPlayer()) { + /*e.getRecipients().remove(p); + msg = ChatColor.RED + msg;*/ BountifulAPI.sendActionBar(p, ChatColor.RED + "Byl jsi zminen v chatu!"); p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 3.0F); } - p.sendMessage(String.format(e.getFormat(), e.getPlayer().getDisplayName(), msg)); + //p.sendMessage(String.format(e.getFormat(), e.getPlayer().getDisplayName(), msg)); } }