Implemented check to detect attempt to break LinkedBeaconTeleporterBlock
This commit is contained in:
parent
376695b466
commit
69fcab7bbc
@ -0,0 +1,11 @@
|
||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener;
|
||||
|
||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterBlock;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
public class OnBlockBreak {
|
||||
|
||||
public static void onBlockBreakEvent(BlockBreakEvent e, LinkedBeaconTeleporterBlock lbtBlock){
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters.listener;
|
||||
|
||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.Main;
|
||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterBlock;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -9,6 +14,16 @@ public class OnBlockBreak implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockBreakEvent(BlockBreakEvent e){
|
||||
Block block = e.getBlock();
|
||||
Location loc = block.getLocation();
|
||||
|
||||
if(block.getType() == Material.BEACON){
|
||||
// Check if this beacon is a LinkedBeaconTeleporter
|
||||
LinkedBeaconTeleporterBlock lbtBlock = LinkedBeaconTeleporterBlock.getFromLocation(loc);
|
||||
|
||||
if(lbtBlock != null){
|
||||
eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener.OnBlockBreak.onBlockBreakEvent(e, lbtBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user