Minecraft API plugin for display of visual elements in the player's screen, such as text, images or interface components.
Requires the usage of the
Negative Space Resource Pack by
AmberW:
Reminder that you can include AmberW's resource pack in your own resource pack (see the link for details). You can also set a server resource pack in server.properties, or by using a plugin such as
ForceResourcePack.
For server owners:
If you are a server owner, you might want to add this plugin to your server for mainly two purposes:
Resolve conflicting action bars coming from different plugins (requires ProtocolLib)
GUI API will store the conflicting action bar texts and cycle through them, displaying them one by one at a configurable rate.

Make depending plugins work!
Through the use of GUI API, other plugins can achieve amazing visual effects, displaying information relevant to their functionality or gameplay.
For developers:
You can use GUI API as a dependency to display information and other visual elements, further customizing the looks of your plugin. Possible GUI Components include text in different places of the screen, and images added through a resource pack. You get to choose the position and order in which each individual GUI component is rendered.
This is part of a GUI I designed for my server, the reason I came up with GUI API:

To use, get a Player's GUI by calling GUIAPI.getGUIManager().getGUI(Player). Create a new GUIComponent with the text and positioning you want, and finally add it to the GUI using one of the provided methods (they're all properly documented!).
You can also create a temporary component with the class TemporaryGUIComponent.
If you need very complex operations for GUI component manipulation, I suggest you make a wrapper class for the GUI class, which contains the methods you need, and interacts internally with the GUIs.
How to figure out the needed offset for GUI components
In the config file, you can add debug GUI components, which will be displayed when enabing debug mode with the command /guiapi debug. That way you can figure out the proper layout by simple changing the config and typing /guiapi reload, instead of recompiling your code and restarting the server every time.
Adding as a dependency
You can add GUI API as a dependency of your plugin by using
Jitpack.
How does it work, exactly?:
This part is a bit technical, thus why I left it for the end.
You know how whenever text is shown in the action bar, it shows up centered, according to the total width of the text? This means that the exact position of each character depends on the total amount of text that is being displayed. This is not good when you're making a plugin for developers to add bunches of text and images to the action bar.
Here's where the Negative Spaces resource pack comes in handy. This amazing creation by AmberW means that, knowing the total width of the text, we can then insert the correct amount of negative space after it, effectively bringing the width to 0. That way, the position of the next GUI component that is added is independent on the previous ones, and you can get a working GUI!
This does mean that the exact width of the text is to be known, and thus of each character used. Since all that is calculated by the client, I had to spend a bunch of time measuring pixels and figuring out a proper interpolation equation for character scaling... you get the idea. Thankfully, all that work is already done for the most common characters (a-z, A-Z, 0-9, most, if not all punctuation symbols, and other common characters like # and @). If you find any characters that break the GUI, let me know and I'll add them! A config option for you to add other characters will be coming soon.
Also note that the measurements I made were done with the default Minecraft font textures. If you use different textures, most likely those values have changed, and you might have to measure them and adjust them yourself I'm affraid.
So in short, what this plugin does is store all the GUI components that other plugins have told it to add, calculate the exact amount of spaces that must be added before and after each component for them to total out to 0, put all of it in a single chat component, and send it to the player every certain time (or as soon as a change has been made to the GUI). And all you have to worry about is adding or removing stuff, and maybe some character width measuring!
Donations:
You can donate to my
PayPal if you want to. I'd really appreciate it!
I got the inspiration for this plugin as I needed it for my massive server proyect,
Craftec, a MMORPG Minecraft server currently in development. By donating, aside from thanking me, you'll help me finance my proyect.