From 04fdd3270a1f6788dfb0c1022f7f74d79743cbb1 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 14 Mar 2019 18:14:08 -0700 Subject: [PATCH] MOTD Config --- Changelog.txt | 14 ++++++++++++- .../gmail/nossr50/config/ConfigManager.java | 7 +++++++ .../nossr50/config/hocon/motd/ConfigMOTD.java | 20 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/motd/ConfigMOTD.java diff --git a/Changelog.txt b/Changelog.txt index 9d5b479dc..65d1601da 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,14 +10,21 @@ Key: Version 2.2.0 mcMMO's config system has been rewritten Many config files are now generated on demand instead of being copied from within the JAR - All config nodes that used to be styled with CamelCase now use hyphens (-) as spaces for readability and consistency + All config nodes that used to be styled with CamelCase or otherwise now use hyphens (-) as spaces for readability and consistency All config nodes will now use Capital letters at the start of each nodes name and after each hyphen (-) All config nodes now include a comment with the default value of the node to use as reference Expanded settings relating to purging users who have not leveled or users who had not logged in for many months NOTE: Not every config key that was renamed will be listed here + + Bug Fixes Fixed a bug where players who started at level 1 would not be purged from the DB for being "powerless" Fixed a potential bug where players could be awarded XP for cancelled tame events + Config Changes + + MOTD (Message of the day) config options will now be found in "motd.conf" + MOTD's "MOTD_Enabled" renamed -> "Show-MOTD-On-Player-Join" + Exploit related config options will now be found in "exploit-prevention" Exploit Prevention's "EndermanEndermiteFarms" renamed -> "Endermen-Endermite-Fix" Added toggle for pistons marking natural blocks as unnatural after being moved to prevent afk stone farms @@ -72,6 +79,11 @@ Version 2.2.0 Giga Drill Breaker will now break "diggable" blocks even if they have no configured treasures removed child.yml, child skills now have hard coded parents removed the hardcore and vampirism commands, these are dangerous settings and should not be toggle-able (turn them on in your configs if you want to use them) + + Removed the following config settings from various configs for literally doing nothing + Update_Check, Prefer_Beta + + API Changes Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition Added API method to check if a skill was being level capped diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index 7c8cdb000..9509c8b87 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.hocon.SerializedConfigLoader; import com.gmail.nossr50.config.hocon.antiexploit.ConfigExploitPrevention; import com.gmail.nossr50.config.hocon.database.ConfigDatabase; +import com.gmail.nossr50.config.hocon.motd.ConfigMOTD; import com.gmail.nossr50.config.hocon.playerleveling.ConfigLeveling; import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard; import com.gmail.nossr50.config.hocon.worldblacklist.ConfigWorldBlacklist; @@ -69,6 +70,7 @@ public final class ConfigManager { private SerializedConfigLoader configLeveling; private SerializedConfigLoader configWorldBlacklist; private SerializedConfigLoader configExploitPrevention; + private SerializedConfigLoader configMOTD; private MainConfig mainConfig; private FishingTreasureConfig fishingTreasureConfig; private ExcavationTreasureConfig excavationTreasureConfig; @@ -105,6 +107,7 @@ public final class ConfigManager { configLeveling = new SerializedConfigLoader<>(ConfigLeveling.class, "player_leveling.conf", null); configWorldBlacklist = new SerializedConfigLoader<>(ConfigWorldBlacklist.class, "world_blacklist.conf", null); configExploitPrevention = new SerializedConfigLoader<>(ConfigExploitPrevention.class, "exploit_prevention.conf", null); + configMOTD = new SerializedConfigLoader<>(ConfigMOTD.class, "message_of_the_day.conf", null); mainConfig = new MainConfig(); @@ -334,4 +337,8 @@ public final class ConfigManager { public ConfigExploitPrevention getConfigExploitPrevention() { return configExploitPrevention.getConfig(); } + + public ConfigMOTD getConfigMOTD() { + return configMOTD.getConfig(); + } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/motd/ConfigMOTD.java b/src/main/java/com/gmail/nossr50/config/hocon/motd/ConfigMOTD.java new file mode 100644 index 000000000..41827f83e --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/motd/ConfigMOTD.java @@ -0,0 +1,20 @@ +package com.gmail.nossr50.config.hocon.motd; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigMOTD { + private static final boolean ENABLE_MOTD_DEFAULT = true; + + @Setting(value = "Show-MOTD-On-Player-Join", comment = "Show players who connect to the server the MOTD from mcMMO" + + "\nHistorically this message is literally just telling players that the server runs mcMMO." + + "\nSometimes the MOTD includes warnings about build stability if using a volatile dev build." + + "\nIf you wish to edit the MOTD, that is done in the locale files inside the JAR." + + "\nDefault value: "+ENABLE_MOTD_DEFAULT) + private boolean enableMOTD = ENABLE_MOTD_DEFAULT; + + public boolean isEnableMOTD() { + return enableMOTD; + } +}