General fixes.

This commit is contained in:
Virizion 2016-01-12 20:23:25 -05:00
parent 8a8d5b088b
commit b27d5849d8

View File

@ -25,7 +25,6 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -43,7 +42,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -483,6 +481,9 @@ public class SpeedBuilder extends SoloGame
if (!_buildRecreations.containsKey(event.getPlayer()))
return;
if (_perfectBuild.containsKey(event.getPlayer()))
return;
if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3)
{
event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F);
@ -518,6 +519,9 @@ public class SpeedBuilder extends SoloGame
if (!_buildRecreations.containsKey(event.getPlayer()))
return;
if (_perfectBuild.containsKey(event.getPlayer()))
return;
if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3)
{
event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F);
@ -636,7 +640,10 @@ public class SpeedBuilder extends SoloGame
//Sometimes it doesn't show in the update method
UtilTextMiddle.display("", C.cRed + "View Time Over!", 0, 30, 10);
Announce(F.main("Build", "Recreate the build shown."));
for (Player player : GetTeamList().get(0).GetPlayers(true))
{
UtilPlayer.message(player, F.main("Build", "Recreate the build shown."));
}
setSpeedBuilderState(SpeedBuilderState.BUILDING);
}
@ -665,10 +672,10 @@ public class SpeedBuilder extends SoloGame
for (Player player : UtilServer.getPlayers())
{
player.setGameMode(GameMode.SPECTATOR);
player.setSpectatorTarget(_judgeEntity);
// player.setGameMode(GameMode.SPECTATOR);
// player.setSpectatorTarget(_judgeEntity);
Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false);
// Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false);
PacketPlayOutGameStateChange packet = new PacketPlayOutGameStateChange(10, 0.0F);
UtilPlayer.sendPacket(player, packet);
@ -723,50 +730,53 @@ public class SpeedBuilder extends SoloGame
recreation.pasteBuildData(_currentBuild);
}
Location specLocation = GetSpectatorLocation();
double avgDist = 0;
//Add up all the distances
for (Location loc : GetTeamList().get(0).GetSpawns())
{
avgDist += UtilMath.offset2d(specLocation, loc);
}
//Get the average by dividing
avgDist /= GetTeamList().get(0).GetSpawns().size();
for (Player player : UtilServer.getPlayers())
{
player.setGameMode(GameMode.SURVIVAL);
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Guardian POV");
if (_buildRecreations.containsKey(player))
player.teleport(_buildRecreations.get(player).PlayerSpawn);
if (!IsAlive(player) || GetTeamList().get(1).HasPlayer(player))
{
player.setAllowFlight(true);
player.setFlying(true);
Location toTeleport = specLocation.clone();
//Spread players by getting a random x and z in that radius
toTeleport.setX(toTeleport.getX() + (Math.random() * avgDist * 2 - avgDist));
toTeleport.setZ(toTeleport.getZ() + (Math.random() * avgDist * 2 - avgDist));
toTeleport.setDirection(UtilAlg.getTrajectory(toTeleport, _buildMiddle.clone().add(0.5, 0, 0.5)));
player.teleport(toTeleport);
}
}
// Location specLocation = GetSpectatorLocation();
// double avgDist = 0;
//
// //Add up all the distances
// for (Location loc : GetTeamList().get(0).GetSpawns())
// {
// avgDist += UtilMath.offset2d(specLocation, loc);
// }
//
// //Get the average by dividing
// avgDist /= GetTeamList().get(0).GetSpawns().size();
//
// for (Player player : UtilServer.getPlayers())
// {
// player.setGameMode(GameMode.SURVIVAL);
//
// Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Guardian POV");
//
// if (_buildRecreations.containsKey(player))
// player.teleport(_buildRecreations.get(player).PlayerSpawn);
//
// if (!IsAlive(player) || GetTeamList().get(1).HasPlayer(player))
// {
// player.setAllowFlight(true);
// player.setFlying(true);
//
// Location toTeleport = specLocation.clone();
//
// //Spread players by getting a random x and z in that radius
// toTeleport.setX(toTeleport.getX() + (Math.random() * avgDist * 2 - avgDist));
// toTeleport.setZ(toTeleport.getZ() + (Math.random() * avgDist * 2 - avgDist));
//
// toTeleport.setDirection(UtilAlg.getTrajectory(toTeleport, _buildMiddle.clone().add(0.5, 0, 0.5)));
//
// player.teleport(toTeleport);
// }
// }
if (_buildTime > 1)
_buildTime--;
_viewCountStage = 0;
Announce(F.main("Build", "You will recreate this build."));
for (Player player : GetTeamList().get(0).GetPlayers(true))
{
UtilPlayer.message(player, F.main("Build", "You will recreate this build."));
}
setSpeedBuilderState(SpeedBuilderState.VIEWING);
}
@ -991,27 +1001,27 @@ public class SpeedBuilder extends SoloGame
}
}
@EventHandler
public void stopJudgeUnspec(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
if (_state != SpeedBuilderState.REVIEWING)
return;
for (Player player : UtilServer.getPlayers())
{
player.setGameMode(GameMode.SPECTATOR);
player.setSpectatorTarget(_judgeEntity);
if (!Manager.GetCondition().HasCondition(player, ConditionType.CLOAK, "Guardian POV"))
Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false);
}
}
// @EventHandler
// public void stopJudgeUnspec(UpdateEvent event)
// {
// if (event.getType() != UpdateType.TICK)
// return;
//
// if (!IsLive())
// return;
//
// if (_state != SpeedBuilderState.REVIEWING)
// return;
//
// for (Player player : UtilServer.getPlayers())
// {
// player.setGameMode(GameMode.SPECTATOR);
// player.setSpectatorTarget(_judgeEntity);
//
// if (!Manager.GetCondition().HasCondition(player, ConditionType.CLOAK, "Guardian POV"))
// Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false);
// }
// }
@EventHandler
public void stopGuardianSpecPickup(PlayerPickupItemEvent event)