Class PlaceholderRegistry
java.lang.Object
com.plotsquared.core.util.placeholders.PlaceholderRegistry
Registry that contains
placeholders
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createPlaceholder
(@NonNull String key, @NonNull com.google.common.base.Function<PlotPlayer<?>, String> placeholderFunction) Create a functional placeholdervoid
createPlaceholder
(@NonNull String key, @NonNull BiFunction<PlotPlayer<?>, Plot, String> placeholderFunction) Create a functional placeholdergetPlaceholder
(@NonNull String key) Get a placeholder instance from its keyGet all placeholdersgetPlaceholderValue
(@NonNull String key, @NonNull PlotPlayer<?> player) Get the placeholder value evaluated for a player, and catch and deal with any problems occurring while doing sovoid
registerPlaceholder
(@NonNull Placeholder placeholder) Register a placeholder
-
Constructor Details
-
PlaceholderRegistry
-
-
Method Details
-
createPlaceholder
public void createPlaceholder(@NonNull String key, @NonNull com.google.common.base.Function<PlotPlayer<?>, String> placeholderFunction) Create a functional placeholder- Parameters:
key
- Placeholder keyplaceholderFunction
- Placeholder generator. Cannot return null
-
createPlaceholder
public void createPlaceholder(@NonNull String key, @NonNull BiFunction<PlotPlayer<?>, Plot, String> placeholderFunction) Create a functional placeholder- Parameters:
key
- Placeholder keyplaceholderFunction
- Placeholder generator. Cannot return null
-
registerPlaceholder
Register a placeholder- Parameters:
placeholder
- Placeholder instance
-
getPlaceholder
Get a placeholder instance from its key- Parameters:
key
- Placeholder key- Returns:
- Placeholder value
-
getPlaceholderValue
Get the placeholder value evaluated for a player, and catch and deal with any problems occurring while doing so- Parameters:
key
- Placeholder keyplayer
- Player to evaluate for- Returns:
- Replacement value
-
getPlaceholders
Get all placeholders- Returns:
- Unmodifiable collection of placeholders
-