2012-06-08 15:28:36 +02:00
|
|
|
package com.Acrobot.ChestShop.Listeners.Player;
|
|
|
|
|
|
|
|
import org.bukkit.event.EventHandler;
|
2015-07-05 21:56:42 +02:00
|
|
|
import org.bukkit.event.EventPriority;
|
2012-06-08 15:28:36 +02:00
|
|
|
import org.bukkit.event.Listener;
|
2014-04-10 21:52:05 +02:00
|
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
2012-06-08 15:28:36 +02:00
|
|
|
|
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;
|
2015-08-06 15:19:37 +02:00
|
|
|
|
2012-06-08 15:28:36 +02:00
|
|
|
/**
|
|
|
|
* @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) {
|
2018-08-29 22:29:27 +02:00
|
|
|
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());
|
|
|
|
|
2023-03-23 23:50:08 +01:00
|
|
|
ChestShop.runInAsyncThread(() -> {
|
2020-06-19 21:57:22 +02:00
|
|
|
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
|
|
|
}
|
2012-06-08 15:28:36 +02:00
|
|
|
}
|