Virtual Anvil Error Clicking?

Th
- in Plugins
5

I made an order for an Anvil in my Minecraft plugin. If you enter this command, an Anvil window opens. This works great in itself but with every click in any field this error comes: https://paste.ofcode.org/DU2B3uFR6daM7FBbB4UATg Can I make this mistake? Hide or prevent somehow?

This is how the command looks like:
https://paste.ofcode.org/8y476ZNxPxKAuguD9YWDpP

Al

In the stack trace is the source: PlayerConnection.java:1463
So line 1463 in the class PlayerConnection.

Could you please show the code cutout?

So I guess the error is caused because you clicked into your inventory (slot 30). The anvil does not have this slot and thus the IndexOutOfBoundsException is thrown. When creating the inventory you give as InventoryHolder the respective player. Write instead of player rather zero purely. But only by the way.

So that the IndexOutOfBoundsException does not come anymore, you can simply intercept the relevant slots in the InventoryClickEvent and then cancel the event.

Th

An anvil itself has only 3 slots but the inventory has slots too. Besides, it does not matter if I hit a slot that's on Anvil or not. This error generally comes when I look into it somewhere

Th

I have fixed the error now. You can't just do a Anvil inventory directly

St

Is my research into a mistake in CraftBukkit. You have to do that via NMS.

Th

Thanks, have made it over it now.