Class DataComponent.Patch
java.lang.Object
com.saicone.rtag.data.DataComponent.Patch
- Enclosing class:
DataComponent
Class to invoke methods from DataComponentPatch.
Instead of patched map, a component patch acts like a cloneable object that can be introduced into maps and also hold empty values to future deletion.
Instead of patched map, a component patch acts like a cloneable object that can be introduced into maps and also hold empty values to future deletion.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic DataComponent.Builder<Object> builder()Create a DataComponentPatch builder to set values and then wrap into component patch.Get a DataComponentType key set from component patch.
On versions older than 26.3 this method return a set of entries withOptionalobjects as values.static ObjectGet a declared component type from provided component patch.Get the map value from component patch.
On versions older than 26.3 this method return a map withOptionalobjects as values.static booleanCheck if the provided component patch is empty.static voidReplace the map value into component patch.
If server version is older than 26.3 the map values must beOptionalobjects.static intGet the size of provided component patch.
-
Field Details
-
EMPTY
An empty DataComponentPatch instance.
-
-
Method Details
-
builder
Create a DataComponentPatch builder to set values and then wrap into component patch.- Returns:
- a newly generated builder to edit.
-
get
Get a declared component type from provided component patch.- Parameters:
patch- the component patch to get component from.type- the DataComponentType instance that declares a component type.- Returns:
- the component declared type from data component cache.
-
getValue
public static it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Object,Object> getValue(Object patch) Get the map value from component patch.
On versions older than 26.3 this method return a map withOptionalobjects as values.- Parameters:
patch- the patch to get the value itself.- Returns:
- a Reference2ObjectMap inside component patch.
-
entrySet
Get a DataComponentType key set from component patch.
On versions older than 26.3 this method return a set of entries withOptionalobjects as values.- Parameters:
patch- the patch to get the key set.- Returns:
- set full of DataComponentType objects.
-
size
Get the size of provided component patch.- Parameters:
patch- the component patch to get size.- Returns:
- the number of data type elements in provided component patch.
-
isEmpty
Check if the provided component patch is empty.- Parameters:
patch- the component patch to check.- Returns:
- true if the component patch has no elements.
-
setValue
public static void setValue(Object patch, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Object, Object> value) Replace the map value into component patch.
If server version is older than 26.3 the map values must beOptionalobjects.- Parameters:
patch- the component patch to set the map value.value- a Reference2ObjectMap with DataComponentType as keys and wrapped declared objects has values.
-