use of com.builtbroken.mc.prefab.commands.AbstractCommand in project Engine by VoltzEngine-Project.
the class TestAbstractCommand method testInit.
@Test
public void testInit() {
AbstractCommand command = new AbstractCommand("command");
assertTrue(command.getCommandName().equals("command"));
}
use of com.builtbroken.mc.prefab.commands.AbstractCommand in project Engine by VoltzEngine-Project.
the class ModularCommandRemoveAdd method handleConsoleCommand.
@Override
public boolean handleConsoleCommand(ICommandSender sender, String[] args) {
if (isHelpCommand(args)) {
handleHelp(sender, args);
} else {
String username = args[0];
if (username != null && !username.isEmpty()) {
if (args.length > 1) {
String command = args[1];
String[] a = removeFront(args, 2);
if (!remove && command.equalsIgnoreCase("to") || remove && command.equalsIgnoreCase("from")) {
if (args.length > 2) {
command = args[2];
a = removeFront(a);
} else if (remove) {
sender.addChatMessage(new ChatComponentText("Need to know what to remove the " + type + " from"));
return true;
} else {
sender.addChatMessage(new ChatComponentText("Need to know what to add the " + type + " to"));
return true;
}
}
for (AbstractCommand c : subCommands) {
if (c instanceof SubCommandWithName && c.getCommandName().equalsIgnoreCase(command) && ((SubCommandWithName) c).handleConsoleCommand(sender, username, a)) {
return true;
}
}
sender.addChatMessage(new ChatComponentText("Unknown sub command"));
} else if (remove) {
sender.addChatMessage(new ChatComponentText("Need to know what to remove the " + type + " from"));
return true;
} else {
sender.addChatMessage(new ChatComponentText("Need to know what to add the " + type + " to"));
return true;
}
} else {
sender.addChatMessage(new ChatComponentText("Empty names are not permitted"));
}
}
return true;
}
use of com.builtbroken.mc.prefab.commands.AbstractCommand in project Engine by VoltzEngine-Project.
the class CommandRegion method getHelpOutput.
@Override
public void getHelpOutput(ICommandSender sender, List<String> items) {
List<String> commands;
for (AbstractCommand command : subCommands) {
commands = new ArrayList();
command.getHelpOutput(sender, commands);
for (String s : commands) {
items.add("[name] " + command.getCommandName() + " " + s);
}
}
}
use of com.builtbroken.mc.prefab.commands.AbstractCommand in project Engine by VoltzEngine-Project.
the class CommandGroup method getHelpOutput.
@Override
public void getHelpOutput(ICommandSender sender, List<String> items) {
List<String> commands;
for (AbstractCommand command : subCommands) {
commands = new ArrayList();
command.getHelpOutput(sender, commands);
for (String s : commands) {
items.add("[name] " + command.getCommandName() + " " + s);
}
}
}
use of com.builtbroken.mc.prefab.commands.AbstractCommand in project Engine by VoltzEngine-Project.
the class ModularCommandRemoveAdd method getHelpOutput.
@Override
public void getHelpOutput(ICommandSender sender, List<String> items) {
List<String> commands;
for (AbstractCommand command : subCommands) {
commands = new ArrayList();
command.getHelpOutput(sender, commands);
for (String s : commands) {
items.add("[" + type + "] " + (remove ? "from" : "to") + " " + command.getCommandName() + " " + s);
}
}
}
Aggregations