Class WrappedWatchableObject

java.lang.Object
com.comphenix.protocol.wrappers.AbstractWrapper
com.comphenix.protocol.wrappers.WrappedWatchableObject

public final class WrappedWatchableObject extends AbstractWrapper
Represents a DataWatcher Item in 1.8 to 1.19.2. Use WrappedDataValue for 1.19.3 or later.
  • Constructor Details

    • WrappedWatchableObject

      public WrappedWatchableObject(Object handle)
      Constructs a DataWatcher Item wrapper from an existing NMS data watcher item.
      Parameters:
      handle - Data watcher item
    • WrappedWatchableObject

      public WrappedWatchableObject(int index, Object value)
      Constructs a DataWatcher Item wrapper from a given index and initial value.

      Not recommended in 1.9 and up.

      Parameters:
      index - Index of the Item
      value - 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 object
      value - 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

      public Object getValue()
      Gets the wrapped value of this data watcher item.
      Returns:
      The wrapped value
    • setValue

      public void setValue(Object value)
      Sets the value of this item.
      Parameters:
      value - New value
    • getRawValue

      public Object getRawValue()
      Gets the raw value of this data watcher item.
      Returns:
      Raw value
    • setValue

      public void setValue(Object value, boolean updateClient)
      Sets the value of this item.
      Parameters:
      value - New value
      updateClient - 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

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractWrapper
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractWrapper
    • toString

      public String toString()
      Overrides:
      toString in class AbstractWrapper