Call InventoryPreClickEvent even without any inventory condition

This commit is contained in:
Felix Cravic 2020-08-13 19:14:07 +02:00
parent 23e82e0ae2
commit ef28720496

View File

@ -518,10 +518,8 @@ public class InventoryClickProcessor {
// Wait for inventory conditions + events to possibly close the inventory
player.UNSAFE_changeDidCloseInventory(false);
final List<InventoryCondition> inventoryConditions = isPlayerInventory ?
player.getInventory().getInventoryConditions() : inventory.getInventoryConditions();
if (!inventoryConditions.isEmpty()) {
// PreClickEvent
{
InventoryPreClickEvent inventoryPreClickEvent = new InventoryPreClickEvent(player, inventory, slot, clickType, clicked, cursor);
player.callEvent(InventoryPreClickEvent.class, inventoryPreClickEvent);
cursor = inventoryPreClickEvent.getCursorItem();
@ -531,6 +529,12 @@ public class InventoryClickProcessor {
if (inventoryPreClickEvent.isCancelled()) {
clickResult.setRefresh(true);
}
}
// Inventory conditions
final List<InventoryCondition> inventoryConditions = isPlayerInventory ?
player.getInventory().getInventoryConditions() : inventory.getInventoryConditions();
if (!inventoryConditions.isEmpty()) {
for (InventoryCondition inventoryCondition : inventoryConditions) {
InventoryConditionResult result = new InventoryConditionResult(clicked, cursor);