Check for illegal data when using /quests top, fixes #91

This commit is contained in:
HappyPikachu 2017-08-04 19:02:32 -04:00
parent 7f9eb50252
commit b0301fa2ce

View File

@ -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) {