Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] getPlayerInput function #213

Open
lrmtheboss opened this issue Jan 22, 2022 · 4 comments
Open

[Request] getPlayerInput function #213

lrmtheboss opened this issue Jan 22, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@lrmtheboss
Copy link

Add a function to have the player give input by typing it into the chat box when requested and then set a slot metaData value when input is gotten, for use in later functions

GUI function example

functions:
  - "getPlayerInput: (metaData to store input into), (description of input required)"
  or
    # this case the function would handle input validation which would be best as
    #    otherwise we would need another function to check/validate data
  - "getPlayerInput: (metaData to store input into), (input validation), (description of input required)"

For input validation could do int(<10), int(>5), int(5<10), String(maybe regex check) or use condition function for validation

The 'getPlayerInput' function when called should send a message to the player to let the player know that they need to give input and a description of what type of input is required (description of input required). Then it should close the GUI and wait for input for a set amount of time. If no input is gotten within the set amount of time it should send an error message to the player that no input was given (maybe reopen the previous GUI) and cancel the execution of the remaining functions in that slot

@virustotalop
Copy link
Member

@lrmtheboss Technically would be possible but there isn't a way to open the player's chat afaik. I would probably prefer implementing anvil or sign guis but I would need a way to do this cross platform in the future which shouldn't be too hard if I just maintain libraries per version and platform.

@virustotalop virustotalop added the enhancement New feature or request label Jan 22, 2022
@lrmtheboss
Copy link
Author

For the bukkit implementation I was thinking could use the chat event and watch for messages from that player that way, once you got a message from them you would also want to cancel that event so no other plugins pick up on it and it does not get sent in chat.

You could just register the event when you needed to get input and unregister it once you have gotten some input or the set time has run out.

An Anvil GUI for input would be much better than relying on the chat event as I mentioned above

@virustotalop
Copy link
Member

Yea I'm probably just going to implement anvil guis. Should be done in 5.0.0 which will make api breaking changes but gui files will still stay the same.

@lrmtheboss
Copy link
Author

@virustotalop great, can't wait for 5.0.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants