Package com.comphenix.protocol.wrappers
Class WrappedWatchableObject
java.lang.Object
com.comphenix.protocol.wrappers.AbstractWrapper
com.comphenix.protocol.wrappers.WrappedWatchableObject
Represents a DataWatcher Item in 1.8 to 1.19.2.
Use
WrappedDataValue for 1.19.3 or later.-
Field Summary
Fields inherited from class com.comphenix.protocol.wrappers.AbstractWrapper
handle, handleType -
Constructor Summary
ConstructorsConstructorDescriptionWrappedWatchableObject(int index, Object value) Constructs a DataWatcher Item wrapper from a given index and initial value.WrappedWatchableObject(WrappedDataWatcher.WrappedDataWatcherObject watcherObject, Object value) Constructs a DataWatcher Item wrapper from a given watcher object and initial value.WrappedWatchableObject(Object handle) Constructs a DataWatcher Item wrapper from an existing NMS data watcher item. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanWhether the value must be synchronized with the client.intgetIndex()Gets this Item's index from the watcher objectGets the raw value of this data watcher item.getValue()Gets the wrapped value of this data watcher item.Gets this Item's watcher object, which contains the index and serializer.inthashCode()voidsetDirtyState(boolean dirty) Sets this item's dirty statevoidSets the value of this item.voidSets the value of this item.toString()Methods inherited from class com.comphenix.protocol.wrappers.AbstractWrapper
getHandle, getHandleType, setHandle
-
Constructor Details
-
WrappedWatchableObject
Constructs a DataWatcher Item wrapper from an existing NMS data watcher item.- Parameters:
handle- Data watcher item
-
WrappedWatchableObject
Constructs a DataWatcher Item wrapper from a given index and initial value.Not recommended in 1.9 and up.
- Parameters:
index- Index of the Itemvalue- Initial value
-
WrappedWatchableObject
public WrappedWatchableObject(WrappedDataWatcher.WrappedDataWatcherObject watcherObject, Object value) Constructs a DataWatcher Item wrapper from a given watcher object and initial value.- Parameters:
watcherObject- Watcher objectvalue- Initial value
-
-
Method Details
-
getWatcherObject
Gets this Item's watcher object, which contains the index and serializer.- Returns:
- The watcher object
-
getIndex
public int getIndex()Gets this Item's index from the watcher object- Returns:
- The index
-
getValue
Gets the wrapped value of this data watcher item.- Returns:
- The wrapped value
-
setValue
Sets the value of this item.- Parameters:
value- New value
-
getRawValue
Gets the raw value of this data watcher item.- Returns:
- Raw value
-
setValue
Sets the value of this item.- Parameters:
value- New valueupdateClient- Whether to update the client
-
getDirtyState
public boolean getDirtyState()Whether the value must be synchronized with the client.- Returns:
- True if it must, false if not
-
setDirtyState
public void setDirtyState(boolean dirty) Sets this item's dirty state- Parameters:
dirty- New state
-
equals
- Overrides:
equalsin classAbstractWrapper
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractWrapper
-
toString
- Overrides:
toStringin classAbstractWrapper
-