How can you make that I can take in my plugin only in a certain inventory no items but in the rest already (Minecraft plugin programming)?

Bi
- in Plugins
6

How can you make that I can take in my plugin only in a certain inventory no items but in the rest already (Minecraft plugin programming)?

Lo

Look who owns the inventory with inventoryholder
and then in the inventoryevents e.setCancelled true

Di

That depends on your spigot version.

First of all, you would need to register a listener with the InventoryClickEvent. When the event is run, you'll need to check the name of the inventory and if it has the name of the inventory whose items should not be removable, you'll need to cancel it.

It looks like this:

@EventHandler
public void onInventoryClick (InventoryClickEvent inventoryClickEvent) {
// Query for the 1.13+
if (inventoryClickEvent.getView (). GetTitle (). Equals ("Inventory")) {
// Item must not be removable
inventoryClickEvent.setCancelled (true);
}

// Query for 1.x - 1.12.2
if (inventoryClickEvent.getTitle (). Equals ("Inventory")) {
// Item must not be removable
inventoryClickEvent.setCancelled (true);
}
}

Di

Very good description - not.

Lo

Hehe. I thought that's enough - not xD

Lo

You should also cancel the InventoryDragEvent

Di

I'm just not sure, can be.