From 956b01a28e046bc855927b7ba5123ba18f335e98 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 19 Mar 2019 09:23:53 -0700 Subject: [PATCH] wire up creatures config --- Changelog.txt | 7 +++- .../gmail/nossr50/commands/MHDCommand.java | 5 ++- .../com/gmail/nossr50/config/MainConfig.java | 21 +----------- .../hocon/mobs/ConfigSectionCombat.java | 10 ++++++ .../hocon/mobs/ConfigSectionHealthBars.java | 33 +++++++++++++++++++ .../database/FlatfileDatabaseManager.java | 15 ++++----- .../nossr50/database/SQLDatabaseManager.java | 13 ++++---- .../nossr50/datatypes/MobHealthbarType.java | 3 +- .../datatypes/player/PlayerProfile.java | 3 +- .../datatypes/skills/SuperAbilityType.java | 1 - .../runnables/backups/CleanBackupsTask.java | 6 ++-- .../runnables/skills/ToolLowerTask.java | 1 - .../skills/excavation/ExcavationManager.java | 1 - .../gmail/nossr50/util/MobHealthbarUtils.java | 7 ++-- .../gmail/nossr50/util/skills/SkillUtils.java | 1 - 15 files changed, 74 insertions(+), 53 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index b8437ec86..bb63ccd77 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -46,6 +46,8 @@ Version 2.2.0 Language config options will now be found in "language.conf" + Creature config settings will now be found in "creatures.conf" + Particle settings will now be found in "particle_spawning.conf" Party config options will now be found in "party.conf" @@ -125,9 +127,12 @@ Version 2.2.0 removed child.yml, child skills now have hard coded parents removed the hardcore and vampirism commands, these are dangerous settings and should not be toggle-able (turn them on in your configs if you want to use them) - Removed the following config settings from various configs for literally doing nothing + Removed the following config settings from various configs for doing nothing Update_Check, Prefer_Beta + Removed the following config settings for being unwanted + Config_Update_Overwrite + API Changes Added API method to check if player parties are size capped Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition diff --git a/src/main/java/com/gmail/nossr50/commands/MHDCommand.java b/src/main/java/com/gmail/nossr50/commands/MHDCommand.java index c8a184fb8..9af60e8c1 100644 --- a/src/main/java/com/gmail/nossr50/commands/MHDCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/MHDCommand.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.commands; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.database.FlatfileDatabaseManager; import com.gmail.nossr50.database.SQLDatabaseManager; import com.gmail.nossr50.datatypes.player.McMMOPlayer; @@ -21,7 +20,7 @@ public class MHDCommand implements TabExecutor { SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager(); m.resetMobHealthSettings(); for (McMMOPlayer player : UserManager.getPlayers()) { - player.getProfile().setMobHealthbarType(MainConfig.getInstance().getMobHealthbarDefault()); + player.getProfile().setMobHealthbarType(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType()); } sender.sendMessage("Mob health reset"); return true; @@ -30,7 +29,7 @@ public class MHDCommand implements TabExecutor { FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager(); m.resetMobHealthSettings(); for (McMMOPlayer player : UserManager.getPlayers()) { - player.getProfile().setMobHealthbarType(MainConfig.getInstance().getMobHealthbarDefault()); + player.getProfile().setMobHealthbarType(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType()); } sender.sendMessage("Mob health reset"); return true; diff --git a/src/main/java/com/gmail/nossr50/config/MainConfig.java b/src/main/java/com/gmail/nossr50/config/MainConfig.java index 8b9a97ea9..051b7456b 100644 --- a/src/main/java/com/gmail/nossr50/config/MainConfig.java +++ b/src/main/java/com/gmail/nossr50/config/MainConfig.java @@ -1,8 +1,6 @@ package com.gmail.nossr50.config; -import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.StringUtils; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @@ -255,7 +253,7 @@ public class MainConfig extends ConfigValidated { }*/ /* Mob Healthbar */ - if (getMobHealthbarTime() == 0) { + if (mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayTimeSeconds() == 0) { reason.add(MOB_HEALTHBAR + "." + DISPLAY_TIME + " cannot be 0! Set to -1 to disable or set a valid value."); } @@ -462,23 +460,6 @@ public class MainConfig extends ConfigValidated { return getBooleanValue(GENERAL, REFRESH_CHUNKS); } - public boolean getMobHealthbarEnabled() { - return getBooleanValue(MOB_HEALTHBAR, ENABLED); - } - - /* Mob Healthbar */ - public MobHealthbarType getMobHealthbarDefault() { - try { - return MobHealthbarType.valueOf(getStringValue(MOB_HEALTHBAR, DISPLAY_TYPE, HEARTS).toUpperCase().trim()); - } catch (IllegalArgumentException ex) { - return MobHealthbarType.HEARTS; - } - } - - public int getMobHealthbarTime() { - return getIntValue(MOB_HEALTHBAR, DISPLAY_TIME); - } - /* Hardcore Mode */ public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) { return getBooleanValue(HARDCORE, DEATH_STAT_LOSS, ENABLED, StringUtils.getCapitalized(primarySkillType.toString())); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionCombat.java b/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionCombat.java index e5f31b37d..970efd811 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionCombat.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionCombat.java @@ -1,6 +1,16 @@ package com.gmail.nossr50.config.hocon.mobs; +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + @ConfigSerializable public class ConfigSectionCombat { + @Setting(value = "Mob-Health-Bars", comment = "Health bars appear over a mobs world model when they are damaged by a player," + + "\nTypically this is a visually representation of their health using hearts.") + private ConfigSectionHealthBars healthBars = new ConfigSectionHealthBars(); + + public ConfigSectionHealthBars getHealthBars() { + return healthBars; + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionHealthBars.java b/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionHealthBars.java index 7a6cbb414..e2882eda2 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionHealthBars.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/mobs/ConfigSectionHealthBars.java @@ -1,6 +1,39 @@ package com.gmail.nossr50.config.hocon.mobs; +import com.gmail.nossr50.datatypes.MobHealthbarType; +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + @ConfigSerializable public class ConfigSectionHealthBars { + public static final boolean MOB_HEALTH_BARS_DEFAULT = true; + public static final int DISPLAY_TIME_SECONDS_DEFAULT = 3; + public static final String HEARTS = "HEARTS"; + public static final String displayTypesList = "\nYou can use the following MobHealthBarType values: HEARTS, BAR"; + + @Setting(value = "Enable-Health-Bars", comment = "Turn this off to disable health bars appearing above mobs when damaged." + + "\nDefault value: "+MOB_HEALTH_BARS_DEFAULT) + private boolean enableHealthBars = MOB_HEALTH_BARS_DEFAULT; + + @Setting(value = "Display-Bar-Type", comment = "The type of display to use for the mobs health bar." + + displayTypesList + + "\nDefault value: "+HEARTS) + private MobHealthbarType displayBarType = MobHealthbarType.HEARTS; + + @Setting(value = "Display-Time-In-Seconds", comment = "How many seconds mob health bars should be displayed before being hidden." + + "\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT) + private int displayTimeSeconds = DISPLAY_TIME_SECONDS_DEFAULT; + + public boolean isEnableHealthBars() { + return enableHealthBars; + } + + public MobHealthbarType getDisplayBarType() { + return displayBarType; + } + + public int getDisplayTimeSeconds() { + return displayTimeSeconds; + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java index afa9fd986..21e997ee7 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.database; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.database.DatabaseType; import com.gmail.nossr50.datatypes.database.PlayerStat; @@ -345,7 +344,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { writer.append((int) profile.getAbilityDATS(SuperAbilityType.BLAST_MINING)).append(":"); writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":"); MobHealthbarType mobHealthbarType = profile.getMobHealthbarType(); - writer.append(mobHealthbarType == null ? MainConfig.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":"); + writer.append(mobHealthbarType == null ? mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString() : mobHealthbarType.toString()).append(":"); writer.append(profile.getSkillLevel(PrimarySkillType.ALCHEMY)).append(":"); writer.append(profile.getSkillXpLevel(PrimarySkillType.ALCHEMY)).append(":"); writer.append(uuid != null ? uuid.toString() : "NULL").append(":"); @@ -424,7 +423,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { out.append("0:"); // FishingXp out.append("0:"); // Blast Mining out.append(String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)).append(":"); // LastLogin - out.append(MainConfig.getInstance().getMobHealthbarDefault().toString()).append(":"); // Mob Healthbar HUD + out.append(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString()).append(":"); // Mob Healthbar HUD out.append(startingLevel); // Alchemy out.append("0:"); // AlchemyXp out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID @@ -964,7 +963,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { // Version 1.4.06 // commit da29185b7dc7e0d992754bba555576d48fa08aa6 character = Arrays.copyOf(character, character.length + 1); - character[character.length - 1] = MainConfig.getInstance().getMobHealthbarDefault().toString(); + character[character.length - 1] = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString(); if (oldVersion == null) { oldVersion = "1.4.06"; } @@ -1008,7 +1007,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { character[i] = String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); } else if (i == 38) { - character[i] = MainConfig.getInstance().getMobHealthbarDefault().toString(); + character[i] = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString(); } else { character[i] = "0"; @@ -1017,7 +1016,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { if (StringUtils.isInt(character[i]) && i == 38) { corrupted = true; - character[i] = MainConfig.getInstance().getMobHealthbarDefault().toString(); + character[i] = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString(); } if (!StringUtils.isInt(character[i]) && !(i == 0 || i == 2 || i == 3 || i == 23 || i == 33 || i == 38 || i == 41)) { @@ -1173,7 +1172,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { mobHealthbarType = MobHealthbarType.valueOf(character[HEALTHBAR]); } catch (Exception e) { - mobHealthbarType = MainConfig.getInstance().getMobHealthbarDefault(); + mobHealthbarType = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType(); } UUID uuid; @@ -1321,7 +1320,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { } String[] character = line.split(":"); - character[HEALTHBAR] = MainConfig.getInstance().getMobHealthbarDefault().toString(); + character[HEALTHBAR] = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString(); line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString(); diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index c8243d2c0..c56230967 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.database; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.database.DatabaseType; import com.gmail.nossr50.datatypes.database.PlayerStat; @@ -322,7 +321,7 @@ public final class SQLDatabaseManager implements DatabaseManager { } statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?, scoreboardtips = ? WHERE user_id = ?"); - statement.setString(1, profile.getMobHealthbarType() == null ? MainConfig.getInstance().getMobHealthbarDefault().name() : profile.getMobHealthbarType().name()); + statement.setString(1, profile.getMobHealthbarType() == null ? mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().name() : profile.getMobHealthbarType().name()); statement.setInt(2, profile.getScoreboardTipsShown()); statement.setInt(3, id); success = (statement.executeUpdate() != 0); @@ -817,7 +816,7 @@ public final class SQLDatabaseManager implements DatabaseManager { createStatement = connection.createStatement(); createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` (" + "`user_id` int(10) unsigned NOT NULL," - + "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + MainConfig.getInstance().getMobHealthbarDefault() + "'," + + "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType() + "'," + "`scoreboardtips` int(10) NOT NULL DEFAULT '0'," + "PRIMARY KEY (`user_id`)) " + "DEFAULT CHARSET=latin1;"); @@ -1063,7 +1062,7 @@ public final class SQLDatabaseManager implements DatabaseManager { statement = connection.prepareStatement("INSERT IGNORE INTO " + tablePrefix + "huds (user_id, mobhealthbar, scoreboardtips) VALUES (?, ?, ?)"); statement.setInt(1, id); - statement.setString(2, MainConfig.getInstance().getMobHealthbarDefault().name()); + statement.setString(2, mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().name()); statement.setInt(3, 0); statement.execute(); statement.close(); @@ -1138,7 +1137,7 @@ public final class SQLDatabaseManager implements DatabaseManager { mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 1)); } catch (Exception e) { - mobHealthbarType = MainConfig.getInstance().getMobHealthbarDefault(); + mobHealthbarType = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType(); } try { @@ -1240,7 +1239,7 @@ public final class SQLDatabaseManager implements DatabaseManager { } catch (SQLException ex) { mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for mob healthbars..."); - statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + MainConfig.getInstance().getMobHealthbarDefault() + "'"); + statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType() + "'"); } } @@ -1537,7 +1536,7 @@ public final class SQLDatabaseManager implements DatabaseManager { try { connection = getConnection(PoolIdentifier.MISC); statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?"); - statement.setString(1, MainConfig.getInstance().getMobHealthbarDefault().toString()); + statement.setString(1, mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString()); statement.executeUpdate(); } catch (SQLException ex) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/MobHealthbarType.java b/src/main/java/com/gmail/nossr50/datatypes/MobHealthbarType.java index 3c67df798..5079d64bd 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/MobHealthbarType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/MobHealthbarType.java @@ -2,6 +2,5 @@ package com.gmail.nossr50.datatypes; public enum MobHealthbarType { HEARTS, - BAR, - DISABLED; + BAR } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java index 4e8a3be26..8ea8e5b09 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.datatypes.player; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.experience.FormulaType; @@ -48,7 +47,7 @@ public class PlayerProfile { this.uuid = uuid; this.playerName = playerName; - mobHealthbarType = MainConfig.getInstance().getMobHealthbarDefault(); + mobHealthbarType = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType(); scoreboardTipsShown = 0; for (SuperAbilityType superAbilityType : SuperAbilityType.values()) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java index f3b260fc4..71d332c02 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.datatypes.skills; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.Permissions; diff --git a/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java b/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java index 84be8156f..a72e922ae 100644 --- a/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java @@ -1,13 +1,15 @@ package com.gmail.nossr50.runnables.backups; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.mcMMO; import org.bukkit.scheduler.BukkitRunnable; import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; import java.util.concurrent.TimeUnit; public class CleanBackupsTask extends BukkitRunnable { diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java index 978eac018..29ddcfac4 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.runnables.skills; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.ToolType; diff --git a/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java b/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java index 73f54b4b8..b6aa956bc 100644 --- a/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java +++ b/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.skills.excavation; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index 2e06de4e4..2b94f2f4f 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.util; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.meta.OldName; import com.gmail.nossr50.mcMMO; @@ -35,7 +34,7 @@ public final class MobHealthbarUtils { * @param damage damage done by the attack triggering this */ public static void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) { - if (mcMMO.isHealthBarPluginEnabled() || !MainConfig.getInstance().getMobHealthbarEnabled()) { + if (mcMMO.isHealthBarPluginEnabled() || !mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) { return; } @@ -57,12 +56,12 @@ public final class MobHealthbarUtils { } boolean oldNameVisible = target.isCustomNameVisible(); - String newName = createHealthDisplay(MainConfig.getInstance().getMobHealthbarDefault(), target, damage); + String newName = createHealthDisplay(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType(), target, damage); target.setCustomName(newName); target.setCustomNameVisible(true); - int displayTime = MainConfig.getInstance().getMobHealthbarTime(); + int displayTime = Math.max(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayTimeSeconds(), 1); if (displayTime != -1) { boolean updateName = !ChatColor.stripColor(oldName).equalsIgnoreCase(ChatColor.stripColor(newName)); diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index 6e85d6714..0b3853a29 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -1,7 +1,6 @@ package com.gmail.nossr50.util.skills; import com.gmail.nossr50.config.AdvancedConfig; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainSource; import com.gmail.nossr50.datatypes.interactions.NotificationType;