Override toString() for upcoming config changes. Also, this ability is

"Skull Splitter," not "Skull Spliiter"
This commit is contained in:
GJ 2013-02-20 13:29:41 -05:00
parent 4284fe1029
commit 17a85c94c6
5 changed files with 35 additions and 13 deletions

View File

@ -26,7 +26,7 @@ public final class AbilityAPI {
} }
public static boolean skullSplitterEnabled(Player player) { public static boolean skullSplitterEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLIITER); return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER);
} }
public static boolean superBreakerEnabled(Player player) { public static boolean superBreakerEnabled(Player player) {

View File

@ -130,7 +130,7 @@ public class PlayerProfile {
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldownValues.get(3))); skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldownValues.get(3)));
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldownValues.get(4))); skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldownValues.get(4)));
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldownValues.get(5))); skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldownValues.get(5)));
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldownValues.get(6))); skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(cooldownValues.get(6)));
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldownValues.get(7))); skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldownValues.get(7)));
} }
@ -262,7 +262,7 @@ public class PlayerProfile {
if (character.length > 30) if (character.length > 30)
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(character[30])); skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(character[30]));
if (character.length > 31) if (character.length > 31)
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(character[31])); skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(character[31]));
if (character.length > 32) if (character.length > 32)
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[32])); skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[32]));
if (character.length > 33) { if (character.length > 33) {
@ -308,7 +308,7 @@ public class PlayerProfile {
+ ", herbalism = " + skillsDATS.get(AbilityType.GREEN_TERRA) + ", herbalism = " + skillsDATS.get(AbilityType.GREEN_TERRA)
+ ", excavation = " + skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER) + ", excavation = " + skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER)
+ ", swords = " + skillsDATS.get(AbilityType.SERRATED_STRIKES) + ", swords = " + skillsDATS.get(AbilityType.SERRATED_STRIKES)
+ ", axes = " + skillsDATS.get(AbilityType.SKULL_SPLIITER) + ", axes = " + skillsDATS.get(AbilityType.SKULL_SPLITTER)
+ ", blast_mining = " + skillsDATS.get(AbilityType.BLAST_MINING) + ", blast_mining = " + skillsDATS.get(AbilityType.BLAST_MINING)
+ " WHERE user_id = " + userId); + " WHERE user_id = " + userId);
Database.write("UPDATE " + tablePrefix + "skills SET " Database.write("UPDATE " + tablePrefix + "skills SET "
@ -391,7 +391,7 @@ public class PlayerProfile {
writer.append(skillsDATS.get(AbilityType.TREE_FELLER)).append(":"); writer.append(skillsDATS.get(AbilityType.TREE_FELLER)).append(":");
writer.append(skillsDATS.get(AbilityType.GREEN_TERRA)).append(":"); writer.append(skillsDATS.get(AbilityType.GREEN_TERRA)).append(":");
writer.append(skillsDATS.get(AbilityType.SERRATED_STRIKES)).append(":"); writer.append(skillsDATS.get(AbilityType.SERRATED_STRIKES)).append(":");
writer.append(skillsDATS.get(AbilityType.SKULL_SPLIITER)).append(":"); writer.append(skillsDATS.get(AbilityType.SKULL_SPLITTER)).append(":");
writer.append(skillsDATS.get(AbilityType.SUPER_BREAKER)).append(":"); writer.append(skillsDATS.get(AbilityType.SUPER_BREAKER)).append(":");
writer.append(hudType.toString()).append(":"); writer.append(hudType.toString()).append(":");
writer.append(skills.get(SkillType.FISHING)).append(":"); writer.append(skills.get(SkillType.FISHING)).append(":");
@ -670,7 +670,7 @@ public class PlayerProfile {
case GREEN_TERRA: case GREEN_TERRA:
return greenTerraMode; return greenTerraMode;
case SKULL_SPLIITER: case SKULL_SPLITTER:
return skullSplitterMode; return skullSplitterMode;
case TREE_FELLER: case TREE_FELLER:
@ -708,7 +708,7 @@ public class PlayerProfile {
greenTerraMode = bool; greenTerraMode = bool;
break; break;
case SKULL_SPLIITER: case SKULL_SPLITTER:
skullSplitterMode = bool; skullSplitterMode = bool;
break; break;
@ -748,7 +748,7 @@ public class PlayerProfile {
case GREEN_TERRA: case GREEN_TERRA:
return greenTerraInformed; return greenTerraInformed;
case SKULL_SPLIITER: case SKULL_SPLITTER:
return skullSplitterInformed; return skullSplitterInformed;
case TREE_FELLER: case TREE_FELLER:
@ -790,7 +790,7 @@ public class PlayerProfile {
greenTerraInformed = bool; greenTerraInformed = bool;
break; break;
case SKULL_SPLIITER: case SKULL_SPLITTER:
skullSplitterInformed = bool; skullSplitterInformed = bool;
break; break;

View File

@ -8,6 +8,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
public enum AbilityType { public enum AbilityType {
BERSERK( BERSERK(
@ -46,7 +47,7 @@ public enum AbilityType {
"Herbalism.Skills.GTe.Refresh", "Herbalism.Skills.GTe.Refresh",
"Herbalism.Skills.GTe.Other.Off"), "Herbalism.Skills.GTe.Other.Off"),
SKULL_SPLIITER( SKULL_SPLITTER(
Config.getInstance().getAbilityCooldownSkullSplitter(), Config.getInstance().getAbilityCooldownSkullSplitter(),
Config.getInstance().getAbilityMaxTicksSkullSplitter(), Config.getInstance().getAbilityMaxTicksSkullSplitter(),
"Axes.Skills.SS.On", "Axes.Skills.SS.On",
@ -137,6 +138,27 @@ public enum AbilityType {
return this.maxTicks; return this.maxTicks;
} }
@Override
public String toString() {
String baseString = name();
String[] substrings = baseString.split("_");
String formattedString = "";
int size = 1;
for (String string : substrings) {
formattedString = formattedString.concat(StringUtils.getCapitalized(string));
if (size < substrings.length) {
formattedString = formattedString.concat("_");
}
size++;
}
return formattedString;
}
/** /**
* Get the permissions for this ability. * Get the permissions for this ability.
* *
@ -164,7 +186,7 @@ public enum AbilityType {
case SERRATED_STRIKES: case SERRATED_STRIKES:
return Permissions.serratedStrikes(player); return Permissions.serratedStrikes(player);
case SKULL_SPLIITER: case SKULL_SPLITTER:
return Permissions.skullSplitter(player); return Permissions.skullSplitter(player);
case SUPER_BREAKER: case SUPER_BREAKER:

View File

@ -139,7 +139,7 @@ public final class CombatTools {
axeManager.impact(event, target); axeManager.impact(event, target);
} }
if (!target.isDead() && profile.getAbilityMode(AbilityType.SKULL_SPLIITER) && canSkullSplit) { if (!target.isDead() && profile.getAbilityMode(AbilityType.SKULL_SPLITTER) && canSkullSplit) {
axeManager.skullSplitter(target, event.getDamage()); axeManager.skullSplitter(target, event.getDamage());
} }

View File

@ -8,7 +8,7 @@ import com.gmail.nossr50.util.StringUtils;
public enum SkillType { public enum SkillType {
ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()), ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()),
ARCHERY(Config.getInstance().getLevelCapArchery(), Config.getInstance().getFormulaMultiplierArchery()), ARCHERY(Config.getInstance().getLevelCapArchery(), Config.getInstance().getFormulaMultiplierArchery()),
AXES(AbilityType.SKULL_SPLIITER, Config.getInstance().getLevelCapAxes(), ToolType.AXE, Config.getInstance().getFormulaMultiplierAxes()), AXES(AbilityType.SKULL_SPLITTER, Config.getInstance().getLevelCapAxes(), ToolType.AXE, Config.getInstance().getFormulaMultiplierAxes()),
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, Config.getInstance().getLevelCapExcavation(), ToolType.SHOVEL, Config.getInstance().getFormulaMultiplierExcavation()), EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, Config.getInstance().getLevelCapExcavation(), ToolType.SHOVEL, Config.getInstance().getFormulaMultiplierExcavation()),
FISHING(Config.getInstance().getLevelCapFishing(), Config.getInstance().getFormulaMultiplierFishing()), FISHING(Config.getInstance().getLevelCapFishing(), Config.getInstance().getFormulaMultiplierFishing()),
HERBALISM(AbilityType.GREEN_TERRA, Config.getInstance().getLevelCapHerbalism(), ToolType.HOE, Config.getInstance().getFormulaMultiplierHerbalism()), HERBALISM(AbilityType.GREEN_TERRA, Config.getInstance().getLevelCapHerbalism(), ToolType.HOE, Config.getInstance().getFormulaMultiplierHerbalism()),