Package org.empirewar.orbis.flag
Class RegionFlag<T>
java.lang.Object
org.empirewar.orbis.flag.RegionFlag<T>
- Type Parameters:
T- the type this flag has
- All Implemented Interfaces:
net.kyori.adventure.key.Keyed
- Direct Known Subclasses:
MutableRegionFlag,RegistryRegionFlag
public sealed class RegionFlag<T>
extends Object
implements net.kyori.adventure.key.Keyed
permits MutableRegionFlag<T>, RegistryRegionFlag<T>
Represents the flag of a
Region.
All flags are Keyed and thus have a Key to identify them.
To add a region flag, you should use the RegistryRegionFlag.builder() and register it to OrbisRegistries.FLAGS.
Note that all flags must provide a Codec of RegionFlag.
This allows for deserialization and serialization and is also used in command parsing.
You may need to add Mojang's DataFixerUpper to your dependencies.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRegionFlag(net.kyori.adventure.key.Key key, com.mojang.serialization.Codec<T> codec) -
Method Summary
Modifier and TypeMethodDescriptionbooleancom.mojang.serialization.MapCodec<? extends RegionFlag<T>> getCodec(RegistryRegionFlag<?> registry) Gets the codec for this flag.inthashCode()@NotNull net.kyori.adventure.key.Keykey()com.mojang.serialization.Codec<T>
-
Field Details
-
key
protected final net.kyori.adventure.key.Key key -
codec
-
-
Constructor Details
-
RegionFlag
-
-
Method Details
-
typeCodec
-
getCodec
public com.mojang.serialization.MapCodec<? extends RegionFlag<T>> getCodec(RegistryRegionFlag<?> registry) Gets the codec for this flag.The parameter provided is the instance of this flag type in the
OrbisRegistries.FLAGSregistry. This allows for transformation within the codec to occur.- Parameters:
registry- the registry value of this flag- Returns:
- the codec
-
key
@NotNull public @NotNull net.kyori.adventure.key.Key key()- Specified by:
keyin interfacenet.kyori.adventure.key.Keyed
-
equals
-
hashCode
public int hashCode()
-