From 7885a0a398f1a53181f77b69cde4c0c151c94b89 Mon Sep 17 00:00:00 2001 From: cnaude Date: Wed, 9 Dec 2015 18:50:32 -0700 Subject: [PATCH] Only send AFK message when player is online. --- dependency-reduced-pom.xml | 3 --- .../GameListeners/EssentialsListener.java | 15 ++++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 99b9e50..3ed8260 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -82,9 +82,6 @@ - - - diff --git a/src/main/java/com/cnaude/purpleirc/GameListeners/EssentialsListener.java b/src/main/java/com/cnaude/purpleirc/GameListeners/EssentialsListener.java index bfae102..a3ff197 100644 --- a/src/main/java/com/cnaude/purpleirc/GameListeners/EssentialsListener.java +++ b/src/main/java/com/cnaude/purpleirc/GameListeners/EssentialsListener.java @@ -45,12 +45,17 @@ public class EssentialsListener implements Listener { */ @EventHandler public void onAfkStatusChangeEvent(AfkStatusChangeEvent event) { - IUser user = event.getAffected(); + final IUser user = event.getAffected(); plugin.logDebug("AFK: " + user.getName() + ":" + user.isAfk()); - for (PurpleBot ircBot : plugin.ircBots.values()) { - if (user.getBase().isOnline()) { - ircBot.essentialsAFK(user.getBase(), !user.isAfk()); + plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + @Override + public void run() { + for (PurpleBot ircBot : plugin.ircBots.values()) { + if (user.getBase().isOnline()) { + ircBot.essentialsAFK(user.getBase(), !user.isAfk()); + } + } } - } + }, 20); } }