Command API thoughts
#8
Actually this is rather easy to solve. We can make it so that when a command has empty help string, it will not display in the /help list. That's all it takes:

For debug purposes, you don't care about the /help list; if you do, just don't provide the help string in command binding.

As for your Portal example, you could achieve that by binding the "portal" command (possibly with an empty help string to hide it), provide the functionality there using a switch on the split. Then, you bind a "portal mode" command with the correct help string and a dummy handler function; "portal enter" and "portal exit" the same. Since MCServer always compares the commands in the internal command table with the first word of the player-issued command, it will never match "portal mode" nor the other two.

Why am I doing this so twisted? Consider for a while if we wanted to add the posibility to bind multi-word commands. A plugin binds "portal mode" command, then another plugin requests to bind "portal" command. Do we let it, or do we refuse? If we let it, how do we handle user input, then? What if the registration is done the other way around, do we accept it, or refuse it?
In my opinion, multi-word commands are just not reasonably implementable; only a single plugin can reasonably cover all the bases, and it can do so on its own using the split.

So, to sum up:
cPluginManager:BindCommand("Command", "Permission", Function, "") - binds the command, but hides it from the help
cPluginManager:BindCommand("Multi Word Command", "Any Permission", DummyFunction, "Description") - displays help, never gets called
Reply
Thanks given by:


Messages In This Thread
Command API thoughts - by xoft - 01-30-2013, 05:44 AM
RE: Command API thoughts - by bearbin - 01-30-2013, 05:49 AM
RE: Command API thoughts - by Taugeshtu - 01-30-2013, 06:32 AM
RE: Command API thoughts - by xoft - 01-30-2013, 06:53 AM
RE: Command API thoughts - by Taugeshtu - 01-30-2013, 06:58 PM
RE: Command API thoughts - by xoft - 01-30-2013, 07:41 PM
RE: Command API thoughts - by Taugeshtu - 01-30-2013, 09:38 PM
RE: Command API thoughts - by xoft - 02-01-2013, 05:06 AM
RE: Command API thoughts - by Taugeshtu - 02-01-2013, 05:45 AM
RE: Command API thoughts - by xoft - 02-01-2013, 07:18 PM
RE: Command API thoughts - by xoft - 02-02-2013, 05:57 AM
RE: Command API thoughts - by NiLSPACE - 02-14-2013, 05:21 AM
RE: Command API thoughts - by xoft - 02-14-2013, 05:24 AM
RE: Command API thoughts - by xoft - 02-15-2013, 11:11 PM



Users browsing this thread: 1 Guest(s)