mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Make party loading more resilient (#4881)
This commit is contained in:
parent
69ef484b86
commit
9b0632d63c
@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public final class PartyManager {
|
public final class PartyManager {
|
||||||
private static final String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
private static final String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
||||||
@ -609,6 +610,7 @@ public final class PartyManager {
|
|||||||
ArrayList<Party> hasAlly = new ArrayList<>();
|
ArrayList<Party> hasAlly = new ArrayList<>();
|
||||||
|
|
||||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||||
|
try {
|
||||||
Party party = new Party(partyName);
|
Party party = new Party(partyName);
|
||||||
|
|
||||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||||
@ -637,6 +639,9 @@ public final class PartyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parties.add(party);
|
parties.add(party);
|
||||||
|
} catch (Exception e) {
|
||||||
|
mcMMO.p.getLogger().log(Level.WARNING, "An exception occurred while loading a party with name '" + partyName + "'. Skipped loading party.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||||
|
Loading…
Reference in New Issue
Block a user