From 322c2d908ad428c7e975cd1c601527525428aa50 Mon Sep 17 00:00:00 2001 From: Nathan Wolf Date: Mon, 14 Dec 2015 11:05:44 -0800 Subject: [PATCH] Some fixes to /questsadmin reset --- src/main/java/me/blackvein/quests/Quests.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index b0f802b33..c0a74b56b 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -1600,27 +1600,36 @@ try{ cs.sendMessage(YELLOW + Lang.get("playerNotFound")); return; } + UUID id = quester.id; + questers.remove(id); try { quester.hardClear(); quester.saveData(); quester.updateJournal(); final File dataFolder = new File(this.getDataFolder(), "data/"); - final File found = new File(dataFolder, quester.id + ".yml"); + final File found = new File(dataFolder, id + ".yml"); found.delete(); String msg = Lang.get("questReset"); - if (Bukkit.getOfflinePlayer(quester.id).getName() != null) { - msg = msg.replaceAll("", GREEN + Bukkit.getOfflinePlayer(quester.id).getName() + GOLD); + if (Bukkit.getOfflinePlayer(id).getName() != null) { + msg = msg.replaceAll("", GREEN + Bukkit.getOfflinePlayer(id).getName() + GOLD); } else { msg = msg.replaceAll("", GREEN + args[1] + GOLD); } cs.sendMessage(GOLD + msg); - cs.sendMessage(PURPLE + " UUID: " + DARKAQUA + quester.id); + cs.sendMessage(PURPLE + " UUID: " + DARKAQUA + id); + + } catch (Exception e) { - getLogger().info("Data file does not exist for " + quester.id.toString()); + getLogger().info("Data file does not exist for " + id.toString()); } + quester = new Quester(this); + quester.id = id; + quester.saveData(); + questers.put(id, quester); + } else { cs.sendMessage(RED + Lang.get("questCmdNoPerms"));