mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
We don't need two functions that do the exact same thing.
This commit is contained in:
parent
c3f83302c5
commit
6c266a8926
@ -57,7 +57,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.addLevels(SkillTools.getSkillType(args[0]), levels);
|
profile.addLevels(SkillType.getSkill(args[0]), levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allSkills) {
|
if (allSkills) {
|
||||||
@ -109,7 +109,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.addLevels(SkillTools.getSkillType(args[1]), levels);
|
profile.addLevels(SkillType.getSkill(args[1]), levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -129,7 +129,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.addLevels(SkillTools.getSkillType(args[1]), levels);
|
profile.addLevels(SkillType.getSkill(args[1]), levels);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, Misc.getCapitalized(args[1])));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, Misc.getCapitalized(args[1])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mcMMOPlayer.applyXpGain(SkillTools.getSkillType(args[0]), xp);
|
mcMMOPlayer.applyXpGain(SkillType.getSkill(args[0]), xp);
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, Misc.getCapitalized(args[0])));
|
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, Misc.getCapitalized(args[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.setSkillXpLevel(SkillTools.getSkillType(args[1]), xp);
|
profile.setSkillXpLevel(SkillType.getSkill(args[1]), xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -126,7 +126,7 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mcMMOPlayer.applyXpGain(SkillTools.getSkillType(args[1]), xp);
|
mcMMOPlayer.applyXpGain(SkillType.getSkill(args[1]), xp);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, Misc.getCapitalized(args[1])));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, Misc.getCapitalized(args[1])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillTools.getSkillType(args[0]), newValue);
|
profile.modifySkill(SkillType.getSkill(args[0]), newValue);
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", Misc.getCapitalized(args[0]), newValue));
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", Misc.getCapitalized(args[0]), newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillTools.getSkillType(args[1]), newValue);
|
profile.modifySkill(SkillType.getSkill(args[1]), newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -125,7 +125,7 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillTools.getSkillType(args[1]), newValue);
|
profile.modifySkill(SkillType.getSkill(args[1]), newValue);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", Misc.getCapitalized(args[1]), newValue));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", Misc.getCapitalized(args[1]), newValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillTools.getSkillType(args[0]), 0);
|
profile.modifySkill(SkillType.getSkill(args[0]), 0);
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", Misc.getCapitalized(args[0])));
|
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", Misc.getCapitalized(args[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillTools.getSkillType(args[1]), 0);
|
profile.modifySkill(SkillType.getSkill(args[1]), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -152,7 +152,7 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillTools.getSkillType(args[1]), 0);
|
profile.modifySkill(SkillType.getSkill(args[1]), 0);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.Single", Misc.getCapitalized(args[1])));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.Single", Misc.getCapitalized(args[1])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,22 +269,6 @@ public class SkillTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the skill represented by the given string
|
|
||||||
*
|
|
||||||
* @param skillName The name of the skill
|
|
||||||
* @return the SkillType if it exists, null otherwise
|
|
||||||
*/
|
|
||||||
public static SkillType getSkillType(String skillName) {
|
|
||||||
for (SkillType x : SkillType.values()) {
|
|
||||||
if (x.toString().equalsIgnoreCase(skillName)) {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given string represents a valid skill
|
* Checks if the given string represents a valid skill
|
||||||
*
|
*
|
||||||
@ -292,7 +276,7 @@ public class SkillTools {
|
|||||||
* @return true if this is a valid skill, false otherwise
|
* @return true if this is a valid skill, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isSkill(String skillName) {
|
public static boolean isSkill(String skillName) {
|
||||||
if (getSkillType(skillName) != null) {
|
if (SkillType.getSkill(skillName) != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public enum SkillType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SkillType getSkill(String skillName) {
|
public static SkillType getSkill(String skillName) {
|
||||||
for (SkillType type : SkillType.values()) {
|
for (SkillType type : values()) {
|
||||||
if (type.name().equalsIgnoreCase(skillName)) {
|
if (type.name().equalsIgnoreCase(skillName)) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class XplockCommand extends SpoutCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lockXpBar(sender, SkillTools.getSkillType(args[0]));
|
lockXpBar(sender, SkillType.getSkill(args[0]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user