Move spawn related methods to challenge classes
This commit is contained in:
parent
6fdbda0ed0
commit
e2663d6448
@ -76,9 +76,8 @@ import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeData;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeSettings;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeList;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.TeamChallenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeSettings;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeAnvilDance;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeArrowRampage;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBlockLobbers;
|
||||
@ -398,6 +397,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Spawns
|
||||
*/
|
||||
|
||||
private ArrayList<Location> setupChallengeSpawnLocations()
|
||||
{
|
||||
ArrayList<Location> selected = _challenge.createSpawns();
|
||||
@ -434,10 +437,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Spawns
|
||||
*/
|
||||
|
||||
private void teleportSpectatorsToSpawn()
|
||||
{
|
||||
for (Player player : GetPlayers(false))
|
||||
@ -451,15 +450,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
private void teleportPlayersToSpawns(boolean firstRun)
|
||||
{
|
||||
if (_challenge instanceof TeamChallenge)
|
||||
{
|
||||
teamTeleport(firstRun);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerTeleport(firstRun);
|
||||
}
|
||||
|
||||
_challenge.spawn(firstRun);
|
||||
removeSolidBlockForPlayers();
|
||||
}
|
||||
|
||||
@ -489,46 +480,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
}
|
||||
|
||||
private void teamTeleport(boolean firstRun)
|
||||
{
|
||||
TeamChallenge teamChallenge = (TeamChallenge) _challenge;
|
||||
|
||||
if (teamChallenge.shouldTeamSpawn())
|
||||
{
|
||||
teamChallenge.spawn(firstRun);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerTeleport(firstRun);
|
||||
}
|
||||
}
|
||||
|
||||
private void playerTeleport(boolean firstRun)
|
||||
{
|
||||
if (firstRun)
|
||||
{
|
||||
ArrayList<Player> players = GetPlayers(false);
|
||||
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
{
|
||||
Player player = players.get(i);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_playerTeam.SpawnTeleport(player);
|
||||
}
|
||||
}.runTaskLater(Manager.getPlugin(), i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerTeam.SpawnTeleport(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Start
|
||||
*/
|
||||
@ -948,7 +899,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
UtilTextTop.displayTextBar(player, _challenge.getTimeLeftPercent(), C.cYellow + C.Bold + _challenge.getName());
|
||||
UtilTextTop.displayTextBar(player, _challenge.getTimeLeftPercent(), C.cYellowB + _challenge.getName());
|
||||
player.setLevel(_challenge.getRemainingPlaces());
|
||||
player.setExp(_challenge.getTimeLeftPercent());
|
||||
}
|
||||
|
@ -121,6 +121,32 @@ public abstract class Challenge implements Listener
|
||||
return true;
|
||||
}
|
||||
|
||||
public void spawn(boolean firstRun)
|
||||
{
|
||||
if (firstRun)
|
||||
{
|
||||
ArrayList<Player> players = Host.GetPlayers(false);
|
||||
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
{
|
||||
Player player = players.get(i);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Host.getPlayerTeam().SpawnTeleport(player);
|
||||
}
|
||||
}.runTaskLater(Host.Manager.getPlugin(), i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Host.getPlayerTeam().SpawnTeleport(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
Settings.setStartTime(System.currentTimeMillis());
|
||||
|
@ -54,7 +54,10 @@ public abstract class TeamChallenge extends Challenge
|
||||
* Called automatically only when _teamSpawn is true.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void spawn(boolean firstRun)
|
||||
{
|
||||
if (_teamSpawn)
|
||||
{
|
||||
autoSelectTeams();
|
||||
|
||||
@ -113,6 +116,11 @@ public abstract class TeamChallenge extends Challenge
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.spawn(firstRun);
|
||||
}
|
||||
}
|
||||
|
||||
private void teleportWithDelay(Player player, final Location spawn, int teleported)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user