Reduce kick event spamming.

This commit is contained in:
cnaude 2017-01-11 18:06:43 -07:00
parent fd997cc348
commit 19f72d8927

View File

@ -45,13 +45,19 @@ public class GamePlayerKickListener implements Listener {
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerKickEvent(PlayerKickEvent event) {
plugin.logDebug("KICK: " + event.getPlayer().getName());
if (!plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.kickedPlayers.add(event.getPlayer().getName());
plugin.logDebug("KICK: " + event.getPlayer().getName());
if (plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.logDebug("Player "
+ event.getPlayer().getName()
+ " is in the recently kicked list. Not sending kick message.");
return;
}
for (PurpleBot ircBot : plugin.ircBots.values()) {
ircBot.gameKick(event.getPlayer(), event.getLeaveMessage(), event.getReason());
}
if (!plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.kickedPlayers.add(event.getPlayer().getName());
}
}
}