I've made a Placeholder API, help me make it better?
#1
I've been working on this for awhile, putting in bits of code when I found the time. I finally got it to a point where it feels "done". Now, I'm looking for help making it better (as well as bugtesting as I'm about to be without a way to reliably test that often). Full disclosure: I just spent hours working on finishing it and adding documentation to the files, and I'm 2 hours past when I normally head to bed, so the grammar might be weird in places.

https://github.com/Zee1234/PlaceholderAPI <- Source, as well as an example of a main.lua for a plugin that uses it. The functions are extremely commented, so I hope you can make sense of it.

Now I'm off to bed before I fall asleep in this chair. I just know that several people are on during these hours, and wanted to avoid putting this off a whole day.

Edit: Changed name, and therefore link. Making a new post describing things more in detail, although Readme.md is now packed with information.
Reply
Thanks given by:
#2
This looks good, but what exactly is it supposed to do?
Reply
Thanks given by:
#3
What does it do, and why not a less unfortunate name?
Reply
Thanks given by:
#4
It looks like an example of inter-plugin API meant for other developers.
Reply
Thanks given by:
#5
Yeah, but what kind of API, what problem does it solve? Where are the docs? Any examples? Use-cases?
Reply
Thanks given by:
#6
OK! I'm back from being unable to do stuff. And oh boy did I do a shitty job of writing documentation (while simultaneously screwing up my sleep cycle) last time!

Thanks for pointing out the... bad name. It's been renamed, therefore a new link: https://github.com/Zee1234/PlaceholderAPI

As per the purpose: It's made to handle textual placeholders. Think about NilSPace's Chatter plugin. Some "random" plugin can tell Chatter "Hey, if you get some text {MyPluginName_ThatOneThing}, then just call "ThatOneThingsFunction" in my library to get what it should be instead!". What PlaceholderAPI (ever so lovingly shortened to PAPI) does is take the weight off of plugin devs to accommodate every plugin that wants to do that separately. Instead, Plugin X can tell PAPI "I want you to replace MyPluginName_ThatOneThing with whatever I return from 'ThatOneThingsFunction'". Then, Plugin Y, having encountered a placeholder that it doesn't know, asks PAPI about it. PAPI recognizes MyPluginName_ThatOneThing, and therefore calls ThatOneThingsFunction, and returns the result to Plugin Y. This allows Plugin Y and Plugin X to be fully compatible with each other without either having to build around the other.

More detailed (AND actually good this time (I swear)) documentation can be found in the Readme on Github. There's also an example plugin that shows how you would integrate with PAPI at the end of the file.

The problem it solves? One plugin Dev having to satisfy multiple multiple other plugin's text-replacement systems. Use cases? A factions plugin and a {chat formatting plugin, boss bar plugin (can we do those yet?), scoreboard plugin, action bar plugin, title plugin (same here :/)}. It's not exactly a big problem right now, but it could be a big help when cuberite gets bigger.

Ninja edit: the help line in the placeholder registration is for later when I make a console command that creates a text/HTML/XML (possibly all three?) file that lists all placeholders you can use, allowing uses to generate their own form of documentation.
Reply
Thanks given by:




Users browsing this thread: 3 Guest(s)