mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
add delayed task for XMPP presence update
This commit is contained in:
parent
601bdbff46
commit
27ee587887
@ -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");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user