command text change stuff and also getting rid of unnecessary npc list in NPCManager
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package net.nuggetmc.ai.commands;
|
||||
|
||||
import com.jonahseguin.drink.CommandService;
|
||||
import com.jonahseguin.drink.Drink;
|
||||
import com.jonahseguin.drink.annotation.Command;
|
||||
import com.jonahseguin.drink.command.DrinkCommandContainer;
|
||||
import com.jonahseguin.drink.command.DrinkCommandService;
|
||||
import net.nuggetmc.ai.PlayerAI;
|
||||
import net.nuggetmc.ai.commands.commands.PlayerAICommand;
|
||||
@@ -19,16 +17,17 @@ public class CommandHandler {
|
||||
|
||||
private final DrinkCommandService drink;
|
||||
|
||||
public CommandHandler() {
|
||||
drink = (DrinkCommandService) Drink.get(PlayerAI.getInstance());
|
||||
drink.register(new PlayerAICommand(this), "playerai", "pai");
|
||||
public CommandHandler(PlayerAI plugin) {
|
||||
drink = (DrinkCommandService) Drink.get(plugin);
|
||||
drink.register(new PlayerAICommand(this), "bot", "playerai", "pai", "ai", "npc");
|
||||
drink.registerCommands();
|
||||
}
|
||||
|
||||
public List<String> getUsage(Class<? extends CommandInstance> clazz) {
|
||||
String rootName = getRootName(clazz);
|
||||
return getSubCommands(clazz).stream().map(c -> {
|
||||
Command command = c.getAnnotation(Command.class);
|
||||
return ChatColor.GRAY + " ▪ " + ChatColor.YELLOW + "/" + getRootName(clazz) + (command.name().isEmpty() ? "" : " " + command.name()) + ChatColor.GRAY + " ▪ "
|
||||
return ChatColor.GRAY + " ▪ " + ChatColor.YELLOW + "/" + rootName + " " + command.name() + ChatColor.GRAY + " ▪ "
|
||||
+ ChatColor.RESET + command.desc();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@@ -39,7 +38,6 @@ public class CommandHandler {
|
||||
}
|
||||
|
||||
private List<Method> getSubCommands(Class<? extends CommandInstance> clazz) {
|
||||
return Arrays.stream(clazz.getDeclaredMethods()).filter(m -> m.isAnnotationPresent(Command.class)).collect(Collectors.toList());
|
||||
return Arrays.stream(clazz.getDeclaredMethods()).filter(m -> m.isAnnotationPresent(Command.class) && !m.getAnnotation(Command.class).name().isEmpty()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user