Browse Source

Mob Health bars global toggle

t00thpick1 7 years ago
parent
commit
9df72e61a2

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

@@ -265,6 +265,8 @@ public class Config extends AutoUpdateConfigLoader {
     public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
     public boolean getRefreshChunksEnabled() { return config.getBoolean("General.Refresh_Chunks", false); }
 
+    public boolean getMobHealthbarEnabled() { return config.getBoolean("Mob_Healthbar.Enabled", true); }
+
     /* Mob Healthbar */
     public MobHealthbarType getMobHealthbarDefault() {
         try {

+ 2 - 2
src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java

@@ -16,7 +16,7 @@ import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
 import com.gmail.nossr50.util.player.UserManager;
 
 public final class MobHealthbarUtils {
-    private MobHealthbarUtils() {};
+    private MobHealthbarUtils() {}
 
     /**
      * Fix issues with death messages caused by the mob healthbars.
@@ -40,7 +40,7 @@ public final class MobHealthbarUtils {
      * @param damage damage done by the attack triggering this
      */
     public static void handleMobHealthbars(Player player, LivingEntity target, double damage) {
-        if (mcMMO.isHealthBarPluginEnabled() || !Permissions.mobHealthDisplay(player)) {
+        if (mcMMO.isHealthBarPluginEnabled() || !Permissions.mobHealthDisplay(player) || !Config.getInstance().getMobHealthbarEnabled()) {
             return;
         }
 

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

@@ -102,8 +102,10 @@ Scoreboard:
             LevelUp_Time: 5
 
 Mob_Healthbar:
-    # Display_Type: Default display for mob health bars - HEARTS, BAR, or DISABLED
+    # Enabled: Whether or not the feature is enabled at all
+    # Display_Type: Per player Default display for mob health bars - HEARTS, BAR, or DISABLED
     # Display_Time: Amount of time (in seconds) to display. To display permanently, set to -1
+    Enabled: true
     Display_Type: HEARTS
     Display_Time: 3