mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
make immutability test before pre anvil bypass event
This commit is contained in:
parent
f4ce267e44
commit
8f408438dc
1 changed files with 5 additions and 6 deletions
|
|
@ -47,16 +47,10 @@ class PrepareAnvilListener : Listener {
|
||||||
// Should find player
|
// Should find player
|
||||||
val player: HumanEntity = InventoryViewUtil.getInstance().getPlayer(event.view)
|
val player: HumanEntity = InventoryViewUtil.getInstance().getPlayer(event.view)
|
||||||
|
|
||||||
// Test if the event should bypass custom anvil.
|
|
||||||
if (DependencyManager.tryEventPreAnvilBypass(event, player)) return
|
|
||||||
|
|
||||||
val inventory = event.inventory
|
val inventory = event.inventory
|
||||||
val first = inventory.getItem(ANVIL_INPUT_LEFT) ?: return
|
val first = inventory.getItem(ANVIL_INPUT_LEFT) ?: return
|
||||||
val second = inventory.getItem(ANVIL_INPUT_RIGHT)
|
val second = inventory.getItem(ANVIL_INPUT_RIGHT)
|
||||||
|
|
||||||
|
|
||||||
if (!player.hasPermission(CustomAnvil.affectedByPluginPermission)) return
|
|
||||||
|
|
||||||
if (isImmutable(first) || isImmutable(second)) {
|
if (isImmutable(first) || isImmutable(second)) {
|
||||||
CustomAnvil.verboseLog("Skipping anvil process as one of the two item is immutable")
|
CustomAnvil.verboseLog("Skipping anvil process as one of the two item is immutable")
|
||||||
|
|
||||||
|
|
@ -64,6 +58,11 @@ class PrepareAnvilListener : Listener {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test if the event should bypass custom anvil.
|
||||||
|
if (DependencyManager.tryEventPreAnvilBypass(event, player)) return
|
||||||
|
|
||||||
|
if (!player.hasPermission(CustomAnvil.affectedByPluginPermission)) return
|
||||||
|
|
||||||
// Test custom recipe
|
// Test custom recipe
|
||||||
if (testCustomRecipe(event, inventory, player, first, second)) return
|
if (testCustomRecipe(event, inventory, player, first, second)) return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue