From 3e750262819f53f9f1c57bb74aff96cbedc81df6 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 6 Jun 2019 05:31:13 -0700 Subject: [PATCH] Wire up Hardcore/Vampirism --- .../com/gmail/nossr50/config/MainConfig.java | 25 ------------------- .../datatypes/skills/PrimarySkillType.java | 4 +-- .../gmail/nossr50/util/HardcoreManager.java | 9 ++++--- .../java/com/gmail/nossr50/util/Motd.java | 4 +-- 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/MainConfig.java b/src/main/java/com/gmail/nossr50/config/MainConfig.java index 6b5d54d02..a9f6b932a 100644 --- a/src/main/java/com/gmail/nossr50/config/MainConfig.java +++ b/src/main/java/com/gmail/nossr50/config/MainConfig.java @@ -259,31 +259,6 @@ public class MainConfig extends ConfigValidated { return getBooleanValue(GENERAL, REFRESH_CHUNKS); } - /* Hardcore Mode */ - public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) { - return getBooleanValue(HARDCORE, DEATH_STAT_LOSS, ENABLED, StringUtils.getCapitalized(primarySkillType.toString())); - } - - public double getHardcoreDeathStatPenaltyPercentage() { - return getDoubleValue(HARDCORE, DEATH_STAT_LOSS, PENALTY_PERCENTAGE); - } - - public int getHardcoreDeathStatPenaltyLevelThreshold() { - return getIntValue(HARDCORE, DEATH_STAT_LOSS, LEVEL_THRESHOLD); - } - - public boolean getHardcoreVampirismEnabled(PrimarySkillType primarySkillType) { - return getBooleanValue(HARDCORE, VAMPIRISM, ENABLED, StringUtils.getCapitalized(primarySkillType.toString())); - } - - public double getHardcoreVampirismStatLeechPercentage() { - return getDoubleValue(HARDCORE, VAMPIRISM, LEECH_PERCENTAGE); - } - - public int getHardcoreVampirismLevelThreshold() { - return getIntValue(HARDCORE, VAMPIRISM, LEVEL_THRESHOLD); - } - /* Particles */ public boolean getAbilityActivationEffectEnabled() { return getBooleanValue(PARTICLES, ABILITY_ACTIVATION); diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java index 74d83595d..167455407 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java @@ -208,11 +208,11 @@ public enum PrimarySkillType { } public boolean getHardcoreStatLossEnabled() { - return MainConfig.getInstance().getHardcoreStatLossEnabled(this); + return mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getSkillToggleMap().get(this); } public boolean getHardcoreVampirismEnabled() { - return MainConfig.getInstance().getHardcoreVampirismEnabled(this); + return mcMMO.getConfigManager().getConfigHardcore().getVampirism().getSkillToggleMap().get(this); } public ToolType getTool() { diff --git a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java index b9578b8a1..b2e4d4816 100644 --- a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java +++ b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; import org.bukkit.entity.Player; @@ -15,8 +16,8 @@ public final class HardcoreManager { } public static void invokeStatPenalty(Player player) { - double statLossPercentage = MainConfig.getInstance().getHardcoreDeathStatPenaltyPercentage(); - int levelThreshold = MainConfig.getInstance().getHardcoreDeathStatPenaltyLevelThreshold(); + double statLossPercentage = mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getPenaltyPercentage(); + int levelThreshold = mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getLevelThreshold(); if (UserManager.getPlayer(player) == null) return; @@ -60,8 +61,8 @@ public final class HardcoreManager { } public static void invokeVampirism(Player killer, Player victim) { - double vampirismStatLeechPercentage = MainConfig.getInstance().getHardcoreVampirismStatLeechPercentage(); - int levelThreshold = MainConfig.getInstance().getHardcoreVampirismLevelThreshold(); + double vampirismStatLeechPercentage = mcMMO.getConfigManager().getConfigHardcore().getVampirism().getPenaltyPercentage(); + int levelThreshold = mcMMO.getConfigManager().getConfigHardcore().getVampirism().getLevelThreshold(); if (UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null) return; diff --git a/src/main/java/com/gmail/nossr50/util/Motd.java b/src/main/java/com/gmail/nossr50/util/Motd.java index 83111b617..83cea51a9 100644 --- a/src/main/java/com/gmail/nossr50/util/Motd.java +++ b/src/main/java/com/gmail/nossr50/util/Motd.java @@ -71,11 +71,11 @@ public final class Motd { player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Enabled", statLossInfo + seperator + vampirismInfo)); if (deathStatLossEnabled) { - player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.DeathStatLoss.Stats", MainConfig.getInstance().getHardcoreDeathStatPenaltyPercentage())); + player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.DeathStatLoss.Stats", mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getPenaltyPercentage())); } if (vampirismEnabled) { - player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Vampirism.Stats", MainConfig.getInstance().getHardcoreVampirismStatLeechPercentage())); + player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Vampirism.Stats", mcMMO.getConfigManager().getConfigHardcore().getVampirism().getPenaltyPercentage())); } }