net.minecraft.command.ICommand Java Examples

The following examples show how to use net.minecraft.command.ICommand. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandHandler.java    From TickDynamic with MIT License 6 votes vote down vote up
public CommandHandler(TickDynamicMod mod) {
	this.mod = mod;
	
	aliases = new ArrayList<String>();
	aliases.add("tickdynamic");
	aliases.add("td");
	
	subCommandHandlers = new HashMap<String, ICommand>();
	subCommandHandlers.put("reload", new CommandReload(mod));
	subCommandHandlers.put("reloadgroups", new CommandReloadGroups(mod));
	subCommandHandlers.put("listworlds", new CommandListWorlds(mod));
	subCommandHandlers.put("world", new CommandWorld(mod));
	subCommandHandlers.put("enabled", new CommandEnabled(mod));
	
	StringBuilder builderSubCommands = new StringBuilder();
	SubCommands[] subs = SubCommands.values();
	for(SubCommands command : subs) {
		builderSubCommands.append(command).append(", ");
	}
	builderSubCommands.delete(builderSubCommands.length()-2, builderSubCommands.length());
	listSubCommands = builderSubCommands.toString();
}
 
Example #2
Source File: CommandHandler.java    From TickDynamic with MIT License 6 votes vote down vote up
@Override
public List addTabCompletionOptions(ICommandSender sender, String[] args) {
	if(args.length == 1)
	{
		List listOut = new LinkedList();
		String lastArg = args[args.length-1];
		SubCommands[] subCommands = SubCommands.values();
		for(SubCommands command : subCommands)
		{
			if(command.toString().contains(lastArg))
				listOut.add(command.toString());
		}
		
		return listOut;
	}
	else
	{
		//Send it over to subCommand handler
		ICommand subHandler = subCommandHandlers.get(args[0]);
		if(subHandler == null)
			return null;
		return subHandler.addTabCompletionOptions(sender, args);
	}
}
 
Example #3
Source File: CraftServer.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
private void setVanillaCommands(boolean first) {
    Map<String, ICommand> commands = console.getCommandManager().getCommands();
    for (ICommand cmd : commands.values()) {
        commandMap.register("minecraft",
                new VanillaCommandWrapper((CommandBase) cmd, I18n.translateToLocal(cmd.getUsage(null))));
    }
}
 
Example #4
Source File: CommandOutputs.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int compareTo(Object object) {
    if (object instanceof ICommand) {
        return this.compareTo((ICommand) object);
    } else {
        return 0;
    }
}
 
Example #5
Source File: CommandHandler.java    From TickDynamic with MIT License 5 votes vote down vote up
@Override
public void processCommand(ICommandSender sender, String[] args) {
	if(args.length == 0)
	{
		sender.addChatMessage(new ChatComponentText("Usage: " + getCommandUsage(sender)));
		return;
	}
	
	if(args[0].equals("tps"))
	{
		
		sender.addChatMessage(new ChatComponentText("Average TPS: " + getTPSFormatted(mod) + " TPS"));
		return;
	} else if(args[0].equals("identify")) {
		sender.addChatMessage(new ChatComponentText("Command not yet implemented! This will allow you to check what group a Tile or Entity belongs to by right clicking it.(And other info, like TPS)"));
		return;
	} else if(args[0].equals("help")) {
		sender.addChatMessage(new ChatComponentText("You can find the documentation over at http://mods.stjerncraft.com/tickdynamic"));
		return;
	}
	
	//Send it over to subCommand handler
	ICommand subHandler = subCommandHandlers.get(args[0]);
	if(subHandler == null)
	{
		sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "No handler for the command " + EnumChatFormatting.ITALIC + args[0]));
		return;
	}
	subHandler.processCommand(sender, args);
}
 
Example #6
Source File: QCraftCommand.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo( Object o )
{
    if( o instanceof ICommand )
    {
        return ((ICommand)o).getCommandName().compareTo( getCommandName() );
    }
    return 0;
}
 
Example #7
Source File: CommandCalc.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public int compareTo(ICommand o) {
	return name.compareTo(o.getName());
}
 
Example #8
Source File: SidedCommand.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public int compareTo(ICommand o) {
	return name.compareTo(o.getName());
}
 
Example #9
Source File: CoreCommand.java    From CodeChickenCore with MIT License 4 votes vote down vote up
@Override
public int compareTo(Object o) {
    return getCommandName().compareTo(((ICommand) o).getCommandName());
}
 
Example #10
Source File: IProxy.java    From AgriCraft with MIT License 4 votes vote down vote up
@Override
default void onServerStarting(FMLServerStartingEvent event) {
    // This is to be moved to infinity lib in a future version, I would expect.
    AgriCore.getLogger("agricraft").info("Registering AgriCraft Commands.");
    ReflectionHelper.forEachValueIn(AgriCraft.instance.getModCommandRegistry(), ICommand.class, event::registerServerCommand);
}
 
Example #11
Source File: CommandStat.java    From AgriCraft with MIT License 4 votes vote down vote up
@Override
public int compareTo(ICommand o) {
    return ComparisonChain.start()
            .compare(this.getName(), o.getName())
            .result();
}
 
Example #12
Source File: CommandNbt.java    From AgriCraft with MIT License 4 votes vote down vote up
@Override
public int compareTo(ICommand o) {
    return ComparisonChain.start()
            .compare(this.getName(), o.getName())
            .result();
}
 
Example #13
Source File: WorldCommand.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public int compareTo(ICommand arg0) {
	return this.getName().compareTo(arg0.getName());
}
 
Example #14
Source File: MainCommand.java    From mobycraft with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(ICommand command) {
	return 0;
}
 
Example #15
Source File: YouTubeChatMock.java    From youtube-chat-for-minecraft with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(ICommand o) {
  return 0;
}
 
Example #16
Source File: YouTubeCommand.java    From youtube-chat-for-minecraft with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(ICommand o) {
  return 0;
}
 
Example #17
Source File: CommandWrapper.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int compareTo(ICommand o) {
    return 0;
}