Inventory-Rollback icon indicating copy to clipboard operation
Inventory-Rollback copied to clipboard

Suggestion - Add help on /inventoryrollback

Open RWoof opened this issue 5 years ago • 2 comments

Hi, I'm running a Paper 1.16.1 server with EssentialsX, when I installed the plugin at first and added the permissions using LuckPerms, the help for the plugin automatically appears in Essentials /help. However, this is limited to only the /inventoryrestore command which does nothing without the proper syntax. For now, I've added an alias to /inventoryrestore that shows the player a customtext (again from EssentialsX) with the following:

&c/ir restore &6 - Open a GUI showing restore data for the user you specify, you can perform a rollback from here.

&c/ir forcebackup &6 - Force the immediate creation of a backup for a particular user.

I think this would be helpful for new users of the plugin or in case you forget the commands later on.

RWoof avatar Jul 21 '20 03:07 RWoof

+1 to this. I keep having to open the spigot page just to use the damn plugin. Please setup a proper help menu and tab-complete options.

Boastful1353 avatar Sep 14 '20 00:09 Boastful1353

@danjono This is actually very easy to do. If you return false from onCommand(), Bukkit/Spigot/PaperSpigot will automatically generate help text from the contents of plugin.yml. So for the usage: of the /inventoryrollback command in plugin.yml write:

    usage: |
    
      §e/<command> help§f - Show usage help.
      §e/<command> restore <player-name>§f - Open a GUI showing restore data for the user you specify, you can perform a rollback from here.
      §e/<command> forcebackup <player-name>§f - Force the immediate creation of a backup for a particular user.

The extra blank line after usage: is helpful for formatting (I forget the exact details).

And at the top of your onCommand() method, add:

        if (args.length == 0 || (args.length == 1 && args[0].equalsIgnoreCase("help"))) {
            return false;
        }

That will list all options described in plugin.yml if the command is run without arguments, or with the help argument.

I might add that currently, the command doesn't show any kind of error message if an invalid subcommand argument is passed to it. A default case in onCommand() that shows an error message and suggests the user runs /inventoryrollback help would be helpful.

totemo avatar Dec 04 '20 06:12 totemo