Class GlobalPlaceholderEngine
java.lang.Object
ml.karmaconfigs.api.common.utils.placeholder.util.PlaceholderEngine
ml.karmaconfigs.api.common.utils.placeholder.GlobalPlaceholderEngine
Global KarmaAPI placeholder engine
-
Constructor Summary
ConstructorsConstructorDescriptionGlobalPlaceholderEngine(KarmaSource owner)Initialize the global placeholder engine -
Method Summary
Modifier and TypeMethodDescription<T> voidforceRegister(Placeholder<T>... placeholders)Force placeholder registrationsSet<Placeholder<?>>getKeys()Get all the placeholders registered to this engine<T> @Nullable Placeholder<T>getPlaceholder(String key)Get a placeholderString[]Parse a messageParse a messageParse a messagevoidprotect()Protect the placeholder engine against already added placeholder modifications<T> voidregister(Placeholder<T>... placeholders)Register more placeholdersvoidregisterUnsafe(Placeholder<?>... placeholders)Register placeholders indiscriminatelyvoidsetCloseIdentifier(char identifier)Set the placeholder close identifiervoidsetOpenIdentifier(char identifier)Set the placeholder open identifiervoidunregister(String... placeholders)Unregister placeholders<T> voidunregister(Placeholder<T>... placeholders)Unregister placeholdersMethods inherited from class ml.karmaconfigs.api.common.utils.placeholder.util.PlaceholderEngine
toString
-
Constructor Details
-
GlobalPlaceholderEngine
Initialize the global placeholder engine- Parameters:
owner- the placeholder owner
-
-
Method Details
-
setOpenIdentifier
public void setOpenIdentifier(char identifier)Set the placeholder open identifier- Specified by:
setOpenIdentifierin classPlaceholderEngine- Parameters:
identifier- the placeholder identifier character
-
setCloseIdentifier
public void setCloseIdentifier(char identifier)Set the placeholder close identifier- Specified by:
setCloseIdentifierin classPlaceholderEngine- Parameters:
identifier- the placeholder identifier character
-
protect
public void protect()Protect the placeholder engine against already added placeholder modifications- Specified by:
protectin classPlaceholderEngine
-
register
Register more placeholders- Specified by:
registerin classPlaceholderEngine- Type Parameters:
T- the placeholder type- Parameters:
placeholders- the placeholders to register
-
registerUnsafe
@Unstable(reason="The normal register method should be used instead as this method may register non desired placeholders") public void registerUnsafe(Placeholder<?>... placeholders)Register placeholders indiscriminately- Specified by:
registerUnsafein classPlaceholderEngine- Parameters:
placeholders- the placeholders to register
-
forceRegister
@SafeVarargs @Unstable(reason="Using this method may register null placeholders which can cause more issues in the future") public final <T> void forceRegister(Placeholder<T>... placeholders)Force placeholder registrations- Specified by:
forceRegisterin classPlaceholderEngine- Type Parameters:
T- the placeholder type- Parameters:
placeholders- the placeholders to register
-
unregister
Unregister placeholders- Specified by:
unregisterin classPlaceholderEngine- Parameters:
placeholders- the placeholders to unregister
-
unregister
Unregister placeholders- Specified by:
unregisterin classPlaceholderEngine- Type Parameters:
T- the placeholder type- Parameters:
placeholders- the placeholders to unregister
-
getPlaceholder
@Unstable(reason="Return method may differ from stored method") @Nullable public <T> @Nullable Placeholder<T> getPlaceholder(String key)Get a placeholder- Specified by:
getPlaceholderin classPlaceholderEngine- Type Parameters:
T- the placeholder type- Parameters:
key- the placeholder identifier- Returns:
- the placeholder
-
parse
Parse a message- Specified by:
parsein classPlaceholderEngine- Parameters:
message- the messagecontainers- the placeholder containers- Returns:
- the parsed message
-
parse
Parse a message- Specified by:
parsein classPlaceholderEngine- Parameters:
message- the messagecontainers- the placeholder containers- Returns:
- the parsed message
-
parse
Parse a message- Specified by:
parsein classPlaceholderEngine- Parameters:
message- the messagecontainers- the placeholder containers- Returns:
- the parsed message
-
getKeys
Get all the placeholders registered to this engine- Specified by:
getKeysin classPlaceholderEngine- Returns:
- the placeholder keys
-