Contents
Class Ban
java.lang.Object
com.hypixel.hytale.server.core.modules.accesscontrol.ban.Ban
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<Ban> The codec used to parseBaninstances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBy()<T> TgetMetadata(KeyedCodec<T> keyedCodec) Reads one value of the data that plugins keep on the ban.<T> TgetMetadata(String key, Codec<T> codec) Reads one value of the data that plugins keep on the ban.boolean<T> BanwithMetadata(KeyedCodec<T> keyedCodec, T data) Returns a copy of the ban carrying one more value of the data that plugins keep on it.<T> BanwithMetadata(String key, Codec<T> codec, T data)
-
Field Details
-
CODEC
The codec used to parseBaninstances.
-
-
Constructor Details
-
Ban
public Ban(@Nonnull UUID target, @Nonnull UUID by, @Nonnull Instant timestamp, @Nullable Instant expiresOn, @Nullable String reason) Default Constructor for aBaninstance.- Parameters:
target- the player the ban applies toby- the player who issued the bantimestamp- when the ban was issuedexpiresOn- when the ban runs out, ornullfor a ban that never doesreason- why the ban was issued, ornullto give no reason
-
-
Method Details
-
getTarget
- Returns:
- the player the ban applies to
-
getBy
- Returns:
- the player who issued the ban
-
getTimestamp
- Returns:
- when the ban was issued
-
getExpiresOn
- Returns:
- when the ban runs out, or
nullfor a ban that never does
-
getReason
- Returns:
- why the ban was issued, or
nullif it gives no reason
-
getMetadata
Reads one value of the data that plugins keep on the ban.- Parameters:
keyedCodec- the key the value is stored under and the codec that reads it- Returns:
- the value, or
nullif the ban carries none under that key
-
getMetadata
-
withMetadata
Returns a copy of the ban carrying one more value of the data that plugins keep on it. Add the copy to store it, because a ban a provider already holds does not take a change.Anything stored is written with the ban and read back with it, including on a server that no longer runs the plugin that wrote it. Every plugin shares this data, so name the key after your plugin. A
KeyedCodectakes only the key format the codecs use, so pass the key and the codec towithMetadata(String, Codec, Object)to name one of your own.- Parameters:
keyedCodec- the key to store the value under and the codec that writes itdata- the value to store, ornullto leave the key out- Returns:
- a copy of the ban carrying the value
-
withMetadata
@Nonnull public <T> Ban withMetadata(@Nonnull String key, @Nonnull Codec<T> codec, @Nullable T data) - Parameters:
key- the key to store the value undercodec- the codec that writes the valuedata- the value to store, ornullto leave the key out- Returns:
- a copy of the ban carrying the value
- See Also:
-
isInEffect
public boolean isInEffect()- Returns:
truewhile the ban applies
-
getDisconnectReason
- Returns:
- the message to disconnect the target with
-