More changes and fixes.

This commit is contained in:
Virizion 2016-01-12 23:29:08 -05:00
parent 528a7435e7
commit dfd5a63b78
3 changed files with 68 additions and 9 deletions

View File

@ -355,6 +355,8 @@ public class SpeedBuilder extends SoloGame
}
}
Manager.getCosmeticManager().setHideParticles(true);
}
@ -373,6 +375,8 @@ public class SpeedBuilder extends SoloGame
_currentBuild = UtilAlg.Random(_buildData);
HashSet<Location> usedBuildLocs = new HashSet<Location>();
for (Player player : GetPlayers(true))
{
Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW"));
@ -381,9 +385,24 @@ public class SpeedBuilder extends SoloGame
_buildRecreations.put(player, new RecreationData(this, player, buildLoc, spawnLoc));
_buildRecreations.get(player).pasteBuildData(_currentBuild);
usedBuildLocs.add(buildLoc);
}
Announce(F.main("Build", "You will recreate this build."));
for (Location loc : WorldData.GetDataLocs("YELLOW"))
{
if (!usedBuildLocs.contains(loc))
{
HashSet<Block> blocks = UtilBlock.findConnectedBlocks(loc.getBlock(), loc.getBlock(), null, 2000, 8);
Manager.GetExplosion().BlockExplosion(blocks, loc, false, true);
}
}
for (Player player : GetTeamList().get(0).GetPlayers(true))
{
UtilPlayer.message(player, F.main("Build", "Recreate the build shown."));
}
setSpeedBuilderState(SpeedBuilderState.VIEWING);
}
@ -727,6 +746,8 @@ public class SpeedBuilder extends SoloGame
for (RecreationData recreation : _buildRecreations.values())
{
recreation.Player.teleport(recreation.PlayerSpawn);
recreation.pasteBuildData(_currentBuild);
}
@ -787,7 +808,7 @@ public class SpeedBuilder extends SoloGame
//Eliminate in order This also means that the empty builds are eliminated first
final RecreationData eliminating = _toEliminate.get(0);
judgeTargetLocation(eliminating.getMidpoint());
judgeTargetLocation(eliminating.OriginalBuildLocation.clone().subtract(0, 1.7, 0));
UtilTextMiddle.display("", C.cRed + eliminating.Player.getName() + C.cGreen + " was eliminated!", 0, 30, 10);
@ -933,6 +954,9 @@ public class SpeedBuilder extends SoloGame
if (!_buildRecreations.get(event.getPlayer()).inBuildArea(event.getClickedBlock()))
return;
if (event.getClickedBlock().getType() == Material.AIR)
return;
_buildRecreations.get(event.getPlayer()).addToDemolition(event.getClickedBlock());
}
@ -1000,7 +1024,26 @@ public class SpeedBuilder extends SoloGame
UtilPlayer.sendPacket(player, packetLook, packetRot);
}
}
@EventHandler
public void specNightVision(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.SEC)
return;
for (Player player : UtilServer.getPlayers())
{
if (UtilPlayer.isSpectator(player) || (GetTeamList().size() > 1 && GetTeamList().get(1).HasPlayer(player)))
{
Manager.GetCondition().Factory().NightVision("Spectator Night Vision", player, null, Integer.MAX_VALUE, 0, false, false, true);
Manager.GetCondition().Factory().Breath("Spectator Water Vision", player, null, Integer.MAX_VALUE, 0, false, false, true);
}
}
}
// @EventHandler
// public void stopJudgeUnspec(UpdateEvent event)
// {

View File

@ -118,6 +118,13 @@ public class DemolitionData
if (block.getType() == Material.AIR)
continue;
//Ignore top double plant blocks
if (block.getType() == Material.DOUBLE_PLANT)
{
if (block.getData() > 7)
continue;
}
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
{
Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack);
@ -146,10 +153,11 @@ public class DemolitionData
}
else if (block.getType() == Material.DOUBLE_PLANT)
{
if (block.getData() > 7)
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR);
else
//The top block does not carry the correct data
if (block.getData() <= 7)
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);

View File

@ -168,6 +168,13 @@ public class RecreationData
if (block.getType() == Material.AIR)
continue;
//Ignore top double plant blocks
if (block.getType() == Material.DOUBLE_PLANT)
{
if (block.getData() > 7)
continue;
}
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
{
Item item = block.getWorld().dropItem(getMidpoint(), itemStack);
@ -196,10 +203,11 @@ public class RecreationData
}
else if (block.getType() == Material.DOUBLE_PLANT)
{
if (block.getData() > 7)
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR);
else
//The top block does not carry the correct data
if (block.getData() <= 7)
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
}