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>
<arg />
</exec>
<exec>
<arg />
</exec>
</tasks>
</configuration>
</execution>

View File

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