2016-03-14 19:00:03 -07:00
|
|
|
package WayofTime.bloodmagic.command;
|
|
|
|
|
|
|
|
import WayofTime.bloodmagic.command.sub.SubCommandBind;
|
|
|
|
import WayofTime.bloodmagic.command.sub.SubCommandHelp;
|
|
|
|
import WayofTime.bloodmagic.command.sub.SubCommandNetwork;
|
|
|
|
import WayofTime.bloodmagic.command.sub.SubCommandOrb;
|
|
|
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
|
|
|
import net.minecraft.command.CommandBase;
|
|
|
|
import net.minecraft.command.ICommandSender;
|
|
|
|
import net.minecraft.util.ChatComponentText;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
2016-03-16 18:41:06 -04:00
|
|
|
public class CommandBloodMagic extends CommandBase
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
|
|
|
|
private final List<String> aliases = new ArrayList<String>();
|
|
|
|
private final Map<String, ISubCommand> subCommands = new HashMap<String, ISubCommand>();
|
|
|
|
|
2016-03-16 18:41:06 -04:00
|
|
|
public CommandBloodMagic()
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
aliases.add("BloodMagic");
|
|
|
|
aliases.add("bloodmagic");
|
|
|
|
aliases.add("bloodMagic");
|
|
|
|
aliases.add("bm");
|
|
|
|
|
|
|
|
subCommands.put("help", new SubCommandHelp(this));
|
|
|
|
subCommands.put("network", new SubCommandNetwork(this));
|
|
|
|
subCommands.put("bind", new SubCommandBind(this));
|
|
|
|
subCommands.put("orb", new SubCommandOrb(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-16 18:41:06 -04:00
|
|
|
public String getCommandName()
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
return "/bloodmagic";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-16 18:41:06 -04:00
|
|
|
public int getRequiredPermissionLevel()
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-16 18:41:06 -04:00
|
|
|
public String getCommandUsage(ICommandSender commandSender)
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
return getCommandName() + " help";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-16 18:41:06 -04:00
|
|
|
public List<String> getCommandAliases()
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
return aliases;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-16 18:41:06 -04:00
|
|
|
public void processCommand(ICommandSender commandSender, String[] args)
|
|
|
|
{
|
|
|
|
if (args.length > 0 && subCommands.containsKey(args[0]))
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
|
|
|
|
ISubCommand subCommand = subCommands.get(args[0]);
|
|
|
|
String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
|
|
|
|
subCommand.processSubCommand(commandSender, subArgs);
|
2016-03-16 18:41:06 -04:00
|
|
|
} else
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
commandSender.addChatMessage(new ChatComponentText(TextHelper.localizeEffect("commands.error.unknown")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-16 18:41:06 -04:00
|
|
|
public Map<String, ISubCommand> getSubCommands()
|
|
|
|
{
|
2016-03-14 19:00:03 -07:00
|
|
|
return subCommands;
|
|
|
|
}
|
|
|
|
}
|