java.lang.Object
me.neznamy.tab.platforms.bukkit.nms.datawatcher.DataWatcher

public class DataWatcher extends Object
A class representing the n.m.s.DataWatcher class to make work with it much easier
  • Constructor Details

    • DataWatcher

      public DataWatcher()
  • Method Details

    • setValue

      public void setValue(DataWatcherObject type, Object value)
      Sets value into data values
      Parameters:
      type - type of value
      value - value
    • removeValue

      public void removeValue(int position)
      Removes value by position
      Parameters:
      position - position of value to remove
    • getItem

      public DataWatcherItem getItem(int position)
      Returns item with given position
      Parameters:
      position - position of item
      Returns:
      item or null if not set
    • helper

      public DataWatcherHelper helper()
      Returns helper created by this instance
      Returns:
      data write helper
    • toNMS

      public Object toNMS() throws ReflectiveOperationException
      Converts the class into an instance of NMS.DataWatcher
      Returns:
      an instance of NMS.DataWatcher with same data
      Throws:
      ReflectiveOperationException - if thrown by reflective operation
    • fromNMS

      public static DataWatcher fromNMS(Object nmsWatcher) throws ReflectiveOperationException
      Reads NMS data watcher and returns and instance of this class with same data
      Parameters:
      nmsWatcher - NMS DataWatcher to read
      Returns:
      an instance of this class with same values
      Throws:
      ReflectiveOperationException - if thrown by reflective operation