Browse Source

Add toggle for event broadcasts - General.EventBroadcasts

nossr50 6 years ago
parent
commit
c8a32b8b38

+ 2 - 0
Changelog.txt

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

+ 14 - 4
src/main/java/com/gmail/nossr50/commands/XprateCommand.java

@@ -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);
                     }
                     }
 
 
-                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
-                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
+                    if(Config.getInstance().broadcastEventMessages())
+                    {
+                        mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
+                        mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
+                    }
+
 
 
                     mcMMO.p.toggleXpEventEnabled();
                     mcMMO.p.toggleXpEventEnabled();
                 }
                 }
@@ -91,8 +96,13 @@ 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);
                     }
                     }
-                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
-                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
+
+                    if(Config.getInstance().broadcastEventMessages())
+                    {
+                        mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
+                        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));

+ 2 - 0
src/main/java/com/gmail/nossr50/config/Config.java

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

+ 1 - 0
src/main/resources/config.yml

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