2020-04-15 14:22:03 +02:00
|
|
|
package com.minelittlepony.unicopia;
|
2019-01-13 21:07:44 +01:00
|
|
|
|
2020-04-25 13:32:33 +02:00
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Set;
|
2019-01-13 21:07:44 +01:00
|
|
|
|
|
|
|
import com.google.gson.annotations.Expose;
|
2020-04-25 13:32:33 +02:00
|
|
|
import com.minelittlepony.common.util.GamePaths;
|
|
|
|
import com.minelittlepony.common.util.settings.JsonConfig;
|
2019-01-13 21:07:44 +01:00
|
|
|
|
2020-04-25 13:32:33 +02:00
|
|
|
public class Config extends JsonConfig {
|
2019-01-13 21:07:44 +01:00
|
|
|
|
2020-04-25 13:32:33 +02:00
|
|
|
@Deprecated
|
2020-04-15 18:12:00 +02:00
|
|
|
public static Config getInstance() {
|
2020-04-25 13:32:33 +02:00
|
|
|
return Unicopia.getConfig();
|
2019-01-13 21:07:44 +01:00
|
|
|
}
|
|
|
|
|
2020-04-25 13:32:33 +02:00
|
|
|
public Config() {
|
|
|
|
super(GamePaths.getConfigDirectory().resolve("unicopia.json"));
|
2019-01-13 21:07:44 +01:00
|
|
|
}
|
|
|
|
|
2019-01-27 20:34:02 +01:00
|
|
|
@Expose(deserialize = false)
|
|
|
|
private final String speciesWhiteListComment =
|
|
|
|
"A whitelist of races permitted on the server. " +
|
|
|
|
"Races added to this list can be used by anyone, whilst any ones left off are not permitted. " +
|
|
|
|
"An empty list disables whitelisting entirely.";
|
2019-01-13 21:07:44 +01:00
|
|
|
@Expose
|
2020-04-25 13:32:33 +02:00
|
|
|
private final Set<Race> speciesWhiteList = new HashSet<>();
|
2019-01-13 21:07:44 +01:00
|
|
|
|
2019-01-27 20:34:02 +01:00
|
|
|
@Expose(deserialize = false)
|
|
|
|
private final String preferredRaceComment =
|
|
|
|
"The default preferred race. " +
|
|
|
|
"This is the race a client requests when first joining a game. " +
|
|
|
|
"It is the default used both when Mine Little Pony is not installed and when they respond with a human race.";
|
|
|
|
@Expose
|
2019-01-29 13:13:06 +01:00
|
|
|
private Race preferredRace = Race.EARTH;
|
2019-01-27 20:34:02 +01:00
|
|
|
|
|
|
|
@Expose(deserialize = false)
|
|
|
|
private final String ignoreMineLPComment =
|
|
|
|
"If true Mine Little Pony will not be considered when determining the race to use. " +
|
|
|
|
"The result will always be what is set by this config file.";
|
|
|
|
@Expose
|
|
|
|
private boolean ignoreMineLP = false;
|
|
|
|
|
2020-04-25 13:32:33 +02:00
|
|
|
public Set<Race> getSpeciesWhiteList() {
|
2019-01-13 21:07:44 +01:00
|
|
|
return speciesWhiteList;
|
|
|
|
}
|
|
|
|
|
2019-01-27 20:34:02 +01:00
|
|
|
public boolean ignoresMineLittlePony() {
|
|
|
|
return ignoreMineLP;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setIgnoreMineLittlePony(boolean value) {
|
|
|
|
if (value != ignoreMineLP) {
|
|
|
|
ignoreMineLP = value;
|
|
|
|
save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPreferredRace(Race race) {
|
|
|
|
if (preferredRace != race) {
|
|
|
|
preferredRace = race;
|
|
|
|
save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Race getPrefferedRace() {
|
|
|
|
if (preferredRace == null) {
|
2019-01-29 13:13:06 +01:00
|
|
|
setPreferredRace(Race.EARTH);
|
2019-01-27 20:34:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return preferredRace;
|
|
|
|
}
|
2019-01-13 21:07:44 +01:00
|
|
|
}
|