From 172d5ffeee781e65df4abb52742f9a347fb600bf Mon Sep 17 00:00:00 2001 From: HappyPikachu Date: Wed, 25 Apr 2018 02:42:21 -0400 Subject: [PATCH] Remove blacklist and purge subcommand --- src/main/java/me/blackvein/quests/Event.java | 3 - .../me/blackvein/quests/EventFactory.java | 6 +- .../java/me/blackvein/quests/NpcListener.java | 122 +++++++++-------- .../me/blackvein/quests/QuestFactory.java | 6 +- src/main/java/me/blackvein/quests/Quests.java | 125 +++++------------- src/main/resources/config.yml | 7 +- src/main/resources/plugin.yml | 3 - src/main/resources/strings.yml | 18 +-- 8 files changed, 99 insertions(+), 191 deletions(-) diff --git a/src/main/java/me/blackvein/quests/Event.java b/src/main/java/me/blackvein/quests/Event.java index e107c0c67..6bcc98bd5 100644 --- a/src/main/java/me/blackvein/quests/Event.java +++ b/src/main/java/me/blackvein/quests/Event.java @@ -19,7 +19,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.Location; @@ -32,8 +31,6 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; -import org.bukkit.scheduler.BukkitRunnable; - import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.QuestMob; diff --git a/src/main/java/me/blackvein/quests/EventFactory.java b/src/main/java/me/blackvein/quests/EventFactory.java index 43b57c62e..6528ab059 100644 --- a/src/main/java/me/blackvein/quests/EventFactory.java +++ b/src/main/java/me/blackvein/quests/EventFactory.java @@ -111,7 +111,7 @@ public class EventFactory implements ConversationAbandonedListener { context.setSessionData(CK.E_OLD_EVENT, ""); return new EventNamePrompt(); } else { - player.sendMessage(ChatColor.RED + Lang.get("eventEditorCreatePermisssions")); + player.sendMessage(ChatColor.RED + Lang.get("noPermission")); return new MenuPrompt(); } } else if (input.equalsIgnoreCase("2")) { @@ -123,7 +123,7 @@ public class EventFactory implements ConversationAbandonedListener { return new SelectEditPrompt(); } } else { - player.sendMessage(ChatColor.RED + Lang.get("eventEditorEditPermisssions")); + player.sendMessage(ChatColor.RED + Lang.get("noPermission")); return new MenuPrompt(); } } else if (input.equalsIgnoreCase("3")) { @@ -135,7 +135,7 @@ public class EventFactory implements ConversationAbandonedListener { return new SelectDeletePrompt(); } } else { - player.sendMessage(ChatColor.RED + Lang.get("eventEditorDeletePermisssions")); + player.sendMessage(ChatColor.RED + Lang.get("noPermission")); return new MenuPrompt(); } } else if (input.equalsIgnoreCase("4")) { diff --git a/src/main/java/me/blackvein/quests/NpcListener.java b/src/main/java/me/blackvein/quests/NpcListener.java index bf1ce72f3..91dd733d3 100644 --- a/src/main/java/me/blackvein/quests/NpcListener.java +++ b/src/main/java/me/blackvein/quests/NpcListener.java @@ -94,81 +94,79 @@ public class NpcListener implements Listener { } } if (plugin.questNPCs.contains(evt.getNPC()) && delivery == false) { - if (plugin.checkQuester(player.getUniqueId()) == false) { - boolean hasObjective = false; - for (Quest quest : quester.currentQuests.keySet()) { - if (quester.hasObjective(quest, "talkToNPC")) { - if (quester.getQuestData(quest) != null && quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) { - hasObjective = true; - } - quester.interactWithNPC(quest, evt.getNPC()); + boolean hasObjective = false; + for (Quest quest : quester.currentQuests.keySet()) { + if (quester.hasObjective(quest, "talkToNPC")) { + if (quester.getQuestData(quest) != null && quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) { + hasObjective = true; } + quester.interactWithNPC(quest, evt.getNPC()); } - if (!hasObjective) { - LinkedList npcQuests = new LinkedList(); - for (Quest q : plugin.getQuests()) { - if (quester.currentQuests.containsKey(q)) - continue; - if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) { - if (plugin.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1)) { - if (q.testRequirements(quester)) { - npcQuests.add(q); - } - } else if (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1) { + } + if (!hasObjective) { + LinkedList npcQuests = new LinkedList(); + for (Quest q : plugin.getQuests()) { + if (quester.currentQuests.containsKey(q)) + continue; + if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) { + if (plugin.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1)) { + if (q.testRequirements(quester)) { npcQuests.add(q); } + } else if (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1) { + npcQuests.add(q); } } - if (npcQuests.isEmpty() == false && npcQuests.size() >= 1) { - if (plugin.questNPCGUIs.contains(evt.getNPC().getId())) { - quester.showGUIDisplay(evt.getNPC(), npcQuests); - return; - } - Conversation c = plugin.NPCConversationFactory.buildConversation(player); - c.getContext().setSessionData("quests", npcQuests); - c.getContext().setSessionData("npc", evt.getNPC().getName()); - c.begin(); - } else if (npcQuests.size() == 1) { - Quest q = npcQuests.get(0); - if (!quester.completedQuests.contains(q.name)) { - if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) { - quester.questToTake = q.name; - String s = extracted(quester); - for (String msg : s.split("
")) { - player.sendMessage(msg); - } - plugin.conversationFactory.buildConversation(player).begin(); - } else if (quester.currentQuests.containsKey(q) == false) { - String msg = Lang.get(player, "questMaxAllowed"); - msg = msg.replaceAll("", String.valueOf(plugin.maxQuests)); - player.sendMessage(ChatColor.YELLOW + msg); - } - } else if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) { - if (quester.getDifference(q) > 0) { - String early = Lang.get(player, "questTooEarly"); - early = early.replaceAll("", ChatColor.AQUA + q.name + ChatColor.YELLOW); - early = early.replaceAll("