Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Only send AFK message when player is online.
  • Loading branch information
cnaude committed Dec 10, 2015
1 parent 5545282 commit 07ddf3e
Showing 1 changed file with 13 additions and 6 deletions.
Expand Up @@ -25,15 +25,15 @@

/**
*
* @author cnaude
* @author Chris Naude
*/
public class EssentialsListener implements Listener {

private final PurpleIRC plugin;

/**
*
* @param plugin
* @param plugin the PurpleIRC plugin
*/
public EssentialsListener(PurpleIRC plugin) {
this.plugin = plugin;
Expand All @@ -45,10 +45,17 @@ public EssentialsListener(PurpleIRC plugin) {
*/
@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()) {
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);
}
}

0 comments on commit 07ddf3e

Please sign in to comment.