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

Convenience methods for one-player GUIs #20

Open
SomeSourceCode opened this issue May 22, 2024 · 1 comment
Open

Convenience methods for one-player GUIs #20

SomeSourceCode opened this issue May 22, 2024 · 1 comment
Labels
type: enhancement New feature or request

Comments

@SomeSourceCode
Copy link
Owner

Description

Sometimes, GUIs are only meant to be used by one player. However, since the API is designed to work with multiple players, it can be cumbersome when you know beforehand that only one player should see the GUI at a time.

This could be accomplished by adding convenience methods, like Gui#getViewer() which would return the first viewer in the viewers list (equivalent to gui.getViewers().get(0)).

Another idea is to introduce a ViewerPolicy, such as EVERYONE (the default), FIRST_ONLY (only the first to open it), SINGLE (when a new viewer is added, the old one gets removed).

Challenges

  • Handling changes of the ViewerPolicy (e.g. switching from EVERYONE to SINGLE)
@SomeSourceCode SomeSourceCode added the type: enhancement New feature or request label May 22, 2024
SomeSourceCode added a commit that referenced this issue May 28, 2024
@SomeSourceCode
Copy link
Owner Author

Current Status

A Gui#getViewer() method was implemented and will be available as of version 2.1.0.

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

No branches or pull requests

1 participant