Run punishBot in main server thread

This commit is contained in:
Shaun Bennett 2015-10-13 22:56:14 -04:00
parent 39d88e8060
commit 0df637b80a

View File

@ -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;
}