mobarena / MobArenaStats

An extension plugin for MobArena that collects arena session stats.
GNU General Public License v3.0
3 stars 2 forks source link

Add PlaceholderAPI integration #5

Closed garbagemule closed 2 years ago

garbagemule commented 3 years ago

Commands are fairly limited in scope, usability, and discoverability. They are far from the only possible medium for conveying stats (signs, scoreboards, "holograms", etc.), so it makes sense to broaden the feature space. Third-party plugins that specialize in some or all of these media are obvious integration points, but it would require significant effort to add support for all of them directly.

Similar to how Vault has become the de facto standard way for economy plugins to expose themselves to other plugins, PlaceholderAPI appears to be the de facto standard way for plugins to expose runtime-resolvable variables to other plugins. As such, hooking into PlaceholderAPI would indirectly add support for many different media via third-party plugins.

Note: PlaceholderAPI is a blocking API, which means the plugin must resolve its registered placeholders whenever it is asked to do so. There is no way to "guarantee" that placeholders are resolved off the main thread (that depends entirely on the plugin that asks for a value), so this integration might benefit greatly from #4.

Nesseley commented 3 years ago

Example placeholders:

Global:

%mobarenastats_global_sessions% 
%mobarenastats_global_duration% 
%mobarenastats_global_kills% 
%mobarenastats_global_waves% 

Defined Arenas

%mobarenastats_<arena>_higest_wave% 
%mobarenastats_<arena>_longest_duration% 
%mobarenastats_<arena>_most_kills% 
%mobarenastats_<arena>_total_sessions% 
%mobarenastats_<arena>_total_duration% 
%mobarenastats_<arena>_kills% 
%mobarenastats_<arena>_waves% 

some people probably also want

%mobarenastats_<player>_x%
garbagemule commented 3 years ago

PlaceholderAPI integration now has its own extension (kindly started by Maroon28 himself!), so we've decided to try to make that extension add placeholders for MobArenaStats as well. From a server owner standpoint, that means adding MobArenaPlaceholders to their plugin collection will enable placeholders for all official/verified MobArena extensions. This should also allow us to more consistently choose placeholder names, because it will all be collected in one spot.

The dependency tree will look like this (this took me much longer than I care to admit):

                 _______      
 __________     |       |     ______________
|          |<---| Stats |<---|              |
| MobArena |    |_______|    | Placeholders |
|__________|<----------------|______________|

I'll leave the issue open and close it once the MobArenaPlaceholders project has taken roots and has a stable release with MobArenaStats placeholders firmly in place.

garbagemule commented 2 years ago

MobArenaPlaceholders now has an official release, so we can close this :)