Make the FloorIsLava tracker even more forgiving

This commit is contained in:
Sam 2017-11-21 10:24:47 +00:00 committed by Alexander Meech
parent 21319764a5
commit f572007dad
1 changed files with 12 additions and 2 deletions

View File

@ -7,10 +7,10 @@ import java.util.concurrent.TimeUnit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -69,8 +69,18 @@ public class FloorIsLavaTracker extends StatTracker<CakeWars>
Location location = player.getLocation(); Location location = player.getLocation();
Block block = location.getBlock(); Block block = location.getBlock();
Set<Block> blocks = getGame().getCakePlayerModule().getPlacedBlocks(); Set<Block> blocks = getGame().getCakePlayerModule().getPlacedBlocks();
boolean surrounding = false;
return !blocks.contains(block) && !blocks.contains(block.getRelative(BlockFace.DOWN)) && UtilEnt.isGrounded(player) && !getGame().getCakeShopModule().isNearShop(location); for (Block nearby : UtilBlock.getSurrounding(block, true))
{
if (blocks.contains(nearby))
{
surrounding = true;
break;
}
}
return !blocks.contains(block) && !surrounding && UtilEnt.onBlock(player) && !getGame().getCakeShopModule().isNearShop(location);
}); });
} }
} }