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 new file mode 100644 index 0000000..a2a5c3b --- /dev/null +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/listener/OnPrepareItemCraftEvent.java @@ -0,0 +1,11 @@ +package eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener; + +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.InventoryView; + +public class OnPrepareItemCraftEvent { + + public static void onPrepareItemCraftEvent(CraftingInventory what, InventoryView view, boolean isRepair){ + + } +} 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 045014e..83c7dbc 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnPrepareItemCraftEvent.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnPrepareItemCraftEvent.java @@ -14,5 +14,17 @@ public class OnPrepareItemCraftEvent implements Listener { @EventHandler(priority = EventPriority.LOW) public void onPrepareItemCraftEvent(CraftingInventory what, InventoryView view, boolean isRepair){ + ItemStack[] matrix = what.getMatrix(); + + // Check if 2 beacons are in the crafting-slots + int beaconCount = 0; + for (ItemStack item : matrix) { + if(item.getType() == Material.BEACON) + beaconCount++; + } + if(beaconCount == 2){ + // Exactly 2 beacons found + eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener.OnPrepareItemCraftEvent.onPrepareItemCraftEvent(what, view, isRepair); + } } }