mirror of
https://github.com/BentoBoxWorld/Limits.git
synced 2024-11-22 18:46:02 +01:00
Added BlockFromToEvent (when lava/water removes blocks) (#13)
I've only added redstone things because they are the most common blocks to be limited and removed by water/lava.
This commit is contained in:
parent
36ee63a70b
commit
f4740869da
@ -28,6 +28,7 @@ import org.bukkit.event.block.EntityBlockFormEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
|
||||
import bentobox.addon.limits.Limits;
|
||||
import bentobox.addon.limits.objects.IslandBlockCount;
|
||||
@ -206,6 +207,15 @@ public class BlockLimitsListener implements Listener {
|
||||
process(e.getBlock(), false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlock(BlockFromToEvent e) {
|
||||
if (e.getBlock().isLiquid()){
|
||||
if (e.getToBlock().getType() == Material.REDSTONE_WIRE || e.getToBlock().getType() == Material.REPEATER || e.getToBlock().getType() == Material.COMPARATOR || e.getToBlock().getType() == Material.REDSTONE_TORCH) {
|
||||
process(e.getToBlock(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int process(Block b, boolean add) {
|
||||
return process(b, add, b.getType());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user