Package nl.minetopiasdb.api.playerdata
Class ColorManager
java.lang.Object
nl.minetopiasdb.api.playerdata.ColorManager
Class for handling levelcolor, prefixcolor and chatcolor.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Give a player access to a chatcolor.Give a player access to a chatcolor.void
Give a player access to multiple chatcolors at once.Give a player access to multiple chatcolors at once.Get a list of the colors for the given player and colortypegetColorsWithExpiration
(UUID uuid, ColorType type) Get a HashMap containing colors and their expiration datestatic ColorManager
Get the instance of ColorHandler.void
removeColor
(UUID uuid, String color, ColorType type) Revoke a player his access to a chatcolor.removeColor
(UUID uuid, ColorType type, String color) Revoke a player his access to a chatcolor.void
removeFromCache
(UUID uuid, ColorType type) Remove given UUID from the color cache.void
Remove all the chatcolors a player has.void
Swap all colors from a specific colortype from uuid a and uuid b
-
Constructor Details
-
ColorManager
public ColorManager()
-
-
Method Details
-
getInstance
Get the instance of ColorHandler.- Returns:
- instance of ColorHandler.
-
getColors
Get a list of the colors for the given player and colortype- Parameters:
uuid
- UUID of the playertype
- colortype- Returns:
- List of colors (with the starting '&' char)
-
getColorsWithExpiration
Get a HashMap containing colors and their expiration date- Parameters:
uuid
- UUID of the playertype
- colortype- Returns:
- HashMap of colors (with the starting '&' char) and their expiration date in milliseconds since epoch
-
removeFromCache
Remove given UUID from the color cache.- Parameters:
uuid
- UUID of the playertype
- colortype
-
addColor
Give a player access to a chatcolor. The SQL statement happens asynchronously.- Parameters:
uuid
- UUID of the playercolor
- chatcolor that player needs access to (has to start with &)type
- colortype
-
addColor
public CompletableFuture<Boolean> addColor(UUID uuid, ColorType type, String color, Long expiration) Give a player access to a chatcolor. The SQL statement happens asynchronously.- Parameters:
uuid
- UUID of the playertype
- colortypecolor
- chatcolor that player needs access to (has to start with &)expiration
- moment of expiration, null when this color doesn't expire- Returns:
- CompletableFuture containing a boolean that is true when adding the color was succesful
-
addColors
Give a player access to multiple chatcolors at once. The SQL statement happens asynchronously.- Parameters:
uuid
- UUID of the playercolors
- chatcolors that player needs access to (has to start with &)type
- colortype
-
addColors
Give a player access to multiple chatcolors at once. The SQL statement happens asynchronously.- Parameters:
uuid
- UUID of the playertype
- colortypecolors
- Map containing chatcolors that player needs access to (has to start with &). The Map value (Long) represents expiry. A value ofnull
or-1
will be seen as never expiring.- Returns:
- sum of all inserted row IDs
-
removeColor
Revoke a player his access to a chatcolor.- Parameters:
uuid
- UUID of the player.color
- chatcolor that gets revoked from given player (has to start with &)type
- colortype- Returns:
- true if removal was successful
-
removeColor
Revoke a player his access to a chatcolor. The SQL statement happens asynchronously.- Parameters:
uuid
- UUID of the player.color
- chatcolor that gets revoked from given player (has to start with &)type
- colortype
-
reset
Remove all the chatcolors a player has.- Parameters:
uuid
- UUID of the player.type
- colortype
-
swap
Swap all colors from a specific colortype from uuid a and uuid b- Parameters:
a
- First UUIDb
- Second UUIDtype
- colortype
-