Skip to content
Advertisement

Trying to get getView().getTitle() to work

I was first using only getTitle() for this but then found you need to use getView() as well. So i did but I stil can’t get it to work.

FYI This is the error : Cannot resolve method 'getView' in 'Inventory'

I tried changing getInventory() for InventoryView() but still the same error but also the Cannot resolve method 'InventoryView' in 'Chest' error so this means I cant get the inventory view from a block?

JavaScript

Advertisement

Answer

I have figured it out after searching on around 100 sites I found a solution that works, I don’t know if it’s the best solution but good for me.

I changed the whole event to use InventoryOpenEvent insted of PlayerInteractEvent.

Here is the full code :

JavaScript

Here is the code stripped down :

JavaScript
Advertisement