Question What is the point of usage in the plugin yml

Discussion in 'Bukkit Help' started by Trumpet99, Mar 18, 2020.

Thread Status:
Not open for further replies.
  1. Offline


    If you have the usage of a command in your plugin yml(using the usage command of course), then it will be sent to the player if the onCommand returns false. This is great, because it seems like if you type a command incorrectly then it will tell you the correct syntax of that command. However, as far as I know, the onCommand is only ever run if the command you type is the same as the command in the plugin yml(so typing the incorrect command will never even enter the onCommand to send the usage), so usage will never be returned. Yes you can use it, if the command has arguments you just check if the correct amount was put in with the command. However, is there a way to have usage sent to the player if the command you type has 0 arguments(this is also of course if for when you type the command incorrectly)?
    Say you have a command /hello that sends the player a message helloWorld. Let's say in the plugin yml under usage you have "Incorrect Syntax: /hello"

    I want the usage to be sent to the player if they misspell. For example /helllo or /helloo
    You could make a plugin where its sole focus is to just send the correct command, and you can do this using
    Levenshteindistance, but if this is possible it would be much easier.
  2. Offline

    timtower Moderator Moderator

Thread Status:
Not open for further replies.

Share This Page