Little optimization in island spawn checking

This commit is contained in:
Fabrizio La Rosa 2020-06-20 03:39:55 +02:00
parent fc8a95d1c1
commit 0496fe629d
2 changed files with 3 additions and 4 deletions

View File

@ -128,9 +128,8 @@ public class Block implements Listener {
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
if (LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))
|| LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone()) || LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0.0D, 1.0D, 0.0D))
|| LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Visitor).clone())) {
if (LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D)) || LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0.0D, 1.0D, 0.0D))
|| LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)) {
if (configLoad.getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Break.Message"));

View File

@ -304,7 +304,7 @@ public class Entity implements Listener {
}
if ((event.getEntityType() == EntityType.FALLING_BLOCK)
&& LocationUtil.isLocationLocation(event.getBlock().getLocation(), island.getLocation(world, IslandEnvironment.Main).clone())
&& LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)
&& configLoad.getBoolean("Island.Spawn.Protection")) {
FallingBlock fallingBlock = (FallingBlock) event.getEntity();
if (fallingBlock.getDropItem()) {