Add new config for events

This commit is contained in:
nossr50 2019-05-18 13:57:23 -07:00
parent 9c5ec234d9
commit ca8293bc35
3 changed files with 58 additions and 0 deletions

View File

@ -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> configMobs;
private SerializedConfigLoader<ConfigExperience> configExperience;
private SerializedConfigLoader<ConfigCoreSkills> configCoreSkills;
private SerializedConfigLoader<ConfigEvent> configEvent;
private SerializedConfigLoader<ConfigNameRegisterDefaults> 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

View File

@ -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();
}
}

View File

@ -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;
}
}