diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index cafef6ee9..14c441a50 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -7,6 +7,7 @@ import com.gmail.nossr50.config.hocon.backup.ConfigAutomatedBackups; import com.gmail.nossr50.config.hocon.commands.ConfigCommands; import com.gmail.nossr50.config.hocon.database.ConfigDatabase; import com.gmail.nossr50.config.hocon.donation.ConfigAuthorAdvertisements; +import com.gmail.nossr50.config.hocon.event.ConfigEvent; import com.gmail.nossr50.config.hocon.experience.ConfigExperience; import com.gmail.nossr50.config.hocon.hardcore.ConfigHardcore; import com.gmail.nossr50.config.hocon.items.ConfigItems; @@ -95,6 +96,7 @@ public final class ConfigManager { private SerializedConfigLoader configMobs; private SerializedConfigLoader configExperience; private SerializedConfigLoader configCoreSkills; + private SerializedConfigLoader configEvent; private SerializedConfigLoader configDefaultExamples; private ConfigAcrobatics configAcrobatics; @@ -179,6 +181,7 @@ public final class ConfigManager { configMobs = new SerializedConfigLoader<>(ConfigMobs.class, "creatures.conf", "Creatures", null); configExperience = new SerializedConfigLoader<>(ConfigExperience.class, "experience.conf", "Experience", null); configCoreSkills = new SerializedConfigLoader<>(ConfigCoreSkills.class, "core_skills.conf", "Core-Skills", null); + configEvent = new SerializedConfigLoader<>(ConfigEvent.class, "events.conf", "Events", null); configDefaultExamples = new SerializedConfigLoader<>(ConfigNameRegisterDefaults.class, "minecraft_item_block_name_examples.conf", "Minecraft", null); initSerializedSkillConfigs(); @@ -476,6 +479,10 @@ public final class ConfigManager { return configSalvage; } + public ConfigEvent getConfigEvent() { + return configEvent.getConfig(); + } + /** * Checks if this plugin is using retro mode * Retro mode is a 0-1000 skill system diff --git a/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEvent.java b/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEvent.java new file mode 100644 index 000000000..2a5f2c75f --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEvent.java @@ -0,0 +1,23 @@ +package com.gmail.nossr50.config.hocon.event; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigEvent { + + @Setting(value = "XP-Rate-Event", comment = "Settings relating to XP rate events") + public ConfigEventExperienceRate xpRate = new ConfigEventExperienceRate(); + + public ConfigEventExperienceRate getXpRate() { + return xpRate; + } + + public boolean isShowXPRateInfoOnPlayerJoin() { + return xpRate.isShowXPRateInfoOnPlayerJoin(); + } + + public boolean isBroadcastXPRateEventMessages() { + return xpRate.isBroadcastXPRateEventMessages(); + } +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEventExperienceRate.java b/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEventExperienceRate.java new file mode 100644 index 000000000..5e1ceaf2d --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEventExperienceRate.java @@ -0,0 +1,28 @@ +package com.gmail.nossr50.config.hocon.event; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigEventExperienceRate { + + public static final boolean SHOW_XP_RATE_ON_JOIN_DEFAULT = true; + public static final boolean BROADCAST_EVENT_MESSAGES_DEFAULT = true; + + @Setting(value = "Show-Details-On-Player-Join", comment = "Show players info about ongoing XP rate events when they join the server." + + "\nDefault value: "+SHOW_XP_RATE_ON_JOIN_DEFAULT) + private boolean showXPRateInfoOnPlayerJoin = SHOW_XP_RATE_ON_JOIN_DEFAULT; + + @Setting(value = "Broadcast-Event-Messages", comment = "Whether or not to broadcast info about the event to players on the server" + + "\nA broadcast is a message sent to all players connected to the server" + + "\nDefault value: "+BROADCAST_EVENT_MESSAGES_DEFAULT) + private boolean broadcastXPRateEventMessages = BROADCAST_EVENT_MESSAGES_DEFAULT; + + public boolean isShowXPRateInfoOnPlayerJoin() { + return showXPRateInfoOnPlayerJoin; + } + + public boolean isBroadcastXPRateEventMessages() { + return broadcastXPRateEventMessages; + } +}