Package org.bukkit.persistence
Class PersistentDataType.BooleanPersistentDataType
java.lang.Object
org.bukkit.persistence.PersistentDataType.BooleanPersistentDataType
- All Implemented Interfaces:
PersistentDataType<Byte,
Boolean>
- Enclosing interface:
PersistentDataType<P,
C>
public static class PersistentDataType.BooleanPersistentDataType
extends Object
implements PersistentDataType<Byte,Boolean>
A convenience implementation to convert between Byte and Boolean as there is
no native implementation for booleans.
Any byte value not equal to 0 is considered to be true.
Any byte value not equal to 0 is considered to be true.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.persistence.PersistentDataType
PersistentDataType.BooleanPersistentDataType, PersistentDataType.PrimitivePersistentDataType<P>
-
Field Summary
Fields inherited from interface org.bukkit.persistence.PersistentDataType
BOOLEAN, BYTE, BYTE_ARRAY, DOUBLE, FLOAT, INTEGER, INTEGER_ARRAY, LIST, LONG, LONG_ARRAY, SHORT, STRING, TAG_CONTAINER, TAG_CONTAINER_ARRAY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfromPrimitive
(@NotNull Byte primitive, @NotNull PersistentDataAdapterContext context) Creates a complex object based of the passed primitive valueReturns the complex object type the primitive value resembles.Returns the primitive data type of this tag.toPrimitive
(@NotNull Boolean complex, @NotNull PersistentDataAdapterContext context) Returns the primitive data that resembles the complex object passed to this method.
-
Constructor Details
-
BooleanPersistentDataType
public BooleanPersistentDataType()
-
-
Method Details
-
getPrimitiveType
Description copied from interface:PersistentDataType
Returns the primitive data type of this tag.- Specified by:
getPrimitiveType
in interfacePersistentDataType<Byte,
Boolean> - Returns:
- the class
-
getComplexType
Description copied from interface:PersistentDataType
Returns the complex object type the primitive value resembles.- Specified by:
getComplexType
in interfacePersistentDataType<Byte,
Boolean> - Returns:
- the class type
-
toPrimitive
@NotNull public @NotNull Byte toPrimitive(@NotNull @NotNull Boolean complex, @NotNull @NotNull PersistentDataAdapterContext context) Description copied from interface:PersistentDataType
Returns the primitive data that resembles the complex object passed to this method.- Specified by:
toPrimitive
in interfacePersistentDataType<Byte,
Boolean> - Parameters:
complex
- the complex object instancecontext
- the context this operation is running in- Returns:
- the primitive value
-
fromPrimitive
@NotNull public @NotNull Boolean fromPrimitive(@NotNull @NotNull Byte primitive, @NotNull @NotNull PersistentDataAdapterContext context) Description copied from interface:PersistentDataType
Creates a complex object based of the passed primitive value- Specified by:
fromPrimitive
in interfacePersistentDataType<Byte,
Boolean> - Parameters:
primitive
- the primitive valuecontext
- the context this operation is running in- Returns:
- the complex object instance
-