From cb0d82174e031d9e494450bb8933fd9867d826f1 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 13 Oct 2015 17:41:25 -0400 Subject: [PATCH 1/3] Apply botspam to chat messages as well --- .../mineplex/core/botspam/BotSpamManager.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java index a977b3685..9a9a6b8d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java @@ -5,6 +5,7 @@ import java.util.List; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; @@ -54,6 +55,27 @@ public class BotSpamManager extends MiniPlugin } } + @EventHandler + public void onChatMessage(final AsyncPlayerChatEvent event) + { + for (final SpamText spamText : _spam) + { + if (spamText.isEnabled() && spamText.isSpam(event.getMessage())) + { + runSync(new Runnable() + { + @Override + public void run() + { + punishBot(event.getPlayer(), spamText); + } + }); + + event.setCancelled(true); + } + } + } + public void punishBot(Player player, final SpamText botText) { _punish.AddPunishment(player.getName(), Category.Other, "Bot Spam #" + botText.getId(), "Chiss", 1, true, -1, true); From 0df637b80a20f6af2fb98c5d0b42cd9b4b9033b3 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 13 Oct 2015 22:56:14 -0400 Subject: [PATCH 2/3] Run punishBot in main server thread --- .../src/mineplex/core/botspam/BotSpamManager.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java index aabdeca92..29a38932c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java @@ -61,17 +61,24 @@ public class BotSpamManager extends MiniPlugin } @EventHandler(priority = EventPriority.LOWEST) - public void onChat(AsyncPlayerChatEvent event) + public void onChat(final AsyncPlayerChatEvent event) { // Ignore messages sent by staff members if (_clientManager.hasRank(event.getPlayer(), Rank.HELPER)) return; - for (SpamText spamText : _spam) + for (final SpamText spamText : _spam) { if (spamText.isEnabled() && spamText.isSpam(event.getMessage())) { - punishBot(event.getPlayer(), spamText); + runSync(new Runnable() + { + @Override + public void run() + { + punishBot(event.getPlayer(), spamText); + } + }); event.setCancelled(true); return; } From 86bad0be30f581531ae339805b9cce515e6ed9ce Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 14 Oct 2015 14:34:30 +1100 Subject: [PATCH 3/3] mods can check other players skills --- .../game/classcombat/Class/ClassManager.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java index f5d09bba1..b1bf213e3 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java @@ -13,12 +13,15 @@ import mineplex.minecraft.game.classcombat.item.ItemFactory; import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import org.bukkit.Material; import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -303,12 +306,30 @@ public class ClassManager extends MiniClientPlugin implements IClas if (!_enabled) return; - if (event.getMessage().equals("/skill")) + if (event.getMessage().length() < 1) + return; + + String[] args = event.getMessage().toLowerCase().split(" "); + + if (args[0].equals("/skill")) { - ClientClass client = Get(event.getPlayer().getName()); + Player target = event.getPlayer(); + + //Target Other + if (args.length > 1 && _clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR)) + { + target = UtilPlayer.searchOnline(event.getPlayer(), args[1], true); + + if (target == null) + { + return; + } + } + + ClientClass client = Get(target.getName()); if (client == null) - event.getPlayer().sendMessage("You do not have a ClientClass."); + event.getPlayer().sendMessage(target.getName() + " does not have a ClientClass."); else { client.DisplaySkills(event.getPlayer());