Temporarily hardcoded ranks since the getStringList was not loading it from the config and just emptying it instead

This commit is contained in:
Teriuihi 2023-07-08 23:46:06 +02:00
parent 75aa05cdf5
commit 95030d8163
2 changed files with 22 additions and 3 deletions

View File

@ -148,9 +148,28 @@ abstract class AbstractConfig {
return config.node(splitPath(path)).getLong(def); return config.node(splitPath(path)).getLong(def);
} }
protected static <T> List<String> getList(String prefix, String path, T def) { private static void setStringList(String prefix, String path, List<String> def) {
path = prefix + path;
System.out.println("Setting: " + def);
if(config.node(splitPath(path)).virtual()) {
try {
config.node(splitPath(path)).setList(TypeToken.get(String.class), def);
} catch (SerializationException e) {
e.printStackTrace();
}
} else {
try {
config.node(splitPath(path)).setList(TypeToken.get(String.class), def);
} catch (SerializationException e) {
e.printStackTrace();
}
}
saveConfig();
}
protected static List<String> getStringList(String prefix, String path, List<String> def) {
try { try {
set(prefix, path, def); setStringList(prefix, path, def);
return config.node(splitPath(path)).getList(TypeToken.get(String.class)); return config.node(splitPath(path)).getList(TypeToken.get(String.class));
} catch(SerializationException ex) { } catch(SerializationException ex) {
ex.printStackTrace(); ex.printStackTrace();

View File

@ -47,7 +47,7 @@ public final class Config extends AbstractConfig {
UPDATE_FREQUENCY_MINUTES = config.getInt(prefix, "update-frequency-minutes", UPDATE_FREQUENCY_MINUTES); UPDATE_FREQUENCY_MINUTES = config.getInt(prefix, "update-frequency-minutes", UPDATE_FREQUENCY_MINUTES);
BOOST_ANNOUNCE_CHANNEL = config.getLong(prefix, "boost-announce-channel", BOOST_ANNOUNCE_CHANNEL); BOOST_ANNOUNCE_CHANNEL = config.getLong(prefix, "boost-announce-channel", BOOST_ANNOUNCE_CHANNEL);
PLUGIN_MESSAGE_CHANNEL = config.getString(prefix, "plugin-message-channel", PLUGIN_MESSAGE_CHANNEL); PLUGIN_MESSAGE_CHANNEL = config.getString(prefix, "plugin-message-channel", PLUGIN_MESSAGE_CHANNEL);
DONOR_RANKS = config.getList(prefix, "donor-ranks", DONOR_RANKS); // DONOR_RANKS = config.getStringList(prefix, "donor-ranks", DONOR_RANKS);
} }
} }