Remove unnecessary tabs. Make the judge guardian use it's own laser again.

This commit is contained in:
Virizion 2016-01-24 21:55:57 -05:00
parent 0eda813d41
commit bfe9aa7a59
7 changed files with 118 additions and 131 deletions

View File

@ -95,45 +95,44 @@ public class SpeedBuilders extends SoloGame
public int BuildSizeDiv2 = BuildSize / 2;
public int BuildSizeMin1 = BuildSize - 1;
public int BuildSizePow3 = BuildSize * BuildSize * BuildSize;
private SpeedBuildersState _state = SpeedBuildersState.VIEWING;
private long _stateTime = System.currentTimeMillis();
private int _roundsPlayed;
private int _buildCountStage;
private int _viewCountStage;
private int _buildTimeTracker = 40;
private int _buildTime = 40;
private int _viewTime = 8;
private Location _buildMiddle;
private ArrayList<BuildData> _buildData = new ArrayList<BuildData>();
private ArrayList<BuildData> _usedBuilds = new ArrayList<>();
private BuildData _currentBuild;
private BlockState[][] _defaultMiddleGround = new BlockState[BuildSize][BuildSize];
private ArrayList<Entity> _middleMobs = new ArrayList<Entity>();
private NautHashMap<Player, RecreationData> _buildRecreations = new NautHashMap<Player, RecreationData>();
private ArmorStand _judgeEntity;
private DisguiseGuardian _judgeDisguise;
private Location _judgeSpawn;
private ArmorStand _judgeLaserHelper;
private ArmorStand _judgeLaserTarget;
private ArrayList<RecreationData> _toEliminate = new ArrayList<RecreationData>();
private long _lastElimination;
private boolean _eliminating;
// Track the time we switch to review so we can give players 8 seconds to look around
private long _reviewStartTime;
private NautHashMap<Player, Long> _perfectBuild = new NautHashMap<Player, Long>();
private boolean _allPerfect;
private Location _lookTarget;
private ArmorStand _lookStand;
private long _targetReached;
@ -141,7 +140,7 @@ public class SpeedBuilders extends SoloGame
private RecreationData _lastRecreationTarget;
private double _standMoveProgress;
private Location _standStart;
public SpeedBuilders(ArcadeManager manager)
{
super(manager, GameType.SpeedBuilders,
@ -178,7 +177,7 @@ public class SpeedBuilders extends SoloGame
new SpeediestBuilderizerTracker(this)
);
}
@Override
public void ParseData()
{
@ -229,28 +228,28 @@ public class SpeedBuilders extends SoloGame
loc.setDirection(UtilAlg.getTrajectory(loc, _buildMiddle.clone().add(0.5, 0, 0.5)));
}
}
public void setSpeedBuilderState(SpeedBuildersState state)
{
_state = state;
_stateTime = System.currentTimeMillis();
}
public SpeedBuildersState getSpeedBuilderState()
{
return _state;
}
public long getSpeedBuilderStateTime()
{
return _stateTime;
}
public int getRoundsPlayed()
{
return _roundsPlayed;
}
public void clearCenterArea(boolean resetGround)
{
Location buildMin = _buildMiddle.clone().subtract(BuildSizeDiv2, 0, BuildSizeDiv2);
@ -279,7 +278,7 @@ public class SpeedBuilders extends SoloGame
}
}
}
public void pasteBuildInCenter(BuildData buildData)
{
clearCenterArea(true);
@ -323,7 +322,7 @@ public class SpeedBuilders extends SoloGame
CreatureAllowOverride = false;
}
public void spawnJudge()
{
CreatureAllowOverride = true;
@ -344,7 +343,7 @@ public class SpeedBuilders extends SoloGame
Manager.GetDisguise().disguise(_judgeDisguise);
}
public void despawnJudge()
{
Manager.GetDisguise().undisguise(_judgeEntity);
@ -354,53 +353,41 @@ public class SpeedBuilders extends SoloGame
_judgeDisguise = null;
_judgeEntity = null;
}
public void judgeTargetLocation(Location loc)
{
if (loc == null)
{
if (_judgeLaserTarget == null)
return;
Manager.GetDisguise().undisguise(_judgeLaserHelper);
_judgeLaserHelper.remove();
_judgeLaserTarget.remove();
_judgeLaserHelper = null;
_judgeLaserTarget = null;
_judgeDisguise.setTarget(0);
Manager.GetDisguise().updateDisguise(_judgeDisguise);
}
else
{
if (_judgeLaserTarget != null)
judgeTargetLocation(null);
CreatureAllowOverride = true;
_judgeLaserHelper = _judgeEntity.getWorld().spawn(_judgeEntity.getLocation().subtract(_judgeEntity.getLocation().getDirection().multiply(2)), ArmorStand.class);
_judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class);
CreatureAllowOverride = false;
_judgeLaserHelper.setVisible(false);
_judgeLaserHelper.setGravity(false);
_judgeLaserHelper.setSmall(true);
_judgeLaserTarget.setVisible(false);
_judgeLaserTarget.setGravity(false);
_judgeLaserTarget.setSmall(true);
UtilEnt.CreatureLook(_judgeEntity, _judgeLaserTarget.getLocation());
DisguiseGuardian disguise = new DisguiseGuardian(_judgeLaserHelper);
disguise.setTarget(_judgeLaserTarget.getEntityId());
disguise.setInvisible(true);
_judgeDisguise.setTarget(_judgeLaserTarget.getEntityId());
Manager.GetDisguise().disguise(disguise);
Manager.GetDisguise().updateDisguise(_judgeDisguise);
}
}
public void moveToGuardians(Player player, boolean elimination)
{
if (elimination)
@ -424,7 +411,7 @@ public class SpeedBuilders extends SoloGame
EndCheck();
}
@EventHandler(priority = EventPriority.MONITOR)
public void teamGen(GameStateChangeEvent event)
{
@ -439,7 +426,7 @@ public class SpeedBuilders extends SoloGame
AddTeam(guardians);
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPrepare(GameStateChangeEvent event)
{
@ -462,7 +449,7 @@ public class SpeedBuilders extends SoloGame
Manager.getCosmeticManager().setHideParticles(true);
}
@EventHandler
public void onLive(GameStateChangeEvent event)
{
@ -515,7 +502,7 @@ public class SpeedBuilders extends SoloGame
setSpeedBuilderState(SpeedBuildersState.VIEWING);
}
@EventHandler
public void onEnd(GameStateChangeEvent event)
{
@ -541,7 +528,7 @@ public class SpeedBuilders extends SoloGame
_toEliminate.remove(recreation);
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
@ -588,20 +575,20 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!"));
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBuildFinish(final BlockPlaceEvent event)
{
checkPerfectBuild(event.getPlayer());
}
//This is here because if you open a door then close it you won't be informed of a perfect build
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void interactInformSuccess(PlayerInteractEvent event)
{
checkPerfectBuild(event.getPlayer());
}
public void checkPerfectBuild(Player player)
{
if (_perfectBuild.containsKey(player))
@ -652,7 +639,7 @@ public class SpeedBuilders extends SoloGame
}
}, 1L);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
@ -667,13 +654,13 @@ public class SpeedBuilders extends SoloGame
else
event.setCancelled(true);
}
@EventHandler
public void stopItemMerge(ItemMergeEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void stopMoveOffArea(UpdateEvent event)
{
@ -710,7 +697,7 @@ public class SpeedBuilders extends SoloGame
}
}
}
@EventHandler
public void stopGuardiansBuildEnter(UpdateEvent event)
{
@ -734,7 +721,7 @@ public class SpeedBuilders extends SoloGame
}
}
}
@EventHandler
public void stateUpdate(UpdateEvent event)
{
@ -1013,7 +1000,7 @@ public class SpeedBuilders extends SoloGame
}
}
}
@EventHandler
public void buildTimeProgressBar(UpdateEvent event)
{
@ -1033,7 +1020,7 @@ public class SpeedBuilders extends SoloGame
UtilTextBottom.displayProgress("Time Left", timeLeft / (_buildTime * 1000.0D), UtilTime.MakeStr(timeLeft), UtilServer.getPlayers());
}
@EventHandler
public void buildEndCountdown(UpdateEvent event)
{
@ -1072,7 +1059,7 @@ public class SpeedBuilders extends SoloGame
_buildCountStage++;
}
}
@EventHandler
public void viewCountdown(UpdateEvent event)
{
@ -1103,7 +1090,7 @@ public class SpeedBuilders extends SoloGame
_viewCountStage++;
}
}
@EventHandler
public void markBlockForDemolition(PlayerInteractEvent event)
{
@ -1127,7 +1114,7 @@ public class SpeedBuilders extends SoloGame
_buildRecreations.get(event.getPlayer()).addToDemolition(event.getClickedBlock());
}
@EventHandler
public void markMobForDemolition(EntityDamageByEntityEvent event)
{
@ -1150,7 +1137,7 @@ public class SpeedBuilders extends SoloGame
_buildRecreations.get(player).addToDemolition(event.getEntity());
}
@EventHandler
public void updateDemolitionBlocks(UpdateEvent event)
{
@ -1170,13 +1157,13 @@ public class SpeedBuilders extends SoloGame
}
}
}
@EventHandler
public void preventBlockGrowth(BlockGrowEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void preventStructureGrowth(StructureGrowEvent event)
{
@ -1242,7 +1229,7 @@ public class SpeedBuilders extends SoloGame
_standMoveProgress += 0.2;
}
private void moveEntity(Location loc, Entity entity)
{
double dx = loc.getX() - entity.getLocation().getX();
@ -1251,7 +1238,7 @@ public class SpeedBuilders extends SoloGame
((CraftEntity) entity).getHandle().move(dx, dy, dz);
}
@EventHandler
public void specNightVision(UpdateEvent event)
{
@ -1292,7 +1279,7 @@ public class SpeedBuilders extends SoloGame
// Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false);
// }
// }
@EventHandler
public void stopGuardianSpecPickup(PlayerPickupItemEvent event)
{
@ -1302,7 +1289,7 @@ public class SpeedBuilders extends SoloGame
if (Manager.isSpectator(event.getPlayer()) || GetTeamList().get(1).HasPlayer(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void stopGuardianSpecPlace(BlockPlaceEvent event)
{
@ -1312,7 +1299,7 @@ public class SpeedBuilders extends SoloGame
if (Manager.isSpectator(event.getPlayer()) || GetTeamList().get(1).HasPlayer(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void stopEntityChangeBlock(EntityChangeBlockEvent event)
{
@ -1321,7 +1308,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void stopBlockFade(BlockFadeEvent event)
{
@ -1330,7 +1317,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void stopBlockBurn(BlockBurnEvent event)
{
@ -1339,7 +1326,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void stopLeavesDecay(LeavesDecayEvent event)
{
@ -1348,7 +1335,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void stopBlockForm(BlockFormEvent event)
{
@ -1357,7 +1344,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void stopBlockSpread(BlockSpreadEvent event)
{
@ -1366,7 +1353,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void stopLiquidLeaks(BlockFromToEvent event)
{
@ -1376,7 +1363,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
}
@EventHandler
public void stopPhysics(BlockPhysicsEvent event)
{
@ -1385,7 +1372,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
{
@ -1407,7 +1394,7 @@ public class SpeedBuilders extends SoloGame
UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!"));
}
}
@EventHandler
public void onPlayerBucketFill(PlayerBucketFillEvent event)
{
@ -1429,7 +1416,7 @@ public class SpeedBuilders extends SoloGame
UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!"));
}
}
@EventHandler
public void addMob(PlayerInteractEvent event)
{
@ -1471,7 +1458,7 @@ public class SpeedBuilders extends SoloGame
UtilInv.remove(event.getPlayer(), Material.MONSTER_EGG, (byte) event.getItem().getDurability(), 1);
}
@EventHandler
public void stopCombust(EntityCombustEvent event)
{
@ -1480,7 +1467,7 @@ public class SpeedBuilders extends SoloGame
event.setCancelled(true);
}
//Add to guardians before arcade manager adds to spectator to trick it into thinking the player is "alive"
@EventHandler(priority = EventPriority.LOW)
public void joinAddGuardian(PlayerJoinEvent event)
@ -1508,7 +1495,7 @@ public class SpeedBuilders extends SoloGame
}
}, 1);
}
@Override
public void EndCheck()
{
@ -1542,7 +1529,7 @@ public class SpeedBuilders extends SoloGame
SetState(GameState.End);
}
}
@Override
public List<Player> getLosers()
{
@ -1558,7 +1545,7 @@ public class SpeedBuilders extends SoloGame
return losers;
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)

View File

@ -6,5 +6,5 @@ public enum SpeedBuildersState
VIEWING,
BUILDING,
REVIEWING;
}

View File

@ -22,17 +22,17 @@ import org.bukkit.material.Stairs;
public class BuildData
{
public SpeedBuilders Game;
public Location BuildMin;
public BlockState[][][] Build;
public BlockState[][] Ground;
//Store stair shapes for stair fix
public EnumStairShape[][][] StairShapes;
public String BuildText;
public ArrayList<MobData> Mobs = new ArrayList<MobData>();
private int _timeAdd = 0;

View File

@ -24,19 +24,19 @@ import org.bukkit.material.Door;
public class DemolitionData
{
public RecreationData Parent;
public NautHashMap<Block, BlockState> Blocks;
public ArrayList<Entity> Mobs;
public long Start;
private Hologram _hologram;
private boolean _flickerAir = true;
private long _lastFlicker = System.currentTimeMillis();
public DemolitionData(RecreationData parent, ArrayList<Block> blocks, ArrayList<Entity> mobs)
{
Parent = parent;
@ -53,7 +53,7 @@ public class DemolitionData
spawnHologram();
}
public void spawnHologram()
{
Location loc = Parent.getMidpoint();
@ -67,14 +67,14 @@ public class DemolitionData
_hologram.start();
}
public void despawnHologram()
{
_hologram.stop();
_hologram = null;
}
public void update()
{
int secondsLeft = (int) Math.ceil((3000 - (System.currentTimeMillis() - Start)) / 1000.0D);
@ -110,7 +110,7 @@ public class DemolitionData
if (secondsLeft == 0)
breakBlocks();
}
public void cancelBreak()
{
despawnHologram();
@ -127,7 +127,7 @@ public class DemolitionData
Parent.BlocksForDemolition.remove(this);
}
public void breakBlocks()
{
despawnHologram();
@ -207,5 +207,5 @@ public class DemolitionData
Parent.Game.checkPerfectBuild(Parent.Player);
}
}

View File

@ -4,13 +4,13 @@ import org.bukkit.entity.EntityType;
public class MobData
{
public EntityType EntityType;
public int DX;
public int DY;
public int DZ;
public MobData(EntityType entityType, int dx, int dy, int dz)
{
EntityType = entityType;
@ -19,5 +19,5 @@ public class MobData
DY = dy;
DZ = dz;
}
}

View File

@ -34,26 +34,26 @@ import org.bukkit.util.Vector;
public class RecreationData
{
public SpeedBuilders Game;
public Player Player;
public BlockState[][] DefaultGround;
public Location OriginalBuildLocation;
public Location CornerA;
public Location CornerB;
public Location PlayerSpawn;
public NautHashMap<Item, Long> DroppedItems = new NautHashMap<Item, Long>();
public ArrayList<DemolitionData> BlocksForDemolition = new ArrayList<DemolitionData>();
public ArrayList<Entity> Mobs = new ArrayList<Entity>();
public RecreationData(SpeedBuilders game, Player player, Location loc, Location playerSpawn)
{
Game = game;
@ -77,7 +77,7 @@ public class RecreationData
}
}
}
public boolean inBuildArea(Block block)
{
if (block.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
@ -100,7 +100,7 @@ public class RecreationData
return true;
}
public boolean inBuildArea(Location loc)
{
if (loc.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
@ -123,7 +123,7 @@ public class RecreationData
return true;
}
public void clearBuildArea(boolean resetGround)
{
for (Block block : getBlocks())
@ -149,7 +149,7 @@ public class RecreationData
}
}
}
public void pasteBuildData(BuildData buildData)
{
clearBuildArea(true);
@ -189,7 +189,7 @@ public class RecreationData
Game.CreatureAllowOverride = false;
}
public void breakAndDropItems()
{
for (Block block : getBlocks())
@ -263,7 +263,7 @@ public class RecreationData
item.setVelocity(Player.getLocation().toVector().subtract(item.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
}
}
public boolean isEmptyBuild(BuildData buildData)
{
for (Block block : getBlocks())
@ -277,7 +277,7 @@ public class RecreationData
return true;
}
public int calculateScoreFromBuild(BuildData buildData)
{
int score = 0;
@ -348,17 +348,17 @@ public class RecreationData
return score;
}
public Location getMidpoint()
{
return UtilAlg.getMidpoint(CornerA, CornerB.clone().add(1, 1, 1));
}
public List<Block> getBlocks()
{
return UtilBlock.getInBoundingBox(CornerA, CornerB);
}
public boolean isQueuedForDemolition(Block block)
{
for (DemolitionData demolition : BlocksForDemolition)
@ -369,7 +369,7 @@ public class RecreationData
return false;
}
public boolean isQueuedForDemolition(Entity entity)
{
for (DemolitionData demolition : BlocksForDemolition)
@ -380,7 +380,7 @@ public class RecreationData
return false;
}
public void addToDemolition(Block block)
{
if (isQueuedForDemolition(block))
@ -418,7 +418,7 @@ public class RecreationData
BlocksForDemolition.add(new DemolitionData(this, blocks, new ArrayList<Entity>()));
}
public void addToDemolition(Entity entity)
{
if (isQueuedForDemolition(entity))
@ -429,5 +429,5 @@ public class RecreationData
BlocksForDemolition.add(new DemolitionData(this, new ArrayList<Block>(), mobs));
}
}

View File

@ -20,7 +20,7 @@ public class DefaultKit extends Kit
},
new Perk[]
{
},
EntityType.ZOMBIE, null);
}