From 1d046ff11918cfebf01548858610867014c8e5cb Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 5 Jul 2017 23:38:24 +0200 Subject: [PATCH] Add "all" to the GetMineplexMission Command, dont let specs get chest quest progress --- .../core/quests/command/GetQuestCommand.java | 38 +++++++++++++++---- .../game/games/dragonescape/DragonEscape.java | 3 +- .../arcade/quest/ChestOpenQuestTracker.java | 3 ++ 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/quests/command/GetQuestCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/quests/command/GetQuestCommand.java index 1b7fe9cc8..867779ee7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/quests/command/GetQuestCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/quests/command/GetQuestCommand.java @@ -1,5 +1,7 @@ package mineplex.core.quests.command; +import java.util.ArrayList; + import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -7,6 +9,7 @@ import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.quests.Quest; import mineplex.core.quests.QuestManager; @@ -37,19 +40,40 @@ public class GetQuestCommand extends CommandBase return; } - Player player = caller; + ArrayList players = new ArrayList<>(); if (args.length == 2) { if (UtilPlayer.searchExact(args[1]) != null) - player = UtilPlayer.searchExact(args[1]); + { + players.add(UtilPlayer.searchExact(args[1])); + } + else + { + if (args[1].equalsIgnoreCase("all")) + { + players.addAll(UtilServer.getPlayersCollection()); + } + } } Quest quest = Plugin.getQuestByID(Integer.parseInt(args[0])); - Plugin.addNewQuest(player, quest); - UtilPlayer.message(player, F.main(QuestManager.QUEST_NAME, "Added " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName())); - - if (caller != player) - UtilPlayer.message(caller, F.main(QuestManager.QUEST_NAME, "You gave the " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName() + ChatColor.GRAY + " to " + ChatColor.YELLOW + player.getName())); + for (Player player : players) + { + Plugin.addNewQuest(player, quest); + UtilPlayer.message(player, F.main(QuestManager.QUEST_NAME, "Added " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName())); + + + if (args[1].equalsIgnoreCase("all")) + { + UtilPlayer.message(caller, F.main(QuestManager.QUEST_NAME, "You gave the " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName() + ChatColor.GRAY + " to " + ChatColor.YELLOW + "everyone")); + } + else + { + if (caller != players.get(0)) + UtilPlayer.message(caller, F.main(QuestManager.QUEST_NAME, "You gave the " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName() + ChatColor.GRAY + " to " + ChatColor.YELLOW + player.getName())); + + } + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 9646a217c..38abce9fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -8,7 +8,6 @@ import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import mineplex.core.common.Pair; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -34,6 +33,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; +import mineplex.core.common.Pair; import mineplex.core.common.block.BlockData; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -52,6 +52,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/quest/ChestOpenQuestTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/quest/ChestOpenQuestTracker.java index 30cbb77d2..c7a935560 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/quest/ChestOpenQuestTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/quest/ChestOpenQuestTracker.java @@ -38,6 +38,9 @@ public class ChestOpenQuestTracker extends QuestTracker if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; + if (!getGame().IsAlive(event.getPlayer())) + return; + if (event.getClickedBlock().getType() != Material.CHEST) return;