mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Wire up events config
This commit is contained in:
parent
ca8293bc35
commit
9fb9228869
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands;
|
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.datatypes.notifications.SensitiveCommandType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -37,14 +35,14 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.p.isXPEventEnabled()) {
|
if (mcMMO.p.isXPEventEnabled()) {
|
||||||
|
|
||||||
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
|
if (mcMMO.getConfigManager().getConfigEvent().isSendTitleMessages()) {
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Stop"),
|
LocaleLoader.getString("Commands.Event.Stop"),
|
||||||
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
||||||
10, 10 * 20, 20);
|
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"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
||||||
@ -86,7 +84,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
mcMMO.getDynamicSettingsManager().getExperienceManager().setGlobalXpMult(newXpRate);
|
mcMMO.getDynamicSettingsManager().getExperienceManager().setGlobalXpMult(newXpRate);
|
||||||
|
|
||||||
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
|
if(mcMMO.getConfigManager().getConfigEvent().isSendTitleMessages())
|
||||||
{
|
{
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Start"),
|
LocaleLoader.getString("Commands.Event.Start"),
|
||||||
@ -94,7 +92,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
10, 10*20, 20);
|
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.Start"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||||
|
@ -13,6 +13,10 @@ public class ConfigEvent {
|
|||||||
return xpRate;
|
return xpRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSendTitleMessages() {
|
||||||
|
return xpRate.isSendTitleMessages();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isShowXPRateInfoOnPlayerJoin() {
|
public boolean isShowXPRateInfoOnPlayerJoin() {
|
||||||
return xpRate.isShowXPRateInfoOnPlayerJoin();
|
return xpRate.isShowXPRateInfoOnPlayerJoin();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ public class ConfigEventExperienceRate {
|
|||||||
|
|
||||||
public static final boolean SHOW_XP_RATE_ON_JOIN_DEFAULT = true;
|
public static final boolean SHOW_XP_RATE_ON_JOIN_DEFAULT = true;
|
||||||
public static final boolean BROADCAST_EVENT_MESSAGES_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." +
|
@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)
|
"\nDefault value: "+SHOW_XP_RATE_ON_JOIN_DEFAULT)
|
||||||
@ -18,6 +19,11 @@ public class ConfigEventExperienceRate {
|
|||||||
"\nDefault value: "+BROADCAST_EVENT_MESSAGES_DEFAULT)
|
"\nDefault value: "+BROADCAST_EVENT_MESSAGES_DEFAULT)
|
||||||
private boolean broadcastXPRateEventMessages = 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() {
|
public boolean isShowXPRateInfoOnPlayerJoin() {
|
||||||
return showXPRateInfoOnPlayerJoin;
|
return showXPRateInfoOnPlayerJoin;
|
||||||
}
|
}
|
||||||
@ -25,4 +31,8 @@ public class ConfigEventExperienceRate {
|
|||||||
public boolean isBroadcastXPRateEventMessages() {
|
public boolean isBroadcastXPRateEventMessages() {
|
||||||
return broadcastXPRateEventMessages;
|
return broadcastXPRateEventMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSendTitleMessages() {
|
||||||
|
return sendTitleMessages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,12 +525,12 @@ public class PlayerListener implements Listener {
|
|||||||
player.sendMessage(LocaleLoader.getString("XPRate.Event", mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()));
|
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")) {
|
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!");
|
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()));
|
player.sendMessage(LocaleLoader.getString("XPRate.Event", ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user