add delayed task for XMPP presence update

This commit is contained in:
patjense 2013-10-13 12:59:04 -07:00 committed by KHobbits
parent 601bdbff46
commit 27ee587887

View File

@ -3,6 +3,9 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.ess3.api.IUser;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -10,6 +13,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.Server;
class EssentialsXMPPPlayerListener implements Listener
@ -26,6 +30,16 @@ class EssentialsXMPPPlayerListener implements Listener
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, new Runnable()
{
@Override
public void run()
{
EssentialsXMPP.updatePresence();
}
});
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
}
@ -40,6 +54,17 @@ class EssentialsXMPPPlayerListener implements Listener
public void onPlayerQuit(final PlayerQuitEvent event)
{
final User user = ess.getUser(event.getPlayer());
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, new Runnable()
{
@Override
public void run()
{
EssentialsXMPP.updatePresence();
}
});
sendMessageToSpyUsers("Player " + user.getDisplayName() + " left the game");
}