Remove grass only from used spawns

This commit is contained in:
Thanos paravantis 2016-04-19 14:17:32 +03:00
parent 20fdb1f21c
commit 17c51f03ad
3 changed files with 20 additions and 2 deletions

View File

@ -389,7 +389,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
_deathEffect.removeSpawnedEntities(); _deathEffect.removeSpawnedEntities();
setupChallengeSpawnLocations(); setupChallengeSpawnLocations();
System.out.println("Spawns: " + _challenge.getData().getDefinedSpawns().size());
_challenge.createMap(); _challenge.createMap();
if (_settings.canMarkSpawnLocations()) if (_settings.canMarkSpawnLocations())
@ -549,6 +548,20 @@ public class BawkBawkBattles extends TeamGame implements IThrown
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
_playersTeam.SpawnTeleport(player); _playersTeam.SpawnTeleport(player);
removeSolidBlock(player.getLocation());
}
}
@SuppressWarnings("deprecation")
private void removeSolidBlock(Location location)
{
Block block = location.getBlock();
if (!block.isEmpty() && _challenge.getData().isModifiedBlock(block))
{
block.setType(Material.AIR);
block.setData((byte) 0);
_challenge.getData().removeModifiedBlock(block);
} }
} }

View File

@ -188,7 +188,7 @@ public abstract class Challenge implements Listener
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
protected Block generateGrass(Block block) protected Block generateGrass(Block block)
{ {
if (!Data.isSpawnLocation(block.getLocation()) && UtilMath.r(4) == 0) if (UtilMath.r(4) == 0)
{ {
if (UtilMath.r(8) == 0) if (UtilMath.r(8) == 0)
{ {

View File

@ -121,6 +121,11 @@ public class ChallengeData
_modifiedBlocks.add(block); _modifiedBlocks.add(block);
} }
public boolean isModifiedBlock(Block block)
{
return _modifiedBlocks.contains(block);
}
public void removeModifiedBlock(Block block) public void removeModifiedBlock(Block block)
{ {
_modifiedBlocks.remove(block); _modifiedBlocks.remove(block);