Skip to content

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
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 Detail

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 Detail

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 - The GenericPlayer instance used.
  • GenericServer: server - The GenericServer instance used.

Returns:

Possibly-parsed or possibly-null String to replace the placeholder with.

String getIdentifier()

Returns the identifier used by this PlaceholderProvider instance.

Returns:

String representing the identifier of this PlaceholderProvider instance.