Add proper error handling to file loading

This commit is contained in:
nossr50 2019-06-17 07:38:30 -07:00
parent 218b2a1a75
commit 4e4d798b1d
3 changed files with 42 additions and 29 deletions

View File

@ -1,3 +1,8 @@
Version 2.1.82
Added proper error handling when loading parties file
Updated Chinese locale (thanks to the user named 89009332 from github)
Added some redundancy checks when loading profiles (NPC checks to be specific)
Version 2.1.81 Version 2.1.81
Fixed a bug where Arrow Deflect would never trigger outside of PVP Fixed a bug where Arrow Deflect would never trigger outside of PVP
Fixed a bug where failing to salvage enchantments incorrectly colored the text Fixed a bug where failing to salvage enchantments incorrectly colored the text

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.1.81</version> <version>2.1.82-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>

View File

@ -591,7 +591,9 @@ public final class PartyManager {
return; return;
} }
YamlConfiguration partiesFile = YamlConfiguration.loadConfiguration(partyFile); try {
YamlConfiguration partiesFile;
partiesFile = YamlConfiguration.loadConfiguration(partyFile);
ArrayList<Party> hasAlly = new ArrayList<Party>(); ArrayList<Party> hasAlly = new ArrayList<Party>();
@ -625,11 +627,17 @@ public final class PartyManager {
parties.add(party); parties.add(party);
} }
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties..."); mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
for (Party party : hasAlly) { for (Party party : hasAlly) {
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally"))); party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
} }
} catch (Exception e) {
e.printStackTrace();
}
} }
/** /**