Whitelist inventory events
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-11-12 05:23:36 +01:00
parent e6eb4a416b
commit 598dcd7e09

View File

@ -4,10 +4,12 @@ import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import wtf.beatrice.limbomanager.LimboManager;
@ -65,4 +67,20 @@ public class PlayerChecker implements Listener
{
event.setCancelled(true);
}
@EventHandler
public void onInventoryEvent(InventoryEvent event)
{
if(event instanceof Cancellable)
{
if(!(event instanceof InventoryCloseEvent) &&
!(event instanceof InventoryClickEvent) &&
!(event instanceof InventoryDragEvent) &&
!(event instanceof InventoryOpenEvent))
{
((Cancellable) event).setCancelled(true);
}
}
}
}