Move these functions to SkillType.

This commit is contained in:
GJ 2013-10-09 09:20:32 -04:00
parent e1bf55b077
commit 9485869014
3 changed files with 14 additions and 6 deletions

View File

@ -51,11 +51,11 @@ public class HardcoreCommand extends HardcoreModeCommand {
private void toggle(boolean enable) { private void toggle(boolean enable) {
if (skill.equalsIgnoreCase("ALL")) { if (skill.equalsIgnoreCase("ALL")) {
for (SkillType skillType : SkillType.nonChildSkills()) { for (SkillType skillType : SkillType.nonChildSkills()) {
Config.getInstance().setHardcoreStatLossEnabled(skillType, enable); skillType.setHardcoreStatLossEnabled(enable);
} }
} }
else { else {
Config.getInstance().setHardcoreStatLossEnabled(SkillType.getSkill(skill), enable); SkillType.getSkill(skill).setHardcoreStatLossEnabled(enable);
} }
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), skill)); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), skill));

View File

@ -48,16 +48,16 @@ public class VampirismCommand extends HardcoreModeCommand {
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercent / 100D))); sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercent / 100D)));
} }
private void toggle(boolean enabled) { private void toggle(boolean enable) {
if (skill.equalsIgnoreCase("ALL")) { if (skill.equalsIgnoreCase("ALL")) {
for (SkillType skillType : SkillType.nonChildSkills()) { for (SkillType skillType : SkillType.nonChildSkills()) {
Config.getInstance().setHardcoreVampirismEnabled(skillType, enabled); skillType.setHardcoreVampirismEnabled(enable);
} }
} }
else { else {
Config.getInstance().setHardcoreVampirismEnabled(SkillType.getSkill(skill), enabled); SkillType.getSkill(skill).setHardcoreVampirismEnabled(enable);
} }
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enabled ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), skill)); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), skill));
} }
} }

View File

@ -109,10 +109,18 @@ public enum SkillType {
return Config.getInstance().getHardcoreStatLossEnabled(this); return Config.getInstance().getHardcoreStatLossEnabled(this);
} }
public void setHardcoreStatLossEnabled(boolean enable) {
Config.getInstance().setHardcoreStatLossEnabled(this, enable);
}
public boolean getHardcoreVampirismEnabled() { public boolean getHardcoreVampirismEnabled() {
return Config.getInstance().getHardcoreVampirismEnabled(this); return Config.getInstance().getHardcoreVampirismEnabled(this);
} }
public void setHardcoreVampirismEnabled(boolean enable) {
Config.getInstance().setHardcoreVampirismEnabled(this, enable);
}
public ToolType getTool() { public ToolType getTool() {
return tool; return tool;
} }