Implement new challenge selection system
The new challenge selection system, picks a random challenge from the list as a starting point. Once the challenge is ended, the next one in the list will be selected. That process continues, until the index is out of bounds, and from that point, a new starting point will be selected. During that process, any challenge that is picked, is also reviewed to make sure it's suitable according to the player count. If that's not the case, the selection process will continue until one challenge is found. If there is no appropriate challenge, the game will be ended. In addition to those changes, there are a couple of bug fixes and changes. At first, some methods that keep track of player lists were renamed and secondly, the enchantment lore is now hidden on challenges that use items.
This commit is contained in:
parent
0228e9951e
commit
cb4e25fb0a
@ -76,6 +76,7 @@ import nautilus.game.arcade.game.GameTeam;
|
|||||||
import nautilus.game.arcade.game.TeamGame;
|
import nautilus.game.arcade.game.TeamGame;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeList;
|
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeList;
|
||||||
|
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.ChallengeAnvilDance;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeArrowRampage;
|
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeArrowRampage;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBlockLobbers;
|
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBlockLobbers;
|
||||||
@ -164,13 +165,11 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
/*
|
/*
|
||||||
* TODO: Bugs
|
* TODO: Bugs
|
||||||
*
|
*
|
||||||
* - Small delay on spectator reset?
|
|
||||||
* - Do not trigger chicken attack on game end (eg. 3 players killed at once).
|
* - Do not trigger chicken attack on game end (eg. 3 players killed at once).
|
||||||
* - Make players spawn with equal distance from a target.
|
* - Make players spawn with equal distance from a target.
|
||||||
* - Do not spawn grass on spawn locations.
|
* - Do not spawn grass on spawn locations.
|
||||||
* - Team Challenges: Define team properly.
|
* - Team Challenges: Define team properly.
|
||||||
* - When timer runs out, challenge does not end.
|
* - When timer runs out, challenge does not end.
|
||||||
* - Win placement is not accurate.
|
|
||||||
* - Chicken attack does not trigger sometimes.
|
* - Chicken attack does not trigger sometimes.
|
||||||
* - Pick a Side: Does not work with 3 players.
|
* - Pick a Side: Does not work with 3 players.
|
||||||
* - Fix rest of the challenges.
|
* - Fix rest of the challenges.
|
||||||
@ -264,6 +263,84 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
ChallengeTreasureDigger.class,
|
ChallengeTreasureDigger.class,
|
||||||
ChallengeVolleyPig.class,
|
ChallengeVolleyPig.class,
|
||||||
ChallengeWaveCrush.class);
|
ChallengeWaveCrush.class);
|
||||||
|
|
||||||
|
_list.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Challenge selectChallenge()
|
||||||
|
{
|
||||||
|
int limit = _list.size();
|
||||||
|
int attemps = 0;
|
||||||
|
boolean available = true;
|
||||||
|
|
||||||
|
Challenge instance = getChallengeInstance();
|
||||||
|
|
||||||
|
while (!isSuitable(instance))
|
||||||
|
{
|
||||||
|
if (attemps < limit)
|
||||||
|
{
|
||||||
|
instance = getChallengeInstance();
|
||||||
|
attemps++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
available = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (available)
|
||||||
|
{
|
||||||
|
System.out.println("Found matching challenge: " + instance.getName());
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSuitable(Challenge instance)
|
||||||
|
{
|
||||||
|
ChallengeSettings settings = instance.getSettings();
|
||||||
|
|
||||||
|
int participants = getPlayersWithRemainingLives();
|
||||||
|
int minCount = settings.getMinPlayers();
|
||||||
|
int maxCount = settings.getMaxPlayers();
|
||||||
|
|
||||||
|
System.out.println("Participants: " + participants);
|
||||||
|
System.out.println("Min: " + minCount);
|
||||||
|
System.out.println("Max: " + maxCount);
|
||||||
|
|
||||||
|
return participants >= minCount && participants <= maxCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Challenge getChallengeInstance()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _list.getNextChallenge().getConstructor(BawkBawkBattles.class).newInstance(this);
|
||||||
|
}
|
||||||
|
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isChallengeNull()
|
||||||
|
{
|
||||||
|
if (_challenge == null)
|
||||||
|
{
|
||||||
|
SetState(GameState.Dead);
|
||||||
|
UtilServer.broadcast(F.main("Game", "No suitable challenge was found."));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -288,47 +365,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Challenge selectChallenge()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _list.size() * 4; i++)
|
|
||||||
{
|
|
||||||
_list.copy();
|
|
||||||
|
|
||||||
Challenge challenge = getChallengeInstance();
|
|
||||||
|
|
||||||
int participants = getChallengers().size();
|
|
||||||
int minCount = challenge.getSettings().getMinPlayers();
|
|
||||||
int maxCount = challenge.getSettings().getMaxPlayers();
|
|
||||||
|
|
||||||
if (participants >= minCount && participants <= maxCount)
|
|
||||||
{
|
|
||||||
if (challenge.getSettings().isTeamBased())
|
|
||||||
if (getChallengers().size() % 2 != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
_list.removeCopy(challenge.getClass());
|
|
||||||
return challenge;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Challenge getChallengeInstance()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return _list.getRandomCopy().getConstructor(BawkBawkBattles.class).newInstance(this);
|
|
||||||
}
|
|
||||||
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
|
|
||||||
| SecurityException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChallengeUpdate(UpdateEvent event)
|
public void onChallengeUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -344,9 +380,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_challenge = selectChallenge();
|
_challenge = selectChallenge();
|
||||||
|
|
||||||
keepSearchingWhenNull();
|
if (isChallengeNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resetLastChallengeMap();
|
resetLastChallengeMap();
|
||||||
|
|
||||||
_deathEffect.removeSpawnedEntities();
|
_deathEffect.removeSpawnedEntities();
|
||||||
@ -490,25 +531,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void keepSearchingWhenNull()
|
|
||||||
{
|
|
||||||
if (_challenge == null)
|
|
||||||
{
|
|
||||||
_list.resetCopy();
|
|
||||||
_challenge = selectChallenge();
|
|
||||||
|
|
||||||
if (_challenge == null)
|
|
||||||
{
|
|
||||||
SetState(GameState.Dead);
|
|
||||||
UtilServer.broadcast(F.main("Game", "No suitable challenge was found."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void teleportPlayersToSpawnpoints()
|
private void teleportPlayersToSpawnpoints()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : GetPlayers(true))
|
||||||
{
|
{
|
||||||
_playersTeam.SpawnTeleport(player);
|
_playersTeam.SpawnTeleport(player);
|
||||||
}
|
}
|
||||||
@ -557,7 +582,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
private boolean canStartCrumbling()
|
private boolean canStartCrumbling()
|
||||||
{
|
{
|
||||||
int lost = _challenge.getData().getLostPlayers().size();
|
int lost = _challenge.getData().getLostPlayers().size();
|
||||||
int current = getChallengers().size();
|
int current = getPlayersAlive().size();
|
||||||
|
|
||||||
return !_settings.isCrumbling() && lost > current / 2 && lost != current;
|
return !_settings.isCrumbling() && lost > current / 2 && lost != current;
|
||||||
}
|
}
|
||||||
@ -565,7 +590,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
private boolean canEndChallengeFromCrumble()
|
private boolean canEndChallengeFromCrumble()
|
||||||
{
|
{
|
||||||
int lost = _challenge.getData().getLostPlayers().size();
|
int lost = _challenge.getData().getLostPlayers().size();
|
||||||
int current = getChallengers().size();
|
int current = getPlayersAlive().size();
|
||||||
|
|
||||||
return current - lost <= 1;
|
return current - lost <= 1;
|
||||||
}
|
}
|
||||||
@ -600,7 +625,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
|
|
||||||
private void resetPlayersOnChallengeEnding()
|
private void resetPlayersOnChallengeEnding()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (_challenge.getData().hasAnyoneCompleted() && !_challenge.getData().isCompleted(player))
|
if (_challenge.getData().hasAnyoneCompleted() && !_challenge.getData().isCompleted(player))
|
||||||
{
|
{
|
||||||
@ -668,11 +693,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
|
|
||||||
if (super.GetPlayers(true).size() > 14)
|
if (super.GetPlayers(true).size() > 14)
|
||||||
{
|
{
|
||||||
int alive = 0;
|
int alive = getPlayersWithRemainingLives();
|
||||||
|
|
||||||
for (Player cAlive : _lives.keySet())
|
|
||||||
if (lives(cAlive) != 0)
|
|
||||||
alive++;
|
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
@ -686,7 +707,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
Scoreboard.Write(C.cGreen + C.Bold + "Alive");
|
Scoreboard.Write(C.cGreen + C.Bold + "Alive");
|
||||||
|
|
||||||
if (check)
|
if (check)
|
||||||
Scoreboard.Write("" + _challenge.getCurrentyAlive(false).size());
|
Scoreboard.Write("" + _challenge.getPlayersIn(false).size());
|
||||||
else
|
else
|
||||||
Scoreboard.Write("-");
|
Scoreboard.Write("-");
|
||||||
|
|
||||||
@ -883,7 +904,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
if (!IsAlive(player))
|
if (!IsAlive(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!getChallengers().contains(player))
|
if (!getPlayersAlive().contains(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!PrepareFreeze)
|
if (!PrepareFreeze)
|
||||||
@ -971,12 +992,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
if (_challenge == null)
|
if (_challenge == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int alive = 0;
|
int alive = getPlayersWithRemainingLives();
|
||||||
|
|
||||||
for (Player players : _lives.keySet())
|
|
||||||
if (_lives.get(players) > 0)
|
|
||||||
alive++;
|
|
||||||
|
|
||||||
int lives = loseLife(player);
|
int lives = loseLife(player);
|
||||||
|
|
||||||
if (lives <= 0)
|
if (lives <= 0)
|
||||||
@ -1234,8 +1250,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Game", "All challenge restrictions were cleared."));
|
UtilPlayer.message(player, F.main("Game", "All challenge restrictions were cleared."));
|
||||||
_list.getChallenges().clear();
|
_list.resetCopy();
|
||||||
populateChallenges();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1320,11 +1335,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
if (event.GetState() != GameState.Prepare)
|
if (event.GetState() != GameState.Prepare)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_challenge = selectChallenge();
|
|
||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
_lives.put(player, _settings.getMaxLives());
|
_lives.put(player, _settings.getMaxLives());
|
||||||
|
|
||||||
|
_challenge = selectChallenge();
|
||||||
|
|
||||||
|
if (isChallengeNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setupChallengeSpawnLocations();
|
setupChallengeSpawnLocations();
|
||||||
_challenge.createMap();
|
_challenge.createMap();
|
||||||
|
|
||||||
@ -1448,37 +1468,20 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
return _lives.get(player);
|
return _lives.get(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Player> getChallengers()
|
|
||||||
{
|
|
||||||
ArrayList<Player> challengers = new ArrayList<Player>();
|
|
||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
|
||||||
if (!UtilPlayer.isSpectator(player))
|
|
||||||
challengers.add(player);
|
|
||||||
|
|
||||||
return challengers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int living = 0;
|
if (getPlayersWithRemainingLives() <= 1)
|
||||||
|
|
||||||
for (Player player : GetPlayers(false))
|
|
||||||
{
|
{
|
||||||
if (lives(player) > 0)
|
_winners.add(0, getPlayersAlive().get(0));
|
||||||
|
|
||||||
|
if (_winners.size() > 2)
|
||||||
{
|
{
|
||||||
living++;
|
Collections.swap(_winners, 2, 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (living <= 1)
|
|
||||||
{
|
|
||||||
_winners.add(0, getChallengers().get(0));
|
|
||||||
Collections.swap(_winners, 2, 1);
|
|
||||||
|
|
||||||
if (_winners.size() >= 1)
|
if (_winners.size() >= 1)
|
||||||
{
|
{
|
||||||
@ -1568,6 +1571,42 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
return super.GetPlayers(aliveOnly);
|
return super.GetPlayers(aliveOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of players that are alive.
|
||||||
|
*/
|
||||||
|
public ArrayList<Player> getPlayersAlive()
|
||||||
|
{
|
||||||
|
ArrayList<Player> list = new ArrayList<Player>();
|
||||||
|
|
||||||
|
for (Player player : GetPlayers(true))
|
||||||
|
{
|
||||||
|
if (!UtilPlayer.isSpectator(player))
|
||||||
|
{
|
||||||
|
list.add(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the amount of players with more than one life.
|
||||||
|
*/
|
||||||
|
public int getPlayersWithRemainingLives()
|
||||||
|
{
|
||||||
|
int amount = 0;
|
||||||
|
|
||||||
|
for (Player player : _lives.keySet())
|
||||||
|
{
|
||||||
|
if (lives(player) > 0)
|
||||||
|
{
|
||||||
|
amount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
protected void addItem(ItemStack... items)
|
protected void addItem(ItemStack... items)
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
for (ItemStack item : items)
|
for (ItemStack item : items)
|
||||||
{
|
{
|
||||||
@ -128,7 +128,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
protected void setItem(int slot, ItemStack item)
|
protected void setItem(int slot, ItemStack item)
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.getInventory().setItem(slot, item);
|
player.getInventory().setItem(slot, item);
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
protected void fillItem(ItemStack item)
|
protected void fillItem(ItemStack item)
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 9; i++)
|
for (int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
protected void removeItem(Material type, byte data)
|
protected void removeItem(Material type, byte data)
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
UtilInv.removeAll(player, type, data);
|
UtilInv.removeAll(player, type, data);
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
protected void addEffect(PotionEffectType type, int duration, int amplifier)
|
protected void addEffect(PotionEffectType type, int duration, int amplifier)
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.addPotionEffect(new PotionEffect(type, duration, amplifier));
|
player.addPotionEffect(new PotionEffect(type, duration, amplifier));
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
protected void removeEffect(PotionEffectType type)
|
protected void removeEffect(PotionEffectType type)
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.removePotionEffect(type);
|
player.removePotionEffect(type);
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
protected boolean isPlayerValid(Player player)
|
protected boolean isPlayerValid(Player player)
|
||||||
{
|
{
|
||||||
return getChallengers().contains(player) && Host.IsAlive(player) && !Data.isDone(player);
|
return getPlayersAlive().contains(player) && Host.IsAlive(player) && !Data.isDone(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start()
|
public void start()
|
||||||
@ -233,11 +233,11 @@ public abstract class Challenge implements Listener
|
|||||||
Data.resetCompletedAndLost();
|
Data.resetCompletedAndLost();
|
||||||
|
|
||||||
Settings.setStartTime(System.currentTimeMillis());
|
Settings.setStartTime(System.currentTimeMillis());
|
||||||
Settings.setMaxCompletedCount((int) Math.ceil(getChallengers().size() / 2D));
|
Settings.setMaxCompletedCount((int) Math.ceil(getPlayersAlive().size() / 2D));
|
||||||
|
|
||||||
if (Settings.isInventoryLocked())
|
if (Settings.isInventoryLocked())
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.getInventory().setHeldItemSlot(Settings.getLockedSlot());
|
player.getInventory().setHeldItemSlot(Settings.getLockedSlot());
|
||||||
}
|
}
|
||||||
@ -248,9 +248,9 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
public boolean canFinish()
|
public boolean canFinish()
|
||||||
{
|
{
|
||||||
ArrayList<Player> players = getChallengers();
|
ArrayList<Player> players = getPlayersAlive();
|
||||||
|
|
||||||
int alive = getCurrentyAlive(true).size();
|
int alive = getPlayersIn(true).size();
|
||||||
int completed = Data.getCompletedPlayers().size();
|
int completed = Data.getCompletedPlayers().size();
|
||||||
int lost = Data.getLostPlayers().size();
|
int lost = Data.getLostPlayers().size();
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
Host.taskWinMessage(player);
|
Host.taskWinMessage(player);
|
||||||
|
|
||||||
if (cloak && getCurrentyAlive(true).size() > 2)
|
if (cloak && getPlayersIn(true).size() > 2)
|
||||||
{
|
{
|
||||||
Data.addInvisiblePlayer(player);
|
Data.addInvisiblePlayer(player);
|
||||||
Host.Manager.GetCondition().Factory().Cloak("Completed", player, player, 7777, true, false);
|
Host.Manager.GetCondition().Factory().Cloak("Completed", player, player, 7777, true, false);
|
||||||
@ -333,7 +333,7 @@ public abstract class Challenge implements Listener
|
|||||||
if (!Host.getSettings().isCrumbling())
|
if (!Host.getSettings().isCrumbling())
|
||||||
Data.addLostPlayer(player);
|
Data.addLostPlayer(player);
|
||||||
|
|
||||||
if (cloak && getCurrentyAlive(true).size() > 2)
|
if (cloak && getPlayersIn(true).size() > 2)
|
||||||
{
|
{
|
||||||
Data.addInvisiblePlayer(player);
|
Data.addInvisiblePlayer(player);
|
||||||
Host.Manager.GetCondition().Factory().Cloak("Lost", player, player, 7777, true, false);
|
Host.Manager.GetCondition().Factory().Cloak("Lost", player, player, 7777, true, false);
|
||||||
@ -505,33 +505,26 @@ public abstract class Challenge implements Listener
|
|||||||
return (int) ((Settings.getDuration() - (System.currentTimeMillis() - Settings.getStartTime())) / 1000);
|
return (int) ((Settings.getDuration() - (System.currentTimeMillis() - Settings.getStartTime())) / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public ArrayList<Player> getPlayersAlive()
|
||||||
* Get all players alive, whether they have won or not.
|
|
||||||
*
|
|
||||||
* @return ArrayList<Player>
|
|
||||||
*/
|
|
||||||
public ArrayList<Player> getChallengers()
|
|
||||||
{
|
{
|
||||||
return Host.getChallengers();
|
return Host.getPlayersAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Player> getCurrentyAlive(boolean ignoreCompleted)
|
public ArrayList<Player> getPlayersIn(boolean ignoreCompleted)
|
||||||
{
|
{
|
||||||
ArrayList<Player> currentlyAlive = new ArrayList<Player>();
|
ArrayList<Player> list = new ArrayList<Player>();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (Data.isLost(player))
|
if (Data.isLost(player) || (ignoreCompleted && Data.isCompleted(player)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ignoreCompleted)
|
list.add(player);
|
||||||
if (Data.isCompleted(player))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
currentlyAlive.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentlyAlive;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTimeLeftPercent()
|
public float getTimeLeftPercent()
|
||||||
@ -546,7 +539,7 @@ public abstract class Challenge implements Listener
|
|||||||
if (_type == ChallengeType.FirstComplete)
|
if (_type == ChallengeType.FirstComplete)
|
||||||
return Settings.getMaxCompletedCount() - Data.getCompletedPlayers().size();
|
return Settings.getMaxCompletedCount() - Data.getCompletedPlayers().size();
|
||||||
else if (_type == ChallengeType.LastStanding)
|
else if (_type == ChallengeType.LastStanding)
|
||||||
return getChallengers().size() - Settings.getMaxCompletedCount();
|
return getPlayersAlive().size() - Settings.getMaxCompletedCount();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -558,7 +551,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
public int getArenaSize(int minBlocks)
|
public int getArenaSize(int minBlocks)
|
||||||
{
|
{
|
||||||
int size = (int) (minBlocks + Math.ceil(getChallengers().size() / 2));
|
int size = (int) (minBlocks + Math.ceil(getPlayersAlive().size() / 2));
|
||||||
return size > 40 ? 40 : size;
|
return size > 40 ? 40 : size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,12 +5,29 @@ import java.util.ArrayList;
|
|||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a wrapper class contains two array lists that hold loaded challenges.
|
* This class holds loaded challenges and rotation functionality.
|
||||||
*/
|
*/
|
||||||
public class ChallengeList
|
public class ChallengeList
|
||||||
{
|
{
|
||||||
private ArrayList<Class<? extends Challenge>> _wrapper = new ArrayList<Class<? extends Challenge>>();
|
private ArrayList<Class<? extends Challenge>> _wrapper = new ArrayList<Class<? extends Challenge>>();
|
||||||
private ArrayList<Class<? extends Challenge>> _wrapperCopy = new ArrayList<Class<? extends Challenge>>();
|
private ArrayList<Class<? extends Challenge>> _wrapperCopy = new ArrayList<Class<? extends Challenge>>();
|
||||||
|
private int _index;
|
||||||
|
|
||||||
|
private void setIndexBetweenBounds()
|
||||||
|
{
|
||||||
|
int bound = _wrapperCopy.size() - 1;
|
||||||
|
|
||||||
|
if (bound > 0)
|
||||||
|
{
|
||||||
|
_index = UtilMath.r(bound);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Index reset: " + _index);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void add(Class<? extends Challenge>... challenges)
|
public void add(Class<? extends Challenge>... challenges)
|
||||||
@ -21,37 +38,47 @@ public class ChallengeList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class<? extends Challenge> getNextChallenge()
|
||||||
|
{
|
||||||
|
if (_index >= _wrapperCopy.size())
|
||||||
|
{
|
||||||
|
setIndexBetweenBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
Class<? extends Challenge> current = _wrapperCopy.get(_index);
|
||||||
|
|
||||||
|
_index++;
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
public void restrict(Class<? extends Challenge> challenge)
|
public void restrict(Class<? extends Challenge> challenge)
|
||||||
{
|
{
|
||||||
_wrapper.clear();
|
_wrapperCopy.clear();
|
||||||
_wrapper.add(challenge);
|
_index = 0; // Since we only have one challenge in the list, the index can only be zero.
|
||||||
|
_wrapperCopy.add(challenge);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetCopy()
|
public void resetCopy()
|
||||||
{
|
{
|
||||||
_wrapperCopy.clear();
|
_wrapperCopy.clear();
|
||||||
_wrapperCopy.addAll(_wrapper);
|
_wrapperCopy.addAll(_wrapper);
|
||||||
|
setIndexBetweenBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copy()
|
public void copy()
|
||||||
{
|
{
|
||||||
if (_wrapperCopy.isEmpty())
|
if (_wrapperCopy.isEmpty())
|
||||||
|
{
|
||||||
_wrapperCopy.addAll(_wrapper);
|
_wrapperCopy.addAll(_wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCopy(Class<? extends Challenge> challenge)
|
setIndexBetweenBounds();
|
||||||
{
|
|
||||||
_wrapperCopy.remove(challenge);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int size()
|
public int size()
|
||||||
{
|
{
|
||||||
return _wrapper.size();
|
return _wrapperCopy.size();
|
||||||
}
|
|
||||||
|
|
||||||
public Class<? extends Challenge> getRandomCopy()
|
|
||||||
{
|
|
||||||
return UtilMath.randomElement(_wrapperCopy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Class<? extends Challenge>> getChallenges()
|
public ArrayList<Class<? extends Challenge>> getChallenges()
|
||||||
|
@ -36,7 +36,7 @@ public abstract class ChallengeSeperateRooms extends Challenge
|
|||||||
|
|
||||||
public void assignRooms()
|
public void assignRooms()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
for (Entry<Location, Entry<Integer[], Location>> entry : _spawns.entrySet())
|
for (Entry<Location, Entry<Integer[], Location>> entry : _spawns.entrySet())
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ public abstract class ChallengeSeperateRooms extends Challenge
|
|||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public final void generateRoom()
|
public final void generateRoom()
|
||||||
{
|
{
|
||||||
int size = getChallengers().size();
|
int size = getPlayersAlive().size();
|
||||||
|
|
||||||
int x = 1;
|
int x = 1;
|
||||||
int z = 1;
|
int z = 1;
|
||||||
|
@ -220,7 +220,7 @@ public class ChallengeAnvilDance extends Challenge
|
|||||||
|
|
||||||
playFireworksTask();
|
playFireworksTask();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.0F, 1.3F);
|
player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.0F, 1.3F);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.util.BlockIterator;
|
import org.bukkit.util.BlockIterator;
|
||||||
@ -108,7 +109,7 @@ public class ChallengeArrowRampage extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
setItem(Settings.getLockedSlot(), new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
|
setItem(Settings.getLockedSlot(), new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).addItemFlags(ItemFlag.HIDE_ENCHANTS).build());
|
||||||
setItem(31, new ItemStack(Material.ARROW)); // Place arrow above bow, not visible in the hotbar.
|
setItem(31, new ItemStack(Material.ARROW)); // Place arrow above bow, not visible in the hotbar.
|
||||||
addEffect(PotionEffectType.JUMP, 2);
|
addEffect(PotionEffectType.JUMP, 2);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class ChallengeBlockLobbers extends Challenge
|
|||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
Material material = UtilMath.randomElement(_types);
|
Material material = UtilMath.randomElement(_types);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class ChallengeBouncingBlock extends Challenge
|
|||||||
{
|
{
|
||||||
addEffect(PotionEffectType.JUMP, 6);
|
addEffect(PotionEffectType.JUMP, 6);
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
_score.put(player, 0);
|
_score.put(player, 0);
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ public class ChallengeBouncingBlock extends Challenge
|
|||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (Data.isDone(player))
|
if (Data.isDone(player))
|
||||||
continue;
|
continue;
|
||||||
@ -204,7 +204,7 @@ public class ChallengeBouncingBlock extends Challenge
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void spawnStartingWool()
|
private void spawnStartingWool()
|
||||||
{
|
{
|
||||||
whileLoop: while (_blocks.size() <= Math.ceil(getChallengers().size() / 2) + 1)
|
whileLoop: while (_blocks.size() <= Math.ceil(getPlayersAlive().size() / 2) + 1)
|
||||||
{
|
{
|
||||||
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
|
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ public class ChallengeBuildRace extends Challenge
|
|||||||
// Second Check
|
// Second Check
|
||||||
// Checking if the player is trying to trap another player.
|
// Checking if the player is trying to trap another player.
|
||||||
|
|
||||||
for (Player others : getChallengers())
|
for (Player others : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (others.equals(player))
|
if (others.equals(player))
|
||||||
continue;
|
continue;
|
||||||
|
@ -89,7 +89,7 @@ public class ChallengeColorChange extends Challenge
|
|||||||
if (!isChallengeValid())
|
if (!isChallengeValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player[] players = getChallengers().toArray(new Player[0]);
|
Player[] players = getPlayersAlive().toArray(new Player[0]);
|
||||||
|
|
||||||
if (_stageExpire < System.currentTimeMillis())
|
if (_stageExpire < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
@ -191,7 +191,7 @@ public class ChallengeColorChange extends Challenge
|
|||||||
|
|
||||||
private void playFallSound()
|
private void playFallSound()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 2.0F, 0.0F);
|
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 2.0F, 0.0F);
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ public class ChallengeColorChange extends Challenge
|
|||||||
{
|
{
|
||||||
_lastSound = System.currentTimeMillis() + 1000;
|
_lastSound = System.currentTimeMillis() + 1000;
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1.0F, 1.0F);
|
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class ChallengeDiamondSeeker extends Challenge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 10 + getChallengers().size(); i++)
|
for (int i = 0; i < 10 + getPlayersAlive().size(); i++)
|
||||||
{
|
{
|
||||||
Inventory inventory = UtilMath.randomElement(inventories);
|
Inventory inventory = UtilMath.randomElement(inventories);
|
||||||
inventory.setItem(UtilMath.r(inventory.getSize()), new ItemStack(Material.DIAMOND));
|
inventory.setItem(UtilMath.r(inventory.getSize()), new ItemStack(Material.DIAMOND));
|
||||||
@ -130,7 +130,7 @@ public class ChallengeDiamondSeeker extends Challenge
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (getChallengers().contains(player) && Host.IsAlive(player) && Data.isDone(player))
|
if (getPlayersAlive().contains(player) && Host.IsAlive(player) && Data.isDone(player))
|
||||||
{
|
{
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ public class ChallengeDogsVersusCats extends Challenge
|
|||||||
{
|
{
|
||||||
int looped = 0;
|
int looped = 0;
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class ChallengeDragonEgg extends Challenge
|
|||||||
|
|
||||||
ItemStack axe = new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build();
|
ItemStack axe = new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
_score.put(player, 0);
|
_score.put(player, 0);
|
||||||
player.getInventory().setItem(Settings.getLockedSlot(), axe);
|
player.getInventory().setItem(Settings.getLockedSlot(), axe);
|
||||||
|
@ -269,7 +269,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
|
|
||||||
Sound nextSound = _sounds[UtilMath.r(_sounds.length)];
|
Sound nextSound = _sounds[UtilMath.r(_sounds.length)];
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.playSound(player.getLocation(), nextSound, 1.0F, 1.5F);
|
player.playSound(player.getLocation(), nextSound, 1.0F, 1.5F);
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent camping
|
// Prevent camping
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
Location camp = player.getLocation();
|
Location camp = player.getLocation();
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class ChallengeFastFood extends Challenge
|
|||||||
{
|
{
|
||||||
itemParticleTask();
|
itemParticleTask();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 9; i++)
|
for (int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
|
@ -206,9 +206,9 @@ public class ChallengeInfestation extends Challenge
|
|||||||
if (event.getType() != UpdateType.FASTER)
|
if (event.getType() != UpdateType.FASTER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_infected.size() >= Math.floor(getChallengers().size() / 2))
|
if (_infected.size() >= Math.floor(getPlayersAlive().size() / 2))
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (!_infected.contains(player))
|
if (!_infected.contains(player))
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ public class ChallengeKangarooJump extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
_players.put(player.getName(), true);
|
_players.put(player.getName(), true);
|
||||||
_playerJumpHeight.put(player, 0);
|
_playerJumpHeight.put(player, 0);
|
||||||
@ -186,7 +186,7 @@ public class ChallengeKangarooJump extends Challenge
|
|||||||
{
|
{
|
||||||
HashMap<String, Integer> playerHeights = new HashMap<String, Integer>();
|
HashMap<String, Integer> playerHeights = new HashMap<String, Integer>();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
if (!playerHeights.containsKey(player.getName()))
|
if (!playerHeights.containsKey(player.getName()))
|
||||||
playerHeights.put(player.getName(), player.getLocation().getBlockY());
|
playerHeights.put(player.getName(), player.getLocation().getBlockY());
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
@ -124,7 +124,7 @@ public class ChallengeKingOfTheLadder extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
setItem(Settings.getLockedSlot(), new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 5).addLore(C.cPurple + "One strong stick!").build());
|
setItem(Settings.getLockedSlot(), new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 5).addItemFlags(ItemFlag.HIDE_ENCHANTS).build());
|
||||||
|
|
||||||
Host.DamagePvP = true;
|
Host.DamagePvP = true;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ public class ChallengeKingOfTheLadder extends Challenge
|
|||||||
if (!isChallengeValid())
|
if (!isChallengeValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
if (UtilAlg.inBoundingBox(player.getLocation(), _winCornerA, _winCornerB))
|
if (UtilAlg.inBoundingBox(player.getLocation(), _winCornerA, _winCornerB))
|
||||||
setCompleted(player, true);
|
setCompleted(player, true);
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ public class ChallengeKingOfTheLadder extends Challenge
|
|||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.SEC)
|
if (event.getType() == UpdateType.SEC)
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class ChallengeLavaRun extends Challenge
|
|||||||
|
|
||||||
createLava();
|
createLava();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
DisguiseMagmaCube disguise = new DisguiseMagmaCube(player);
|
DisguiseMagmaCube disguise = new DisguiseMagmaCube(player);
|
||||||
disguise.SetSize(1);
|
disguise.SetSize(1);
|
||||||
|
@ -133,7 +133,7 @@ public class ChallengeMilkACow extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
DisguiseVillager disguise = new DisguiseVillager(player);
|
DisguiseVillager disguise = new DisguiseVillager(player);
|
||||||
disguise.setBaby();
|
disguise.setBaby();
|
||||||
|
@ -76,7 +76,7 @@ public class ChallengeMineADiamond extends Challenge
|
|||||||
{
|
{
|
||||||
if (amountOfDiamonds == 0)
|
if (amountOfDiamonds == 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Math.ceil((getChallengers().size() + 1) / 2); i++)
|
for (int i = 0; i < Math.ceil((getPlayersAlive().size() + 1) / 2); i++)
|
||||||
{
|
{
|
||||||
Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1, UtilMath.r(getArenaSize() * 2) - (getArenaSize()));
|
Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1, UtilMath.r(getArenaSize() * 2) - (getArenaSize()));
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class ChallengeMinecartDance extends Challenge
|
|||||||
|
|
||||||
private void playersLooseIfOutsideMinecart()
|
private void playersLooseIfOutsideMinecart()
|
||||||
{
|
{
|
||||||
for (Player player : getCurrentyAlive(true))
|
for (Player player : getPlayersIn(true))
|
||||||
{
|
{
|
||||||
if (!player.isInsideVehicle())
|
if (!player.isInsideVehicle())
|
||||||
{
|
{
|
||||||
@ -324,7 +324,7 @@ public class ChallengeMinecartDance extends Challenge
|
|||||||
|
|
||||||
private void spawnMinecarts()
|
private void spawnMinecarts()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < getCurrentyAlive(true).size() / 2; i++)
|
for (int i = 0; i < getPlayersIn(true).size() / 2; i++)
|
||||||
{
|
{
|
||||||
Minecart minecart = Host.WorldData.World.spawn(getCenter().add(UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7)), 2, UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7))), Minecart.class);
|
Minecart minecart = Host.WorldData.World.spawn(getCenter().add(UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7)), 2, UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7))), Minecart.class);
|
||||||
UtilEnt.ghost(minecart, true, false);
|
UtilEnt.ghost(minecart, true, false);
|
||||||
@ -334,8 +334,8 @@ public class ChallengeMinecartDance extends Challenge
|
|||||||
|
|
||||||
private void startTimerWhenReady()
|
private void startTimerWhenReady()
|
||||||
{
|
{
|
||||||
if (getCurrentyAlive(false).size() >= 10)
|
if (getPlayersIn(false).size() >= 10)
|
||||||
startTimer(Math.round(getCurrentyAlive(false).size() / 2));
|
startTimer(Math.round(getPlayersIn(false).size() / 2));
|
||||||
else
|
else
|
||||||
startTimer(Math.round(5));
|
startTimer(Math.round(5));
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ public class ChallengeMinecartDance extends Challenge
|
|||||||
{
|
{
|
||||||
if (_phase == MinecartDancePhase.ENDED)
|
if (_phase == MinecartDancePhase.ENDED)
|
||||||
{
|
{
|
||||||
for (Player player : getCurrentyAlive(true))
|
for (Player player : getPlayersIn(true))
|
||||||
{
|
{
|
||||||
if (!player.isInsideVehicle())
|
if (!player.isInsideVehicle())
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
if (!isChallengeValid())
|
if (!isChallengeValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : getCurrentyAlive(true))
|
for (Player player : getPlayersIn(true))
|
||||||
{
|
{
|
||||||
if (UtilInv.contains(player, Material.ARROW, (byte) 0, 1))
|
if (UtilInv.contains(player, Material.ARROW, (byte) 0, 1))
|
||||||
continue;
|
continue;
|
||||||
|
@ -119,7 +119,7 @@ public class ChallengePickASide extends Challenge
|
|||||||
|
|
||||||
private void displayCounter()
|
private void displayCounter()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display(C.Bold + formattedCounter(), null, player);
|
UtilTextMiddle.display(C.Bold + formattedCounter(), null, player);
|
||||||
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 1.5F);
|
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 1.5F);
|
||||||
@ -165,7 +165,7 @@ public class ChallengePickASide extends Challenge
|
|||||||
|
|
||||||
private void addPlayersOnTeams()
|
private void addPlayersOnTeams()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (player.getLocation().getZ() < 1)
|
if (player.getLocation().getZ() < 1)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ public class ChallengePunchThePig extends Challenge
|
|||||||
{
|
{
|
||||||
Host.DamagePvE = true;
|
Host.DamagePvE = true;
|
||||||
|
|
||||||
for (int i = 0; i <= Math.round(getChallengers().size() * 5); i++)
|
for (int i = 0; i <= Math.round(getPlayersAlive().size() * 5); i++)
|
||||||
{
|
{
|
||||||
Location spawn = getRandomPigSpawn();
|
Location spawn = getRandomPigSpawn();
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ public class ChallengePunchThePig extends Challenge
|
|||||||
_pigs.add(pig);
|
_pigs.add(pig);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
_playerScore.put(player.getName(), 0);
|
_playerScore.put(player.getName(), 0);
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ public class ChallengePunchThePig extends Challenge
|
|||||||
if (!_pigs.isEmpty())
|
if (!_pigs.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : getCurrentyAlive(true))
|
for (Player player : getPlayersIn(true))
|
||||||
{
|
{
|
||||||
setLost(player);
|
setLost(player);
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ public class ChallengeRedLightGreenLight extends Challenge
|
|||||||
|
|
||||||
private void moveTextAndSound()
|
private void moveTextAndSound()
|
||||||
{
|
{
|
||||||
for (Player player : getCurrentyAlive(true))
|
for (Player player : getPlayersIn(true))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Green Light", "You can now move."));
|
UtilPlayer.message(player, F.main("Green Light", "You can now move."));
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 2F, 1F);
|
player.getWorld().playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 2F, 1F);
|
||||||
@ -330,7 +330,7 @@ public class ChallengeRedLightGreenLight extends Challenge
|
|||||||
|
|
||||||
private void cannotMoveTextAndSound()
|
private void cannotMoveTextAndSound()
|
||||||
{
|
{
|
||||||
for (Player player : getCurrentyAlive(true))
|
for (Player player : getPlayersIn(true))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Red Light", "Freeze!"));
|
UtilPlayer.message(player, F.main("Red Light", "Freeze!"));
|
||||||
UtilTextMiddle.display(null, ChatColor.RED + "Freeze!", 5, 60, 5, player);
|
UtilTextMiddle.display(null, ChatColor.RED + "Freeze!", 5, 60, 5, player);
|
||||||
|
@ -99,7 +99,7 @@ public class ChallengeReverseTag extends Challenge
|
|||||||
Host.DamagePvP = true;
|
Host.DamagePvP = true;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
ArrayList<Player> players = getChallengers();
|
ArrayList<Player> players = getPlayersAlive();
|
||||||
Collections.shuffle(players);
|
Collections.shuffle(players);
|
||||||
|
|
||||||
for (Player player : players)
|
for (Player player : players)
|
||||||
@ -147,7 +147,7 @@ public class ChallengeReverseTag extends Challenge
|
|||||||
if (!isChallengeValid())
|
if (!isChallengeValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (getChallengers().size() > 40)
|
if (getPlayersAlive().size() > 40)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : _tagged.getPlayers())
|
for (Player player : _tagged.getPlayers())
|
||||||
|
@ -145,7 +145,7 @@ public class ChallengeRushPush extends Challenge
|
|||||||
{
|
{
|
||||||
ItemStack sword = new ItemBuilder(Material.DIAMOND_SWORD).setUnbreakable(true).build();
|
ItemStack sword = new ItemBuilder(Material.DIAMOND_SWORD).setUnbreakable(true).build();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (player.getLocation().add(0, -1, 0).getBlock().getData() == (byte) 11)
|
if (player.getLocation().add(0, -1, 0).getBlock().getData() == (byte) 11)
|
||||||
_blueTeam.add(player);
|
_blueTeam.add(player);
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
@ -109,10 +110,10 @@ public class ChallengeShootChickens extends Challenge
|
|||||||
|
|
||||||
Host.DamagePvE = true;
|
Host.DamagePvE = true;
|
||||||
|
|
||||||
ItemStack bow = new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build();
|
ItemStack bow = new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).addItemFlags(ItemFlag.HIDE_ENCHANTS).build();
|
||||||
ItemStack arrow = new ItemStack(Material.ARROW);
|
ItemStack arrow = new ItemStack(Material.ARROW);
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
// It's better to add the items without setItem() method, to minimize for-loops.
|
// It's better to add the items without setItem() method, to minimize for-loops.
|
||||||
|
|
||||||
@ -213,7 +214,7 @@ public class ChallengeShootChickens extends Challenge
|
|||||||
public void onUpdate(UpdateEvent event)
|
public void onUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
UpdateType speed;
|
UpdateType speed;
|
||||||
int alive = getCurrentyAlive(false).size();
|
int alive = getPlayersIn(false).size();
|
||||||
|
|
||||||
if (alive >= 40)
|
if (alive >= 40)
|
||||||
speed = UpdateType.FASTEST;
|
speed = UpdateType.FASTEST;
|
||||||
@ -282,7 +283,7 @@ public class ChallengeShootChickens extends Challenge
|
|||||||
|
|
||||||
private void spawnChicken()
|
private void spawnChicken()
|
||||||
{
|
{
|
||||||
if (_chickens.size() < 11 + (getChallengers().size() * 2))
|
if (_chickens.size() < 11 + (getPlayersAlive().size() * 2))
|
||||||
{
|
{
|
||||||
Location spawn = getRandomLocation();
|
Location spawn = getRandomLocation();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class ChallengeSmashOff extends Challenge
|
|||||||
public ArrayList<Location> createSpawns()
|
public ArrayList<Location> createSpawns()
|
||||||
{
|
{
|
||||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||||
int amount = (int) Math.ceil(Math.sqrt(getChallengers().size()));
|
int amount = (int) Math.ceil(Math.sqrt(getPlayersAlive().size()));
|
||||||
|
|
||||||
for (int pX = 0; pX < amount; pX++)
|
for (int pX = 0; pX < amount; pX++)
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ public class ChallengeSmashOff extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void createMap()
|
public void createMap()
|
||||||
{
|
{
|
||||||
int amount = (int) Math.ceil(Math.sqrt(getChallengers().size()));
|
int amount = (int) Math.ceil(Math.sqrt(getPlayersAlive().size()));
|
||||||
int a = UtilMath.r(16);
|
int a = UtilMath.r(16);
|
||||||
|
|
||||||
for (int pX = 0; pX < amount; pX++)
|
for (int pX = 0; pX < amount; pX++)
|
||||||
|
@ -190,7 +190,7 @@ public class ChallengeTreasureDigger extends Challenge
|
|||||||
Host.WorldBlockBurn = true;
|
Host.WorldBlockBurn = true;
|
||||||
Host.WorldFireSpread = true;
|
Host.WorldFireSpread = true;
|
||||||
|
|
||||||
for (Player players : getChallengers())
|
for (Player players : getPlayersAlive())
|
||||||
{
|
{
|
||||||
ItemStack shovel = new ItemStack(Material.STONE_SPADE);
|
ItemStack shovel = new ItemStack(Material.STONE_SPADE);
|
||||||
players.getInventory().setItem(4, shovel);
|
players.getInventory().setItem(4, shovel);
|
||||||
|
@ -226,7 +226,7 @@ public class ChallengeVolleyPig extends Challenge
|
|||||||
{
|
{
|
||||||
ItemStack stick = new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).build();
|
ItemStack stick = new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).build();
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Block blockBelow = player.getWorld().getBlockAt(location.add(0, -1, 0));
|
Block blockBelow = player.getWorld().getBlockAt(location.add(0, -1, 0));
|
||||||
|
@ -165,7 +165,7 @@ public class ChallengeWaterHorror extends Challenge
|
|||||||
{
|
{
|
||||||
Host.getArcadeManager().GetExplosion().SetLiquidDamage(false);
|
Host.getArcadeManager().GetExplosion().SetLiquidDamage(false);
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
Boat boat = player.getWorld().spawn(player.getLocation(), Boat.class);
|
Boat boat = player.getWorld().spawn(player.getLocation(), Boat.class);
|
||||||
boat.setPassenger(player);
|
boat.setPassenger(player);
|
||||||
@ -324,7 +324,7 @@ public class ChallengeWaterHorror extends Challenge
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Player> players = getChallengers();
|
ArrayList<Player> players = getPlayersAlive();
|
||||||
int times = UtilMath.r(_tntSpawnMax) + _tntSpawnMin;
|
int times = UtilMath.r(_tntSpawnMax) + _tntSpawnMin;
|
||||||
|
|
||||||
if (times > players.size())
|
if (times > players.size())
|
||||||
|
@ -114,7 +114,7 @@ public class ChallengeWaveCrush extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
_survivedWaves.put(player, 0);
|
_survivedWaves.put(player, 0);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public class ChallengeBlockShot extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void createMap()
|
public void createMap()
|
||||||
{
|
{
|
||||||
for (Location loc : UtilShapes.getPointsInCircle(getCenter(), getChallengers().size(), 10))
|
for (Location loc : UtilShapes.getPointsInCircle(getCenter(), getPlayersAlive().size(), 10))
|
||||||
{
|
{
|
||||||
loc = loc.getBlock().getLocation().add(0.5, 7.1, 0.5);
|
loc = loc.getBlock().getLocation().add(0.5, 7.1, 0.5);
|
||||||
_spawns.add(loc);
|
_spawns.add(loc);
|
||||||
|
@ -77,7 +77,7 @@ public class ChallengeBuildBuilding extends ChallengeSeperateRooms
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.setGameMode(GameMode.CREATIVE);
|
player.setGameMode(GameMode.CREATIVE);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class ChallengeChickenFishing extends Challenge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public class ChallengeChickenFishing extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.getInventory().addItem(new ItemStack(Material.FISHING_ROD));
|
player.getInventory().addItem(new ItemStack(Material.FISHING_ROD));
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ public class ChallengeChickenFishing extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void createMap()
|
public void createMap()
|
||||||
{
|
{
|
||||||
int size = (getChallengers().size() / 2) + 4;
|
int size = (getPlayersAlive().size() / 2) + 4;
|
||||||
|
|
||||||
for (Location location : UtilShapes.getCircle(getCenter(), true, size))
|
for (Location location : UtilShapes.getCircle(getCenter(), true, size))
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ public class ChallengeDiamondFall extends Challenge
|
|||||||
if (super.canFinish())
|
if (super.canFinish())
|
||||||
{
|
{
|
||||||
final HashMap<Player, Integer> diamonds = new HashMap<Player, Integer>();
|
final HashMap<Player, Integer> diamonds = new HashMap<Player, Integer>();
|
||||||
ArrayList<Player> players = getChallengers();
|
ArrayList<Player> players = getPlayersAlive();
|
||||||
|
|
||||||
for (Player player : players)
|
for (Player player : players)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ public class ChallengeHitTargets extends Challenge
|
|||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
Host.DamagePvP = true;
|
Host.DamagePvP = true;
|
||||||
ArrayList<Player> players = getChallengers();
|
ArrayList<Player> players = getPlayersAlive();
|
||||||
|
|
||||||
for (Player player : players)
|
for (Player player : players)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +292,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
int stage = _currentState.get(player.getName());
|
int stage = _currentState.get(player.getName());
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
_currentState.put(player.getName(), 0);
|
_currentState.put(player.getName(), 0);
|
||||||
_mobs.put(player.getName(), new ArrayList<Entity>());
|
_mobs.put(player.getName(), new ArrayList<Entity>());
|
||||||
|
@ -58,7 +58,7 @@ public class ChallengeRunner extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void createMap()
|
public void createMap()
|
||||||
{
|
{
|
||||||
int amount = (int) Math.ceil(Math.sqrt(getChallengers().size()));
|
int amount = (int) Math.ceil(Math.sqrt(getPlayersAlive().size()));
|
||||||
int a = UtilMath.r(16);
|
int a = UtilMath.r(16);
|
||||||
|
|
||||||
for (int pX = 0; pX < amount; pX++)
|
for (int pX = 0; pX < amount; pX++)
|
||||||
@ -99,7 +99,7 @@ public class ChallengeRunner extends Challenge
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Add Blocks
|
// Add Blocks
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
// Side Standing
|
// Side Standing
|
||||||
double xMod = player.getLocation().getX() % 1;
|
double xMod = player.getLocation().getX() % 1;
|
||||||
|
@ -73,7 +73,7 @@ public class ChallengeSkyFall extends Challenge
|
|||||||
|
|
||||||
Host.DamageEvP = true;
|
Host.DamageEvP = true;
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
player.getInventory().setItem(0, new ItemStack(Material.SNOW_BALL, 64));
|
player.getInventory().setItem(0, new ItemStack(Material.SNOW_BALL, 64));
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ public class ChallengeSkyFall extends Challenge
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : getChallengers())
|
for (Player player : getPlayersAlive())
|
||||||
{
|
{
|
||||||
if (Data.isCompleted(player))
|
if (Data.isCompleted(player))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user