diff --git a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java index 8439761d..5bf610d8 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java @@ -11,6 +11,8 @@ import dev.lrxh.neptune.providers.manager.IService; import dev.lrxh.neptune.utils.ConfigFile; import lombok.Getter; + +import org.bukkit.GameMode; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; @@ -46,6 +48,7 @@ Item getItem(Hotbar inventory, int slot) { public void giveItems(Player player) { player.getInventory().clear(); ProfileState profileState = API.getProfile(player).getState(); + if (API.getProfile(player).getMatch() == null && player.getGameMode() == GameMode.CREATIVE) return; if (profileState.equals(ProfileState.IN_KIT_EDITOR)) return; Hotbar inventory = items.get(profileState); diff --git a/Plugin/src/main/java/dev/lrxh/neptune/providers/listeners/GlobalListener.java b/Plugin/src/main/java/dev/lrxh/neptune/providers/listeners/GlobalListener.java index 16b84014..6f3e9538 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/providers/listeners/GlobalListener.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/providers/listeners/GlobalListener.java @@ -2,6 +2,7 @@ import dev.lrxh.neptune.API; import dev.lrxh.neptune.Neptune; +import dev.lrxh.neptune.feature.hotbar.HotbarService; import dev.lrxh.neptune.profile.data.ProfileState; import dev.lrxh.neptune.profile.impl.Profile; import dev.lrxh.neptune.utils.CC; @@ -244,4 +245,13 @@ public void onRespawn(PlayerRespawnEvent event) { Player player = event.getPlayer(); event.setRespawnLocation(player.getLocation()); } + + @EventHandler + public void onGamemodeChange(PlayerGameModeChangeEvent event) { + Player player = event.getPlayer(); + Profile profile = API.getProfile(player); + if (profile == null) return; + if (isPlayerNotInMatch(profile)) + HotbarService.get().giveItems(player); + } } \ No newline at end of file