Package dev.majek.hexnicks.storage
Interface StorageMethod
- All Known Implementing Classes:
JsonStorage
,SqlStorage
public interface StorageMethod
Handles different storage methods.
-
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.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
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
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
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 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
-