|
|
@ -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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|