use of com.archyx.aureliumskills.commands.SkillsCommand in project AureliumSkills by Archy-X.
the class AureliumSkills method registerCommands.
private void registerCommands() {
commandManager.enableUnstableAPI("help");
commandManager.usePerIssuerLocale(true, false);
commandManager.getCommandContexts().registerContext(Stat.class, c -> {
String input = c.popFirstArg();
Stat stat = statRegistry.getStat(input);
if (stat != null) {
return stat;
} else {
throw new InvalidCommandArgument("Stat " + input + " not found!");
}
});
commandManager.getCommandContexts().registerContext(Skill.class, c -> {
String input = c.popFirstArg();
Skill skill = skillRegistry.getSkill(input);
if (skill != null) {
return skill;
} else {
throw new InvalidCommandArgument("Skill " + input + " not found!");
}
});
commandManager.getCommandCompletions().registerAsyncCompletion("skills", c -> {
List<String> values = new ArrayList<>();
for (Skill skill : skillRegistry.getSkills()) {
if (OptionL.isEnabled(skill)) {
values.add(skill.toString().toLowerCase(Locale.ENGLISH));
}
}
return values;
});
commandManager.getCommandCompletions().registerAsyncCompletion("skills_global", c -> {
List<String> values = new ArrayList<>();
values.add("global");
for (Skill skill : skillRegistry.getSkills()) {
if (OptionL.isEnabled(skill)) {
values.add(skill.toString().toLowerCase(Locale.ENGLISH));
}
}
return values;
});
commandManager.getCommandCompletions().registerAsyncCompletion("skillTop", c -> {
List<String> values = new ArrayList<>();
for (Skill skill : skillRegistry.getSkills()) {
if (OptionL.isEnabled(skill)) {
values.add(skill.toString().toLowerCase(Locale.ENGLISH));
}
}
values.add("average");
return values;
});
commandManager.getCommandCompletions().registerAsyncCompletion("stats", c -> {
List<String> values = new ArrayList<>();
for (Stat stat : statRegistry.getStats()) {
values.add(stat.toString().toLowerCase(Locale.ENGLISH));
}
return values;
});
commandManager.getCommandCompletions().registerAsyncCompletion("lang", c -> Lang.getDefinedLanguagesSet());
commandManager.getCommandCompletions().registerAsyncCompletion("modifiers", c -> {
Player player = c.getPlayer();
PlayerData playerData = getPlayerManager().getPlayerData(player);
if (playerData != null) {
return playerData.getStatModifiers().keySet();
}
return null;
});
commandManager.getCommandCompletions().registerAsyncCompletion("item_keys", c -> itemRegistry.getKeys());
commandManager.registerCommand(new SkillsCommand(this));
commandManager.registerCommand(new StatsCommand(this));
commandManager.registerCommand(new ManaCommand(this));
if (OptionL.getBoolean(Option.ENABLE_SKILL_COMMANDS)) {
if (OptionL.isEnabled(Skills.FARMING)) {
commandManager.registerCommand(new SkillCommands.FarmingCommand(this));
}
if (OptionL.isEnabled(Skills.FORAGING)) {
commandManager.registerCommand(new SkillCommands.ForagingCommand(this));
}
if (OptionL.isEnabled(Skills.MINING)) {
commandManager.registerCommand(new SkillCommands.MiningCommand(this));
}
if (OptionL.isEnabled(Skills.FISHING)) {
commandManager.registerCommand(new SkillCommands.FishingCommand(this));
}
if (OptionL.isEnabled(Skills.EXCAVATION)) {
commandManager.registerCommand(new SkillCommands.ExcavationCommand(this));
}
if (OptionL.isEnabled(Skills.ARCHERY)) {
commandManager.registerCommand(new SkillCommands.ArcheryCommand(this));
}
if (OptionL.isEnabled(Skills.DEFENSE)) {
commandManager.registerCommand(new SkillCommands.DefenseCommand(this));
}
if (OptionL.isEnabled(Skills.FIGHTING)) {
commandManager.registerCommand(new SkillCommands.FightingCommand(this));
}
if (OptionL.isEnabled(Skills.ENDURANCE)) {
commandManager.registerCommand(new SkillCommands.EnduranceCommand(this));
}
if (OptionL.isEnabled(Skills.AGILITY)) {
commandManager.registerCommand(new SkillCommands.AgilityCommand(this));
}
if (OptionL.isEnabled(Skills.ALCHEMY)) {
commandManager.registerCommand(new SkillCommands.AlchemyCommand(this));
}
if (OptionL.isEnabled(Skills.ENCHANTING)) {
commandManager.registerCommand(new SkillCommands.EnchantingCommand(this));
}
if (OptionL.isEnabled(Skills.SORCERY)) {
commandManager.registerCommand(new SkillCommands.SorceryCommand(this));
}
if (OptionL.isEnabled(Skills.HEALING)) {
commandManager.registerCommand(new SkillCommands.HealingCommand(this));
}
if (OptionL.isEnabled(Skills.FORGING)) {
commandManager.registerCommand(new SkillCommands.ForgingCommand(this));
}
}
}
Aggregations