public class PacketContainer
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
handle |
protected StructureModifier<java.lang.Object> |
structureModifier |
protected PacketType |
type |
Modifier | Constructor and Description |
---|---|
protected |
PacketContainer()
For serialization.
|
|
PacketContainer(int id)
Deprecated.
|
|
PacketContainer(int id,
java.lang.Object handle)
Deprecated.
|
|
PacketContainer(int id,
java.lang.Object handle,
StructureModifier<java.lang.Object> structure)
Deprecated.
|
|
PacketContainer(PacketType type)
Creates a packet container for a new packet.
|
|
PacketContainer(PacketType type,
java.lang.Object handle)
Creates a packet container for an existing packet.
|
|
PacketContainer(PacketType type,
java.lang.Object handle,
StructureModifier<java.lang.Object> structure)
Creates a packet container for an existing packet.
|
Modifier and Type | Method and Description |
---|---|
PacketContainer |
deepClone()
Create a deep copy of the current packet.
|
StructureModifier<java.util.List<WrappedAttribute>> |
getAttributeCollectionModifier()
Retrieves a read/write structure for collections of attribute snapshots.
|
StructureModifier<org.bukkit.Material> |
getBlocks()
Retrieves a read/write structure for block fields.
|
StructureModifier<java.lang.Boolean> |
getBooleans()
Retrieves a read/write structure for every boolean field.
|
StructureModifier<byte[]> |
getByteArrays()
Retrieves a read/write structure for every byte array field.
|
StreamSerializer |
getByteArraySerializer()
Retrieve a serializer for reading and writing ItemStacks stored in a byte array.
|
StructureModifier<java.lang.Byte> |
getBytes()
Retrieves a read/write structure for every byte field.
|
StructureModifier<WrappedChatComponent> |
getChatComponents()
Retrieves a read/write structure for chat components in Minecraft 1.7.2.
|
StructureModifier<EnumWrappers.ChatVisibility> |
getChatVisibilities()
Retrieve a read/write structure for the ChatVisibility enum in 1.7.2.
|
StructureModifier<ChunkCoordIntPair> |
getChunkCoordIntPairs()
Retrieves a read/write structure for wrapped ChunkCoordIntPairs.
|
StructureModifier<EnumWrappers.ClientCommand> |
getClientCommands()
Retrieve a read/write structure for the ClientCommand enum in 1.7.2.
|
StructureModifier<WrappedDataWatcher> |
getDataWatcherModifier()
Retrieves a read/write structure for data watchers.
|
StructureModifier<EnumWrappers.Difficulty> |
getDifficulties()
Retrieve a read/write structure for the Difficulty enum in 1.7.2.
|
StructureModifier<java.lang.Double> |
getDoubles()
Retrieves a read/write structure for every double field.
|
StructureModifier<org.bukkit.entity.Entity> |
getEntityModifier(PacketEvent event)
Retrieves a read/write structure for entity objects.
|
StructureModifier<org.bukkit.entity.Entity> |
getEntityModifier(org.bukkit.World world)
Retrieves a read/write structure for entity objects.
|
StructureModifier<EnumWrappers.EntityUseAction> |
getEntityUseActions()
Retrieve a read/write structure for the EntityUse enum in 1.7.2.
|
StructureModifier<java.lang.Float> |
getFloat()
Retrieves a read/write structure for every float field.
|
StructureModifier<EnumWrappers.NativeGameMode> |
getGameModes()
Retrieve a read/write structure for the NativeGameMode enum in 1.7.2.
|
StructureModifier<WrappedGameProfile> |
getGameProfiles()
Retrieves a read/write structure for game profiles in Minecraft 1.7.2.
|
java.lang.Object |
getHandle()
Retrieves the underlying Minecraft packet.
|
int |
getID()
Deprecated.
|
StructureModifier<int[]> |
getIntegerArrays()
Retrieves a read/write structure for every int array field.
|
StructureModifier<java.lang.Integer> |
getIntegers()
Retrieves a read/write structure for every integer field.
|
StructureModifier<org.bukkit.inventory.ItemStack[]> |
getItemArrayModifier()
Retrieves a read/write structure for arrays of ItemStacks.
|
StructureModifier<org.bukkit.inventory.ItemStack> |
getItemModifier()
Retrieves a read/write structure for ItemStack.
|
StructureModifier<java.lang.Long> |
getLongs()
Retrieves a read/write structure for every long field.
|
StructureModifier<java.lang.Object> |
getModifier()
Retrieves the generic structure modifier for this packet.
|
StructureModifier<NbtBase<?>> |
getNbtModifier()
Retrieves a read/write structure for NBT classes.
|
StructureModifier<java.util.List<ChunkPosition>> |
getPositionCollectionModifier()
Retrieves a read/write structure for collections of chunk positions.
|
StructureModifier<ChunkPosition> |
getPositionModifier()
Retrieves a read/write structure for chunk positions.
|
StructureModifier<PacketType.Protocol> |
getProtocols()
Retrieve a read/write structure for the Protocol enum in 1.7.2.
|
StructureModifier<WrappedServerPing> |
getServerPings()
Retrieve a read/write structure for the ServerPing fields in the following packet:
PacketType.Status.Server#OUT_SERVER_INFO
|
StructureModifier<java.lang.Short> |
getShorts()
Retrieves a read/write structure for every short field.
|
<T> StructureModifier<T> |
getSpecificModifier(java.lang.Class<T> primitiveType)
Retrieves a read/write structure for every field with the given type.
|
StructureModifier<java.util.Map<WrappedStatistic,java.lang.Integer>> |
getStatisticMaps()
Retrieve a read/write structure for maps of statistics.
|
StructureModifier<java.lang.String[]> |
getStringArrays()
Retrieves a read/write structure for every String array field.
|
StructureModifier<java.lang.String> |
getStrings()
Retrieves a read/write structure for every String field.
|
PacketType |
getType()
Retrieve the packet type of this packet.
|
StructureModifier<java.util.List<WrappedWatchableObject>> |
getWatchableCollectionModifier()
Retrieves a read/write structure for collections of watchable objects.
|
StructureModifier<org.bukkit.WorldType> |
getWorldTypeModifier()
Retrieves a read/write structure for the world type enum.
|
PacketContainer |
shallowClone()
Create a shallow copy of the current packet.
|
protected PacketType type
protected transient java.lang.Object handle
protected transient StructureModifier<java.lang.Object> structureModifier
@Deprecated public PacketContainer(int id)
Deprecated: Use PacketContainer(PacketType)
instead.
id
- - ID of the packet to create.@Deprecated public PacketContainer(int id, java.lang.Object handle)
Deprecated: Use #PacketContainer(PacketType, Object))
instead.
id
- - ID of the given packet.handle
- - contained packet.@Deprecated public PacketContainer(int id, java.lang.Object handle, StructureModifier<java.lang.Object> structure)
Deprecated: Use #PacketContainer(PacketType, Object, StructureModifier))
instead.
id
- - ID of the given packet.handle
- - contained packet.structure
- - structure modifier.public PacketContainer(PacketType type)
type
- - the type of the packet to create.public PacketContainer(PacketType type, java.lang.Object handle)
id
- - ID of the given packet.handle
- - contained packet.public PacketContainer(PacketType type, java.lang.Object handle, StructureModifier<java.lang.Object> structure)
id
- - ID of the given packet.handle
- - contained packet.structure
- - structure modifier.protected PacketContainer()
public java.lang.Object getHandle()
public StructureModifier<java.lang.Object> getModifier()
public <T> StructureModifier<T> getSpecificModifier(java.lang.Class<T> primitiveType)
primitiveType
- - the type to find.public StructureModifier<java.lang.Byte> getBytes()
public StructureModifier<java.lang.Boolean> getBooleans()
public StructureModifier<java.lang.Short> getShorts()
public StructureModifier<java.lang.Integer> getIntegers()
public StructureModifier<java.lang.Long> getLongs()
public StructureModifier<java.lang.Float> getFloat()
public StructureModifier<java.lang.Double> getDoubles()
public StructureModifier<java.lang.String> getStrings()
public StructureModifier<java.lang.String[]> getStringArrays()
public StructureModifier<byte[]> getByteArrays()
public StreamSerializer getByteArraySerializer()
public StructureModifier<int[]> getIntegerArrays()
public StructureModifier<org.bukkit.inventory.ItemStack> getItemModifier()
This modifier will automatically marshall between the Bukkit ItemStack and the internal Minecraft ItemStack.
public StructureModifier<org.bukkit.inventory.ItemStack[]> getItemArrayModifier()
This modifier will automatically marshall between the Bukkit ItemStack and the internal Minecraft ItemStack.
public StructureModifier<java.util.Map<WrappedStatistic,java.lang.Integer>> getStatisticMaps()
Note that you must write back the changed map to persist it.
public StructureModifier<org.bukkit.WorldType> getWorldTypeModifier()
This modifier will automatically marshall between the Bukkit world type and the internal Minecraft world type.
public StructureModifier<WrappedDataWatcher> getDataWatcherModifier()
public StructureModifier<org.bukkit.entity.Entity> getEntityModifier(@Nonnull org.bukkit.World world)
Note that entities are transmitted by integer ID, and the type may not be enough to distinguish between entities and other values. Thus, this structure modifier MAY return null or invalid entities for certain fields. Using the correct index is essential.
world
- - the world each entity is currently occupying.public StructureModifier<org.bukkit.entity.Entity> getEntityModifier(@Nonnull PacketEvent event)
Note that entities are transmitted by integer ID, and the type may not be enough to distinguish between entities and other values. Thus, this structure modifier MAY return null or invalid entities for certain fields. Using the correct index is essential.
event
- - the original packet event.public StructureModifier<ChunkPosition> getPositionModifier()
public StructureModifier<ChunkCoordIntPair> getChunkCoordIntPairs()
public StructureModifier<NbtBase<?>> getNbtModifier()
public StructureModifier<java.util.List<WrappedAttribute>> getAttributeCollectionModifier()
This modifier will automatically marshall between the visible ProtocolLib WrappedAttribute and the internal Minecraft AttributeSnapshot.
public StructureModifier<java.util.List<ChunkPosition>> getPositionCollectionModifier()
This modifier will automatically marshall between the visible ProtocolLib ChunkPosition and the internal Minecraft ChunkPosition.
public StructureModifier<java.util.List<WrappedWatchableObject>> getWatchableCollectionModifier()
This modifier will automatically marshall between the visible WrappedWatchableObject and the internal Minecraft WatchableObject.
public StructureModifier<org.bukkit.Material> getBlocks()
This modifier will automatically marshall between Material and the internal Minecraft Block.
public StructureModifier<WrappedGameProfile> getGameProfiles()
This modifier will automatically marshall between WrappedGameProfile and the internal Minecraft GameProfile.
public StructureModifier<WrappedChatComponent> getChatComponents()
This modifier will automatically marshall between WrappedChatComponent and the internal Minecraft GameProfile.
public StructureModifier<WrappedServerPing> getServerPings()
PacketType.Status.Server#OUT_SERVER_INFO
public StructureModifier<PacketType.Protocol> getProtocols()
public StructureModifier<EnumWrappers.ClientCommand> getClientCommands()
public StructureModifier<EnumWrappers.ChatVisibility> getChatVisibilities()
public StructureModifier<EnumWrappers.Difficulty> getDifficulties()
public StructureModifier<EnumWrappers.EntityUseAction> getEntityUseActions()
public StructureModifier<EnumWrappers.NativeGameMode> getGameModes()
@Deprecated public int getID()
Deprecated: Use getType()
instead.
public PacketType getType()
public PacketContainer shallowClone()
This merely writes the content of each field to the new class directly, without performing any expensive copies.
public PacketContainer deepClone()
This will perform a full copy of the entire object tree, only skipping known immutable objects and primitive types.
Note that the inflated buffers in packet 51 and 56 will be copied directly to save memory.