Add joining players to guardians team instead of spectator.
This commit is contained in:
parent
245cc1ed93
commit
5dc773032b
@ -31,15 +31,15 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
|||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||||
import nautilus.game.arcade.game.SoloGame;
|
import nautilus.game.arcade.game.SoloGame;
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.DependableTracker;
|
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTracker;
|
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker;
|
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.data.BuildData;
|
import nautilus.game.arcade.game.games.speedbuilders.data.BuildData;
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.data.DemolitionData;
|
import nautilus.game.arcade.game.games.speedbuilders.data.DemolitionData;
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.data.MobData;
|
import nautilus.game.arcade.game.games.speedbuilders.data.MobData;
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.data.RecreationData;
|
import nautilus.game.arcade.game.games.speedbuilders.data.RecreationData;
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
|
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.kits.DefaultKit;
|
import nautilus.game.arcade.game.games.speedbuilders.kits.DefaultKit;
|
||||||
|
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.DependableTracker;
|
||||||
|
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTracker;
|
||||||
|
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker;
|
||||||
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker;
|
import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import nautilus.game.arcade.kit.Kit;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange;
|
||||||
@ -77,6 +77,7 @@ import org.bukkit.event.entity.ItemMergeEvent;
|
|||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.world.StructureGrowEvent;
|
import org.bukkit.event.world.StructureGrowEvent;
|
||||||
@ -396,10 +397,13 @@ public class SpeedBuilders extends SoloGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveToGuardians(Player player)
|
public void moveToGuardians(Player player, boolean elimination)
|
||||||
{
|
{
|
||||||
GetTeamList().get(0).SetPlacement(player, PlayerState.OUT);
|
if (elimination)
|
||||||
GetTeamList().get(0).RemovePlayer(player);
|
{
|
||||||
|
GetTeamList().get(0).SetPlacement(player, PlayerState.OUT);
|
||||||
|
GetTeamList().get(0).RemovePlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
GetTeamList().get(1).AddPlayer(player, true);
|
GetTeamList().get(1).AddPlayer(player, true);
|
||||||
|
|
||||||
@ -423,7 +427,11 @@ public class SpeedBuilders extends SoloGame
|
|||||||
if (event.GetState() != GameState.Live)
|
if (event.GetState() != GameState.Live)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GameTeam guardians = new GameTeam(this, "Guardians", ChatColor.GRAY, new ArrayList<Location>());
|
//Add 1 spawn so it doesn't freak out
|
||||||
|
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||||
|
spawns.add(GetSpectatorLocation());
|
||||||
|
|
||||||
|
GameTeam guardians = new GameTeam(this, "Guardians", ChatColor.GRAY, spawns);
|
||||||
|
|
||||||
AddTeam(guardians);
|
AddTeam(guardians);
|
||||||
}
|
}
|
||||||
@ -973,7 +981,7 @@ public class SpeedBuilders extends SoloGame
|
|||||||
|
|
||||||
_buildRecreations.remove(eliminating.Player);
|
_buildRecreations.remove(eliminating.Player);
|
||||||
|
|
||||||
moveToGuardians(eliminating.Player);
|
moveToGuardians(eliminating.Player, true);
|
||||||
}
|
}
|
||||||
}, 40L);
|
}, 40L);
|
||||||
}
|
}
|
||||||
@ -1444,6 +1452,34 @@ public class SpeedBuilders extends SoloGame
|
|||||||
event.setCancelled(true);
|
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)
|
||||||
|
{
|
||||||
|
if (!InProgress())
|
||||||
|
return;
|
||||||
|
|
||||||
|
moveToGuardians(event.getPlayer(), false);
|
||||||
|
event.getPlayer().teleport(GetSpectatorLocation());
|
||||||
|
|
||||||
|
//We need to disguise a tick after
|
||||||
|
Manager.runSyncLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
DisguiseGuardian disguise = new DisguiseGuardian(event.getPlayer());
|
||||||
|
disguise.setName(C.cGray + event.getPlayer().getName());
|
||||||
|
disguise.setCustomNameVisible(true);
|
||||||
|
|
||||||
|
Manager.GetDisguise().disguise(disguise);
|
||||||
|
|
||||||
|
event.getPlayer().setAllowFlight(true);
|
||||||
|
event.getPlayer().setFlying(true);
|
||||||
|
}
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
{
|
{
|
||||||
@ -1489,6 +1525,7 @@ public class SpeedBuilders extends SoloGame
|
|||||||
List<Player> losers = GetTeamList().get(1).GetPlayers(false);
|
List<Player> losers = GetTeamList().get(1).GetPlayers(false);
|
||||||
|
|
||||||
losers.removeAll(winners);
|
losers.removeAll(winners);
|
||||||
|
losers.retainAll(GetTeamList().get(0).GetPlacements(true));
|
||||||
|
|
||||||
return losers;
|
return losers;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user