Fix TNT breaking bedrock, increase build height and add a minimum chest place height

This commit is contained in:
AlexTheCoder 2016-10-30 14:22:02 -04:00 committed by Shaun Bennett
parent 1535fcc38b
commit a219a2d072
2 changed files with 16 additions and 6 deletions

View File

@ -54,7 +54,7 @@ public class Crater
{
noRepeats.add(locID);
}
if (block.getType() == Material.AIR || block.isLiquid())
if (block.getType() == Material.AIR || block.isLiquid() || block.getType() == Material.BEDROCK)
{
continue;
}
@ -81,7 +81,7 @@ public class Crater
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _origin, null, 0, 1, ViewDist.NORMAL);
for (Block block : event.getBlocks())
{
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.FURNACE || block.getType() == Material.BURNING_FURNACE)
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.FURNACE || block.getType() == Material.BURNING_FURNACE || block.getType() == Material.BED_BLOCK)
{
block.breakNaturally();
}

View File

@ -80,6 +80,8 @@ import org.bukkit.plugin.java.JavaPlugin;
public class Gameplay extends MiniPlugin
{
private static final int MAX_BUILD_HEIGHT = 120;
private static final int MIN_CHEST_HEIGHT = 30;
private ClansManager _clansManager;
private BlockRestore _blockRestore;
private DamageManager _damageManager;
@ -230,19 +232,27 @@ public class Gameplay extends MiniPlugin
@EventHandler(priority = EventPriority.LOWEST)
public void MaxHeight(BlockPlaceEvent event)
{
if (event.getBlock().getLocation().getBlockY() > 100)
if (event.getBlock().getLocation().getBlockY() > MAX_BUILD_HEIGHT)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place blocks this high."));
event.setCancelled(true);
} else if(event.getBlock().getLocation().getBlockY() == 99 && event.getBlock().getType().name().contains("DOOR") && !event.getBlock().getType().equals(Material.TRAP_DOOR)) {
}
else if(event.getBlock().getLocation().getBlockY() == (MAX_BUILD_HEIGHT - 1) && event.getBlock().getType().name().contains("DOOR") && event.getBlock().getType() != Material.TRAP_DOOR && event.getBlock().getType() != Material.IRON_TRAPDOOR)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place blocks this high."));
event.setCancelled(true);
}
if (event.getBlock().getLocation().getBlockY() < MIN_CHEST_HEIGHT && (event.getBlock().getType() == Material.CHEST || event.getBlock().getType() == Material.TRAPPED_CHEST))
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void GrowTree(StructureGrowEvent event) {
event.getBlocks().stream().filter(blockState -> blockState.getLocation().getBlockY() > 100).forEach(blockState -> blockState.setType(Material.AIR) );
public void GrowTree(StructureGrowEvent event)
{
event.getBlocks().stream().filter(blockState -> blockState.getLocation().getBlockY() > MAX_BUILD_HEIGHT).forEach(blockState -> blockState.setType(Material.AIR) );
}
/**