ChestShop-3/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerConnect.java

32 lines
986 B
Java
Raw Normal View History

package com.Acrobot.ChestShop.Listeners.Player;
import org.bukkit.event.EventHandler;
2015-07-05 21:56:42 +02:00
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
2014-04-10 21:52:05 +02:00
import org.bukkit.event.player.PlayerJoinEvent;
2016-09-20 21:45:18 +02:00
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.UUIDs.NameManager;
import com.Acrobot.ChestShop.UUIDs.PlayerDTO;
/**
* @author Acrobot
*/
public class PlayerConnect implements Listener {
2015-07-05 21:56:42 +02:00
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
2015-05-22 13:26:20 +02:00
public static void onPlayerConnect(final PlayerJoinEvent event) {
if (NameManager.getUuidVersion() < 0) {
NameManager.setUuidVersion(event.getPlayer().getUniqueId().version());
}
2015-07-05 21:56:42 +02:00
final PlayerDTO playerDTO = new PlayerDTO(event.getPlayer());
ChestShop.runInAsyncThread(() -> {
if (NameManager.getAccount(playerDTO.getUniqueId()) != null) {
2015-07-05 21:56:42 +02:00
NameManager.storeUsername(playerDTO);
2015-05-22 13:26:20 +02:00
}
});
2014-04-10 21:52:05 +02:00
}
}