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
|
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
|
||||||
|
2
pom.xml
2
pom.xml
@ -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>
|
||||||
|
@ -591,45 +591,53 @@ 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>();
|
||||||
|
|
||||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||||
Party party = new Party(partyName);
|
Party party = new Party(partyName);
|
||||||
|
|
||||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||||
party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
|
party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
|
||||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||||
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
||||||
party.setXp(partiesFile.getInt(partyName + ".Xp"));
|
party.setXp(partiesFile.getInt(partyName + ".Xp"));
|
||||||
|
|
||||||
if (partiesFile.getString(partyName + ".Ally") != null) {
|
if (partiesFile.getString(partyName + ".Ally") != null) {
|
||||||
hasAlly.add(party);
|
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")));
|
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||||
party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));
|
|
||||||
|
|
||||||
for (ItemShareType itemShareType : ItemShareType.values()) {
|
for (Party party : hasAlly) {
|
||||||
party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
|
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) {
|
|
||||||
String[] memberSplit = memberEntry.split("[|]");
|
|
||||||
members.put(UUID.fromString(memberSplit[0]), memberSplit[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
parties.add(party);
|
|
||||||
}
|
}
|
||||||
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