public class WrappedDataWatcher extends AbstractWrapper implements Iterable<WrappedWatchableObject>
| Modifier and Type | Class and Description |
|---|---|
static class |
WrappedDataWatcher.Registry
Represents a DataWatcherRegistry containing the supported
WrappedDataWatcher.Serializers in 1.9. |
static class |
WrappedDataWatcher.Serializer
Represents a DataWatcherSerializer in 1.9.
|
static class |
WrappedDataWatcher.WrappedDataWatcherObject
Represents a DataWatcherObject in 1.9.
|
handle, handleType| Constructor and Description |
|---|
WrappedDataWatcher()
Constructs a new DataWatcher using a fake lightning entity.
|
WrappedDataWatcher(org.bukkit.entity.Entity entity)
Constructs a new DataWatcher using a real entity.
|
WrappedDataWatcher(List<WrappedWatchableObject> objects)
Constructs a new DataWatcher using a fake lightning entity and a given
list of watchable objects.
|
WrappedDataWatcher(Object handle)
Constructs a new DataWatcher wrapper around a NMS handle.
|
| Modifier and Type | Method and Description |
|---|---|
Map<Integer,WrappedWatchableObject> |
asMap()
Gets the contents of this DataWatcher as a map.
|
void |
clear()
Clears the contents of this DataWatcher.
|
WrappedDataWatcher |
deepClone()
Clone the content of the current DataWatcher.
|
boolean |
equals(Object obj) |
Byte |
getByte(int index)
Get a watched byte.
|
WrappedChunkCoordinate |
getChunkCoordinate(int index)
Get a watched string.
|
org.bukkit.entity.Entity |
getEntity()
Retrieve the entity associated with this data watcher.
|
static WrappedDataWatcher |
getEntityWatcher(org.bukkit.entity.Entity entity)
Retrieve the data watcher associated with an entity.
|
Float |
getFloat(int index)
Get a watched float.
|
Set<Integer> |
getIndexes()
Gets a set containing the registered indexes.
|
Integer |
getInteger(int index)
Get a watched integer.
|
org.bukkit.inventory.ItemStack |
getItemStack(int index)
Get a watched string.
|
Object |
getObject(int index)
Retrieve a watchable object by index.
|
Object |
getObject(WrappedDataWatcher.WrappedDataWatcherObject object)
Retrieve a watchable object by watcher object.
|
Short |
getShort(int index)
Get a watched short.
|
String |
getString(int index)
Get a watched string.
|
static Class<?> |
getTypeClass(int typeID)
Retrieves the class associated with a given type ID.
|
static Integer |
getTypeID(Class<?> clazz)
Retrieves the type ID associated with a given class.
|
WrappedWatchableObject |
getWatchableObject(int index)
Gets the item at a given index.
|
List<WrappedWatchableObject> |
getWatchableObjects()
Gets a list of the contents of this DataWatcher.
|
int |
hashCode() |
boolean |
hasIndex(int index)
Whether or not this DataWatcher has an object at a given index.
|
Set<Integer> |
indexSet()
Returns a set containing all the registered indexes
|
Iterator<WrappedWatchableObject> |
iterator() |
WrappedWatchableObject |
remove(int index)
Removes the item at a given index.
|
WrappedWatchableObject |
removeObject(int index)
Deprecated.
Renamed to
remove(int) |
void |
setEntity(org.bukkit.entity.Entity entity)
Set the entity associated with this data watcher.
|
void |
setObject(int index,
Object value)
Shortcut for
setObject(int, Object, boolean) |
void |
setObject(int index,
Object value,
boolean update)
Sets the DataWatcher Item at a given index to a new value.
|
void |
setObject(int index,
WrappedDataWatcher.Serializer serializer,
Object value)
|
void |
setObject(int index,
WrappedDataWatcher.Serializer serializer,
Object value,
boolean update)
Sets the DataWatcher Item at a given index to a new value.
|
void |
setObject(int index,
WrappedWatchableObject value)
|
void |
setObject(int index,
WrappedWatchableObject value,
boolean update)
Sets the DataWatcher Item at a given index to a new value.
|
void |
setObject(WrappedDataWatcher.WrappedDataWatcherObject object,
Object value)
Shortcut for
setObject(WrappedDataWatcherObject, Object, boolean) |
void |
setObject(WrappedDataWatcher.WrappedDataWatcherObject object,
Object value,
boolean update)
Sets the DataWatcher Item associated with a given watcher object to a
new value.
|
void |
setObject(WrappedDataWatcher.WrappedDataWatcherObject object,
WrappedWatchableObject value)
|
void |
setObject(WrappedDataWatcher.WrappedDataWatcherObject object,
WrappedWatchableObject value,
boolean update)
Sets the DataWatcher Item associated with a given watcher object to a new value.
|
int |
size()
Gets the size of this DataWatcher's contents.
|
String |
toString() |
getHandle, getHandleType, setHandleclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic WrappedDataWatcher(Object handle)
clear().handle - DataWatcher handlepublic WrappedDataWatcher()
public WrappedDataWatcher(org.bukkit.entity.Entity entity)
entity - The entitypublic WrappedDataWatcher(List<WrappedWatchableObject> objects)
objects - The list of objectspublic Map<Integer,WrappedWatchableObject> asMap()
public Set<Integer> getIndexes()
public List<WrappedWatchableObject> getWatchableObjects()
public Iterator<WrappedWatchableObject> iterator()
iterator in interface Iterable<WrappedWatchableObject>public int size()
public WrappedWatchableObject getWatchableObject(int index)
index - Index to get@Deprecated public WrappedWatchableObject removeObject(int index)
remove(int)public WrappedWatchableObject remove(int index)
index - Index to removepublic boolean hasIndex(int index)
index - Index to check forpublic Set<Integer> indexSet()
public void clear()
public Byte getByte(int index)
index - - index of the watched byte.public Short getShort(int index)
index - - index of the watched short.public Integer getInteger(int index)
index - - index of the watched integer.public Float getFloat(int index)
index - - index of the watched float.public String getString(int index)
index - - index of the watched string.public org.bukkit.inventory.ItemStack getItemStack(int index)
index - - index of the watched string.public WrappedChunkCoordinate getChunkCoordinate(int index)
index - - index of the watched string.public Object getObject(int index)
index - Index of the object to retrieve.public Object getObject(WrappedDataWatcher.WrappedDataWatcherObject object)
object - The watcher objectpublic void setObject(int index,
Object value,
boolean update)
index - Index of the object to setvalue - New valueupdate - Whether or not to inform the clientIllegalArgumentException - in 1.9 and up if there isn't already an
object at this index#setObject(WrappedDataWatcherObject, Object, boolean)}public void setObject(int index,
Object value)
setObject(int, Object, boolean)public void setObject(int index,
WrappedDataWatcher.Serializer serializer,
Object value,
boolean update)
index - Index of the object to setSerializer - Serializer from Serializer#get(Class)value - New valueupdate - Whether or not to inform the client#setObject(WrappedDataWatcherObject, Object)}public void setObject(int index,
WrappedDataWatcher.Serializer serializer,
Object value)
public void setObject(int index,
WrappedWatchableObject value,
boolean update)
index - Index of the object to setvalue - New valueupdate - Whether or not to inform the client#setObject(int, Object, boolean)}public void setObject(int index,
WrappedWatchableObject value)
public void setObject(WrappedDataWatcher.WrappedDataWatcherObject object, WrappedWatchableObject value, boolean update)
object - Associated watcher objectvalue - Wrapped valueupdate - Whether or not to inform the client#setObject(WrappedDataWatcherObject, Object)}public void setObject(WrappedDataWatcher.WrappedDataWatcherObject object, WrappedWatchableObject value)
public void setObject(WrappedDataWatcher.WrappedDataWatcherObject object, Object value, boolean update)
object - Associated watcher objectvalue - New valueIllegalArgumentException - If the watcher object is null or must
have a serializer and does not have one.public void setObject(WrappedDataWatcher.WrappedDataWatcherObject object, Object value)
setObject(WrappedDataWatcherObject, Object, boolean)public WrappedDataWatcher deepClone()
public static WrappedDataWatcher getEntityWatcher(org.bukkit.entity.Entity entity)
entity - - the entity to read from.public org.bukkit.entity.Entity getEntity()
public void setEntity(org.bukkit.entity.Entity entity)
entity - - the new entity.public static Integer getTypeID(Class<?> clazz)
clazz - Class to find ID forpublic static Class<?> getTypeClass(int typeID)
typeID - ID to find Class forpublic boolean equals(Object obj)
equals in class AbstractWrapperpublic int hashCode()
hashCode in class AbstractWrapperpublic String toString()
toString in class AbstractWrapperCopyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.