From cb4e25fb0a8ab7f8782b39e198e7c2d0924b69f9 Mon Sep 17 00:00:00 2001 From: Thanos paravantis Date: Sat, 16 Apr 2016 15:13:52 +0300 Subject: [PATCH] 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. --- .../game/games/mineware/BawkBawkBattles.java | 245 ++++++++++-------- .../games/mineware/challenge/Challenge.java | 57 ++-- .../mineware/challenge/ChallengeList.java | 53 +++- .../other/ChallengeSeperateRooms.java | 4 +- .../challenge/type/ChallengeAnvilDance.java | 2 +- .../challenge/type/ChallengeArrowRampage.java | 3 +- .../challenge/type/ChallengeBlockLobbers.java | 2 +- .../type/ChallengeBouncingBlock.java | 6 +- .../challenge/type/ChallengeBuildRace.java | 2 +- .../challenge/type/ChallengeColorChange.java | 6 +- .../type/ChallengeDiamondSeeker.java | 4 +- .../type/ChallengeDogsVersusCats.java | 2 +- .../challenge/type/ChallengeDragonEgg.java | 2 +- .../type/ChallengeFallingBlocks.java | 4 +- .../challenge/type/ChallengeFastFood.java | 2 +- .../challenge/type/ChallengeInfestation.java | 4 +- .../challenge/type/ChallengeKangarooJump.java | 4 +- .../type/ChallengeKingOfTheLadder.java | 8 +- .../challenge/type/ChallengeLavaRun.java | 2 +- .../challenge/type/ChallengeMilkACow.java | 2 +- .../challenge/type/ChallengeMineADiamond.java | 2 +- .../type/ChallengeMinecartDance.java | 10 +- .../type/ChallengeMiniOneInTheQuiver.java | 2 +- .../challenge/type/ChallengePickASide.java | 4 +- .../challenge/type/ChallengePunchThePig.java | 6 +- .../type/ChallengeRedLightGreenLight.java | 4 +- .../challenge/type/ChallengeReverseTag.java | 4 +- .../challenge/type/ChallengeRushPush.java | 2 +- .../type/ChallengeShootChickens.java | 9 +- .../challenge/type/ChallengeSmashOff.java | 4 +- .../type/ChallengeTreasureDigger.java | 2 +- .../challenge/type/ChallengeVolleyPig.java | 2 +- .../challenge/type/ChallengeWaterHorror.java | 4 +- .../challenge/type/ChallengeWaveCrush.java | 2 +- .../type/removed/ChallengeBlockShot.java | 2 +- .../type/removed/ChallengeBuildBuilding.java | 2 +- .../type/removed/ChallengeChickenFishing.java | 6 +- .../type/removed/ChallengeDiamondFall.java | 2 +- .../type/removed/ChallengeHitTargets.java | 2 +- .../type/removed/ChallengeNameThatSound.java | 4 +- .../type/removed/ChallengeRunner.java | 4 +- .../type/removed/ChallengeSkyFall.java | 4 +- 42 files changed, 279 insertions(+), 218 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java index 333043616..f26449ee7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java @@ -76,6 +76,7 @@ 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.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.ChallengeArrowRampage; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBlockLobbers; @@ -164,13 +165,11 @@ public class BawkBawkBattles extends TeamGame implements IThrown /* * TODO: Bugs * - * - Small delay on spectator reset? * - Do not trigger chicken attack on game end (eg. 3 players killed at once). * - Make players spawn with equal distance from a target. * - Do not spawn grass on spawn locations. * - Team Challenges: Define team properly. * - When timer runs out, challenge does not end. - * - Win placement is not accurate. * - Chicken attack does not trigger sometimes. * - Pick a Side: Does not work with 3 players. * - Fix rest of the challenges. @@ -264,6 +263,84 @@ public class BawkBawkBattles extends TeamGame implements IThrown ChallengeTreasureDigger.class, ChallengeVolleyPig.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 @@ -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 public void onChallengeUpdate(UpdateEvent event) { @@ -344,9 +380,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown { return; } + _challenge = selectChallenge(); - keepSearchingWhenNull(); + if (isChallengeNull()) + { + return; + } + resetLastChallengeMap(); _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() { - for (Player player : getChallengers()) + for (Player player : GetPlayers(true)) { _playersTeam.SpawnTeleport(player); } @@ -557,7 +582,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown private boolean canStartCrumbling() { int lost = _challenge.getData().getLostPlayers().size(); - int current = getChallengers().size(); + int current = getPlayersAlive().size(); return !_settings.isCrumbling() && lost > current / 2 && lost != current; } @@ -565,7 +590,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown private boolean canEndChallengeFromCrumble() { int lost = _challenge.getData().getLostPlayers().size(); - int current = getChallengers().size(); + int current = getPlayersAlive().size(); return current - lost <= 1; } @@ -600,7 +625,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown private void resetPlayersOnChallengeEnding() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { 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) { - int alive = 0; - - for (Player cAlive : _lives.keySet()) - if (lives(cAlive) != 0) - alive++; + int alive = getPlayersWithRemainingLives(); Scoreboard.WriteBlank(); @@ -686,7 +707,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown Scoreboard.Write(C.cGreen + C.Bold + "Alive"); if (check) - Scoreboard.Write("" + _challenge.getCurrentyAlive(false).size()); + Scoreboard.Write("" + _challenge.getPlayersIn(false).size()); else Scoreboard.Write("-"); @@ -883,7 +904,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (!IsAlive(player)) return; - if (!getChallengers().contains(player)) + if (!getPlayersAlive().contains(player)) return; if (!PrepareFreeze) @@ -971,12 +992,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (_challenge == null) return; - int alive = 0; - - for (Player players : _lives.keySet()) - if (_lives.get(players) > 0) - alive++; - + int alive = getPlayersWithRemainingLives(); int lives = loseLife(player); if (lives <= 0) @@ -1234,8 +1250,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown else { UtilPlayer.message(player, F.main("Game", "All challenge restrictions were cleared.")); - _list.getChallenges().clear(); - populateChallenges(); + _list.resetCopy(); } event.setCancelled(true); @@ -1320,11 +1335,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (event.GetState() != GameState.Prepare) return; - _challenge = selectChallenge(); - for (Player player : GetPlayers(true)) _lives.put(player, _settings.getMaxLives()); + _challenge = selectChallenge(); + + if (isChallengeNull()) + { + return; + } + setupChallengeSpawnLocations(); _challenge.createMap(); @@ -1448,37 +1468,20 @@ public class BawkBawkBattles extends TeamGame implements IThrown return _lives.get(player); } - public ArrayList getChallengers() - { - ArrayList challengers = new ArrayList(); - - for (Player player : GetPlayers(true)) - if (!UtilPlayer.isSpectator(player)) - challengers.add(player); - - return challengers; - } - @Override public void EndCheck() { if (!IsLive()) return; - int living = 0; - - for (Player player : GetPlayers(false)) + if (getPlayersWithRemainingLives() <= 1) { - 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) { @@ -1568,6 +1571,42 @@ public class BawkBawkBattles extends TeamGame implements IThrown return super.GetPlayers(aliveOnly); } + /** + * Returns the list of players that are alive. + */ + public ArrayList getPlayersAlive() + { + ArrayList list = new ArrayList(); + + 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 public void Collide(LivingEntity target, Block block, ProjectileUser data) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java index 1ce045ed9..444b4b58c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java @@ -117,7 +117,7 @@ public abstract class Challenge implements Listener protected void addItem(ItemStack... items) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { for (ItemStack item : items) { @@ -128,7 +128,7 @@ public abstract class Challenge implements Listener protected void setItem(int slot, ItemStack item) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.getInventory().setItem(slot, item); } @@ -136,7 +136,7 @@ public abstract class Challenge implements Listener protected void fillItem(ItemStack item) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { for (int i = 0; i < 9; i++) { @@ -147,7 +147,7 @@ public abstract class Challenge implements Listener protected void removeItem(Material type, byte data) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { UtilInv.removeAll(player, type, data); } @@ -155,7 +155,7 @@ public abstract class Challenge implements Listener protected void addEffect(PotionEffectType type, int duration, int amplifier) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.addPotionEffect(new PotionEffect(type, duration, amplifier)); } @@ -168,7 +168,7 @@ public abstract class Challenge implements Listener protected void removeEffect(PotionEffectType type) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.removePotionEffect(type); } @@ -225,7 +225,7 @@ public abstract class Challenge implements Listener 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() @@ -233,11 +233,11 @@ public abstract class Challenge implements Listener Data.resetCompletedAndLost(); Settings.setStartTime(System.currentTimeMillis()); - Settings.setMaxCompletedCount((int) Math.ceil(getChallengers().size() / 2D)); + Settings.setMaxCompletedCount((int) Math.ceil(getPlayersAlive().size() / 2D)); if (Settings.isInventoryLocked()) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.getInventory().setHeldItemSlot(Settings.getLockedSlot()); } @@ -248,9 +248,9 @@ public abstract class Challenge implements Listener public boolean canFinish() { - ArrayList players = getChallengers(); + ArrayList players = getPlayersAlive(); - int alive = getCurrentyAlive(true).size(); + int alive = getPlayersIn(true).size(); int completed = Data.getCompletedPlayers().size(); int lost = Data.getLostPlayers().size(); @@ -308,7 +308,7 @@ public abstract class Challenge implements Listener Host.taskWinMessage(player); - if (cloak && getCurrentyAlive(true).size() > 2) + if (cloak && getPlayersIn(true).size() > 2) { Data.addInvisiblePlayer(player); 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()) Data.addLostPlayer(player); - if (cloak && getCurrentyAlive(true).size() > 2) + if (cloak && getPlayersIn(true).size() > 2) { Data.addInvisiblePlayer(player); 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); } - /** - * Get all players alive, whether they have won or not. - * - * @return ArrayList - */ - public ArrayList getChallengers() + public ArrayList getPlayersAlive() { - return Host.getChallengers(); + return Host.getPlayersAlive(); } - public ArrayList getCurrentyAlive(boolean ignoreCompleted) + public ArrayList getPlayersIn(boolean ignoreCompleted) { - ArrayList currentlyAlive = new ArrayList(); + ArrayList list = new ArrayList(); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { - if (Data.isLost(player)) + if (Data.isLost(player) || (ignoreCompleted && Data.isCompleted(player))) + { continue; + } - if (ignoreCompleted) - if (Data.isCompleted(player)) - continue; - - currentlyAlive.add(player); + list.add(player); } - return currentlyAlive; + return list; } public float getTimeLeftPercent() @@ -546,7 +539,7 @@ public abstract class Challenge implements Listener if (_type == ChallengeType.FirstComplete) return Settings.getMaxCompletedCount() - Data.getCompletedPlayers().size(); else if (_type == ChallengeType.LastStanding) - return getChallengers().size() - Settings.getMaxCompletedCount(); + return getPlayersAlive().size() - Settings.getMaxCompletedCount(); return 0; } @@ -558,7 +551,7 @@ public abstract class Challenge implements Listener 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; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java index 1ddebca9a..55144fd4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java @@ -5,12 +5,29 @@ import java.util.ArrayList; 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 { private ArrayList> _wrapper = new ArrayList>(); private ArrayList> _wrapperCopy = new ArrayList>(); + 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") public void add(Class... challenges) @@ -21,37 +38,47 @@ public class ChallengeList } } + public Class getNextChallenge() + { + if (_index >= _wrapperCopy.size()) + { + setIndexBetweenBounds(); + } + + Class current = _wrapperCopy.get(_index); + + _index++; + + return current; + } + public void restrict(Class challenge) { - _wrapper.clear(); - _wrapper.add(challenge); + _wrapperCopy.clear(); + _index = 0; // Since we only have one challenge in the list, the index can only be zero. + _wrapperCopy.add(challenge); } public void resetCopy() { _wrapperCopy.clear(); _wrapperCopy.addAll(_wrapper); + setIndexBetweenBounds(); } public void copy() { if (_wrapperCopy.isEmpty()) + { _wrapperCopy.addAll(_wrapper); - } + } - public void removeCopy(Class challenge) - { - _wrapperCopy.remove(challenge); + setIndexBetweenBounds(); } public int size() { - return _wrapper.size(); - } - - public Class getRandomCopy() - { - return UtilMath.randomElement(_wrapperCopy); + return _wrapperCopy.size(); } public ArrayList> getChallenges() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ChallengeSeperateRooms.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ChallengeSeperateRooms.java index c9bdd6845..f7f12a675 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ChallengeSeperateRooms.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ChallengeSeperateRooms.java @@ -36,7 +36,7 @@ public abstract class ChallengeSeperateRooms extends Challenge public void assignRooms() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { for (Entry> entry : _spawns.entrySet()) { @@ -54,7 +54,7 @@ public abstract class ChallengeSeperateRooms extends Challenge @SuppressWarnings({ "unchecked", "rawtypes" }) public final void generateRoom() { - int size = getChallengers().size(); + int size = getPlayersAlive().size(); int x = 1; int z = 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeAnvilDance.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeAnvilDance.java index a7ab3eaee..4bb2c4566 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeAnvilDance.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeAnvilDance.java @@ -220,7 +220,7 @@ public class ChallengeAnvilDance extends Challenge playFireworksTask(); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.0F, 1.3F); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeArrowRampage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeArrowRampage.java index 0d208631d..5b6e8182e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeArrowRampage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeArrowRampage.java @@ -16,6 +16,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.BlockIterator; @@ -108,7 +109,7 @@ public class ChallengeArrowRampage extends Challenge @Override 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. addEffect(PotionEffectType.JUMP, 2); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBlockLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBlockLobbers.java index 2a8d8b62a..32a31a914 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBlockLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBlockLobbers.java @@ -93,7 +93,7 @@ public class ChallengeBlockLobbers extends Challenge if (event.getType() != UpdateType.FAST) return; - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { Material material = UtilMath.randomElement(_types); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java index 8acc27f81..2a0a5eee6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java @@ -90,7 +90,7 @@ public class ChallengeBouncingBlock extends Challenge { addEffect(PotionEffectType.JUMP, 6); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { _score.put(player, 0); } @@ -152,7 +152,7 @@ public class ChallengeBouncingBlock extends Challenge if (event.getType() != UpdateType.TICK) return; - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { if (Data.isDone(player)) continue; @@ -204,7 +204,7 @@ public class ChallengeBouncingBlock extends Challenge @SuppressWarnings("deprecation") 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++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java index 1c4e59222..bae7f0e2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java @@ -141,7 +141,7 @@ public class ChallengeBuildRace extends Challenge // Second Check // Checking if the player is trying to trap another player. - for (Player others : getChallengers()) + for (Player others : getPlayersAlive()) { if (others.equals(player)) continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java index 17e8679c9..ba8a0bed3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java @@ -89,7 +89,7 @@ public class ChallengeColorChange extends Challenge if (!isChallengeValid()) return; - Player[] players = getChallengers().toArray(new Player[0]); + Player[] players = getPlayersAlive().toArray(new Player[0]); if (_stageExpire < System.currentTimeMillis()) { @@ -191,7 +191,7 @@ public class ChallengeColorChange extends Challenge private void playFallSound() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.playSound(player.getLocation(), Sound.NOTE_PIANO, 2.0F, 0.0F); } @@ -226,7 +226,7 @@ public class ChallengeColorChange extends Challenge { _lastSound = System.currentTimeMillis() + 1000; - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1.0F, 1.0F); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDiamondSeeker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDiamondSeeker.java index be6918e9d..8843702a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDiamondSeeker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDiamondSeeker.java @@ -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.setItem(UtilMath.r(inventory.getSize()), new ItemStack(Material.DIAMOND)); @@ -130,7 +130,7 @@ public class ChallengeDiamondSeeker extends Challenge 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) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDogsVersusCats.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDogsVersusCats.java index 287c02cc4..195d3098e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDogsVersusCats.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDogsVersusCats.java @@ -121,7 +121,7 @@ public class ChallengeDogsVersusCats extends Challenge { int looped = 0; - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.setGameMode(GameMode.ADVENTURE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDragonEgg.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDragonEgg.java index 02da996fc..cae27c83c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDragonEgg.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeDragonEgg.java @@ -72,7 +72,7 @@ public class ChallengeDragonEgg extends Challenge ItemStack axe = new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build(); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { _score.put(player, 0); player.getInventory().setItem(Settings.getLockedSlot(), axe); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFallingBlocks.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFallingBlocks.java index 780ddfa8e..67d5c9c38 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFallingBlocks.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFallingBlocks.java @@ -269,7 +269,7 @@ public class ChallengeFallingBlocks extends Challenge Sound nextSound = _sounds[UtilMath.r(_sounds.length)]; - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.playSound(player.getLocation(), nextSound, 1.0F, 1.5F); } @@ -285,7 +285,7 @@ public class ChallengeFallingBlocks extends Challenge } // Prevent camping - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { Location camp = player.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java index 47b944fe8..36c671b5d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java @@ -95,7 +95,7 @@ public class ChallengeFastFood extends Challenge { itemParticleTask(); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { for (int i = 0; i < 9; i++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeInfestation.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeInfestation.java index 40190f568..776943ddd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeInfestation.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeInfestation.java @@ -206,9 +206,9 @@ public class ChallengeInfestation extends Challenge if (event.getType() != UpdateType.FASTER) 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)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKangarooJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKangarooJump.java index c01590265..fb42ca616 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKangarooJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKangarooJump.java @@ -101,7 +101,7 @@ public class ChallengeKangarooJump extends Challenge @Override public void onStart() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { _players.put(player.getName(), true); _playerJumpHeight.put(player, 0); @@ -186,7 +186,7 @@ public class ChallengeKangarooJump extends Challenge { HashMap playerHeights = new HashMap(); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) if (!playerHeights.containsKey(player.getName())) playerHeights.put(player.getName(), player.getLocation().getBlockY()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKingOfTheLadder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKingOfTheLadder.java index 0c139d89f..1a8b98ace 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKingOfTheLadder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeKingOfTheLadder.java @@ -11,8 +11,8 @@ import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; 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.UtilMath; import mineplex.core.itemstack.ItemBuilder; @@ -124,7 +124,7 @@ public class ChallengeKingOfTheLadder extends Challenge @Override 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; } @@ -174,7 +174,7 @@ public class ChallengeKingOfTheLadder extends Challenge if (!isChallengeValid()) return; - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) if (UtilAlg.inBoundingBox(player.getLocation(), _winCornerA, _winCornerB)) setCompleted(player, true); } @@ -205,7 +205,7 @@ public class ChallengeKingOfTheLadder extends Challenge { if (event.getType() == UpdateType.SEC) { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.setHealth(20); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java index e8d45c225..271ebae63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java @@ -90,7 +90,7 @@ public class ChallengeLavaRun extends Challenge createLava(); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { DisguiseMagmaCube disguise = new DisguiseMagmaCube(player); disguise.SetSize(1); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMilkACow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMilkACow.java index af3415290..3f90c799d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMilkACow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMilkACow.java @@ -133,7 +133,7 @@ public class ChallengeMilkACow extends Challenge @Override public void onStart() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { DisguiseVillager disguise = new DisguiseVillager(player); disguise.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMineADiamond.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMineADiamond.java index e808d5345..18580a1c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMineADiamond.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMineADiamond.java @@ -76,7 +76,7 @@ public class ChallengeMineADiamond extends Challenge { 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())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMinecartDance.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMinecartDance.java index b4bffb993..125a8a879 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMinecartDance.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMinecartDance.java @@ -245,7 +245,7 @@ public class ChallengeMinecartDance extends Challenge private void playersLooseIfOutsideMinecart() { - for (Player player : getCurrentyAlive(true)) + for (Player player : getPlayersIn(true)) { if (!player.isInsideVehicle()) { @@ -324,7 +324,7 @@ public class ChallengeMinecartDance extends Challenge 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); UtilEnt.ghost(minecart, true, false); @@ -334,8 +334,8 @@ public class ChallengeMinecartDance extends Challenge private void startTimerWhenReady() { - if (getCurrentyAlive(false).size() >= 10) - startTimer(Math.round(getCurrentyAlive(false).size() / 2)); + if (getPlayersIn(false).size() >= 10) + startTimer(Math.round(getPlayersIn(false).size() / 2)); else startTimer(Math.round(5)); } @@ -376,7 +376,7 @@ public class ChallengeMinecartDance extends Challenge { if (_phase == MinecartDancePhase.ENDED) { - for (Player player : getCurrentyAlive(true)) + for (Player player : getPlayersIn(true)) { if (!player.isInsideVehicle()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMiniOneInTheQuiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMiniOneInTheQuiver.java index 47e94544a..ee607b07b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMiniOneInTheQuiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeMiniOneInTheQuiver.java @@ -138,7 +138,7 @@ public class ChallengeMiniOneInTheQuiver extends Challenge if (!isChallengeValid()) return; - for (Player player : getCurrentyAlive(true)) + for (Player player : getPlayersIn(true)) { if (UtilInv.contains(player, Material.ARROW, (byte) 0, 1)) continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePickASide.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePickASide.java index 47d2d065a..8a30af51f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePickASide.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePickASide.java @@ -119,7 +119,7 @@ public class ChallengePickASide extends Challenge private void displayCounter() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { UtilTextMiddle.display(C.Bold + formattedCounter(), null, player); player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 1.5F); @@ -165,7 +165,7 @@ public class ChallengePickASide extends Challenge private void addPlayersOnTeams() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { if (player.getLocation().getZ() < 1) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePunchThePig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePunchThePig.java index e90ea0a4a..82034b1e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePunchThePig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengePunchThePig.java @@ -113,7 +113,7 @@ public class ChallengePunchThePig extends Challenge { 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(); @@ -126,7 +126,7 @@ public class ChallengePunchThePig extends Challenge _pigs.add(pig); } - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { _playerScore.put(player.getName(), 0); } @@ -216,7 +216,7 @@ public class ChallengePunchThePig extends Challenge if (!_pigs.isEmpty()) return; - for (Player player : getCurrentyAlive(true)) + for (Player player : getPlayersIn(true)) { setLost(player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java index 4128cee4e..1888a745e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java @@ -311,7 +311,7 @@ public class ChallengeRedLightGreenLight extends Challenge private void moveTextAndSound() { - for (Player player : getCurrentyAlive(true)) + for (Player player : getPlayersIn(true)) { UtilPlayer.message(player, F.main("Green Light", "You can now move.")); player.getWorld().playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 2F, 1F); @@ -330,7 +330,7 @@ public class ChallengeRedLightGreenLight extends Challenge private void cannotMoveTextAndSound() { - for (Player player : getCurrentyAlive(true)) + for (Player player : getPlayersIn(true)) { UtilPlayer.message(player, F.main("Red Light", "Freeze!")); UtilTextMiddle.display(null, ChatColor.RED + "Freeze!", 5, 60, 5, player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeReverseTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeReverseTag.java index a0286de55..cfcc8c9e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeReverseTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeReverseTag.java @@ -99,7 +99,7 @@ public class ChallengeReverseTag extends Challenge Host.DamagePvP = true; int i = 0; - ArrayList players = getChallengers(); + ArrayList players = getPlayersAlive(); Collections.shuffle(players); for (Player player : players) @@ -147,7 +147,7 @@ public class ChallengeReverseTag extends Challenge if (!isChallengeValid()) return; - if (getChallengers().size() > 40) + if (getPlayersAlive().size() > 40) return; for (Player player : _tagged.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRushPush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRushPush.java index acac770b7..764f50356 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRushPush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRushPush.java @@ -145,7 +145,7 @@ public class ChallengeRushPush extends Challenge { 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) _blueTeam.add(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeShootChickens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeShootChickens.java index 6ccb8e78d..6ff9b97cb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeShootChickens.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeShootChickens.java @@ -17,6 +17,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; @@ -109,10 +110,10 @@ public class ChallengeShootChickens extends Challenge 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); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { // 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) { UpdateType speed; - int alive = getCurrentyAlive(false).size(); + int alive = getPlayersIn(false).size(); if (alive >= 40) speed = UpdateType.FASTEST; @@ -282,7 +283,7 @@ public class ChallengeShootChickens extends Challenge private void spawnChicken() { - if (_chickens.size() < 11 + (getChallengers().size() * 2)) + if (_chickens.size() < 11 + (getPlayersAlive().size() * 2)) { Location spawn = getRandomLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeSmashOff.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeSmashOff.java index df2b7a26e..a4f7de72a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeSmashOff.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeSmashOff.java @@ -29,7 +29,7 @@ public class ChallengeSmashOff extends Challenge public ArrayList createSpawns() { ArrayList spawns = new ArrayList(); - 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++) { @@ -46,7 +46,7 @@ public class ChallengeSmashOff extends Challenge @Override 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); for (int pX = 0; pX < amount; pX++) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeTreasureDigger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeTreasureDigger.java index a74002593..1153af459 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeTreasureDigger.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeTreasureDigger.java @@ -190,7 +190,7 @@ public class ChallengeTreasureDigger extends Challenge Host.WorldBlockBurn = true; Host.WorldFireSpread = true; - for (Player players : getChallengers()) + for (Player players : getPlayersAlive()) { ItemStack shovel = new ItemStack(Material.STONE_SPADE); players.getInventory().setItem(4, shovel); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java index 8d583b858..4f1e9d26d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java @@ -226,7 +226,7 @@ public class ChallengeVolleyPig extends Challenge { ItemStack stick = new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).build(); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { Location location = player.getLocation(); Block blockBelow = player.getWorld().getBlockAt(location.add(0, -1, 0)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java index 154e49b8d..f63115c6c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java @@ -165,7 +165,7 @@ public class ChallengeWaterHorror extends Challenge { Host.getArcadeManager().GetExplosion().SetLiquidDamage(false); - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { Boat boat = player.getWorld().spawn(player.getLocation(), Boat.class); boat.setPassenger(player); @@ -324,7 +324,7 @@ public class ChallengeWaterHorror extends Challenge return; } - ArrayList players = getChallengers(); + ArrayList players = getPlayersAlive(); int times = UtilMath.r(_tntSpawnMax) + _tntSpawnMin; if (times > players.size()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaveCrush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaveCrush.java index 11b2044a2..40b31eb42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaveCrush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaveCrush.java @@ -114,7 +114,7 @@ public class ChallengeWaveCrush extends Challenge @Override public void onStart() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { _survivedWaves.put(player, 0); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBlockShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBlockShot.java index 098216dee..f18c08ce6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBlockShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBlockShot.java @@ -169,7 +169,7 @@ public class ChallengeBlockShot extends Challenge @Override 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); _spawns.add(loc); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBuildBuilding.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBuildBuilding.java index 9b4802388..4817a5d43 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBuildBuilding.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeBuildBuilding.java @@ -77,7 +77,7 @@ public class ChallengeBuildBuilding extends ChallengeSeperateRooms @Override public void onStart() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.setGameMode(GameMode.CREATIVE); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeChickenFishing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeChickenFishing.java index 8e00b6946..af694973e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeChickenFishing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeChickenFishing.java @@ -62,7 +62,7 @@ public class ChallengeChickenFishing extends Challenge } } - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { Block block = player.getLocation().getBlock(); @@ -85,7 +85,7 @@ public class ChallengeChickenFishing extends Challenge @Override public void onStart() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.getInventory().addItem(new ItemStack(Material.FISHING_ROD)); } @@ -94,7 +94,7 @@ public class ChallengeChickenFishing extends Challenge @Override public void createMap() { - int size = (getChallengers().size() / 2) + 4; + int size = (getPlayersAlive().size() / 2) + 4; for (Location location : UtilShapes.getCircle(getCenter(), true, size)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeDiamondFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeDiamondFall.java index 8d48c9fa1..4fa54accf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeDiamondFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeDiamondFall.java @@ -39,7 +39,7 @@ public class ChallengeDiamondFall extends Challenge if (super.canFinish()) { final HashMap diamonds = new HashMap(); - ArrayList players = getChallengers(); + ArrayList players = getPlayersAlive(); for (Player player : players) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeHitTargets.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeHitTargets.java index d06723064..7165f23c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeHitTargets.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeHitTargets.java @@ -107,7 +107,7 @@ public class ChallengeHitTargets extends Challenge public void onStart() { Host.DamagePvP = true; - ArrayList players = getChallengers(); + ArrayList players = getPlayersAlive(); for (Player player : players) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeNameThatSound.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeNameThatSound.java index aadd5d9d0..3c4b5abc0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeNameThatSound.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeNameThatSound.java @@ -292,7 +292,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms return; } - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { int stage = _currentState.get(player.getName()); @@ -387,7 +387,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms @Override public void onStart() { - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { _currentState.put(player.getName(), 0); _mobs.put(player.getName(), new ArrayList()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeRunner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeRunner.java index d0000d0df..b5c897fec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeRunner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeRunner.java @@ -58,7 +58,7 @@ public class ChallengeRunner extends Challenge @Override 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); for (int pX = 0; pX < amount; pX++) @@ -99,7 +99,7 @@ public class ChallengeRunner extends Challenge return; // Add Blocks - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { // Side Standing double xMod = player.getLocation().getX() % 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeSkyFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeSkyFall.java index 17e150505..9995e452e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeSkyFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/removed/ChallengeSkyFall.java @@ -73,7 +73,7 @@ public class ChallengeSkyFall extends Challenge Host.DamageEvP = true; - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { player.getInventory().setItem(0, new ItemStack(Material.SNOW_BALL, 64)); } @@ -87,7 +87,7 @@ public class ChallengeSkyFall extends Challenge return; } - for (Player player : getChallengers()) + for (Player player : getPlayersAlive()) { if (Data.isCompleted(player)) continue;