package com.useful.ucars; import org.bukkit.World; import org.bukkit.entity.Entity; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; public class WrapperPlayServerEntity extends AbstractPacket { public static final PacketType TYPE = PacketType.Play.Server.ENTITY; public WrapperPlayServerEntity() { super(new PacketContainer(TYPE), TYPE); handle.getModifier().writeDefaults(); } public WrapperPlayServerEntity(PacketContainer packet) { super(packet, TYPE); } protected WrapperPlayServerEntity(PacketContainer packet, PacketType type) { super(packet, type); } /** * Retrieve entity ID. * @return The current EID */ public int getEntityID() { return handle.getIntegers().read(0); } /** * Set entity ID. * @param value - new value. */ public void setEntityID(int value) { handle.getIntegers().write(0, value); } /** * Retrieve the entity. * @param world - the current world of the entity. * @return The entity. */ public Entity getEntity(World world) { return handle.getEntityModifier(world).read(0); } /** * Retrieve the entity. * @param event - the packet event. * @return The entity. */ public Entity getEntity(PacketEvent event) { return getEntity(event.getPlayer().getWorld()); } }