mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-22 23:31:37 +01:00
Call InventoryPreClickEvent even without any inventory condition
This commit is contained in:
parent
23e82e0ae2
commit
ef28720496
@ -518,10 +518,8 @@ public class InventoryClickProcessor {
|
|||||||
// Wait for inventory conditions + events to possibly close the inventory
|
// Wait for inventory conditions + events to possibly close the inventory
|
||||||
player.UNSAFE_changeDidCloseInventory(false);
|
player.UNSAFE_changeDidCloseInventory(false);
|
||||||
|
|
||||||
final List<InventoryCondition> inventoryConditions = isPlayerInventory ?
|
// PreClickEvent
|
||||||
player.getInventory().getInventoryConditions() : inventory.getInventoryConditions();
|
{
|
||||||
if (!inventoryConditions.isEmpty()) {
|
|
||||||
|
|
||||||
InventoryPreClickEvent inventoryPreClickEvent = new InventoryPreClickEvent(player, inventory, slot, clickType, clicked, cursor);
|
InventoryPreClickEvent inventoryPreClickEvent = new InventoryPreClickEvent(player, inventory, slot, clickType, clicked, cursor);
|
||||||
player.callEvent(InventoryPreClickEvent.class, inventoryPreClickEvent);
|
player.callEvent(InventoryPreClickEvent.class, inventoryPreClickEvent);
|
||||||
cursor = inventoryPreClickEvent.getCursorItem();
|
cursor = inventoryPreClickEvent.getCursorItem();
|
||||||
@ -531,6 +529,12 @@ public class InventoryClickProcessor {
|
|||||||
if (inventoryPreClickEvent.isCancelled()) {
|
if (inventoryPreClickEvent.isCancelled()) {
|
||||||
clickResult.setRefresh(true);
|
clickResult.setRefresh(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inventory conditions
|
||||||
|
final List<InventoryCondition> inventoryConditions = isPlayerInventory ?
|
||||||
|
player.getInventory().getInventoryConditions() : inventory.getInventoryConditions();
|
||||||
|
if (!inventoryConditions.isEmpty()) {
|
||||||
|
|
||||||
for (InventoryCondition inventoryCondition : inventoryConditions) {
|
for (InventoryCondition inventoryCondition : inventoryConditions) {
|
||||||
InventoryConditionResult result = new InventoryConditionResult(clicked, cursor);
|
InventoryConditionResult result = new InventoryConditionResult(clicked, cursor);
|
||||||
|
Loading…
Reference in New Issue
Block a user