Class ColorManager
java.lang.Object
nl.minetopiasdb.api.playerdata.ColorManager
Class for handling levelcolor, prefixcolor and chatcolor.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidGive a player access to a chatcolor.Give a player access to a chatcolor.voidGive 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 ColorManagerGet the instance of ColorHandler.voidremoveColor(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.voidremoveFromCache(UUID uuid, ColorType type) Remove given UUID from the color cache.voidRemove all the chatcolors a player has.voidSwap 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
-
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
-
addColor
-
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
-
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 ofnullor-1will 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.type- colortypecolor- chatcolor that gets revoked from given player (has to start with &)- Returns:
- true if removal was successful
-
removeColor
-
reset
-
swap
-