Solved Creating a text input

Discussion in 'Plugin Development' started by Tim_M, Sep 17, 2020.

  1. Offline

    Tim_M

    So, my problem is pretty easy. I need the player to enter a string, (a password system) and check if it macthes. I know that I could have the player write it in chat, but entering it in a GUI would be way cooler to be honest. I tried with anvils, with no success. Now Im trying with signs. Im successfully able to send packets of PlayOutOpenSignEditor, which brings up a menu that the player can type in. Howeveer, when trying to make it impossible to write on certain lines, I noticed that it wasnt firing SignChangeEvent (the eventclass is registered, all other events in it work, also yes i have a @EventHandler in from of the void). It seems like sending packets wont be solution. Does anyone know how to get a string input from a player using anvils on signs? (Also I dont want to use protocolLib thank you.)

    Thanks for any answers :p
     
  2. Offline

    gochi9

    See if this helps: link
     
  3. Offline

    Tim_M

    Thanks, but as I said that I would like to avoid protocolLib
     
  4. Offline

    timtower Moderator Moderator

    Why though? Make everything a lot easier, no need to update for every minecraft version.
     
  5. Offline

    Kars

    Why not just have them place it on a sign and then catch the input from the event? and cancel the placement of the sign..
     
  6. Offline

    Tim_M

    That's a good idea, but how would I bring the sign edit screen up?

    Edit: oops I misread, is there any way to automatically open a sign GUI of an existing sign?
     
  7. Offline

    KarimAKL

    @Tim_M
    1. SignChangeEvent is called when you click "done" in a sign GUI.
    2. I don't believe Bukkit events are called when you send a packet.
    3. If you don't want to place a sign in the world, you'll have to use packets.
    4. ProtocolLib makes sending and listening for the packets much easier, especially the listening part.
     
  8. Offline

    Tim_M

    So basically, I HAVE to use protocolLib...
     
  9. Offline

    KarimAKL

    @Tim_M You don't HAVE to, but there's really no reason not to.
     
  10. Offline

    gochi9

    @Tim_M
    Well you would have much more work to do if you didn't so it's the worst idea.Also you this is the example to the post i gave you earlier link. Looking through it i think it should work just fine but you shouldn't just copy and paste and actually try to learn from it
     
  11. Offline

    Tim_M

    Ok, I guess it's time learn how to use protocolLib

    Marking solved...

    Edit: Actually it's not solved. The link you gave seems to have outtaded code, as it gives errors about incorrect arguments.

    Edit 2:nvm I'll open a new thread about a new issue
     
    Last edited: Sep 19, 2020

Share This Page