Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion - Add help on /inventoryrollback #29

Open
RWoof opened this issue Jul 21, 2020 · 2 comments
Open

Suggestion - Add help on /inventoryrollback #29

RWoof opened this issue Jul 21, 2020 · 2 comments

Comments

@RWoof
Copy link

RWoof commented Jul 21, 2020

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.

@SirKratosAurion
Copy link

+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.

@totemo
Copy link

totemo commented Dec 4, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants