ChestShop-3/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerConnect.java
Phoenix616 d52c329618
Make compatible with Folia by using own ExecutorService
Our async tasks were already pretty world-independent (update checker as
 well as some logging so this should work pretty well)

For the rest the ORMLite library should already be able to handle access from
 different threads and whether economy plugins are compatible with Folia is
 up to them, not us...
2023-03-23 23:50:43 +01:00

32 lines
986 B
Java

package com.Acrobot.ChestShop.Listeners.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.UUIDs.NameManager;
import com.Acrobot.ChestShop.UUIDs.PlayerDTO;
/**
* @author Acrobot
*/
public class PlayerConnect implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public static void onPlayerConnect(final PlayerJoinEvent event) {
if (NameManager.getUuidVersion() < 0) {
NameManager.setUuidVersion(event.getPlayer().getUniqueId().version());
}
final PlayerDTO playerDTO = new PlayerDTO(event.getPlayer());
ChestShop.runInAsyncThread(() -> {
if (NameManager.getAccount(playerDTO.getUniqueId()) != null) {
NameManager.storeUsername(playerDTO);
}
});
}
}