mirror of
https://github.com/BentoBoxWorld/Limits.git
synced 2025-02-18 13:21:39 +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.block.LeavesDecayEvent;
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
|
|
||||||
import bentobox.addon.limits.Limits;
|
import bentobox.addon.limits.Limits;
|
||||||
import bentobox.addon.limits.objects.IslandBlockCount;
|
import bentobox.addon.limits.objects.IslandBlockCount;
|
||||||
@ -206,6 +207,15 @@ public class BlockLimitsListener implements Listener {
|
|||||||
process(e.getBlock(), false);
|
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) {
|
private int process(Block b, boolean add) {
|
||||||
return process(b, add, b.getType());
|
return process(b, add, b.getType());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user