[INACTIVE][INFO] Help 0.2: The smart /help menu [531]

Discussion in 'Inactive/Unsupported Plugins' started by tkelly, Feb 28, 2011.

     
  1. Offline

    tkelly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Help v0.2
    Download Help v0.2
    Download Help (Static Jar)
    Help Source Code
    Suggest Features

    Help has support for both GroupManager and Permissions, so you can use either one. You can also use neither if you so choose. Help will not force you to any which one.

    What is Help?
    Help is a clean and advanced /help menu. Help separates "main" commands from secondary ones, allowing you to have a clean initial menu, but still able to dig down and get access to every possible command.

    It is also the first /help menu to take into account permissions; some commands simply aren't applicable to all users, so those commands should clearly not be visible to those users. Now, default users' help menus won't be cluttered with commands for admin tools they have no way of using.

    Scroll down for a preview, or see below for how to hook into Help :)

    Help Commands
    /help (#) : Shows the /help menu.
    /help [plugin] (#): Shows all the help entries for [plugin].
    /help plugins : Shows a list of all the plugins with Help entries.
    /help search [query] : Searches for [query] within it' entries.
    /help reload : Reloads the entries from ExtraHelp.yml.

    Plugin Support
    Help requires that plugins tell Help about the commands they use. This makes sure that the commands and permissions are accurate and precise (rather than trying to auto fetch commands). Because it's ridiculous to assume that all plugins will instantly jump up and support Help (we can dream can't we? :D), server admins can mimic this behavior by supplying...

    Custom ExtraHelp/
    In the Help.zip download, I include a Help/ folder with a sample extra helps inside the ExtraHelp folder. This shows you how you can add custom commands to the /help menu. I'll also cover how to do that here.

    Each command has a "name", this name is only for you, as Help doesn't care about it (they just need to be unique names). In the following example the names are 'versions', 'pluginversions', 'kick' and 'essentialswho'. Within these Nodes you need 3 things: command, description, and plugin. These should be self-explanatory. The two optional pieces are "main" and "permissions".

    If you specify a "main", you can choose whether or not the command is important enough to show up on the main /help menu; if you leave it blank or skip it, it will default to 'false'.

    If you specify a "visible", you can specify whether the command shows up at all. This is useful for overriding other plugins' built-in Help support (in case you don't want all the commands); if you leave it blank or skip it, it will default to 'true'.

    If you specify a "permissions", you can choose what is necessary for the user to see the command; and leaving it blank will allow all to see. So in the case of /version, all users can use it, so no permissions. But with /who, you have to have essentials.list, so that was specified. There is also a special permission case, "OP". By specifying this, this will require the user to be an OP to use the command (as is the case with Minecraft's built-in /kick command).
    Code:
    versions:
        command: version
        description: Show the version of Minecraft and CB
        plugin: CraftBukkit
        main: true
    pluginversions:
        command: version [plugin]
        description: Shows the version of [plugin]
        plugin: CraftBukkit
    kick:
        command: kick [player]
        description: Kicks [player] from the server
        plugin: Minecraft
        main: true
        permissions: OP
    essentialswho:
        command: who
        description: Show who's one the server
        plugin: Essentials
        main: true
        permissions: essentials.list
    
    How To Hook into Help.
    Hooking into Help is extremely easy, and very similar to hooking into any permission-plugin. When your plugin is starting up, just grab the Help plugin and register your commands with Help's registerCommand() method; that's it! Here's the API and some examples. If you'd like a concrete example, check out the relevant source code from MyHome and BigBrother.

    Help API
    Code:
    /**
     * Registers the given command, description, and plugin.
     * There are no permissions, so all users can see it.
     * It is also not a "main" help entry.
     * @return Whether or not it was successful
     */
    public boolean registerCommand(String command, String description, Plugin plugin);
    
    /**
     * Registers the given command, description, and plugin.
     * There are no permissions, so all users can see it.
     * You can set whether the plugin is a "main" entry or not
     * @return Whether or not it was successful
     */
    public boolean registerCommand(String command, String description, Plugin plugin, boolean main);
    
    /**
     * Registers the given command, description, and plugin.
     * You can specify one or more permissions.
     * If a user has permissions for at least (1) of them, he can see this command
     * It is also not a "main" help entry.
     * @return Whether or not it was successful
     */
    public boolean registerCommand(String command, String description, Plugin plugin, String... permissions);
    
    /**
     * Registers the given command, description, and plugin.
     * You can specify one or more permissions.
     * If a user has permissions for at least (1) of them, he can see this command
     * You can set whether the plugin is a "main" entry or not
     * @return Whether or not it was successful
     */
    public boolean registerCommand(String command, String description, Plugin plugin, boolean main, String... permissions);
    
    Basic Example
    Code:
    // plugin is the instance of your Plugin registering the commands
    Plugin test = plugin.getServer().getPluginManager().getPlugin("Help");
    if (test != null) {
        Logger log = Logger.getLogger("Minecraft");
        Help helpPlugin = ((Help) test);
        // Registers a main command. But all users will be able to see it
        helpPlugin.registerCommand("home help", "Help for all MyHome commands", plugin, true);
        // Registers a secondary command to our plugin (MyHome), but the user has to have the permission to see it
        helpPlugin.registerCommand("home", "Go home young chap!", plugin, "myhome.home.basic.home");
        log.log(Level.INFO, "'Help' support enabled.");
    } else {
        Logger log = Logger.getLogger("Minecraft");
        log.log(Level.WARNING, "'Help' isn't detected. No /help support.");
    }
    
    Slightly More Advanced Example
    Code:
    Help helpPlugin = ((Help) test);
    String[] permissions = new String[]{"bb.admin.watch", "bb.admin.info", "bb.admin.rollback", "bb.admin.cleanse"};
    // If a user has any one of those permissions, they'll be able to see /bb help. A main command
    helpPlugin.registerCommand("bb help", "Help for all BigBrother commands", plugin, true, permissions);
    // If a user has "bb.admin.watch" they'll be able to see /bb watch [player]. A secondary command
    helpPlugin.registerCommand("bb watch [player]", "Toggle the watch on [player]", plugin, permissions[0]);
    
    Plugins with Help Support
    Here's a quick list of plugins (and version) that have built in Help support.
    - MyHome v1.9.2+
    - MyWarp v1.10.3+
    - BigBrother v1.6.4+
    - Citizens v1.0+
    - General 3.1+
    - TelePlus 1.6+
    - Pixl 1.3+
    - Vampire 1.3+

    ExtraHelp Packs
    FabianN put together a repository of entries for your ExtraHelp/ that represent other plugins' commands. It's really awesome and was helped put together by others from the community.

    Preview
    [IMG]
    [IMG]


    Changelog

    Help v0.2 [531]
    Released 15 Mar, 2011
    - Built with latest recommend build (531)
    - Multiline support. Descriptions of commands can now be as long as you'd like.
    - Separated ExtraHelp.yml into separate YML files (for each plugin, etc).
    - Plugin overriding. Don't like how a plugin has their Help support? Completely customize their entries.

    Help v0.1.1 [493]
    Released 6 Mar, 2011
    - Built with latest recommend build (493)
    - Updated for GroupManager 1.0

    Help v0.1 [440]
    Released 28 Feb, 2011
    - Intial Release
  2.  
  3. Offline

    NEO

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This has been a big issue for me, not having an up to date or accurate /help command for my users.

    This looks great, cant wait to try it out.
  4. Offline

    Pluckerpluck

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This looks like it could catch on... I need a proper help system and this will work nicely I think.
  5. Offline

    tkelly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yea. That's exactly why I made it. The help systems available were just not up to snuff (General's was my favorite), so I needed one that would work easily and simply with the users on the server I go on.
  6. Offline

    jwideman

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Clever. I'll see how this develops.
  7. Offline

    Alienware777

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    FINALLY! Thank you so much for making this tkelly. I've been suggesting this to multiple developers, and even the bukkit staff haha. I hope every plugin dev starts using this [IMG]
  8. Offline

    mrgreaper

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    looks cool, at mo were using essentialshelp which just lists every command reather a player can use it or not lol

    will definatly be switching to this if it works on our server

    nice to see groupmanager supported too! its getting tricky trying to get plugins when some only support the dead permissions plugin lol
  9. Offline

    Dutchy

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'll consider supporting this for my plugins.
  10. Offline

    SplenectomY

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Why not? It's not very invasive and having a universal help plugin by staff member (meaning it will likely get fully integrated into bukkit one day) is only a boon. Any developer who doesn't take advantage of this is really letting the users down.
  11. Offline

    Dutchy

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yes, makes sense.
  12. Offline

    Phaedrus

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This looks great. Your help menus in MyWarp and MyHome are phenomenal. I can't wait to check it out. Right now I'm using MCdocs to make custom lists for each user group. This would be much easier.
  13. Offline

    Synicyde

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This looks promising, I like.
  14. Offline

    Juze

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Wow! Finally a plugin that automatically does HelpPages' job and does more than that + allows custom help pages! I love you, @tkelly !
  15. Offline

    GizmoTheGreen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Amazing, just like how I envisioned it :p
  16. Offline

    Vaupell

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thank you WERY much,, much needed. the others "on the market" is not ewen compareable with this..
    Again KIS* wins.

    KIS = Keep it simple
  17. Offline

    RTRD

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @tkelly I use Bukkit 468 and i get this error:
    Code:
    2011-03-01 20:44:05 [SEVERE] Could not load plugins\Help.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:65)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:129)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:94)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:59)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:204)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:191)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:131)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:246)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.util.zip.ZipException: invalid END header (bad central directory offset)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(Unknown Source)
    at java.util.jar.JarFile.<init>(Unknown Source)
    at java.util.jar.JarFile.<init>(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:52)
    ... 8 more
  18. Offline

    Giant

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hey tkelly,

    Is it correct that when you have admin permissions set to -'*', the plugin thinks you do not have the permissions to view the info?
  19. Offline

    petteyg359

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Giant, if there's no space between that dash and the apostrophe, then your admin probably has no permissions for anything.
  20. Offline

    Giant

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    uhh that was just typed in here, my permissions file is correct haha :oops:

    Edit:

    Seems like that's not the issue, doesn't work when hard setting the permissions either :S
    myHome seems to not work aswell O__o

    Edit 2:

    I is a total idiot >__<
    Forgot that for more info you needed to use: /help [plugin] srry (A)
  21. Offline

    M1sT3rM4n

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    A lot of plugins don't have this hooked Q_Q
  22. Offline

    PatrickFreed

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    How long has this been out? I've been looking for a help plugin with permissions support forever. [IMG]
  23. Offline

    TheJSeb

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I tried it and it works for me. But when one of my users online tries it, the console says: Unhandled exception executing command 'help' in plugin Help v0.1.

    Any reasons why?
  24. Offline

    creec

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hey i made this config with most commands linked to proper permissions node to it if anyone is interested: http://horobox.co.uk/u/creec_1299150503.txt

    Sorry for hosting like that: Rename file to ExtraHelp.yml and put in plugins/Help folder.
    clash likes this.
  25. Offline

    jascotty2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    when reloading the help menu i got this:

    ( then got message in minecraft in light blue: "Successfully reloaded Help" )

    this was caused by an empty permissions field, so you may want to check for that in a future update
  26. Offline

    DThielke

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I love the concept. However, would you consider adding a way to add more detailed pages for specific commands? Some of my commands require more explaining than can fit on a single line.

    As an example, typing /ch help create while running HeroChat produces the following:
    [IMG]

    It would be wonderful if this plugin supported command-specific help pages like this in addition to what you already have.
  27. Offline

    jascotty2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    i agree, that would be nice.
    conflicts would come if someone named a command the same as the plugin, though.. maybe if both pages were to be printed in the case of overlap?
    also, it should also take into account worldedit commands, many which start with //, and should be searchable by name without the preceding slash
  28. Offline

    Jacob Litewski

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Sweetness! Pixl is so getting this support built into it. I won't release it until tomorrow after I test to make sure GroupManager plays well with it, but as of Pixl 1.3 (Beta or otherwise) is going to support this plugin. You rock @tkelly!
  29. Offline

    MacG32

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Where might I find the permissions list for the different help commands at?
  30. Offline

    Josch

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Pleas update it for the new GropuManager alpha!
    I get this error:
    Code:
    org.bukkit.command.CommandException: Unhandled exception executing command 'help
    ' in plugin Help v0.1
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:33)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:80
    )
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:1
    83)
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:619)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:582)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:576)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:230)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:357)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:272)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.lang.NoSuchMethodError: org.anjocaido.groupmanager.GroupManager.getHandler()Lorg/anjocaido/groupmanager/permissions/AnjoPermissionsHandler;
            at me.taylorkelly.help.HelpPermissions.permission(HelpPermissions.java:42)
            at me.taylorkelly.help.HelpEntry.playerCanUse(HelpEntry.java:40)
            at me.taylorkelly.help.HelpList.getSortedHelp(HelpList.java:38)
            at me.taylorkelly.help.Lister.setPage(Lister.java:32)
    
  31. Offline

    Daan

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'm getting constantly this error, and I can't solve it.
    Maybe someone else can?
    Here's my ExtraHelp.txt http://pastebin.com/6KdsTEFc

    Code:
    [SEVERE] [HELP] Error!
    while scanning a simple key
     in "<reader>", line 14, column 1:
        .
        ^
    could not found expected ':'
     in "<reader>", line 15, column 10:
           plugin: MyWarp
                 ^
    
        at org.yaml.snakeyaml.scanner.ScannerImpl.stalePossibleSimpleKeys(ScannerImpl.java:400)
        at org.yaml.snakeyaml.scanner.ScannerImpl.needMoreTokens(ScannerImpl.java:231)
        at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:182)
        at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:564)
        at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:163)
        at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:228)
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
        at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
        at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:124)
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:264)
        at me.taylorkelly.help.HelpLoader.load(HelpLoader.java:26)
        at me.taylorkelly.help.Help.onEnable(Help.java:29)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:414)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:187)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:83)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:61)
        at org.bukkit.craftbukkit.CraftServer.reload(CraftServer.java:205)
        at com.earth2me.essentials.commands.Commandreloadall.run(Commandreloadall.java:27)
        at com.earth2me.essentials.commands.EssentialsCommand.run(EssentialsCommand.java:42)
        at com.earth2me.essentials.Essentials.onCommand(Essentials.java:566)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:31)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:79)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:183)
        at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:619)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:582)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:576)
        at net.minecraft.server.Packet3Chat.a(SourceFile:24)
        at net.minecraft.server.NetworkManager.a(SourceFile:230)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:357)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:272)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)

Share This Page