Fixed Wrong Method-Arguments

master
Ruakij 4 years ago
parent a7a8a4b037
commit 6a4369c527

@ -8,8 +8,8 @@ import org.bukkit.inventory.ItemStack;
public class OnPrepareItemCraftEvent { public class OnPrepareItemCraftEvent {
public static void onPrepareItemCraftEvent(CraftingInventory what, InventoryView view, boolean isRepair){ public static void onPrepareItemCraftEvent(PrepareItemCraftEvent e){
ItemStack[] matrix = what.getMatrix(); ItemStack[] matrix = e.getInventory().getMatrix();
// Check if one of provided items is already LinkedBeaconTeleporterItem and use first if found // Check if one of provided items is already LinkedBeaconTeleporterItem and use first if found
LinkedBeaconTeleporterItem lbtItem = null; LinkedBeaconTeleporterItem lbtItem = null;
@ -32,6 +32,6 @@ public class OnPrepareItemCraftEvent {
item.setAmount(2); item.setAmount(2);
// Set as crafting-result // Set as crafting-result
what.setResult(item); e.getInventory().setResult(item);
} }
} }

@ -12,19 +12,20 @@ import org.bukkit.inventory.ItemStack;
public class OnPrepareItemCraftEvent implements Listener { public class OnPrepareItemCraftEvent implements Listener {
@EventHandler(priority = EventPriority.LOW) @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 // Check if 2 beacons are in the crafting-slots
int beaconCount = 0; int beaconCount = 0;
for (ItemStack item : matrix) { for (ItemStack item : matrix) {
if(item == null) continue;
if(item.getType() == Material.BEACON) if(item.getType() == Material.BEACON)
beaconCount++; beaconCount++;
} }
if(beaconCount == 2){ if(beaconCount == 2){
// Exactly 2 beacons found // Exactly 2 beacons found
eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener.OnPrepareItemCraftEvent.onPrepareItemCraftEvent(what, view, isRepair); eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener.OnPrepareItemCraftEvent.onPrepareItemCraftEvent(e);
} }
} }
} }

Loading…
Cancel
Save