Add early return for brewing stand hopper check (#5208)

This commit is contained in:
Warrior
2025-08-23 21:37:11 +02:00
committed by GitHub
parent 7cf4409c35
commit ba673a02d0

View File

@@ -406,23 +406,17 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) { public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
/* WORLD BLACKLIST CHECK */
if (event.getSource().getLocation() != null) {
if (WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld())) {
return;
}
}
final Inventory inventory = event.getDestination(); final Inventory inventory = event.getDestination();
if (!(inventory instanceof BrewerInventory)) { if (!(inventory instanceof BrewerInventory)) {
return; return;
} }
final InventoryHolder holder = inventory.getHolder(); /* WORLD BLACKLIST CHECK */
final Location sourceLocation = event.getSource().getLocation();
if (holder instanceof BrewingStand brewingStand) { if (sourceLocation != null && WorldBlacklist.isWorldBlacklisted(sourceLocation.getWorld())) {
return;
}
ItemStack item = event.getItem(); ItemStack item = event.getItem();
@@ -439,6 +433,14 @@ public class InventoryListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (!mcMMO.p.getGeneralConfig().getEnabledForHoppers()) {
return;
}
final InventoryHolder holder = inventory.getHolder();
if (holder instanceof BrewingStand brewingStand) {
int ingredientLevel = 1; int ingredientLevel = 1;
OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(brewingStand); OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(brewingStand);
@@ -449,8 +451,7 @@ public class InventoryListener implements Listener {
} }
} }
if (mcMMO.p.getGeneralConfig().getEnabledForHoppers() if (AlchemyPotionBrewer.isValidIngredientByLevel(ingredientLevel, item)) {
&& AlchemyPotionBrewer.isValidIngredientByLevel(ingredientLevel, item)) {
AlchemyPotionBrewer.scheduleCheck(brewingStand); AlchemyPotionBrewer.scheduleCheck(brewingStand);
} }
} }