Implemented check to detect attempt to place LinkedBeaconTeleporterItem
parent
90443d51f7
commit
0b538db2a4
@ -0,0 +1,11 @@
|
|||||||
|
package eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener;
|
||||||
|
|
||||||
|
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterItem;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
|
||||||
|
public class OnBlockPlace {
|
||||||
|
|
||||||
|
public static void onBlockPlaceEvent(BlockPlaceEvent e, LinkedBeaconTeleporterItem lbtItem){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,28 @@
|
|||||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters.listener;
|
package eu.ruekov.ruakij.LinkedBeaconTeleporters.listener;
|
||||||
|
|
||||||
|
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class OnBlockPlace implements Listener {
|
public class OnBlockPlace implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onBlockPlaceEvent(BlockPlaceEvent e){
|
public void onBlockPlaceEvent(BlockPlaceEvent e){
|
||||||
|
ItemStack item = e.getItemInHand();
|
||||||
|
|
||||||
|
|
||||||
|
if(item.getType() == Material.BEACON){
|
||||||
|
// Check if this beacon is a LinkedBeaconTeleporter
|
||||||
|
LinkedBeaconTeleporterItem lbtItem = LinkedBeaconTeleporterItem.getFromItemStack(item);
|
||||||
|
|
||||||
|
if(lbtItem != null){
|
||||||
|
eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener.OnBlockPlace.onBlockPlaceEvent(e, lbtItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue