diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index 503ac5526..776267a8e 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -1,7 +1,5 @@ package com.gmail.nossr50.commands; -import com.gmail.nossr50.config.AdvancedConfig; -import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; @@ -37,14 +35,14 @@ public class XprateCommand implements TabExecutor { if (mcMMO.p.isXPEventEnabled()) { - if (AdvancedConfig.getInstance().useTitlesForXPEvent()) { + if (mcMMO.getConfigManager().getConfigEvent().isSendTitleMessages()) { NotificationManager.broadcastTitle(mcMMO.p.getServer(), LocaleLoader.getString("Commands.Event.Stop"), LocaleLoader.getString("Commands.Event.Stop.Subtitle"), 10, 10 * 20, 20); } - if(Config.getInstance().broadcastEventMessages()) + if(mcMMO.getConfigManager().getConfigEvent().isBroadcastXPRateEventMessages()) { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop")); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); @@ -86,7 +84,7 @@ public class XprateCommand implements TabExecutor { mcMMO.getDynamicSettingsManager().getExperienceManager().setGlobalXpMult(newXpRate); - if(AdvancedConfig.getInstance().useTitlesForXPEvent()) + if(mcMMO.getConfigManager().getConfigEvent().isSendTitleMessages()) { NotificationManager.broadcastTitle(mcMMO.p.getServer(), LocaleLoader.getString("Commands.Event.Start"), @@ -94,7 +92,7 @@ public class XprateCommand implements TabExecutor { 10, 10*20, 20); } - if(Config.getInstance().broadcastEventMessages()) + if(mcMMO.getConfigManager().getConfigEvent().isBroadcastXPRateEventMessages()) { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start")); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); 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 index 2a5f2c75f..21009921c 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEvent.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEvent.java @@ -13,6 +13,10 @@ public class ConfigEvent { return xpRate; } + public boolean isSendTitleMessages() { + return xpRate.isSendTitleMessages(); + } + public boolean isShowXPRateInfoOnPlayerJoin() { return xpRate.isShowXPRateInfoOnPlayerJoin(); } 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 index 5e1ceaf2d..483752bc2 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEventExperienceRate.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/event/ConfigEventExperienceRate.java @@ -8,6 +8,7 @@ public class ConfigEventExperienceRate { public static final boolean SHOW_XP_RATE_ON_JOIN_DEFAULT = true; public static final boolean BROADCAST_EVENT_MESSAGES_DEFAULT = true; + public static final boolean SEND_TITLES_FOR_EVENT_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) @@ -18,6 +19,11 @@ public class ConfigEventExperienceRate { "\nDefault value: "+BROADCAST_EVENT_MESSAGES_DEFAULT) private boolean broadcastXPRateEventMessages = BROADCAST_EVENT_MESSAGES_DEFAULT; + @Setting(value = "Send-Title-Messages", comment = "Send title messages to players for this event." + + "\nTitles are the very large text that appears in the middle of a players screen" + + "\nDefault value: "+SEND_TITLES_FOR_EVENT_DEFAULT) + private boolean sendTitleMessages = SEND_TITLES_FOR_EVENT_DEFAULT; + public boolean isShowXPRateInfoOnPlayerJoin() { return showXPRateInfoOnPlayerJoin; } @@ -25,4 +31,8 @@ public class ConfigEventExperienceRate { public boolean isBroadcastXPRateEventMessages() { return broadcastXPRateEventMessages; } + + public boolean isSendTitleMessages() { + return sendTitleMessages; + } } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 600f98b1d..f9b0a2dcb 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -525,12 +525,12 @@ public class PlayerListener implements Listener { player.sendMessage(LocaleLoader.getString("XPRate.Event", mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult())); } - //TODO: Remove this warning + //TODO: Remove this warning after 2.2 is done if (mcMMO.p.getDescription().getVersion().contains("SNAPSHOT")) { event.getPlayer().sendMessage(ChatColor.RED + "WARNING: " + ChatColor.WHITE + "This dev build version of mcMMO is in the MIDDLE of completely rewriting the configs, there may be game breaking bugs. It is not recommended to play on this version of mcMMO, please grab the latest stable release from https://www.mcmmo.org and use that instead!"); } - if (plugin.isXPEventEnabled() && Config.getInstance().playerJoinEventInfo()) { + if (plugin.isXPEventEnabled() && mcMMO.getConfigManager().getConfigEvent().isShowXPRateInfoOnPlayerJoin()) { player.sendMessage(LocaleLoader.getString("XPRate.Event", ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier())); } }