Wire up events config

This commit is contained in:
nossr50 2019-05-18 14:08:33 -07:00
parent ca8293bc35
commit 9fb9228869
4 changed files with 20 additions and 8 deletions

View File

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

View File

@ -13,6 +13,10 @@ public class ConfigEvent {
return xpRate;
}
public boolean isSendTitleMessages() {
return xpRate.isSendTitleMessages();
}
public boolean isShowXPRateInfoOnPlayerJoin() {
return xpRate.isShowXPRateInfoOnPlayerJoin();
}

View File

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

View File

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