diff --git a/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java b/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java index 3ae497d2..9ebc6ff3 100644 --- a/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java +++ b/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java @@ -19,6 +19,7 @@ import net.minecraft.stats.Stats; import java.util.Objects; +import java.util.concurrent.CompletableFuture; import static com.nexia.discord.NexiaDiscord.jda; @@ -31,7 +32,7 @@ public void registerListener() { //setJoinMessage(player, playerJoinEvent); - PlayerDataManager.dataManagerMap.forEach((resourceLocation, playerDataManager) -> playerDataManager.addPlayerData(player)); + CompletableFuture.runAsync(() -> PlayerDataManager.dataManagerMap.forEach((resourceLocation, playerDataManager) -> playerDataManager.addPlayerData(player))); LobbyUtil.returnToLobby(player, true); checkBooster(player); diff --git a/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java b/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java index 04c7061f..9c372f7b 100644 --- a/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java +++ b/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java @@ -6,6 +6,8 @@ import com.nexia.nexus.api.event.player.PlayerDisconnectEvent; import net.kyori.adventure.text.Component; +import java.util.concurrent.CompletableFuture; + public class PlayerLeaveListener { public void registerListener() { PlayerDisconnectEvent.BACKEND.register(playerDisconnectEvent -> { @@ -15,7 +17,7 @@ public void registerListener() { //setLeaveMessage(player, playerDisconnectEvent); if (playerDisconnectEvent.getPlayer().hasTag("bot")) return; - PlayerDataManager.dataManagerMap.forEach((resourceLocation, playerDataManager) -> playerDataManager.removePlayerData(player)); + CompletableFuture.runAsync(() -> PlayerDataManager.dataManagerMap.forEach((resourceLocation, playerDataManager) -> playerDataManager.removePlayerData(player))); }); } diff --git a/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java b/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java index 461cb904..42b54981 100644 --- a/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java +++ b/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java @@ -23,7 +23,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemCooldowns; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; @@ -38,8 +37,6 @@ public abstract class PlayerMixin extends LivingEntity { @Shadow @Final public Inventory inventory; - @Shadow public abstract ItemCooldowns getCooldowns(); - protected PlayerMixin(EntityType entityType, Level level) { super(entityType, level); }