CouldNotPassPlayerInteracEvent (Minecraft)?

Fu
- in Plugins
4

Hello I'm writing a Lootchest plugin, it works too, but every time you right-click an item there's an error code.

My code:

if (e.getAction () == Action.RIGHT_CLICK_AIR || e.getAction () == Action.RIGHT_CLICK_BLOCK) {
if (e.hasItem ()) {
if (e.getItem (). HasItemMeta ()) {
if (e.getItem (). GetItemMeta (). GetDisplayName (). Equals ("§8 [§2Loot§2Chest§8]")) {
} else {return;}
}
else {return;}
} else {return;}
}

The error code:

Mo

I had the same problem.

I had added the following query

if (e.getItem () == null ||
e.getItem (). GetItemMeta () == null || e.getItem (). GetItemMeta (). GetDisplayName () == null) {
return;
}

Da

In which line is the error? (Line 51 in class)

Va

Yep, he encountered a null pointer exception. Your code should work.

Fu

Thanks, my rescue haha