PlaceholderProvider¶
Abstract class that is used to provide your own Placeholder patterns for AdvancedServerList to parse.
In order for your class to be considered a valid PlaceholderProvider will you need to set the identifier to a non-null, non-empty value without having any spaces in it.
Once set, use AdvancedServerListAPI#addPlaceholderProvider(PlaceholderProvider) to register your class for AdvancedServerList to use.
Constructor Summary¶
| Constructor | Description |
|---|---|
PlaceholderProvider(String) |
Constructor used to set the identifier for the class extending the PlaceholderProvider class itself. |
Method Summary¶
| Modifier and Type | Method | Description |
|---|---|---|
nullable abstract String |
parsePlaceholder(String, GenericPlayer, GenericServer) |
Method called by AdvancedServerList's StringReplacer class to replace any appearances of ${<identifier> <placeholder>} with whatever value a matching PlaceholderProvider may return. |
String |
getIdentifier() |
Returns the identifier used by this PlaceholderProvider instance. |
Constructor Details¶
PlaceholderProvider(String)¶
Constructor used to set the identifier for the class extending the PlaceholderProvider class itself.
Parameters:¶
String: identifier- The identifier to use for the placeholder. Cannot be empty.
Method Details¶
String parsePlaceholder(String, GenericPlayer, GenericServer)¶
Method called by AdvancedServerList's StringReplacer class to replace any appearances of ${<identifier> <placeholder>} with whatever value a matching PlaceholderProvider may return.
Returning null will be treated as an invalid placeholder by the plugin, making it return the placeholder as-is without any changes.
Parameters:¶
-
String: placeholder- The part of the Placeholder that comes after the identifier and before the closing curly bracket. -
GenericPlayer: player- TheGenericPlayerinstance used. -
GenericServer: server- TheGenericServerinstance used.
Returns:¶
Possibly-parsed or possibly-null String to replace the placeholder with.