SomeSourceCode / SomeGuiApi

A Paper API to create interactable GUIs using Minecraft Inventories, ...
MIT License
0 stars 0 forks source link

Convenience methods for one-player GUIs #20

Open SomeSourceCode opened 1 month ago

SomeSourceCode commented 1 month ago

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

SomeSourceCode commented 2 weeks ago

Current Status

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