mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Add proper error handling to file loading
This commit is contained in:
parent
218b2a1a75
commit
4e4d798b1d
@ -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
|
||||
Fixed a bug where Arrow Deflect would never trigger outside of PVP
|
||||
Fixed a bug where failing to salvage enchantments incorrectly colored the text
|
||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.81</version>
|
||||
<version>2.1.82-SNAPSHOT</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -591,45 +591,53 @@ public final class PartyManager {
|
||||
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>();
|
||||
|
||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||
Party party = new Party(partyName);
|
||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||
Party party = new Party(partyName);
|
||||
|
||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||
party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
|
||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
||||
party.setXp(partiesFile.getInt(partyName + ".Xp"));
|
||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||
party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
|
||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
||||
party.setXp(partiesFile.getInt(partyName + ".Xp"));
|
||||
|
||||
if (partiesFile.getString(partyName + ".Ally") != null) {
|
||||
hasAlly.add(party);
|
||||
if (partiesFile.getString(partyName + ".Ally") != null) {
|
||||
hasAlly.add(party);
|
||||
}
|
||||
|
||||
party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE")));
|
||||
party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));
|
||||
|
||||
for (ItemShareType itemShareType : ItemShareType.values()) {
|
||||
party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
|
||||
}
|
||||
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
|
||||
for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) {
|
||||
String[] memberSplit = memberEntry.split("[|]");
|
||||
members.put(UUID.fromString(memberSplit[0]), memberSplit[1]);
|
||||
}
|
||||
|
||||
parties.add(party);
|
||||
}
|
||||
|
||||
party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE")));
|
||||
party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));
|
||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||
|
||||
for (ItemShareType itemShareType : ItemShareType.values()) {
|
||||
party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
|
||||
for (Party party : hasAlly) {
|
||||
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||
}
|
||||
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
|
||||
for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) {
|
||||
String[] memberSplit = memberEntry.split("[|]");
|
||||
members.put(UUID.fromString(memberSplit[0]), memberSplit[1]);
|
||||
}
|
||||
|
||||
parties.add(party);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||
|
||||
for (Party party : hasAlly) {
|
||||
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user