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

Player pressed ESC while in menu. #9

Closed
siemlohuis opened this issue Aug 27, 2017 · 3 comments
Closed

Player pressed ESC while in menu. #9

siemlohuis opened this issue Aug 27, 2017 · 3 comments

Comments

@siemlohuis
Copy link

Dear WesJD,

Is it possible to run some code when the player 'cancels' the renaming them selves?
I can't figure it out because the InventoryCloseEvent is always fired, no mater if the AnvilGUI did 'player.closeInventory()' or the if the player cancels it him/her self...

Thank you,
Siem

@WesJD
Copy link
Owner

WesJD commented Aug 27, 2017

Why do you need to detect this? I'm not sure if it's possible.

@siemlohuis
Copy link
Author

Thanks for your response!
I need this because I have the AnvilGUI come up when placing a block(beacon) and the player is then prompted to give a name for it, but when they press esc I want to cancel the block from placing...

@WesJD
Copy link
Owner

WesJD commented Aug 27, 2017

Then you shouldn't place the block if they close the inventory (InventoryCloseEvent). You should only place the block in the BiFunction of when the user inputs a value, rather than placing it before and removing on pressing the esc key.

@WesJD WesJD closed this as completed Aug 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants