Solved How to show expected arguments for a command

Discussion in 'Plugin Development' started by BeKoolMan, Oct 3, 2019.

  1. Offline

    BeKoolMan

    Hi everyone,

    I am developping a Minecraft plugin to manage a battle royal game (like fortnite) and to do that, I use some commands.

    Typically, I use a command to configure a game style. With this command, it is possible to set the initial border diameter, the final border diameter, the time after which the border will move from its initial diameter to its final diameter. There are more possibilities but it is not the goal of this topic.

    So, for my command, here is the way I do to use my command :

    /hg initialborderdiameter <initialdiameter>
    /hg finalborderdiameter <finaldiameter>
    /hg gametime <hh:mm:ss>
    etc...

    Now here is my question : I want to show on player's screen which arguments are expected (initialborderdiameter, finalborderdiameter, gametime etc...) when the player write "/hg ".
    I read a lot on forum, and I thought that I could specify those arguments in the plugin.yml in the tag "usage" but it does not really work (only when the commandexecutor return false).

    I just want to have the same behavior as the command team for example. When a user write "/team " minecraft propose some arguments like "add join modify remove". I want to do exactly the same.

    Does anyone have an idea ? I join my plugin.yml if it help :)

    Thanks :)

    PS: My source code is available at my github account : github.com/Pierre-Emmanuel41
     

    Attached Files:

  2. Offline

    timtower Moderator Moderator

    @BeKoolMan That would be the usage.
    And if you just receive /hg then you can also send your own message.
    A tab complete is also a nice option.
     
  3. Offline

    BeKoolMan

    Yeah, I can send message, this is the way I currently do but it is not very beautiful.
    When the player write wrong arguments, the plugin send him a message with all arguments possibilities but it is not the way I want to show them..
     
  4. Offline

    timtower Moderator Moderator

    You can also just send the next argument that they are missing.
     
  5. Offline

    BeKoolMan

    Yeah, I did not think about that ^^
    But if the player write "/hg initialborderdiamter", he forgot one letter.. I cant send him the next argument that is missing, and a tab complete is a better option for me :/ how it is possible to do that ?
     
  6. Offline

    timtower Moderator Moderator

  7. Offline

    BeKoolMan

    Oh ! Thank you so much ! It was what I'm looking for !

    Have a good day :D

    How I can do to set this topic solved ?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  8. Offline

    timtower Moderator Moderator

    Marked as solved for you ;)
    But you can do that in the
     

Share This Page