Wire up Hardcore/Vampirism

This commit is contained in:
nossr50 2019-06-06 05:31:13 -07:00
parent c698bed05e
commit 3e75026281
4 changed files with 9 additions and 33 deletions

View File

@ -259,31 +259,6 @@ public class MainConfig extends ConfigValidated {
return getBooleanValue(GENERAL, REFRESH_CHUNKS); 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 */ /* Particles */
public boolean getAbilityActivationEffectEnabled() { public boolean getAbilityActivationEffectEnabled() {
return getBooleanValue(PARTICLES, ABILITY_ACTIVATION); return getBooleanValue(PARTICLES, ABILITY_ACTIVATION);

View File

@ -208,11 +208,11 @@ public enum PrimarySkillType {
} }
public boolean getHardcoreStatLossEnabled() { public boolean getHardcoreStatLossEnabled() {
return MainConfig.getInstance().getHardcoreStatLossEnabled(this); return mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getSkillToggleMap().get(this);
} }
public boolean getHardcoreVampirismEnabled() { public boolean getHardcoreVampirismEnabled() {
return MainConfig.getInstance().getHardcoreVampirismEnabled(this); return mcMMO.getConfigManager().getConfigHardcore().getVampirism().getSkillToggleMap().get(this);
} }
public ToolType getTool() { public ToolType getTool() {

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.config.MainConfig;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 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.NotificationManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -15,8 +16,8 @@ public final class HardcoreManager {
} }
public static void invokeStatPenalty(Player player) { public static void invokeStatPenalty(Player player) {
double statLossPercentage = MainConfig.getInstance().getHardcoreDeathStatPenaltyPercentage(); double statLossPercentage = mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getPenaltyPercentage();
int levelThreshold = MainConfig.getInstance().getHardcoreDeathStatPenaltyLevelThreshold(); int levelThreshold = mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getLevelThreshold();
if (UserManager.getPlayer(player) == null) if (UserManager.getPlayer(player) == null)
return; return;
@ -60,8 +61,8 @@ public final class HardcoreManager {
} }
public static void invokeVampirism(Player killer, Player victim) { public static void invokeVampirism(Player killer, Player victim) {
double vampirismStatLeechPercentage = MainConfig.getInstance().getHardcoreVampirismStatLeechPercentage(); double vampirismStatLeechPercentage = mcMMO.getConfigManager().getConfigHardcore().getVampirism().getPenaltyPercentage();
int levelThreshold = MainConfig.getInstance().getHardcoreVampirismLevelThreshold(); int levelThreshold = mcMMO.getConfigManager().getConfigHardcore().getVampirism().getLevelThreshold();
if (UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null) if (UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
return; return;

View File

@ -71,11 +71,11 @@ public final class Motd {
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Enabled", statLossInfo + seperator + vampirismInfo)); player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Enabled", statLossInfo + seperator + vampirismInfo));
if (deathStatLossEnabled) { 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) { 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()));
} }
} }