Update RandomListeners.java

This commit is contained in:
Luca 2021-11-24 20:58:37 +01:00
parent a9007dcccb
commit 9b061317a7

View File

@ -1,5 +1,6 @@
package rip.tilly.bedwars.listeners;
import org.bukkit.GameMode;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -90,6 +91,10 @@ public class RandomListeners implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (player.getGameMode() == GameMode.CREATIVE) {
return;
}
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId());
if (playerData.getPlayerState() != PlayerState.PLAYING) {
event.setCancelled(true);