From d759a39c42f029a5c51b9b9cb9ec4849b59e47d7 Mon Sep 17 00:00:00 2001 From: Minenash Date: Sun, 11 Mar 2018 22:31:27 -0400 Subject: [PATCH 1/6] makes sure event isn't cancelled. changed priority --- src/com/redstoner/modules/chat/Chat.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/redstoner/modules/chat/Chat.java b/src/com/redstoner/modules/chat/Chat.java index f5a8aa6..a1330e4 100644 --- a/src/com/redstoner/modules/chat/Chat.java +++ b/src/com/redstoner/modules/chat/Chat.java @@ -39,9 +39,11 @@ public class Chat implements Module, Listener DataManager.setConfig("shrug", " %n §7→§r %m ¯\\_(ツ)_/¯"); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerChat(AsyncPlayerChatEvent event) { + if (event.isCancelled()) + return; Player player = event.getPlayer(); String message = event.getMessage(); event.setCancelled(true); From aa1164ecb771118ea36e7c110ce8db40747d5428 Mon Sep 17 00:00:00 2001 From: Minenash Date: Sun, 11 Mar 2018 22:32:25 -0400 Subject: [PATCH 2/6] Changed priority --- src/com/redstoner/modules/mentio/Mentio.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/redstoner/modules/mentio/Mentio.java b/src/com/redstoner/modules/mentio/Mentio.java index 060f29c..8856314 100644 --- a/src/com/redstoner/modules/mentio/Mentio.java +++ b/src/com/redstoner/modules/mentio/Mentio.java @@ -120,7 +120,7 @@ public class Mentio implements Module, Listener } @SuppressWarnings("unchecked") - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerChat(AsyncPlayerChatEvent event) { if (event.isCancelled()) From 80045e551f053d8aedefaf8e311b998ce9496a39 Mon Sep 17 00:00:00 2001 From: Pepich Date: Mon, 12 Mar 2018 03:38:37 +0100 Subject: [PATCH 3/6] These things have version numbers. Increased them for ya --- src/com/redstoner/modules/chat/Chat.java | 7 ++++--- src/com/redstoner/modules/mentio/Mentio.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/com/redstoner/modules/chat/Chat.java b/src/com/redstoner/modules/chat/Chat.java index a1330e4..8764e4f 100644 --- a/src/com/redstoner/modules/chat/Chat.java +++ b/src/com/redstoner/modules/chat/Chat.java @@ -24,7 +24,7 @@ import net.nemez.chatapi.ChatAPI; @Commands(CommandHolderType.File) @AutoRegisterListener -@Version(major = 4, minor = 0, revision = 1, compatible = 4) +@Version(major = 4, minor = 0, revision = 2, compatible = 4) public class Chat implements Module, Listener { @@ -42,7 +42,7 @@ public class Chat implements Module, Listener @EventHandler(priority = EventPriority.MONITOR) public void onPlayerChat(AsyncPlayerChatEvent event) { - if (event.isCancelled()) + if (event.isCancelled()) return; Player player = event.getPlayer(); String message = event.getMessage(); @@ -154,7 +154,8 @@ public class Chat implements Module, Listener } String raw = (String) DataManager.getConfigOrDefault(format, " %n §7→§r %m"); String formatted = raw.replace("%n", name).replace("%m", message); - Utils.broadcast("", ChatAPI.colorify(sender, formatted), wrap(ModuleLoader.exists("Ignore") ? Ignore.getIgnoredBy(sender) : null, event)); + Utils.broadcast("", ChatAPI.colorify(sender, formatted), + wrap(ModuleLoader.exists("Ignore") ? Ignore.getIgnoredBy(sender) : null, event)); return true; } diff --git a/src/com/redstoner/modules/mentio/Mentio.java b/src/com/redstoner/modules/mentio/Mentio.java index 8856314..b224175 100644 --- a/src/com/redstoner/modules/mentio/Mentio.java +++ b/src/com/redstoner/modules/mentio/Mentio.java @@ -28,7 +28,7 @@ import net.nemez.chatapi.click.Message; @Commands(CommandHolderType.String) @AutoRegisterListener -@Version(major = 4, minor = 0, revision = 1, compatible = 4) +@Version(major = 4, minor = 0, revision = 2, compatible = 4) public class Mentio implements Module, Listener { private File mentioLocation = new File(Main.plugin.getDataFolder(), "mentio.json"); From 5a91bdee6d81a424a7e67a053deed7fde9aa2ef7 Mon Sep 17 00:00:00 2001 From: Pepich Date: Mon, 12 Mar 2018 03:55:56 +0100 Subject: [PATCH 4/6] Fixed mentio double messages --- src/com/redstoner/modules/chat/Chat.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/redstoner/modules/chat/Chat.java b/src/com/redstoner/modules/chat/Chat.java index 8764e4f..d96d96a 100644 --- a/src/com/redstoner/modules/chat/Chat.java +++ b/src/com/redstoner/modules/chat/Chat.java @@ -24,7 +24,7 @@ import net.nemez.chatapi.ChatAPI; @Commands(CommandHolderType.File) @AutoRegisterListener -@Version(major = 4, minor = 0, revision = 2, compatible = 4) +@Version(major = 4, minor = 0, revision = 3, compatible = 4) public class Chat implements Module, Listener { @@ -47,7 +47,7 @@ public class Chat implements Module, Listener Player player = event.getPlayer(); String message = event.getMessage(); event.setCancelled(true); - broadcastFormatted("chat", player, message); + broadcastFormatted("chat", player, message, event); } @Command(hook = "me") From 0e8da87003a40ddd3622699062bbb73f747801ea Mon Sep 17 00:00:00 2001 From: Pepich Date: Mon, 12 Mar 2018 03:58:55 +0100 Subject: [PATCH 5/6] Takes event, forwards null. Thx. --- src/com/redstoner/modules/chat/Chat.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/redstoner/modules/chat/Chat.java b/src/com/redstoner/modules/chat/Chat.java index d96d96a..0053bcb 100644 --- a/src/com/redstoner/modules/chat/Chat.java +++ b/src/com/redstoner/modules/chat/Chat.java @@ -24,7 +24,7 @@ import net.nemez.chatapi.ChatAPI; @Commands(CommandHolderType.File) @AutoRegisterListener -@Version(major = 4, minor = 0, revision = 3, compatible = 4) +@Version(major = 4, minor = 0, revision = 4, compatible = 4) public class Chat implements Module, Listener { @@ -139,7 +139,7 @@ public class Chat implements Module, Listener public boolean broadcastFormatted(String format, CommandSender sender, String message, AsyncPlayerChatEvent event) { - return broadcastFormatted(format, sender, message, Utils.getName(sender), null); + return broadcastFormatted(format, sender, message, Utils.getName(sender), event); } public boolean broadcastFormatted(String format, CommandSender sender, String message, String name, From 30fe935aeed42f1d7def05ccedcc63972b435e1a Mon Sep 17 00:00:00 2001 From: minenash Date: Sun, 11 Mar 2018 23:43:19 -0400 Subject: [PATCH 6/6] Fixed Mentio ignoring ignore --- src/com/redstoner/modules/chat/Chat.cmd | 5 +++++ src/com/redstoner/modules/chat/Chat.java | 7 +++++++ src/com/redstoner/modules/mentio/Mentio.java | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/src/com/redstoner/modules/chat/Chat.cmd b/src/com/redstoner/modules/chat/Chat.cmd index fe511e7..1e6bc13 100644 --- a/src/com/redstoner/modules/chat/Chat.cmd +++ b/src/com/redstoner/modules/chat/Chat.cmd @@ -26,6 +26,11 @@ command shrug { run shrug message; help Appends the shrug emoticon to the end of your message.; } + [empty] { + perm utils.shrug; + run shrug; + help Just the shrug emoticon.; + } } command say { [string:message...] { diff --git a/src/com/redstoner/modules/chat/Chat.java b/src/com/redstoner/modules/chat/Chat.java index 0053bcb..22ff4e0 100644 --- a/src/com/redstoner/modules/chat/Chat.java +++ b/src/com/redstoner/modules/chat/Chat.java @@ -97,6 +97,13 @@ public class Chat implements Module, Listener return true; } + @Command(hook = "shrugnoarg") + public boolean shrug(CommandSender sender) + { + broadcastFormatted("shrug", sender, ""); + return true; + } + @Command(hook = "mute") public boolean mute(CommandSender sender, String player) { diff --git a/src/com/redstoner/modules/mentio/Mentio.java b/src/com/redstoner/modules/mentio/Mentio.java index b224175..3328280 100644 --- a/src/com/redstoner/modules/mentio/Mentio.java +++ b/src/com/redstoner/modules/mentio/Mentio.java @@ -19,10 +19,12 @@ import com.nemez.cmdmgr.Command; import com.redstoner.annotations.AutoRegisterListener; import com.redstoner.annotations.Commands; import com.redstoner.annotations.Version; +import com.redstoner.coremods.moduleLoader.ModuleLoader; import com.redstoner.misc.CommandHolderType; import com.redstoner.misc.JsonManager; import com.redstoner.misc.Main; import com.redstoner.modules.Module; +import com.redstoner.modules.ignore.Ignore; import net.nemez.chatapi.click.Message; @@ -127,6 +129,8 @@ public class Mentio implements Module, Listener return; for (Player player : event.getRecipients()) { + if (ModuleLoader.exists("Ignore") ? !Ignore.getIgnoredBy(event.getPlayer()).sendTo(player) : false) + return; UUID uuid = player.getUniqueId(); JSONArray playerMentios = (JSONArray) mentios.get(uuid.toString()); if (playerMentios == null)