Only send AFK message when player is online.

This commit is contained in:
cnaude 2015-12-09 18:50:32 -07:00
parent bcad2b3e5e
commit 7885a0a398
2 changed files with 10 additions and 8 deletions

View File

@ -82,9 +82,6 @@
<exec> <exec>
<arg /> <arg />
</exec> </exec>
<exec>
<arg />
</exec>
</tasks> </tasks>
</configuration> </configuration>
</execution> </execution>

View File

@ -45,12 +45,17 @@ public class EssentialsListener implements Listener {
*/ */
@EventHandler @EventHandler
public void onAfkStatusChangeEvent(AfkStatusChangeEvent event) { public void onAfkStatusChangeEvent(AfkStatusChangeEvent event) {
IUser user = event.getAffected(); final IUser user = event.getAffected();
plugin.logDebug("AFK: " + user.getName() + ":" + user.isAfk()); plugin.logDebug("AFK: " + user.getName() + ":" + user.isAfk());
for (PurpleBot ircBot : plugin.ircBots.values()) { plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
if (user.getBase().isOnline()) { @Override
ircBot.essentialsAFK(user.getBase(), !user.isAfk()); public void run() {
for (PurpleBot ircBot : plugin.ircBots.values()) {
if (user.getBase().isOnline()) {
ircBot.essentialsAFK(user.getBase(), !user.isAfk());
}
}
} }
} }, 20);
} }
} }