mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-12 13:43:57 +01:00
Remove blacklist and purge subcommand
This commit is contained in:
parent
e88d7159fe
commit
172d5ffeee
@ -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;
|
||||
|
@ -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")) {
|
||||
|
@ -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<Quest> npcQuests = new LinkedList<Quest>();
|
||||
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<Quest> npcQuests = new LinkedList<Quest>();
|
||||
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("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
plugin.conversationFactory.buildConversation(player).begin();
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", 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("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
} else if (q.cooldownPlanner < 0) {
|
||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
} else {
|
||||
quester.questToTake = q.name;
|
||||
String s = extracted(quester);
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
plugin.conversationFactory.buildConversation(player).begin();
|
||||
}
|
||||
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("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
plugin.conversationFactory.buildConversation(player).begin();
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
} else if (npcQuests.isEmpty()) {
|
||||
evt.getClicker().sendMessage(ChatColor.YELLOW + Lang.get(player, "noMoreQuest"));
|
||||
} else if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||
if (quester.getDifference(q) > 0) {
|
||||
String early = Lang.get(player, "questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
} else if (q.cooldownPlanner < 0) {
|
||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
} else {
|
||||
quester.questToTake = q.name;
|
||||
String s = extracted(quester);
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
plugin.conversationFactory.buildConversation(player).begin();
|
||||
}
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
} else if (npcQuests.isEmpty()) {
|
||||
evt.getClicker().sendMessage(ChatColor.YELLOW + Lang.get(player, "noMoreQuest"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,21 +106,21 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.create")) {
|
||||
return new QuestNamePrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("questEditorNoPermsCreate"));
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.edit")) {
|
||||
return new SelectEditPrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("questEditorNoPermsCreate"));
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.delete")) {
|
||||
return new SelectDeletePrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("questEditorNoPermsDelete"));
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
|
@ -70,6 +70,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@ -137,7 +138,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public HashMap<String, Integer> commands = new HashMap<String, Integer>();
|
||||
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
|
||||
public final Map<UUID, Quester> questers = new HashMap<UUID, Quester>();
|
||||
public final List<String> questerBlacklist = new LinkedList<String>();
|
||||
public final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>();
|
||||
public final List<CustomReward> customRewards = new LinkedList<CustomReward>();
|
||||
public final List<CustomObjective> customObjectives = new LinkedList<CustomObjective>();
|
||||
@ -317,7 +317,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_FINISH"), 3); // finish [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE"), 3); // nextstage [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_SETSTAGE"), 4); // setstage [player] [quest] [stage]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_PURGE"), 2); // purge [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RESET"), 2); // reset [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI"), 2); // togglegui [npc id]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RELOAD"), 1); // reload
|
||||
@ -342,7 +341,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
adminCommands.put("finish", 3); // finish [player] [quest]
|
||||
adminCommands.put("nextstage", 3); // nextstage [player] [quest]
|
||||
adminCommands.put("setstage", 4); // setstage [player] [quest] [stage]
|
||||
adminCommands.put("purge", 2); // purge [player]
|
||||
adminCommands.put("reset", 2); // reset [player]
|
||||
adminCommands.put("togglegui", 2); // togglegui [npc id]
|
||||
adminCommands.put("reload", 1); // reload
|
||||
@ -426,10 +424,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public void onDisable() {
|
||||
getLogger().info("Saving Quester data.");
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
if (!questerBlacklist.contains(p.getUniqueId().toString())) {
|
||||
Quester quester = getQuester(p.getUniqueId());
|
||||
quester.saveData();
|
||||
}
|
||||
Quester quester = getQuester(p.getUniqueId());
|
||||
quester.saveData();
|
||||
}
|
||||
updateData();
|
||||
}
|
||||
@ -514,11 +510,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
showQuestTitles = config.getBoolean("show-titles", true);
|
||||
translateSubCommands = config.getBoolean("translate-subcommands", false);
|
||||
useCompass = config.getBoolean("use-compass", true);
|
||||
for (String s : config.getStringList("quester-blacklist")) {
|
||||
if (!s.equalsIgnoreCase("UUID")) {
|
||||
questerBlacklist.add(s);
|
||||
}
|
||||
}
|
||||
try {
|
||||
config.save(new File(this.getDataFolder(), "config.yml"));
|
||||
} catch (IOException e) {
|
||||
@ -681,7 +672,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public boolean onCommand(final CommandSender cs, Command cmd, String label, String[] args) {
|
||||
if (cs instanceof Player) {
|
||||
if (checkQuester(((Player) cs).getUniqueId()) == true) {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get((Player) cs, "questBlacklisted"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get((Player) cs, "noPermission"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -725,8 +716,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
adminNextStage(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage")) {
|
||||
adminSetStage(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_PURGE") : "purge")) {
|
||||
adminPurge(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset")) {
|
||||
adminReset(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove")) {
|
||||
@ -745,7 +734,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin")) {
|
||||
printAdminHelp(cs);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -757,7 +746,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
msg = msg.replaceAll("<number>", ChatColor.DARK_PURPLE + String.valueOf(quests.size()) + ChatColor.GOLD);
|
||||
cs.sendMessage(ChatColor.GOLD + msg);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -789,7 +778,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("unknownError"));
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -824,7 +813,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,7 +849,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
quester.saveData();
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -896,7 +885,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
quester.saveData();
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -953,7 +942,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1028,7 +1017,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
thread.start();
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1068,7 +1057,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1126,7 +1115,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1166,7 +1155,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1208,44 +1197,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
} catch (NullPointerException npe) {
|
||||
npe.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void adminPurge(final CommandSender cs, String[] args) {
|
||||
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.purge")) {
|
||||
Quester quester = getQuester(args[1]);
|
||||
if (quester == null) {
|
||||
cs.sendMessage(ChatColor.YELLOW + Lang.get("playerNotFound"));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
quester.hardClear();
|
||||
quester.saveData();
|
||||
quester.updateJournal();
|
||||
final File dataFolder = new File(this.getDataFolder(), "data" + File.separator);
|
||||
final File found = new File(dataFolder, quester.id + ".yml");
|
||||
found.delete();
|
||||
addToBlacklist(quester.id);
|
||||
String msg = Lang.get("questPurged");
|
||||
if (Bukkit.getOfflinePlayer(quester.id).getName() != null) {
|
||||
msg = msg.replaceAll("<player>", ChatColor.GREEN + Bukkit.getOfflinePlayer(quester.id).getName() + ChatColor.GOLD);
|
||||
} else {
|
||||
msg = msg.replaceAll("<player>", ChatColor.GREEN + args[1] + ChatColor.GOLD);
|
||||
}
|
||||
cs.sendMessage(ChatColor.GOLD + msg);
|
||||
cs.sendMessage(ChatColor.DARK_PURPLE + " UUID: " + ChatColor.DARK_AQUA + quester.id);
|
||||
} catch (Exception e) {
|
||||
getLogger().info("Data file does not exist for " + quester.id.toString());
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
}
|
||||
}
|
||||
|
||||
private void adminReset(final CommandSender cs, String[] args) {
|
||||
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reset")) {
|
||||
Quester quester = getQuester(args[1]);
|
||||
@ -1278,7 +1236,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
quester.saveData();
|
||||
questers.put(id, quester);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1286,7 +1244,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (cs.hasPermission("quests.admin.*") && cs.hasPermission("quests.admin.stats")) {
|
||||
questsStats(cs, args);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1315,7 +1273,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
quester.saveData();
|
||||
quester.updateJournal();
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1367,7 +1325,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (cs.hasPermission("quests.editor.*") || cs.hasPermission("quests.editor.events.editor")) {
|
||||
eventFactory.convoCreator.buildConversation((Conversable) cs).begin();
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("eventEditorNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1376,7 +1334,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (cs.hasPermission("quests.editor.*") || cs.hasPermission("quests.editor.editor")) {
|
||||
questFactory.convoCreator.buildConversation((Conversable) cs).begin();
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questEditorNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1560,7 +1518,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "questQuitNoPerms"));
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "NoPermission"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@ -1678,7 +1636,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "questTakeNoPerms"));
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "NoPermission"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "questTakeDisabled"));
|
||||
@ -1704,7 +1662,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
listQuests((Player) cs, page);
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questListNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1713,7 +1671,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
Player p = (Player) cs;
|
||||
printHelp(p);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1726,7 +1684,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
showQuestDetails(cs, args);
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@ -1870,7 +1828,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
cs.sendMessage(ChatColor.YELLOW + Lang.get("questNotFound"));
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questInfoNoPerms"));
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1928,8 +1886,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_PURGE_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_PURGE") : "purge"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")
|
||||
@ -1979,10 +1935,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.purge")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_PURGE_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_PURGE") : "purge"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.reset")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
|
||||
@ -2036,7 +1988,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public void reloadQuests() {
|
||||
quests.clear();
|
||||
events.clear();
|
||||
questerBlacklist.clear();
|
||||
loadQuests();
|
||||
loadData();
|
||||
loadEvents();
|
||||
@ -3826,18 +3777,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether player has been blacklisted from Quests
|
||||
* Checks whether player meets criteria to use Quests
|
||||
*
|
||||
* @param uuid the entity UUID to be checked
|
||||
* @return {@code true} if UUID is blacklisted
|
||||
*/
|
||||
public boolean checkQuester(UUID uuid) {
|
||||
for (String s : questerBlacklist) {
|
||||
try {
|
||||
uuid.equals(UUID.fromString(s));
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
for (PermissionAttachmentInfo pm : p.getEffectivePermissions()) {
|
||||
if (pm.getPermission().startsWith("quests")) {
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
getLogger().warning(s + " in config.yml is not a valid UUID for quester-blacklist");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -4111,16 +4060,4 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void addToBlacklist(UUID id) {
|
||||
List<String> blacklist = getConfig().getStringList("quester-blacklist");
|
||||
if (!blacklist.contains(id.toString())) {
|
||||
blacklist.add(id.toString());
|
||||
getConfig().set("quester-blacklist", blacklist);
|
||||
saveConfig();
|
||||
}
|
||||
if (!questerBlacklist.contains(id.toString())) {
|
||||
questerBlacklist.add(id.toString());
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ allow-command-questing: true
|
||||
allow-command-quests-with-npcs: false
|
||||
allow-quitting: true
|
||||
ask-confirmation: true
|
||||
convert-data-on-startup: false
|
||||
generate-files-on-join: true
|
||||
ignore-locked-quests: false
|
||||
kill-delay: 600
|
||||
@ -17,8 +16,4 @@ npc-effects:
|
||||
show-requirements: true
|
||||
show-titles: true
|
||||
translate-subcommands: false
|
||||
use-compass: true
|
||||
quester-blacklist:
|
||||
- UUID
|
||||
- UUID
|
||||
- UUID
|
||||
use-compass: true
|
@ -68,9 +68,6 @@ permissions:
|
||||
quests.admin.nextstage:
|
||||
description: Immediately force Stage completion for a player
|
||||
default: op
|
||||
quests.admin.purge:
|
||||
description: Clear all Quests data of a player AND BLACKLISTS THEM
|
||||
default: op
|
||||
quests.admin.reset:
|
||||
description: Clear all Quests data of a player
|
||||
default: op
|
||||
|
@ -42,8 +42,6 @@ COMMAND_QUESTADMIN_NEXTSTAGE_HELP: "<command> [player] [quest] - Immediately for
|
||||
COMMAND_QUESTADMIN_SETSTAGE: "setstage"
|
||||
COMMAND_QUESTADMIN_SETSTAGE_HELP: "<command> [player] [quest] [stage] - Set the current Stage for a player"
|
||||
COMMAND_QUESTADMIN_SETSTAGE_USAGE: 'Usage: /questadmin setstage [player] [quest] [stage]'
|
||||
COMMAND_QUESTADMIN_PURGE: "purge"
|
||||
COMMAND_QUESTADMIN_PURGE_HELP: "<command> [player] - Clear all Quests data of a player AND BLACKLISTS THEM"
|
||||
COMMAND_QUESTADMIN_RESET: "reset"
|
||||
COMMAND_QUESTADMIN_RESET_HELP: "<command> [player] - Clear all Quests data of a player"
|
||||
COMMAND_QUESTADMIN_REMOVE: "remove"
|
||||
@ -107,9 +105,6 @@ questEditorNeedStages: "Your Quest has no Stages!"
|
||||
questEditorSaved: "%bold%Quest saved! %reset%(You will need to perform %red%<command> %reset% for it to appear in-game)"
|
||||
questEditorExited: "Are you sure you want to exit without saving?"
|
||||
questEditorDeleted: "Are you sure you want to delete the Quest"
|
||||
questEditorNoPermsCreate: "You do not have permission to create Quests."
|
||||
questEditorNoPermsEdit: "You do not have permission to edit Quests."
|
||||
questEditorNoPermsDelete: "You do not have permission to delete Quests."
|
||||
stageEditorEditStage: "Edit Stage"
|
||||
stageEditorNewStage: "Add new Stage"
|
||||
stageEditorStages: "Stages"
|
||||
@ -309,9 +304,6 @@ allListsNotSameSize: "All of your lists are not the same size!"
|
||||
eventEditorCreate: "Create new Event"
|
||||
eventEditorEdit: "Edit an Event"
|
||||
eventEditorDelete: "Delete an Event"
|
||||
eventEditorCreatePermisssions: "You do not have permission to create new Events."
|
||||
eventEditorEditPermisssions: "You do not have permission to edit Events."
|
||||
eventEditorDeletePermisssions: "You do not have permission to delete Events."
|
||||
eventEditorNoneToEdit: "No Events currently exist to be edited!"
|
||||
eventEditorNoneToDelete: "No Events currently exist to be deleted!"
|
||||
eventEditorNotFound: "Event not found!"
|
||||
@ -703,18 +695,11 @@ questNoEquip: "You may not equip Quest items."
|
||||
questNoDispense: "You may not put Quest items in dispensers."
|
||||
questNoEnchant: "You may not enchant Quest items."
|
||||
questNoSmelt: "You may not smelt using Quest items."
|
||||
questInfoNoPerms: "You do not have permission to view a Quest's information."
|
||||
questCmdNoPerms: "You do not have access to that command."
|
||||
pageSelectionNum: "Page selection must be a number."
|
||||
pageSelectionPosNum: "Page selection must be a positive number."
|
||||
questListNoPerms: "You do not have permission to view the Quests list."
|
||||
questTakeNoPerms: "You do not have permission to take Quests via commands."
|
||||
questTakeDisabled: "Taking Quests via commands has been disabled."
|
||||
questQuit: "You have quit <quest>"
|
||||
questQuitNoPerms: "You do not have permission to quit Quests."
|
||||
questQuitDisabled: "Quitting Quests has been disabled."
|
||||
questEditorNoPerms: "You do not have permission to use the Quests Editor."
|
||||
eventEditorNoPerms: "You do not have permission to use the Events Editor."
|
||||
questsUnknownCommand: "Unknown Quests command. Type /quests for help."
|
||||
pageNotExist: "Page does not exist."
|
||||
pageFooter: "- Page <current> of <all> -"
|
||||
@ -728,7 +713,6 @@ questForceFinish: "<player> has forcibly finished their Quest <quest>."
|
||||
questForcedFinish: "<player> has forced you to finish your Quest <quest>."
|
||||
questForceNextStage: "<player> has advanced to the next Stage in the Quest <quest>."
|
||||
questForcedNextStage: "<player> has advanced you to the next Stage in your Quest <quest>."
|
||||
questPurged: "<player> has been purged and blacklisted."
|
||||
questReset: "<player> has been reset."
|
||||
questRemoved: "Quest <quest> has been removed from player <player>'s completed Quests."
|
||||
settingAllQuestPoints: "Setting all players' Quest Points..."
|
||||
@ -873,4 +857,4 @@ timerMessage: "%green%Time left to finish the quest/stage:%red% <time> seconds"
|
||||
timerStart: "%green%You have%red% <time> seconds%green% to finish this quest/stage"
|
||||
questErrorReadingFile: "Error reading Quests file."
|
||||
questSaveError: "An error occurred while saving."
|
||||
questBlacklisted: "You are blacklisted. Contact an admin if this is in error."
|
||||
noPermission: "You do not have permission to do that."
|
Loading…
Reference in New Issue
Block a user