Package org.bukkit.persistence
Class PersistentDataType.BooleanPersistentDataType
java.lang.Object
org.bukkit.persistence.PersistentDataType.BooleanPersistentDataType
- All Implemented Interfaces:
PersistentDataType<Byte,Boolean>
- Enclosing interface:
- PersistentDataType<T,
Z>
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<T> -
Field Summary
Fields inherited from interface org.bukkit.persistence.PersistentDataType
BOOLEAN, BYTE, BYTE_ARRAY, DOUBLE, FLOAT, INTEGER, INTEGER_ARRAY, LONG, LONG_ARRAY, SHORT, STRING, TAG_CONTAINER, TAG_CONTAINER_ARRAY -
Constructor Summary
Constructors -
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:PersistentDataTypeReturns the primitive data type of this tag.- Specified by:
getPrimitiveTypein interfacePersistentDataType<Byte,Boolean> - Returns:
- the class
-
getComplexType
Description copied from interface:PersistentDataTypeReturns the complex object type the primitive value resembles.- Specified by:
getComplexTypein 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:PersistentDataTypeReturns the primitive data that resembles the complex object passed to this method.- Specified by:
toPrimitivein 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:PersistentDataTypeCreates a complex object based of the passed primitive value- Specified by:
fromPrimitivein interfacePersistentDataType<Byte,Boolean> - Parameters:
primitive- the primitive valuecontext- the context this operation is running in- Returns:
- the complex object instance
-