From 6a4369c527eff4d12d855351ccfb69309bc98f24 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 10 May 2021 00:07:52 +0200 Subject: [PATCH] Fixed Wrong Method-Arguments --- .../listener/OnPrepareItemCraftEvent.java | 6 +++--- .../listener/OnPrepareItemCraftEvent.java | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/listener/OnPrepareItemCraftEvent.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/listener/OnPrepareItemCraftEvent.java index daeecf8..2f30ed7 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/listener/OnPrepareItemCraftEvent.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/listener/OnPrepareItemCraftEvent.java @@ -8,8 +8,8 @@ import org.bukkit.inventory.ItemStack; public class OnPrepareItemCraftEvent { - public static void onPrepareItemCraftEvent(CraftingInventory what, InventoryView view, boolean isRepair){ - ItemStack[] matrix = what.getMatrix(); + public static void onPrepareItemCraftEvent(PrepareItemCraftEvent e){ + ItemStack[] matrix = e.getInventory().getMatrix(); // Check if one of provided items is already LinkedBeaconTeleporterItem and use first if found LinkedBeaconTeleporterItem lbtItem = null; @@ -32,6 +32,6 @@ public class OnPrepareItemCraftEvent { item.setAmount(2); // Set as crafting-result - what.setResult(item); + e.getInventory().setResult(item); } } diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnPrepareItemCraftEvent.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnPrepareItemCraftEvent.java index 83c7dbc..74599e6 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnPrepareItemCraftEvent.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnPrepareItemCraftEvent.java @@ -12,19 +12,20 @@ import org.bukkit.inventory.ItemStack; public class OnPrepareItemCraftEvent implements Listener { @EventHandler(priority = EventPriority.LOW) - public void onPrepareItemCraftEvent(CraftingInventory what, InventoryView view, boolean isRepair){ + public void onPrepareItemCraftEvent(PrepareItemCraftEvent e){ - ItemStack[] matrix = what.getMatrix(); + ItemStack[] matrix = e.getInventory().getMatrix(); // Check if 2 beacons are in the crafting-slots int beaconCount = 0; for (ItemStack item : matrix) { + if(item == null) continue; if(item.getType() == Material.BEACON) beaconCount++; } if(beaconCount == 2){ // Exactly 2 beacons found - eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener.OnPrepareItemCraftEvent.onPrepareItemCraftEvent(what, view, isRepair); + eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener.OnPrepareItemCraftEvent.onPrepareItemCraftEvent(e); } } }