Interface StorageMethod

All Known Implementing Classes:
JsonStorage, SqlStorage

public interface StorageMethod
Handles different storage methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    CompletableFuture<net.kyori.adventure.text.Component>
    getNick(@NotNull UUID uuid)
    Get the nickname stored for a specific unique id.
    hasNick(@NotNull UUID uuid)
    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.
    void
    removeNick(@NotNull UUID uuid)
    Remove a nickname from storage.
    void
    saveNick(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component nickname)
    Save a nickname in storage.
    default void
    Update the nickname of all online players from storage.
  • Method Details

    • hasNick

      CompletableFuture<Boolean> hasNick(@NotNull @NotNull UUID uuid)
      Check if there is a nickname stored for the provided unique id.
      Parameters:
      uuid - The unique id to check.
      Returns:
      True if nickname stored.
    • getNick

      CompletableFuture<net.kyori.adventure.text.Component> getNick(@NotNull @NotNull UUID uuid)
      Get the nickname stored for a specific unique id. hasNick(UUID) should be checked first.
      Parameters:
      uuid - The unique id to fetch.
      Returns:
      Nickname.
    • removeNick

      void removeNick(@NotNull @NotNull UUID uuid)
      Remove a nickname from storage.
      Parameters:
      uuid - The unique id the nickname is tied to.
    • saveNick

      void saveNick(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.Component nickname)
      Save a nickname in storage. This can be used to put it there initially or to update it.
      Parameters:
      player - The player whose nickname to save.
      nickname - the nickname to save
    • updateNicks

      default void updateNicks()
      Update the nickname of all online players from storage.
    • nicknameExists

      CompletableFuture<Boolean> nicknameExists(@NotNull @NotNull net.kyori.adventure.text.Component nickname, boolean strict, @NotNull @NotNull org.bukkit.entity.Player player)
      Check if a nickname is already taken by a player.
      Parameters:
      nickname - the nickname to check
      strict - whether the same names with different colors should be considered
      player - the player creating a nickname - we want to exclude them so their name doesn't count against them
      Returns:
      whether it's taken