Class PlaceholderApiBridge
java.lang.Object
dev.crafty.core.bridge.placeholders.placeholderapi.PlaceholderApiBridge
- All Implemented Interfaces:
Bridge
,PlaceholderBridge
- Since:
- 1.0.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if this bridge can be registered.getName()
Returns the unique name of this bridge instance.void
registerPlaceholder
(String identifier, BiFunction<org.bukkit.entity.Player, String, String> replacer) Registers a new placeholder with the given identifier and replacement function.replacePlaceholders
(String input) Replaces all registered placeholders in the given input string with their corresponding values.replacePlaceholders
(String input, org.bukkit.entity.Player player) Replaces all registered placeholders in the given input string with their corresponding values, using the providedPlayer
context for player-specific placeholders.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.crafty.core.bridge.Bridge
pluginEnabled
Methods inherited from interface dev.crafty.core.bridge.placeholders.PlaceholderBridge
bridgeName
-
Constructor Details
-
PlaceholderApiBridge
public PlaceholderApiBridge()
-
-
Method Details
-
registerPlaceholder
public void registerPlaceholder(String identifier, BiFunction<org.bukkit.entity.Player, String, String> replacer) Description copied from interface:PlaceholderBridge
Registers a new placeholder with the given identifier and replacement function.- Specified by:
registerPlaceholder
in interfacePlaceholderBridge
- Parameters:
identifier
- the unique identifier for the placeholder (e.g., "player_name")replacer
- a function that takes the input string and returns the replacement value
-
replacePlaceholders
Description copied from interface:PlaceholderBridge
Replaces all registered placeholders in the given input string with their corresponding values.- Specified by:
replacePlaceholders
in interfacePlaceholderBridge
- Parameters:
input
- the input string containing placeholders to be replaced- Returns:
- the input string with all placeholders replaced
-
replacePlaceholders
Description copied from interface:PlaceholderBridge
Replaces all registered placeholders in the given input string with their corresponding values, using the providedPlayer
context for player-specific placeholders.- Specified by:
replacePlaceholders
in interfacePlaceholderBridge
- Parameters:
input
- the input string containing placeholders to be replacedplayer
- the player whose context should be used for placeholder replacement- Returns:
- the input string with all placeholders replaced, using player context where applicable
-
getName
Description copied from interface:Bridge
Returns the unique name of this bridge instance. -
canRegister
public boolean canRegister()Description copied from interface:Bridge
Checks if this bridge can be registered.- Specified by:
canRegister
in interfaceBridge
- Returns:
- true if the bridge can be registered, false otherwise
-