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