From b0301fa2cee5b352e9151cf4e1b0e90d8fbb34d8 Mon Sep 17 00:00:00 2001 From: HappyPikachu Date: Fri, 4 Aug 2017 19:02:32 -0400 Subject: [PATCH] Check for illegal data when using /quests top, fixes #91 --- src/main/java/me/blackvein/quests/Quests.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index 238bbc9a9..c26be8f5f 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -1337,8 +1337,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener for (String s : sortedMap.keySet()) { int i = (Integer) sortedMap.get(s); s = s.trim(); - UUID id = UUID.fromString(s); - s = Bukkit.getOfflinePlayer(id).getName(); + try { + UUID id = UUID.fromString(s); + s = Bukkit.getOfflinePlayer(id).getName(); + } catch (IllegalArgumentException e) { + getLogger().warning("Invalid file name \"" + s + "\"in /data folder. Replace with player UUID" + + " or start the plugin with the \"convert-data-on-startup\" enabled in config.yml"); + break; + } numPrinted++; cs.sendMessage(ChatColor.YELLOW + String.valueOf(numPrinted) + ". " + s + " - " + ChatColor.DARK_PURPLE + i + ChatColor.YELLOW + " " + Lang.get("questPoints")); if (numPrinted == topNumber) {