botspam now checks for chat as well
This commit is contained in:
parent
981002e3dc
commit
e8388437b6
@ -5,6 +5,8 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -53,6 +55,24 @@ public class BotSpamManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
// Ignore messages sent to staff members
|
||||
if (_clientManager.hasRank(event.getPlayer(), Rank.HELPER))
|
||||
return;
|
||||
|
||||
for (SpamText spamText : _spam)
|
||||
{
|
||||
if (spamText.isEnabled() && spamText.isSpam(event.getMessage()))
|
||||
{
|
||||
punishBot(event.getPlayer(), spamText);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void punishBot(Player player, final SpamText botText)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user