Exception handling and don't kill everything
This commit is contained in:
@@ -52,6 +52,7 @@ public class BackpackConverter implements Converter {
|
|||||||
File[] files = worldFolder.listFiles();
|
File[] files = worldFolder.listFiles();
|
||||||
for (File file : files != null ? files : new File[0]) {
|
for (File file : files != null ? files : new File[0]) {
|
||||||
if (file.isFile() && file.getName().toLowerCase().endsWith(".yml")) {
|
if (file.isFile() && file.getName().toLowerCase().endsWith(".yml")) {
|
||||||
|
try {
|
||||||
PlayerRecord player = uuidProvider.doLookup(file.getName().substring(0, file.getName().lastIndexOf('.')));
|
PlayerRecord player = uuidProvider.doLookup(file.getName().substring(0, file.getName().lastIndexOf('.')));
|
||||||
if (player == null || player.getUuid() == null) {
|
if (player == null || player.getUuid() == null) {
|
||||||
plugin.getLogger().warning("Unable to convert Backpack for player: " + (player != null ? player.getName() : file.getName()));
|
plugin.getLogger().warning("Unable to convert Backpack for player: " + (player != null ? player.getName() : file.getName()));
|
||||||
@@ -62,7 +63,8 @@ public class BackpackConverter implements Converter {
|
|||||||
if (section.getKeys(false).size() <= 0) continue; // No slots
|
if (section.getKeys(false).size() <= 0) continue; // No slots
|
||||||
|
|
||||||
Inventory vault = vaults.getVault(uuid, intoVaultNum);
|
Inventory vault = vaults.getVault(uuid, intoVaultNum);
|
||||||
if (vault == null) vault = plugin.getServer().createInventory(null, section.getKeys(false).size());
|
if (vault == null)
|
||||||
|
vault = plugin.getServer().createInventory(null, section.getKeys(false).size());
|
||||||
for (String key : section.getKeys(false)) {
|
for (String key : section.getKeys(false)) {
|
||||||
ConfigurationSection slotSection = section.getConfigurationSection(key);
|
ConfigurationSection slotSection = section.getConfigurationSection(key);
|
||||||
ItemStack item = slotSection.getItemStack("ItemStack");
|
ItemStack item = slotSection.getItemStack("ItemStack");
|
||||||
@@ -84,6 +86,10 @@ public class BackpackConverter implements Converter {
|
|||||||
lastUpdate = System.currentTimeMillis();
|
lastUpdate = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
plugin.getLogger().warning("Error converting " + file.getAbsolutePath());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return converted;
|
return converted;
|
||||||
|
|||||||
Reference in New Issue
Block a user