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

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

  1. Offline

    tkelly

    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 http://dev.bukkit.org/bukkit-plugins/ (#)[/I][/B]:[/FONT] Shows all the help entries for [I][plugin][/I]. [B][FONT=courier new]/help plugins[/FONT][/B] : Shows a list of all the plugins with Help entries. [FONT=courier new][B]/help search [I][query][/I][/B][/FONT] : Searches for [I][query][/I] within it' entries. [B][FONT=courier new]/help reload[/FONT][/B] : Reloads the entries from ExtraHelp.yml. [FONT=helvetica][SIZE=5][B]Plugin Support[/B][/SIZE][/FONT] 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... [SIZE=5][FONT=helvetica][B]Custom ExtraHelp/[/B][/FONT][/SIZE] 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 [U][I][B]need[/B][/I][/U] 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 [/CODE] [B][SIZE=5][FONT=helvetica]How To Hook into Help.[/FONT][/SIZE][/B] 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 [URL='https://github.com/tkelly910/MyHome/blob/master/src/main/java/me/taylorkelly/myhome/HomeHelp.java']MyHome[/URL] and [URL='https://github.com/tkelly910/BigBrother/blob/master/src/main/java/me/taylorkelly/bigbrother/BBHelp.java']BigBrother[/URL]. [SIZE=4][FONT=helvetica][B]Help API[/B][/FONT][/SIZE] [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); [/CODE] [SIZE=4][FONT=helvetica][B]Basic Example[/B][/FONT][/SIZE] [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."); } [/CODE] [SIZE=4][FONT=helvetica][B]Slightly More Advanced Example[/B][/FONT][/SIZE] [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]); [/CODE] [FONT=helvetica][SIZE=5][B]Plugins with Help Support[/B][/SIZE][/FONT] 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+ [FONT=helvetica][SIZE=5][B]ExtraHelp Packs[/B][/SIZE][/FONT] [URL='https://github.com/FabianN/MC-Bukkit-HelpExtra']FabianN put together a repository of entries for your ExtraHelp/ that represent other plugins' commands.[/URL] It's really awesome and was helped put together by others from the community. [SIZE=5][B][FONT=helvetica]Preview[/FONT][/B][/SIZE] [IMG]http://i.imgur.com/AE9cG.jpg[/IMG] [IMG]http://i.imgur.com/cII2X.jpg[/IMG] [SIZE=5][B][FONT=helvetica]Changelog[/FONT][/B][/SIZE] [SPOILER="Changelog"] [SIZE=5][FONT=helvetica][B][URL='http://taylorkelly.me/plugins/Help/Help%20v0-2.zip'][COLOR=rgb(16, 97, 179)]Help v0.2 [531][/COLOR][/URL][/B][/FONT][/SIZE] [I]Released 15 Mar, 2011[/I] - 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. [SIZE=5][FONT=helvetica][B][URL='http://taylorkelly.me/plugins/Help/Help%20v0-1-1.zip']Help v0.1.1 [493][/URL][/B][/FONT][/SIZE] [I]Released 6 Mar, 2011[/I] - Built with latest recommend build (493) - Updated for GroupManager 1.0 [SIZE=5][FONT=helvetica][B][URL='http://taylorkelly.me/plugins/Help/Help%20v0-1.zip'][COLOR=rgb(16, 97, 179)]Help v0.1 [440][/COLOR][/URL][/B][/FONT][/SIZE] [I]Released 28 Feb, 2011[/I] - Intial Release [/SPOILER]/
     
  2. Offline

    PneumonicFungus

    I'm completely lost as to how to add or remove commands from the menu..
    My "Members" have access to admin commands..
    So, please help me. :S
     
  3. Offline

    BPCM

    You need to have Permissions installed. Then in your [worldName].yml file, edit your user groups to something like:
    Code:
    Default:
            default: true
            info:
                prefix: '&f'
                suffix: '&f'
                build: true
            inheritance:
            permissions:
                - 'myhome.home.basic.home'
    
    Under the permissions: tag are the plugin nodes that the Default group can use. So all players can use 'myHome.home.basic' commands. Now in your /plugins/Help/ExtraHelp/ folder make a relevant filename; so in this case MyHome.yml then in that file:
    Code:
    home:
        visible: true
        description: Sends you to your Home Point
        permissions:
        - myhome.home.basic.home
        command: home
        plugin: MyHome
        main: false
    See how the permissions match in both config files? It makes it easy to setup Help files that correspond to a users permissions. Permissions tell the server that users can only use the commands you put in that list, and Help will only show commands that users have the same permissions to. As long as your permissions are right, if you use the repository of 'Help' files near the bottom of OPs post, you should be OK.

    NOTE: both code blocks are just snippets, if they are run just as they are shown they are most likely to throw an error.
     
    PneumonicFungus likes this.
  4. Offline

    PneumonicFungus

    So would this work?

    Code:
    give:
        visible: true
        description: Gives an item(s) to your target
        permissions:
        - 'essentials.give'
        command: give
        plugin: Essentials
        main: false
    Also, is this how the code works?
    Code:
    give: (command that comes after "/" in-game)
        visible: true (visibility in the menu)
        description: Gives an item(s) to your target (description)
        permissions:
        - 'essentials.give' (permission posted on the thread)
        command: give (command that comes after "/" in-game)
        plugin: Essentials (exact plugin that this supports)
        main: false (?)
    And, what's "MAIN"?
     
  5. Offline

    Celtic Minstrel

    Not quite, but close. See below.

    Code:
    give: (internal name used to distinguish it from other commands)
        visible: true (visibility in the menu)
        description: Gives an item(s) to your target (description)
        permissions:
        - 'essentials.give' (permission posted on the thread)
        command: give (command that comes after "/" in-game)
        plugin: Essentials (exact plugin that this supports)
        main: false (whether it appears when you type /help with nothing after it)
     
  6. Offline

    Tim Yong

    I'm confused. Was that a response to my post or that of another individual's? What puzzles me is how to overwrite the "main page:" variable of the *_orig.yml help files.

    For example, I don't want any of the commands described in the Help_orig.yml file to be displayed on the main "/help" page. As you described, editing the *_orig.yml files won't change any thing since they are automatically recreated to server as examples. So, I copied BigBrother_orig.yml and renamed it to BigBrother.yml. Last , I changed all of the "main page:" tags to false. Alas, BigBrother commands still display on the main page.

    Thanks for making this! It truly is a life-saver due the time it saves mods from explaining every command to players. haha
     
  7. Offline

    hello2u

    I get the feeling this will mess up Essentials. Any consideration into that? Possibly request that Essentials check for this plugin and disable its help command accordingly?
     
  8. Offline

    FabianN

    I'm running Essentials and this works just fine with it. It overrides essential's help menu without issues, but that means that then you need to re-add essentials help to this plugin. But if you check the repository I have in my sig (or put on the OP) there are help files for essentials in there.
     
  9. Offline

    Celtic Minstrel

    It was not a response to anyone in particular, but a note that I edited one of my posts earlier in the thread.
     
  10. Offline

    BPCM

    I'm having the same issue. I believe it is a bug. I've even deleted the contents of FO:confused:rig.yml and set it to read only, yet they still show up on the /help list. It seems to be hard-coded into the plugin itself, so unless you change the source and recompile it, it cant be fixed... I think so at least
     
  11. Offline

    Tim Yong

    Aye. Next server restart I'm going to remove the Windows disk write permissions for Help.jar and see if I can force it to stop generating the *_orig.yml files since there's no way to alter if their commands are on the main help page.
     
  12. Offline

    dompie

    I'm having the same problem with MyHome plugin. Configuration worked flawlessly for LWC, WorldEdit and General Plugin (All Commands from WorldEdit.yml are overwriting WorldEdit_orig.yml) but somehow it does not for MyHome Plugin. My configuration for MyHome looks like this:
    Code:
    Home:
        visible: true
        description: Go home young chap!
        permissions:
        - myhome.home.basic.home
        command: help Home
        plugin: MyHome
        main: true
    
    When Typing /help the menu items '/home' and '/home set' are printed but not '/help Home' - like it worked for LWC, WorldEdit and General.
    Is this a MyHome- or Help plugin issue?

    Another question:
    I would like to disable the buildin plugin help functionality e.g. '/home help' or '/lwc' to make sure people read the text from the *.yml files - is this possible?
     
  13. Offline

    BPCM

    @dompie So far using tkellys other plugins with this one gives these types of problems. It looks like Help is using default configs rather then the ones we provide.
     
  14. Offline

    dompie

    Thanks for info.
    I also tried to remove '/help http://dev.bukkit.org/bukkit-plugins/' from main Help menu by setting 'main: false' in both, Home.yml and Home_orig.yml - but '/help [plugin]' keeps showing up. I suppose Help is using default configs too? :)/
     
  15. Offline

    Celtic Minstrel

    Unfortunately, that's the territory of the plugin itself. General for example does not show help in response to "/general help" unless it can find a corresponding file, but there's no way to disable (for example) "/time help" at this time, nor the usage notes that show up when you try to use the command incorrectly.

    If tkelly were to add a displayHelpTopic function, I would probably make "/time help" show that instead if Help is available. However, it currently doesn't. @tkelly - it'd also be nice to be able to programmatically register a command with a short "key", much like you can in the plugin.yml, rather than using the full command string as the key.
     
  16. Offline

    PneumonicFungus

    Got it figured out, and might I say.. I FUCKING LOVE YOU.
     
  17. Offline

    tkelly

    I'll look into the not-being-able-to-override-commands thing, and get a fix for that soon.

    @Celtic Minstrel : Yea, I was actually planning on adding the displayHelpTopic(String plugin) soon as well :p.
    As for the keys, the keys in the plugin.yml have no real affect on the way Help sees the commands, so I'm not sure what you're asking for with that.
     
  18. Offline

    Celtic Minstrel

    Simply that, if there's a displayHelpTopic, it's easier to refer to the command by a short name than to copy out the entire parameters string.

    Oh, and perhaps the ability to put the command in a category for plugins (like WorldEdit) that define an enormous number of commands? And then you could do "/help <plugin> categories" to see the category or "/help <plugin> <category>" for a specific category.

    Speaking of WorldEdit, @Paradox460 - I heard you were working on that? How's that coming?
     
  19. Offline

    dompie

    Thanks for response. So I'll wait and hope that more plugin developers adopt your Help system to prevent plugin messages popping up twice (e.g. LWC protection notice).
     
  20. Offline

    Celtic Minstrel

    It's not my Help system. It's tkelly's Help system.
     
  21. Offline

    jascotty2

    just thought i'd inform you of a potential fatal error i fixed (won't fork, since it's minor)
    i was getting nullPointerException at HelpLoader:22
    Code:
    for (File insideFile : helpFolder.listFiles(new YmlFilter())) {
    
    change to:
    Code:
    File files[] = helpFolder.listFiles(new YmlFilter());
    if(files==null) return;
    for (File insideFile : files) {
    
    and the problem goes away
     
  22. Offline

    tom

    Only the top 4 are on my /help menu when i have ALOT of items on the list. And there is only 1 page available. How do i add a new page?

    This is my setup.

     
  23. Offline

    alron

    Hey, just wanted to mention that I just finished adding support for this help plugin into Wormhole-X-Treme. It will show up in our next release, v0.812.

    Cheers.
     
  24. Offline

    jascotty2

    similar report here. . i added Help support with BetterShop 1.6.2+

    ok.. two more bugs.. i just might fork this after all...
    - HelpLoader should have the "if (!helpNode.containsKey("command")) {" block moved to before "String command = helpNode.get("command").toString();"
    - Lister, line 85, "player.sendMessage(entryBuilder.toString());" should be moved to inside the "if (sizeRemaining > descriptionSize) {" block

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 10, 2016
  25. Offline

    tkelly

    Yea, sorry I haven't updated this for a little while. I've been pretty busy and haven't got time. If you want to put in a pull request for that stuff @jascotty2 that'd be great; otherwise I'll just take care of those when I get a chance. Anyway, thanks for finding them! :D

    I'll also update the OP with the plugin support, thanks for that as well guys :)
     
  26. Offline

    alron

    Thanks for making a useful help plugin. :)

    Also, to note, we just released v0.812 of Wormhole-X-Treme, which has the Help plugin support. :)
     
  27. Offline

    Olof Larsson

    I have added a little support for this plugin in my plugin Factions. Since version 1.1. However there is only a help entry pointing the player to factions own help system. The reason for this is that the help contains text based information that you read like a book. Not only commands. I look forward for an update to your Help plugin when you have time :)
     
  28. Offline

    SpeedyDawg

    How would I make it so a group can access a certain help menu?
     
  29. Offline

    jascotty2

    don't know how much i'll support it, but i forked Help
    improvements so far, Version 0.2.2 :
    various null pointer fixes (could have nullpointerException on load without)
    improved help listing
    added console help support

    https://github.com/downloads/jascotty2/Help/Help.jar
     
  30. Offline

    Celtic Minstrel

    Meaning...?
    Oooh, yay!
     
  31. Offline

    jascotty2

    fixed the double-command display bug, right-aligned the second line, and changed the methods used to get the formatting to use less lines (and easier to read)
     

Share This Page