Borders for spec are fixed.

This commit is contained in:
Virizion 2016-01-26 17:14:21 -05:00
parent 2f4146c243
commit 40113f99d3
2 changed files with 47 additions and 29 deletions

View File

@ -43,6 +43,7 @@ import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTrac
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker;
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.GameFlagManager;
import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange;
import org.bukkit.Bukkit;
@ -736,6 +737,25 @@ public class SpeedBuilders extends SoloGame
}
}
@EventHandler
public void border(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!InProgress())
return;
Location specLocation = GetSpectatorLocation();
//This can be done like this cause nobody should be outside
for (Player player : UtilServer.getPlayers())
{
if (!isInsideMap(player))
player.teleport(specLocation);
}
}
@EventHandler
public void stateUpdate(UpdateEvent event)
{

View File

@ -888,7 +888,7 @@ public class GameFlagManager implements Listener
for (Player player : UtilServer.getPlayers())
{
if (!game.isInsideMap(player) && game.IsAlive(player))
{
{
//Riding a Projectile, edgecase
if (player.getVehicle() != null && player.getVehicle() instanceof Projectile)
{
@ -897,38 +897,36 @@ public class GameFlagManager implements Listener
((CraftPlayer)player).getHandle().spectating = false;
}
if (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating)
if (!game.WorldBoundaryKill)
{
player.teleport(game.GetSpectatorLocation());
UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!");
if (game.GetType() != GameType.Gravity)
{
if (player.getLocation().getY() > game.WorldData.MaxY)
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0, 0, 10, true);
else
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0.4, 0, 10, true);
}
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 4, false, false, false,
"Border", "Border Damage");
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
}
else
{
if (!game.WorldBoundaryKill)
{
UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!");
if (game.GetType() != GameType.Gravity)
{
if (player.getLocation().getY() > game.WorldData.MaxY)
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0, 0, 10, true);
else
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0.4, 0, 10, true);
}
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 4, false, false, false,
"Border", "Border Damage");
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
}
else
{
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 9001, false, false, false,
"Border", "Border Damage");
}
}
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 9001, false, false, false,
"Border", "Border Damage");
}
}
if (!game.isInsideMap(player) && (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating))
{
player.teleport(game.GetSpectatorLocation());
}
}
}