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()) { for (String s : sortedMap.keySet()) {
int i = (Integer) sortedMap.get(s); int i = (Integer) sortedMap.get(s);
s = s.trim(); s = s.trim();
UUID id = UUID.fromString(s); try {
s = Bukkit.getOfflinePlayer(id).getName(); 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++; numPrinted++;
cs.sendMessage(ChatColor.YELLOW + String.valueOf(numPrinted) + ". " + s + " - " + ChatColor.DARK_PURPLE + i + ChatColor.YELLOW + " " + Lang.get("questPoints")); cs.sendMessage(ChatColor.YELLOW + String.valueOf(numPrinted) + ". " + s + " - " + ChatColor.DARK_PURPLE + i + ChatColor.YELLOW + " " + Lang.get("questPoints"));
if (numPrinted == topNumber) { if (numPrinted == topNumber) {