How to request the user to input a number

Discussion in 'Plugin Development' started by Unprofessional, Dec 28, 2015.

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

    Unprofessional

    Could someone tell me how to the player to input a number please, i've been struggling on this for a while.
     
  2. Offline

    mug561

    Theres Multiple ways you could do this,
    You could:
    a) Let the player chat it in and listen for chat event
    b) Use an anvil gui
    c) use a command block gui

    For whichever one you use, remember that you have ti Integer.parseInt(String);

    I've used anvil gui for a similar thing before.
    Check out: https://bukkit.org/threads/class-anvilgui-use-the-anvil-gui-to-retrieve-strings.211849/ (link to an updated version in one of the comments)

    Best of luck!
     
  3. Offline

    teej107

    Use Bukkit's Conversation API. It has a NumberPrompt to listen to number input.
     
Thread Status:
Not open for further replies.

Share This Page