fix: on interact null pointer exceptions

This commit is contained in:
TreemanKing 2024-12-18 20:46:24 +11:00 committed by GitHub
parent e93ecd0894
commit 53fad3360c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -133,7 +133,17 @@ public class Listeners implements Listener {
&& (event.getAction() == Action.LEFT_CLICK_BLOCK
|| event.getAction() == Action.RIGHT_CLICK_BLOCK)
&& event.getItem() != null) {
if (event.getClickedBlock() == null)
return;
if (event.getItem().getItemMeta() == null)
return;
Location blockloc = event.getClickedBlock().getLocation();
if (blockloc.getWorld() == null)
return;
boolean allowEvent = this.coreListeners.playerInteractWithBlock(
new SpigotPlayerContainer(event.getPlayer()),
event.getClickedBlock().getType().toString(),