Prevented blocks from falling off the spawn point.

This commit is contained in:
Brianna 2020-10-12 15:23:20 -05:00
parent 65724fe3da
commit 766a605762
1 changed files with 6 additions and 3 deletions

View File

@ -301,9 +301,12 @@ public class EntityListeners implements Listener {
if ((LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0, 1, 0))
|| LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0, 1, 0)))
&& this.plugin.getConfiguration()
.getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
&& this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) {
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
event.getEntity().remove();
event.getBlock().setType(material.getBlockMaterial());
}, 1L);
return;
}