Resource Read Player Input

Discussion in 'Spigot Plugin Development' started by JoseGamer_PT, Jan 28, 2020.

  1. Hi there! I made a simple class to read user input in the chat whenever you want. This class contains cancel and run methods.
    This was tested under the Spigot 1.14.4 server version and is working perfectly.
    Any suggestions are welcome!

    You can see the code here:
    https://gist.github.com/JoseGamerPT/be069fcbeb222103f2d30e9324d2f1d4

    How to use:
    Code (Text):

    new PlayerInput(player, new InputRunnable() {
    public void run(String input) {
    String retrieve = input; //this is the input that the player typed in the chat
    }
    }, new InputRunnable() {
    @Override
    public void run(String input) {
    //this part of the code only runs when the player types "cancel" in the chat.
    }
    });
     
     
  2. I'm not that experienced when it comes to Spigot 1.14.4, but I remember in Spigot 1.13 there was a Conversation class provided from Spigot to make such things extremely easier with input validation, cancellation and many more features?