public final class PlayerKey<T> extends Object
The class provides static methods to load, remove, edit, and replace keys with their corresponding values.
The class also maintains a map of default keys that can be restored at any time.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
editKey(String oldKey,
String newKey)
Edits a key-function pair by changing the key string.
|
boolean |
equals(Object o) |
static <T> boolean |
loadKey(String key,
java.util.function.Function<org.bukkit.entity.Player,T> function)
Loads a new key-function pair and stores it in the loaded keys.
|
static boolean |
removeKey(String key)
Removes a key-function pair from the loaded keys using its key.
|
static String |
replaceKeys(org.bukkit.entity.Player player,
String string)
Replaces all the occurrences of the keys in a given string with their
corresponding value functions for a given player.
|
static String |
replaceKeys(org.bukkit.entity.Player player,
String string,
boolean isSensitive)
Replaces all the occurrences of the keys in a given string with their
corresponding value functions for a given player.
|
static void |
setDefaults()
Restores the loaded keys to its default configuration.
|
String |
toString() |
public static <T> boolean loadKey(String key, java.util.function.Function<org.bukkit.entity.Player,T> function)
T - The result of the function.key - The key stringfunction - The function that returns a value of type T for a given playerpublic static boolean removeKey(String key)
key - The key stringpublic static boolean editKey(String oldKey, String newKey)
oldKey - The old key stringnewKey - The new key stringpublic static String replaceKeys(org.bukkit.entity.Player player, String string, boolean isSensitive)
player - The player to apply the function tostring - The string to replace the keys inisSensitive - A boolean flag that indicates whether the replacement
is case-sensitive or notpublic static String replaceKeys(org.bukkit.entity.Player player, String string)
player - The player to apply the function tostring - The string to replace the keys inpublic static void setDefaults()
Copyright © 2023. All rights reserved.