mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 11:14:44 +02:00
SkillUtils cleanup, EventUtils creation
Move some functions in SkillUtils to more relevant locations. Begin work on utility class to handle all event calls.
This commit is contained in:
@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class AddlevelsCommand extends ExperienceCommand {
|
||||
@Override
|
||||
@ -36,6 +35,6 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill() {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, SkillUtils.getSkillName(skill)));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getSkillName()));
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class AddxpCommand extends ExperienceCommand {
|
||||
@Override
|
||||
@ -35,6 +34,6 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill() {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, SkillUtils.getSkillName(skill)));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getSkillName()));
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@ -149,7 +148,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillUtils.getSkillName(skill), playerName));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getSkillName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelDownEvent;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class MmoeditCommand extends ExperienceCommand {
|
||||
@Override
|
||||
@ -46,6 +45,6 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill() {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillUtils.getSkillName(skill), value));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getSkillName(), value));
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class SkillresetCommand extends ExperienceCommand {
|
||||
private CommandSender sender;
|
||||
@ -117,6 +116,6 @@ public class SkillresetCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill() {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", SkillUtils.getSkillName(skill)));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getSkillName()));
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
|
||||
private void toggle(boolean enable) {
|
||||
if (skill.equalsIgnoreCase("ALL")) {
|
||||
for (SkillType skillType : SkillType.nonChildSkills()) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
skillType.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
|
||||
private void toggle(boolean enable) {
|
||||
if (skill.equalsIgnoreCase("ALL")) {
|
||||
for (SkillType skillType : SkillType.nonChildSkills()) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
skillType.setHardcoreVampirismEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
@ -52,22 +52,20 @@ public class InspectCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.EXCAVATION);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.FISHING);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.HERBALISM);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.MINING);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.WOODCUTTING);
|
||||
for (SkillType skill : SkillType.GATHERING_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.AXES);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.ARCHERY);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.SWORDS);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.TAMING);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.UNARMED);
|
||||
for (SkillType skill : SkillType.COMBAT_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.ACROBATICS);
|
||||
CommandUtils.displaySkill(sender, profile, SkillType.REPAIR);
|
||||
for (SkillType skill : SkillType.MISC_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
@ -23,7 +23,6 @@ import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@ -46,7 +45,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
public SkillCommand(SkillType skill) {
|
||||
this.skill = skill;
|
||||
skillName = SkillUtils.getSkillName(skill);
|
||||
skillName = skill.getSkillName();
|
||||
skillGuideCommand = new SkillGuideCommand(skill);
|
||||
}
|
||||
|
||||
@ -91,7 +90,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
Set<SkillType> parents = FamilyTree.getParents(skill);
|
||||
|
||||
for (SkillType parent : parents) {
|
||||
player.sendMessage(SkillUtils.getSkillName(parent) + " - " + LocaleLoader.getString("Effects.Level", profile.getSkillLevel(parent), profile.getSkillXpLevel(parent), profile.getXpToLevel(parent)));
|
||||
player.sendMessage(parent.getSkillName() + " - " + LocaleLoader.getString("Effects.Level", profile.getSkillLevel(parent), profile.getSkillXpLevel(parent), profile.getXpToLevel(parent)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class SkillGuideCommand implements CommandExecutor {
|
||||
private String header;
|
||||
@ -19,7 +18,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
private String invalidPage;
|
||||
|
||||
public SkillGuideCommand(SkillType skillType) {
|
||||
header = LocaleLoader.getString("Guides.Header", SkillUtils.getSkillName(skillType));
|
||||
header = LocaleLoader.getString("Guides.Header", skillType.getSkillName());
|
||||
guide = getGuide(skillType);
|
||||
|
||||
invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
||||
|
Reference in New Issue
Block a user