Package dev.majek.hexnicks.storage
Class JsonStorage
java.lang.Object
dev.majek.hexnicks.storage.JsonStorage
- All Implemented Interfaces:
StorageMethod
Handles Json storage for nicknames.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<net.kyori.adventure.text.Component>Get the nickname stored for a specific unique id.Check if there is a nickname stored for the provided unique id.nicknameExists(@NotNull net.kyori.adventure.text.Component nickname, boolean strict, @NotNull org.bukkit.entity.Player player) Check if a nickname is already taken by a player.voidremoveNick(@NotNull UUID uuid) Remove a nickname from storage.voidsaveNick(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component nickname) Save a nickname in storage.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.majek.hexnicks.storage.StorageMethod
updateNicks
-
Constructor Details
-
JsonStorage
public JsonStorage()
-
-
Method Details
-
hasNick
Description copied from interface:StorageMethodCheck if there is a nickname stored for the provided unique id.- Specified by:
hasNickin interfaceStorageMethod- Parameters:
uuid- The unique id to check.- Returns:
- True if nickname stored.
-
getNick
Description copied from interface:StorageMethodGet the nickname stored for a specific unique id.StorageMethod.hasNick(UUID)should be checked first.- Specified by:
getNickin interfaceStorageMethod- Parameters:
uuid- The unique id to fetch.- Returns:
- Nickname.
-
removeNick
Description copied from interface:StorageMethodRemove a nickname from storage.- Specified by:
removeNickin interfaceStorageMethod- Parameters:
uuid- The unique id the nickname is tied to.
-
saveNick
public void saveNick(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.Component nickname) Description copied from interface:StorageMethodSave a nickname in storage. This can be used to put it there initially or to update it.- Specified by:
saveNickin interfaceStorageMethod- Parameters:
player- The player whose nickname to save.nickname- the nickname to save
-
nicknameExists
public CompletableFuture<Boolean> nicknameExists(@NotNull @NotNull net.kyori.adventure.text.Component nickname, boolean strict, @NotNull @NotNull org.bukkit.entity.Player player) Description copied from interface:StorageMethodCheck if a nickname is already taken by a player.- Specified by:
nicknameExistsin interfaceStorageMethod- Parameters:
nickname- the nickname to checkstrict- whether the same names with different colors should be consideredplayer- the player creating a nickname - we want to exclude them so their name doesn't count against them- Returns:
- whether it's taken
-