Should fix the lag, hopefully

This commit is contained in:
Andrzej Pomirski 2015-05-22 13:26:20 +02:00
parent 02673dec94
commit cd3781c26c

View File

@ -1,6 +1,8 @@
package com.Acrobot.ChestShop.Listeners.Player;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.UUIDs.NameManager;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
@ -10,7 +12,12 @@ import org.bukkit.event.player.PlayerJoinEvent;
*/
public class PlayerConnect implements Listener {
@EventHandler
public static void onPlayerConnect(PlayerJoinEvent event) {
NameManager.storeUsername(event.getPlayer());
public static void onPlayerConnect(final PlayerJoinEvent event) {
Bukkit.getScheduler().runTaskAsynchronously(ChestShop.getPlugin(), new Runnable() {
@Override
public void run() {
NameManager.storeUsername(event.getPlayer());
}
});
}
}