mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 13:14:44 +02:00
Turned skilltypes into constants instead of enum
This commit is contained in:
@ -41,6 +41,6 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getLocalizedName()));
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,6 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getLocalizedName()));
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
skill = SkillType.getSkillFromLocalized(args[0]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
@ -58,7 +58,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skill = SkillType.getSkillFromLocalized(args[1]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
@ -98,7 +98,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.skillNames, new ArrayList<String>(SkillType.skillNames.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@ -119,13 +119,13 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
for (SkillType skillType : SkillType.nonChildSkills) {
|
||||
handleCommand(player, profile, skillType, value);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,6 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getLocalizedName(), value));
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0]));
|
||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkillFromLocalized(args[0]));
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
@ -62,7 +62,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
skill = null;
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skill = SkillType.getSkillFromLocalized(args[1]);
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
@ -97,7 +97,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.skillNames, new ArrayList<String>(SkillType.skillNames.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected void handlePlayerMessageSkill(Player player, SkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getLocalizedName()));
|
||||
}
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName) {
|
||||
@ -142,13 +142,13 @@ public class SkillresetCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
for (SkillType skillType : SkillType.nonChildSkills) {
|
||||
handleCommand(player, profile, skillType);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
@Override
|
||||
protected boolean checkEnabled(SkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
for (SkillType skillType : SkillType.skillList) {
|
||||
if (!skillType.getHardcoreStatLossEnabled()) {
|
||||
return false;
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
|
||||
private void toggle(boolean enable, SkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
for (SkillType skillType : SkillType.nonChildSkills) {
|
||||
skillType.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,6 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
skill.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getName())));
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getLocalizedName())));
|
||||
}
|
||||
}
|
@ -76,7 +76,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkillType skill = SkillType.getSkill(args[0]);
|
||||
SkillType skill = SkillType.getSkillFromLocalized(args[0]);
|
||||
|
||||
if (!CommandUtils.isChildSkill(sender, skill)) {
|
||||
return true;
|
||||
|
@ -22,7 +22,7 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
@Override
|
||||
protected boolean checkEnabled(SkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
for (SkillType skillType : SkillType.skillList) {
|
||||
if (!skillType.getHardcoreVampirismEnabled()) {
|
||||
return false;
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
|
||||
private void toggle(boolean enable, SkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
for (SkillType skillType : SkillType.nonChildSkills) {
|
||||
skillType.setHardcoreVampirismEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
@ -53,17 +53,17 @@ public class InspectCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
for (SkillType skill : SkillType.GATHERING_SKILLS) {
|
||||
for (SkillType skill : SkillType.gatheringSkills) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
for (SkillType skill : SkillType.COMBAT_SKILLS) {
|
||||
for (SkillType skill : SkillType.combatSkills) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
for (SkillType skill : SkillType.MISC_SKILLS) {
|
||||
for (SkillType skill : SkillType.miscSkills) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class MctopCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
return StringUtil.copyPartialMatches(args[0], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[0], SkillType.skillNames, new ArrayList<String>(SkillType.skillNames.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class MctopCommand implements TabExecutor {
|
||||
return null;
|
||||
}
|
||||
|
||||
SkillType skill = SkillType.getSkill(skillName);
|
||||
SkillType skill = SkillType.getSkillFromLocalized(skillName);
|
||||
|
||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
||||
return null;
|
||||
|
@ -23,7 +23,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
private boolean canGracefulRoll;
|
||||
|
||||
public AcrobaticsCommand() {
|
||||
super(SkillType.ACROBATICS);
|
||||
super(SkillType.acrobatics);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class AlchemyCommand extends SkillCommand {
|
||||
private boolean canConcoctions;
|
||||
|
||||
public AlchemyCommand() {
|
||||
super(SkillType.ALCHEMY);
|
||||
super(SkillType.alchemy);
|
||||
}
|
||||
|
||||
protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) {
|
||||
|
@ -23,7 +23,7 @@ public class ArcheryCommand extends SkillCommand {
|
||||
private boolean canRetrieve;
|
||||
|
||||
public ArcheryCommand() {
|
||||
super(SkillType.ARCHERY);
|
||||
super(SkillType.archery);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class AxesCommand extends SkillCommand {
|
||||
private boolean canGreaterImpact;
|
||||
|
||||
public AxesCommand() {
|
||||
super(SkillType.AXES);
|
||||
super(SkillType.axes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
private boolean canTreasureHunt;
|
||||
|
||||
public ExcavationCommand() {
|
||||
super(SkillType.EXCAVATION);
|
||||
super(SkillType.excavation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class FishingCommand extends SkillCommand {
|
||||
private boolean canIceFish;
|
||||
|
||||
public FishingCommand() {
|
||||
super(SkillType.FISHING);
|
||||
super(SkillType.fishing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ public class HerbalismCommand extends SkillCommand {
|
||||
private boolean canShroomThumb;
|
||||
|
||||
public HerbalismCommand() {
|
||||
super(SkillType.HERBALISM);
|
||||
super(SkillType.herbalism);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ public class MiningCommand extends SkillCommand {
|
||||
private boolean canDemoExpert;
|
||||
|
||||
public MiningCommand() {
|
||||
super(SkillType.MINING);
|
||||
super(SkillType.mining);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,7 @@ public class RepairCommand extends SkillCommand {
|
||||
private int stoneLevel;
|
||||
|
||||
public RepairCommand() {
|
||||
super(SkillType.REPAIR);
|
||||
super(SkillType.repair);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@ public class SalvageCommand extends SkillCommand {
|
||||
private boolean canArcaneSalvage;
|
||||
|
||||
public SalvageCommand() {
|
||||
super(SkillType.SALVAGE);
|
||||
super(SkillType.salvage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
public SkillCommand(SkillType skill) {
|
||||
this.skill = skill;
|
||||
skillName = skill.getName();
|
||||
skillName = skill.getLocalizedName();
|
||||
skillGuideCommand = new SkillGuideCommand(skill);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
Set<SkillType> parents = FamilyTree.getParents(skill);
|
||||
|
||||
for (SkillType parent : parents) {
|
||||
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||
player.sendMessage(parent.getLocalizedName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
||||
|
||||
public SkillGuideCommand(SkillType skill) {
|
||||
header = LocaleLoader.getString("Guides.Header", skill.getName());
|
||||
header = LocaleLoader.getString("Guides.Header", skill.getLocalizedName());
|
||||
guide = getGuide(skill);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class SmeltingCommand extends SkillCommand {
|
||||
private boolean canVanillaXPBoost;
|
||||
|
||||
public SmeltingCommand() {
|
||||
super(SkillType.SMELTING);
|
||||
super(SkillType.smelting);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class SwordsCommand extends SkillCommand {
|
||||
private boolean canBleed;
|
||||
|
||||
public SwordsCommand() {
|
||||
super(SkillType.SWORDS);
|
||||
super(SkillType.swords);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@ public class TamingCommand extends SkillCommand {
|
||||
private boolean canHolyHound;
|
||||
|
||||
public TamingCommand() {
|
||||
super(SkillType.TAMING);
|
||||
super(SkillType.taming);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
private boolean canIronGrip;
|
||||
|
||||
public UnarmedCommand() {
|
||||
super(SkillType.UNARMED);
|
||||
super(SkillType.unarmed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
private boolean canDoubleDrop;
|
||||
|
||||
public WoodcuttingCommand() {
|
||||
super(SkillType.WOODCUTTING);
|
||||
super(SkillType.woodcutting);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user