2015-02-05 05:48:07 +01:00
|
|
|
package com.pahimar.ee3.command;
|
|
|
|
|
2015-02-05 20:34:22 +01:00
|
|
|
import com.pahimar.ee3.reference.Messages;
|
2015-02-05 05:48:07 +01:00
|
|
|
import com.pahimar.ee3.reference.Names;
|
|
|
|
import net.minecraft.command.CommandBase;
|
|
|
|
import net.minecraft.command.ICommandSender;
|
|
|
|
|
2015-02-05 20:34:22 +01:00
|
|
|
import java.util.ArrayList;
|
2015-02-05 05:48:07 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class CommandEE extends CommandBase
|
|
|
|
{
|
2015-02-05 20:34:22 +01:00
|
|
|
private static List<CommandBase> modCommands = new ArrayList<CommandBase>();
|
|
|
|
private static List<String> commands = new ArrayList<String>();
|
2015-02-05 05:48:07 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getCommandName()
|
|
|
|
{
|
|
|
|
return Names.Commands.BASE_COMMAND;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getCommandUsage(ICommandSender commandSender)
|
|
|
|
{
|
2015-02-05 20:34:22 +01:00
|
|
|
return Messages.Commands.BASE_COMMAND_USAGE;
|
2015-02-05 05:48:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void processCommand(ICommandSender commandSender, String[] args)
|
|
|
|
{
|
|
|
|
if (args.length >= 1)
|
|
|
|
{
|
|
|
|
for (CommandBase command : modCommands)
|
|
|
|
{
|
|
|
|
if (command.getCommandName().equalsIgnoreCase(args[0]) && command.canCommandSenderUseCommand(commandSender))
|
|
|
|
{
|
|
|
|
command.processCommand(commandSender, args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
|
|
|
|
{
|
|
|
|
if (args.length == 1)
|
|
|
|
{
|
2015-02-05 20:34:22 +01:00
|
|
|
return getListOfStringsFromIterableMatchingLastWord(args, commands);
|
2015-02-05 05:48:07 +01:00
|
|
|
}
|
|
|
|
else if (args.length >= 2)
|
|
|
|
{
|
|
|
|
for (CommandBase command : modCommands)
|
|
|
|
{
|
|
|
|
if (command.getCommandName().equalsIgnoreCase(args[0]))
|
|
|
|
{
|
|
|
|
return command.addTabCompletionOptions(commandSender, args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2015-02-05 20:34:22 +01:00
|
|
|
|
|
|
|
static
|
|
|
|
{
|
2015-02-06 05:06:53 +01:00
|
|
|
modCommands.add(new CommandSetEnergyValue());
|
2015-02-18 16:47:59 +01:00
|
|
|
modCommands.add(new CommandSetEnergyValueCurrentItem());
|
2015-02-06 05:06:53 +01:00
|
|
|
modCommands.add(new CommandSyncEnergyValues());
|
2015-02-05 20:34:22 +01:00
|
|
|
modCommands.add(new CommandPlayerLearnEverything());
|
|
|
|
modCommands.add(new CommandPlayerLearnItem());
|
2015-02-18 16:47:59 +01:00
|
|
|
modCommands.add(new CommandPlayerLearnCurrentItem());
|
2015-02-06 03:03:08 +01:00
|
|
|
modCommands.add(new CommandPlayerForgetEverything());
|
|
|
|
modCommands.add(new CommandPlayerForgetItem());
|
2015-02-18 16:47:59 +01:00
|
|
|
modCommands.add(new CommandPlayerForgetCurrentItem());
|
2015-02-05 20:34:22 +01:00
|
|
|
modCommands.add(new CommandTemplateLearnEverything());
|
|
|
|
modCommands.add(new CommandTemplateLearnItem());
|
2015-02-18 16:47:59 +01:00
|
|
|
modCommands.add(new CommandTemplateLearnCurrentItem());
|
2015-02-05 20:34:22 +01:00
|
|
|
modCommands.add(new CommandTemplateForgetEverything());
|
|
|
|
modCommands.add(new CommandTemplateForgetItem());
|
2015-02-18 16:47:59 +01:00
|
|
|
modCommands.add(new CommandTemplateForgetCurrentItem());
|
2015-02-06 23:11:17 +01:00
|
|
|
modCommands.add(new CommandSetItemLearnable());
|
|
|
|
modCommands.add(new CommandSetItemNotLearnable());
|
|
|
|
modCommands.add(new CommandSetItemRecoverable());
|
|
|
|
modCommands.add(new CommandSetItemNotRecoverable());
|
2015-02-05 20:34:22 +01:00
|
|
|
|
|
|
|
for (CommandBase commandBase : modCommands)
|
|
|
|
{
|
|
|
|
commands.add(commandBase.getCommandName());
|
|
|
|
}
|
|
|
|
}
|
2015-02-05 05:48:07 +01:00
|
|
|
}
|