File tree Expand file tree Collapse file tree
src/main/java/org/modernbeta/admintoolbox
integration/placeholderapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212import org .modernbeta .admintoolbox .commands .*;
1313import org .modernbeta .admintoolbox .integration .BlueMapIntegration ;
1414import org .modernbeta .admintoolbox .integration .luckperms .LuckPermsIntegration ;
15+ import org .modernbeta .admintoolbox .integration .placeholderapi .PlaceholderAPIIntegration ;
1516import org .modernbeta .admintoolbox .managers .FreezeManager ;
1617import org .modernbeta .admintoolbox .managers .admin .AdminManager ;
1718
@@ -36,6 +37,7 @@ public class AdminToolboxPlugin extends JavaPlugin {
3637
3738 private @ Nullable BlueMapIntegration blueMapIntegration = null ;
3839 private @ Nullable LuckPermsIntegration luckPermsIntegration = null ;
40+ private @ Nullable PlaceholderAPIIntegration placeholderAPIIntegration = null ;
3941
4042 private static final String ADMIN_STATE_CONFIG_FILENAME = "admin-state.yml" ;
4143
@@ -94,6 +96,13 @@ public void onEnable() {
9496 getLogger ().warning ("BlueMap API not found! Some features will be unavailable." );
9597 }
9698
99+ try {
100+ this .placeholderAPIIntegration = new PlaceholderAPIIntegration (this );
101+ this .placeholderAPIIntegration .registerPlaceholders ();
102+ } catch (NoClassDefFoundError e ) {
103+ getLogger ().warning ("PlaceholderAPI is not available! Some features will be unavailable." );
104+ }
105+
97106 if (getConfig ().getBoolean ("enable-stats" )) {
98107 getLogger ().info ("Enabling bStats for plugin statistics." );
99108 // bStats - plugin analytics
Original file line number Diff line number Diff line change 11package org .modernbeta .admintoolbox .integration .placeholderapi ;
22
3+ import me .clip .placeholderapi .PlaceholderAPI ;
4+ import org .modernbeta .admintoolbox .AdminToolboxPlugin ;
5+ import org .modernbeta .admintoolbox .integration .placeholderapi .expansion .StreamerModePlaceholder ;
6+
37public class PlaceholderAPIIntegration {
8+ private final AdminToolboxPlugin plugin ;
9+
10+ private final StreamerModePlaceholder streamerModePlaceholder ;
11+
12+ public PlaceholderAPIIntegration (AdminToolboxPlugin plugin ) {
13+ this .plugin = plugin ;
14+ this .streamerModePlaceholder = new StreamerModePlaceholder (plugin );
15+ }
16+
17+ public boolean registerPlaceholders () {
18+ return this .streamerModePlaceholder .register ();
19+ }
420}
Original file line number Diff line number Diff line change 1+ package org .modernbeta .admintoolbox .integration .placeholderapi .expansion ;
2+
3+ import me .clip .placeholderapi .expansion .PlaceholderExpansion ;
4+ import me .clip .placeholderapi .expansion .Relational ;
5+ import org .bukkit .entity .Player ;
6+ import org .jetbrains .annotations .NotNull ;
7+ import org .modernbeta .admintoolbox .AdminToolboxPlugin ;
8+
9+ import javax .annotation .Nullable ;
10+
11+ public class StreamerModePlaceholder extends PlaceholderExpansion implements Relational {
12+ private final AdminToolboxPlugin plugin ;
13+
14+ public StreamerModePlaceholder (AdminToolboxPlugin plugin ) {
15+ this .plugin = plugin ;
16+ }
17+
18+ @ Override
19+ public @ NotNull String getIdentifier () {
20+ return "streamermode" ;
21+ }
22+
23+ @ SuppressWarnings ("UnstableApiUsage" )
24+ @ Override
25+ public @ NotNull String getAuthor () {
26+ return String .join (", " , plugin .getPluginMeta ().getAuthors ());
27+ }
28+
29+ @ SuppressWarnings ("UnstableApiUsage" )
30+ @ Override
31+ public @ NotNull String getVersion () {
32+ return plugin .getPluginMeta ().getVersion ();
33+ }
34+
35+ @ Override
36+ public boolean persist () {
37+ return true ;
38+ }
39+
40+ @ Override
41+ public @ Nullable String onPlaceholderRequest (Player viewer , Player wearer , String identifier ) {
42+ return null ;
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments