diff options
author | Cow <cow@volloeko.de> | 2020-04-26 03:43:30 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2020-04-26 03:43:30 +0200 |
commit | 35553dceb9c683000095ce1a62b4e094234304bc (patch) | |
tree | 8ed09cd69ba877be4defe9583007333c8164f8f0 /src/main/java/eu/olli/cowmoonication/config/MooConfig.java | |
parent | f0686a8e45528e3dd682a6f7a69dd904730f6fb1 (diff) | |
download | Cowlection-35553dceb9c683000095ce1a62b4e094234304bc.tar.gz Cowlection-35553dceb9c683000095ce1a62b4e094234304bc.tar.bz2 Cowlection-35553dceb9c683000095ce1a62b4e094234304bc.zip |
Improved output of player stalking feature
- offline players now include 'offline for <duration>'
- better handling of special cases (e.g. nicked players)
- also: simplified API requests and config handling
Diffstat (limited to 'src/main/java/eu/olli/cowmoonication/config/MooConfig.java')
-rw-r--r-- | src/main/java/eu/olli/cowmoonication/config/MooConfig.java | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/main/java/eu/olli/cowmoonication/config/MooConfig.java b/src/main/java/eu/olli/cowmoonication/config/MooConfig.java index a401dbb..41cec89 100644 --- a/src/main/java/eu/olli/cowmoonication/config/MooConfig.java +++ b/src/main/java/eu/olli/cowmoonication/config/MooConfig.java @@ -19,6 +19,7 @@ public class MooConfig { public static boolean showGuildNotifications; public static String moo; private static Configuration cfg = null; + private List<String> propOrderGeneral; public MooConfig(Configuration configuration) { cfg = configuration; @@ -68,36 +69,26 @@ public class MooConfig { if (loadConfigFromFile) { cfg.load(); } + propOrderGeneral = new ArrayList<>(); + + Property propDoUpdateCheck = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT, + "doUpdateCheck", true, "Check for mod updates?"), true); + Property propShowBestFriendNotifications = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT, + "showBestFriendNotifications", true, "Set to true to receive best friends' login/logout messages, set to false hide them."), true); + Property propShowFriendNotifications = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT, + "showFriendNotifications", false, "Set to true to receive friends' login/logout messages, set to false hide them."), true); + Property propShowGuildNotifications = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT, + "showGuildNotifications", false, "Set to true to receive guild members' login/logout messages, set to false hide them."), true); + Property propMoo = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT, + "moo", "", "The answer to life the universe and everything. Don't edit this entry manually!", Utils.VALID_UUID_PATTERN), false); - final boolean DO_UPDATE_CHECK = true; - Property propDoUpdateCheck = cfg.get(Configuration.CATEGORY_CLIENT, "doUpdateCheck", DO_UPDATE_CHECK, "Check for mod updates?"); - - final boolean SHOW_BEST_FRIEND_NOTIFICATIONS = true; - Property propShowBestFriendNotifications = cfg.get(Configuration.CATEGORY_CLIENT, "showBestFriendNotifications", SHOW_BEST_FRIEND_NOTIFICATIONS, "Set to true to receive best friends' login/logout messages, set to false hide them."); - - final boolean SHOW_FRIEND_NOTIFICATIONS = false; - Property propShowFriendNotifications = cfg.get(Configuration.CATEGORY_CLIENT, "showFriendNotifications", SHOW_FRIEND_NOTIFICATIONS, "Set to true to receive friends' login/logout messages, set to false hide them."); - - final boolean SHOW_GUILD_NOTIFICATIONS = false; - Property propShowGuildNotifications = cfg.get(Configuration.CATEGORY_CLIENT, "showGuildNotifications", SHOW_GUILD_NOTIFICATIONS, "Set to true to receive guild members' login/logout messages, set to false hide them."); - - final String MOO = ""; - Property propMoo = cfg.get(Configuration.CATEGORY_CLIENT, "moo", MOO, "The answer to life the universe and everything. Don't edit this entry manually!", Utils.VALID_UUID_PATTERN); - propMoo.setShowInGui(false); - - List<String> propOrderGeneral = new ArrayList<>(); - propOrderGeneral.add(propDoUpdateCheck.getName()); - propOrderGeneral.add(propShowBestFriendNotifications.getName()); - propOrderGeneral.add(propShowFriendNotifications.getName()); - propOrderGeneral.add(propShowGuildNotifications.getName()); - propOrderGeneral.add(propMoo.getName()); cfg.setCategoryPropertyOrder(Configuration.CATEGORY_CLIENT, propOrderGeneral); if (readFieldsFromConfig) { - doUpdateCheck = propDoUpdateCheck.getBoolean(DO_UPDATE_CHECK); - showBestFriendNotifications = propShowBestFriendNotifications.getBoolean(SHOW_BEST_FRIEND_NOTIFICATIONS); - showFriendNotifications = propShowFriendNotifications.getBoolean(SHOW_FRIEND_NOTIFICATIONS); - showGuildNotifications = propShowGuildNotifications.getBoolean(SHOW_GUILD_NOTIFICATIONS); + doUpdateCheck = propDoUpdateCheck.getBoolean(); + showBestFriendNotifications = propShowBestFriendNotifications.getBoolean(); + showFriendNotifications = propShowFriendNotifications.getBoolean(); + showGuildNotifications = propShowGuildNotifications.getBoolean(); moo = propMoo.getString(); } @@ -112,6 +103,16 @@ public class MooConfig { } } + private Property addConfigEntry(Property property, boolean showInGui) { + if (showInGui) { + property.setLanguageKey(Cowmoonication.MODID + ".config." + property.getName()); + } else { + property.setShowInGui(false); + } + propOrderGeneral.add(property.getName()); + return property; + } + /** * Should login/logout notifications be modified and thus monitored? * |