Add toggle for event broadcasts - General.EventBroadcasts

This commit is contained in:
nossr50 2019-05-16 11:34:26 -07:00
parent ed3ec3aa40
commit c8a32b8b38
4 changed files with 19 additions and 4 deletions

View File

@ -1,7 +1,9 @@
Version 2.1.61 Version 2.1.61
Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat'
Updated the Japanese locale (thanks snake0053) Updated the Japanese locale (thanks snake0053)
Added toggle to turn off event message broadcasts (XP rate) to config.yml - 'General.EventBroadcasts'
NOTE: The toggle for event message broadcasts is separate from the titles being shown, that's another config option (titles are the BIG TEXT in the middle of the screen)
Version 2.1.60 Version 2.1.60
Fixed a NPE error if a LivingEntity's target was set to null Fixed a NPE error if a LivingEntity's target was set to null

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -44,8 +45,12 @@ public class XprateCommand implements TabExecutor {
10, 10*20, 20); 10, 10*20, 20);
} }
if(Config.getInstance().broadcastEventMessages())
{
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"));
}
mcMMO.p.toggleXpEventEnabled(); mcMMO.p.toggleXpEventEnabled();
} }
@ -91,9 +96,14 @@ public class XprateCommand implements TabExecutor {
LocaleLoader.getString("Commands.Event.XP", newXpRate), LocaleLoader.getString("Commands.Event.XP", newXpRate),
10, 10*20, 20); 10, 10*20, 20);
} }
if(Config.getInstance().broadcastEventMessages())
{
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));
} }
}
else { else {
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate)); sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));
} }

View File

@ -567,4 +567,6 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getPVEEnabled(PrimarySkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); } public boolean getPVEEnabled(PrimarySkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
//public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); } //public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
public boolean broadcastEventMessages() { return config.getBoolean("General.EventBroadcasts", true);}
} }

View File

@ -16,6 +16,7 @@ General:
Locale: en_US Locale: en_US
AprilFoolsEvent: true AprilFoolsEvent: true
MOTD_Enabled: true MOTD_Enabled: true
EventBroadcasts: true
# Send a message to the player when his profile was successfully loaded # Send a message to the player when his profile was successfully loaded
Show_Profile_Loaded: false Show_Profile_Loaded: false
# Amount of time (in minutes) to wait between saves of player information # Amount of time (in minutes) to wait between saves of player information