public class ProtocolLibSupport extends APISupport
Modifier and Type | Class and Description |
---|---|
static class |
ProtocolLibSupport.EnumItemSlot |
target
plugin
Constructor and Description |
---|
ProtocolLibSupport(TriggerReactorCore plugin) |
Modifier and Type | Method and Description |
---|---|
com.comphenix.protocol.wrappers.WrappedDataWatcher |
createEmptyWatcher()
create empty data watcher.
|
com.comphenix.protocol.events.PacketContainer |
createPacket(String packetType)
Create empty packet.
|
double[] |
getAngle(double fromX,
double fromY,
double fromZ,
double toX,
double toY,
double toZ) |
void |
init()
Initialize this API.
|
void |
sendEntitiesDestroy(org.bukkit.entity.Player p,
Object... entityId)
Send destroy packet for list of entities.
|
void |
sendEntityDestroy(org.bukkit.entity.Player p,
int entityId)
Send destroy packet for an entity.
|
void |
sendEntityEquip(org.bukkit.entity.Player p,
int entityId,
String slot,
org.bukkit.inventory.ItemStack item)
Sends equip packet to player for specified entity.
|
void |
sendEntityLook(org.bukkit.entity.Player p,
int entityId,
double fromX,
double fromY,
double fromZ,
double toX,
double toY,
double toZ)
Send entity look packet relative to the coordinates
|
void |
sendEntityLook(org.bukkit.entity.Player p,
int entityId,
int yaw,
int pitch)
Send entity look packet
|
void |
sendEntityMove(org.bukkit.entity.Player p,
int entityId,
double fromX,
double fromY,
double fromZ,
double toX,
double toY,
double toZ,
boolean onGround)
send entity movement packet.
|
void |
sendEntityMove(org.bukkit.entity.Player p,
int entityId,
int dX,
int dY,
int dZ,
boolean onGround)
send entity movement packet.
|
void |
sendEntitySpawn(org.bukkit.entity.Player p,
int entityId,
int type)
Spawn entity at player's current location.
|
void |
sendEntitySpawn(org.bukkit.entity.Player p,
int entityId,
int type,
double x,
double y,
double z)
Spawn entity at location
|
void |
sendEntitySpawn(org.bukkit.entity.Player p,
int entityId,
int type,
double x,
double y,
double z,
double yaw,
double pitch,
double headPitch)
Spawn fake entity without velocity set and with random UUID set.
|
void |
sendEntitySpawn(org.bukkit.entity.Player p,
int entityId,
int type,
org.bukkit.Location location)
Spawn entity at location
|
void |
sendEntitySpawn(org.bukkit.entity.Player p,
int entityId,
UUID entityUuid,
int type,
double x,
double y,
double z,
double yaw,
double pitch,
double headPitch,
int velX,
int velY,
int velZ)
Predefined method to spawn a fake entity.
|
void |
sendPacket(org.bukkit.entity.Player p,
com.comphenix.protocol.events.PacketContainer container)
send packet.
|
addSharedVars, getSharedVars
addSharedVar
public ProtocolLibSupport(TriggerReactorCore plugin)
public void init() throws APISupportException
APISupport
init
in class APISupport
APISupportException
- throw this exception when the supporting API is not loaded or not found.public com.comphenix.protocol.events.PacketContainer createPacket(String packetType)
packetType
- type of packet as String. Should match with any
PacketType.
For example, ENTITY is under PacketType.Play.Server.public com.comphenix.protocol.wrappers.WrappedDataWatcher createEmptyWatcher()
public void sendPacket(org.bukkit.entity.Player p, com.comphenix.protocol.events.PacketContainer container) throws InvocationTargetException
p
- player to send packetcontainer
- the packetInvocationTargetException
public void sendEntitySpawn(org.bukkit.entity.Player p, int entityId, UUID entityUuid, int type, double x, double y, double z, double yaw, double pitch, double headPitch, int velX, int velY, int velZ) throws InvocationTargetException
p
- player to send packetentityId
- entity id to use. Usually you use negative number to distinguish entity id with real entities.entityUuid
- uuid of entitytype
- type number of entity.x
- y
- z
- yaw
- in degreepitch
- in degreeheadPitch
- in degreevelX
- See thisvelY
- See thisvelZ
- See thisInvocationTargetException
public void sendEntitySpawn(org.bukkit.entity.Player p, int entityId, int type, double x, double y, double z, double yaw, double pitch, double headPitch) throws InvocationTargetException
p
- player to send packetentityId
- entity id to use. Usually you use negative number to distinguish entity id with real entities.type
- type number of entity.x
- y
- z
- yaw
- in degreepitch
- in degreeheadPitch
- in degreeInvocationTargetException
public void sendEntitySpawn(org.bukkit.entity.Player p, int entityId, int type, org.bukkit.Location location) throws InvocationTargetException
p
- player to send packetentityId
- entity id to use. Usually you use negative number to distinguish entity id with real entities.type
- type number of entity.location
- the LocationInvocationTargetException
public void sendEntitySpawn(org.bukkit.entity.Player p, int entityId, int type, double x, double y, double z) throws InvocationTargetException
p
- player to send packetentityId
- entity id to use. Usually you use negative number to distinguish entity id with real entities.type
- type number of entity.x
- y
- z
- InvocationTargetException
public void sendEntitySpawn(org.bukkit.entity.Player p, int entityId, int type) throws InvocationTargetException
p
- player to send packetentityId
- entity id to use. Usually you use negative number to distinguish entity id with real entities.type
- type number of entity.InvocationTargetException
public void sendEntitiesDestroy(org.bukkit.entity.Player p, Object... entityId) throws InvocationTargetException
p
- player to send packetentityId
- entity ids.InvocationTargetException
public void sendEntityDestroy(org.bukkit.entity.Player p, int entityId) throws InvocationTargetException
p
- player to send packetentityId
- entity idInvocationTargetException
public void sendEntityMove(org.bukkit.entity.Player p, int entityId, int dX, int dY, int dZ, boolean onGround) throws InvocationTargetException
p
- player to send packetentityId
- entity id of entity to movedX
- delta xdY
- delta ydZ
- delta zonGround
- no documentationInvocationTargetException
public void sendEntityMove(org.bukkit.entity.Player p, int entityId, double fromX, double fromY, double fromZ, double toX, double toY, double toZ, boolean onGround) throws InvocationTargetException
p
- player to send packetentityId
- entity id of entity to movefromX
- fromY
- fromZ
- toX
- toY
- toZ
- onGround
- no documentationInvocationTargetException
public void sendEntityLook(org.bukkit.entity.Player p, int entityId, int yaw, int pitch) throws InvocationTargetException
p
- entityId
- yaw
- A rotation angle in steps of 1/256 of a full turnpitch
- A rotation angle in steps of 1/256 of a full turnInvocationTargetException
public void sendEntityLook(org.bukkit.entity.Player p, int entityId, double fromX, double fromY, double fromZ, double toX, double toY, double toZ) throws InvocationTargetException
p
- entityId
- fromX
- fromY
- fromZ
- toX
- toY
- toZ
- InvocationTargetException
public double[] getAngle(double fromX, double fromY, double fromZ, double toX, double toY, double toZ)
public void sendEntityEquip(org.bukkit.entity.Player p, int entityId, String slot, org.bukkit.inventory.ItemStack item) throws ClassNotFoundException, InvocationTargetException
p
- player to send packetentityId
- the id of entity to equip itemslot
- the slot name. String must be same as one of the enum in ProtocolLibSupport.EnumItemSlot
item
- the item to equip.ClassNotFoundException
- This throws if EnumItemSlot doesn't exist in nms package. This can be the case
where you are trying to use this method in somewhere 1.8 version environment. It's advised to create your own with
createPacket(String)
as PacketPlayoutEntityEquipment.class around 1.8 version specify everything using primitive types.InvocationTargetException