added files.
This commit is contained in:
commit
8aa2a15c64
124 files changed
+14297
No files matched your search
@@ -0,0 +1,5 @@
|
||||
package me.konsolas.aac.internal;
|
||||
|
||||
public interface Destroyable {
|
||||
void destroy();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.google.common.base.Objects;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class AbstractPacket {
|
||||
protected PacketContainer handle;
|
||||
|
||||
protected AbstractPacket(PacketContainer handle, PacketType type) {
|
||||
if (handle == null) {
|
||||
throw new IllegalArgumentException("Packet handle cannot be NULL.");
|
||||
}
|
||||
|
||||
if (!Objects.equal(handle.getType(), type)) {
|
||||
throw new IllegalArgumentException(handle.getHandle() + " is not a packet of type " + type);
|
||||
}
|
||||
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public PacketContainer getHandle() {
|
||||
return this.handle;
|
||||
}
|
||||
|
||||
public void sendPacket(Player receiver) {
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(receiver, this.getHandle());
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new RuntimeException("Cannot send packet.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void receivePacket(Player sender) {
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender, this.getHandle());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Cannot recieve packet.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class WrapperPlayClientUseEntity extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Client.USE_ENTITY;
|
||||
|
||||
public WrapperPlayClientUseEntity() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayClientUseEntity(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public EntityUseAction getAction() {
|
||||
return this.handle.getEntityUseActions().read(0);
|
||||
}
|
||||
|
||||
public void setAction(EntityUseAction value) {
|
||||
this.handle.getEntityUseActions().write(0, value);
|
||||
}
|
||||
|
||||
public Vector getTargetVector() {
|
||||
return this.handle.getVectors().read(0);
|
||||
}
|
||||
|
||||
public void setTargetVector(Vector value) {
|
||||
this.handle.getVectors().write(0, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrapperPlayServerAnimation extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ANIMATION;
|
||||
|
||||
public WrapperPlayServerAnimation() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerAnimation(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public Entity getEntity(World world) {
|
||||
return this.handle.getEntityModifier(world).read(0);
|
||||
}
|
||||
|
||||
public Entity getEntity(PacketEvent event) {
|
||||
return this.getEntity(event.getPlayer().getWorld());
|
||||
}
|
||||
|
||||
public int getAnimation() {
|
||||
return this.handle.getIntegers().read(1);
|
||||
}
|
||||
|
||||
public void setAnimation(int value) {
|
||||
this.handle.getIntegers().write(1, value);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
|
||||
public class WrapperPlayServerEntityDestroy extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_DESTROY;
|
||||
|
||||
public WrapperPlayServerEntityDestroy() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityDestroy(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.handle.getIntegerArrays().read(0).length;
|
||||
}
|
||||
|
||||
public int[] getEntityIds() {
|
||||
return this.handle.getIntegerArrays().read(0);
|
||||
}
|
||||
|
||||
public void setEntityIds(int[] value) {
|
||||
this.handle.getIntegerArrays().write(0, value);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class WrapperPlayServerEntityEquipment extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_EQUIPMENT;
|
||||
|
||||
public WrapperPlayServerEntityEquipment() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityEquipment(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return this.handle.getIntegers().read(1);
|
||||
}
|
||||
|
||||
public void setSlot(int value) {
|
||||
this.handle.getIntegers().write(1, value);
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return this.handle.getItemModifier().read(0);
|
||||
}
|
||||
|
||||
public void setItem(ItemStack value) {
|
||||
this.handle.getItemModifier().write(0, value);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
import java.util.List;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrapperPlayServerEntityMetadata extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_METADATA;
|
||||
|
||||
public WrapperPlayServerEntityMetadata() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityMetadata(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public Entity getEntity(World world) {
|
||||
return this.handle.getEntityModifier(world).read(0);
|
||||
}
|
||||
|
||||
public Entity getEntity(PacketEvent event) {
|
||||
return this.getEntity(event.getPlayer().getWorld());
|
||||
}
|
||||
|
||||
public List<WrappedWatchableObject> getMetadata() {
|
||||
return this.handle.getWatchableCollectionModifier().read(0);
|
||||
}
|
||||
|
||||
public void setMetadata(List<WrappedWatchableObject> value) {
|
||||
this.handle.getWatchableCollectionModifier().write(0, value);
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
|
||||
public class WrapperPlayServerEntityMoveLook extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_MOVE_LOOK;
|
||||
|
||||
public WrapperPlayServerEntityMoveLook() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityMoveLook(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public double getDx() {
|
||||
return this.handle.getBytes().read(0) / 32.0;
|
||||
}
|
||||
|
||||
public void setDx(double value) {
|
||||
this.handle.getBytes().write(0, (byte) (value * 32.0));
|
||||
}
|
||||
|
||||
public double getDy() {
|
||||
return this.handle.getBytes().read(0) / 32.0;
|
||||
}
|
||||
|
||||
public void setDy(double value) {
|
||||
this.handle.getBytes().write(0, (byte) (value * 32.0));
|
||||
}
|
||||
|
||||
public double getDz() {
|
||||
return this.handle.getBytes().read(0) / 32.0;
|
||||
}
|
||||
|
||||
public void setDz(double value) {
|
||||
this.handle.getBytes().write(0, (byte) (value * 32.0));
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return this.handle.getBytes().read(0) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setYaw(float value) {
|
||||
this.handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return this.handle.getBytes().read(1) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setPitch(float value) {
|
||||
this.handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public boolean getOnGround() {
|
||||
return this.handle.getSpecificModifier(boolean.class).read(0);
|
||||
}
|
||||
|
||||
public void setOnGround(boolean value) {
|
||||
this.handle.getSpecificModifier(boolean.class).write(0, value);
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrapperPlayServerEntityStatus extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_STATUS;
|
||||
|
||||
public WrapperPlayServerEntityStatus() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityStatus(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public Entity getEntity(World world) {
|
||||
return this.handle.getEntityModifier(world).read(0);
|
||||
}
|
||||
|
||||
public Entity getEntity(PacketEvent event) {
|
||||
return this.getEntity(event.getPlayer().getWorld());
|
||||
}
|
||||
|
||||
public byte getEntityStatus() {
|
||||
return this.handle.getBytes().read(0);
|
||||
}
|
||||
|
||||
public void setEntityStatus(byte value) {
|
||||
this.handle.getBytes().write(0, value);
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrapperPlayServerEntityTeleport extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_TELEPORT;
|
||||
|
||||
public WrapperPlayServerEntityTeleport() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityTeleport(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public Entity getEntity(World world) {
|
||||
return this.handle.getEntityModifier(world).read(0);
|
||||
}
|
||||
|
||||
public Entity getEntity(PacketEvent event) {
|
||||
return this.getEntity(event.getPlayer().getWorld());
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.handle.getDoubles().read(0);
|
||||
}
|
||||
|
||||
public void setX(double value) {
|
||||
this.handle.getDoubles().write(0, value);
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.handle.getDoubles().read(1);
|
||||
}
|
||||
|
||||
public void setY(double value) {
|
||||
this.handle.getDoubles().write(1, value);
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.handle.getDoubles().read(2);
|
||||
}
|
||||
|
||||
public void setZ(double value) {
|
||||
this.handle.getDoubles().write(2, value);
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return this.handle.getBytes().read(0) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setYaw(float value) {
|
||||
this.handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return this.handle.getBytes().read(1) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setPitch(float value) {
|
||||
this.handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class WrapperPlayServerEntityVelocity extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_VELOCITY;
|
||||
|
||||
public WrapperPlayServerEntityVelocity() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityVelocity(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public Entity getEntity(World world) {
|
||||
return this.handle.getEntityModifier(world).read(0);
|
||||
}
|
||||
|
||||
public Entity getEntity(PacketEvent event) {
|
||||
return this.getEntity(event.getPlayer().getWorld());
|
||||
}
|
||||
|
||||
public double getVelocityX() {
|
||||
return this.handle.getIntegers().read(1) / 8000.0;
|
||||
}
|
||||
|
||||
public void setVelocityX(double value) {
|
||||
this.handle.getIntegers().write(1, (int) (value * 8000.0));
|
||||
}
|
||||
|
||||
public double getVelocityY() {
|
||||
return this.handle.getIntegers().read(2) / 8000.0;
|
||||
}
|
||||
|
||||
public void setVelocityY(double value) {
|
||||
this.handle.getIntegers().write(2, (int) (value * 8000.0));
|
||||
}
|
||||
|
||||
public double getVelocityZ() {
|
||||
return this.handle.getIntegers().read(3) / 8000.0;
|
||||
}
|
||||
|
||||
public void setVelocityZ(double value) {
|
||||
this.handle.getIntegers().write(3, (int) (value * 8000.0));
|
||||
}
|
||||
|
||||
public Vector getVelocity() {
|
||||
return new Vector(this.getVelocityX(), this.getVelocityY(), this.getVelocityZ());
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class WrapperPlayServerNamedEntitySpawn extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.NAMED_ENTITY_SPAWN;
|
||||
|
||||
public WrapperPlayServerNamedEntitySpawn() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerNamedEntitySpawn(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public UUID getPlayerUUID() {
|
||||
return this.handle.getSpecificModifier(UUID.class).read(0);
|
||||
}
|
||||
|
||||
public void setPlayerUUID(UUID value) {
|
||||
this.handle.getSpecificModifier(UUID.class).write(0, value);
|
||||
}
|
||||
|
||||
public Vector getPosition() {
|
||||
return new Vector(this.getX(), this.getY(), this.getZ());
|
||||
}
|
||||
|
||||
public void setPosition(Vector position) {
|
||||
this.setX(position.getX());
|
||||
this.setY(position.getY());
|
||||
this.setZ(position.getZ());
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.handle.getDoubles().read(0);
|
||||
}
|
||||
|
||||
public void setX(double value) {
|
||||
this.handle.getDoubles().write(0, value);
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.handle.getDoubles().read(1);
|
||||
}
|
||||
|
||||
public void setY(double value) {
|
||||
this.handle.getDoubles().write(1, value);
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.handle.getDoubles().read(2);
|
||||
}
|
||||
|
||||
public void setZ(double value) {
|
||||
this.handle.getDoubles().write(2, value);
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return this.handle.getBytes().read(0) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setYaw(float value) {
|
||||
this.handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return this.handle.getBytes().read(1) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setPitch(float value) {
|
||||
this.handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public WrappedDataWatcher getMetadata() {
|
||||
return this.handle.getDataWatcherModifier().read(0);
|
||||
}
|
||||
|
||||
public void setMetadata(WrappedDataWatcher value) {
|
||||
this.handle.getDataWatcherModifier().write(0, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
||||
import java.util.List;
|
||||
|
||||
public class WrapperPlayServerPlayerInfo extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.PLAYER_INFO;
|
||||
|
||||
public WrapperPlayServerPlayerInfo() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerPlayerInfo(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public PlayerInfoAction getAction() {
|
||||
return this.handle.getPlayerInfoAction().read(0);
|
||||
}
|
||||
|
||||
public void setAction(PlayerInfoAction value) {
|
||||
this.handle.getPlayerInfoAction().write(0, value);
|
||||
}
|
||||
|
||||
public List<PlayerInfoData> getData() {
|
||||
return this.handle.getPlayerInfoDataLists().read(0);
|
||||
}
|
||||
|
||||
public void setData(List<PlayerInfoData> value) {
|
||||
this.handle.getPlayerInfoDataLists().write(0, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.reflect.StructureModifier;
|
||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||
import com.comphenix.protocol.wrappers.BukkitConverters;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||
import java.util.Set;
|
||||
|
||||
public class WrapperPlayServerPosition extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.POSITION;
|
||||
private static final Class<?> FLAGS_CLASS = MinecraftReflection.getMinecraftClass(
|
||||
"EnumPlayerTeleportFlags", "PacketPlayOutPosition$EnumPlayerTeleportFlags"
|
||||
);
|
||||
|
||||
public WrapperPlayServerPosition() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerPosition(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.handle.getDoubles().read(0);
|
||||
}
|
||||
|
||||
public void setX(double value) {
|
||||
this.handle.getDoubles().write(0, value);
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.handle.getDoubles().read(1);
|
||||
}
|
||||
|
||||
public void setY(double value) {
|
||||
this.handle.getDoubles().write(1, value);
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.handle.getDoubles().read(2);
|
||||
}
|
||||
|
||||
public void setZ(double value) {
|
||||
this.handle.getDoubles().write(2, value);
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return this.handle.getFloat().read(0);
|
||||
}
|
||||
|
||||
public void setYaw(float value) {
|
||||
this.handle.getFloat().write(0, value);
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return this.handle.getFloat().read(1);
|
||||
}
|
||||
|
||||
public void setPitch(float value) {
|
||||
this.handle.getFloat().write(1, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private StructureModifier<Set<PlayerTeleportFlag>> getFlagsModifier() {
|
||||
return this.handle.getModifier().withType(
|
||||
Set.class,
|
||||
BukkitConverters.getSetConverter(FLAGS_CLASS, EnumWrappers.getGenericConverter(PlayerTeleportFlag.class))
|
||||
);
|
||||
}
|
||||
|
||||
public Set<PlayerTeleportFlag> getFlags() {
|
||||
return this.getFlagsModifier().read(0);
|
||||
}
|
||||
|
||||
public void setFlags(Set<PlayerTeleportFlag> value) {
|
||||
this.getFlagsModifier().write(0, value);
|
||||
}
|
||||
|
||||
public enum PlayerTeleportFlag {
|
||||
X,
|
||||
Y,
|
||||
Z,
|
||||
Y_ROT,
|
||||
X_ROT
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
|
||||
public class WrapperPlayServerRelEntityMove extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.REL_ENTITY_MOVE;
|
||||
|
||||
public WrapperPlayServerRelEntityMove() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerRelEntityMove(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
public double getDx() {
|
||||
return this.handle.getShorts().read(0) / 4096.0;
|
||||
}
|
||||
|
||||
public void setDx(double value) {
|
||||
this.handle.getShorts().write(0, (short) (value * 32.0 * 128.0));
|
||||
}
|
||||
|
||||
public double getDy() {
|
||||
return this.handle.getShorts().read(1) / 4096.0;
|
||||
}
|
||||
|
||||
public void setDy(double value) {
|
||||
this.handle.getShorts().write(1, (short) (value * 32.0 * 128.0));
|
||||
}
|
||||
|
||||
public double getDz() {
|
||||
return this.handle.getShorts().read(2) / 4096.0;
|
||||
}
|
||||
|
||||
public void setDz(double value) {
|
||||
this.handle.getShorts().write(2, (short) (value * 32.0 * 128.0));
|
||||
}
|
||||
|
||||
public boolean getOnGround() {
|
||||
return this.handle.getSpecificModifier(boolean.class).read(0);
|
||||
}
|
||||
|
||||
public void setOnGround(boolean value) {
|
||||
this.handle.getSpecificModifier(boolean.class).write(0, value);
|
||||
}
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package me.konsolas.aac.internal.packetwrapper;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.injector.PacketConstructor;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY_LIVING;
|
||||
private static PacketConstructor entityConstructor;
|
||||
|
||||
public WrapperPlayServerSpawnEntityLiving() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
this.handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerSpawnEntityLiving(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public WrapperPlayServerSpawnEntityLiving(Entity entity) {
|
||||
super(fromEntity(entity), TYPE);
|
||||
}
|
||||
|
||||
private static PacketContainer fromEntity(Entity entity) {
|
||||
if (entityConstructor == null) {
|
||||
entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, entity);
|
||||
}
|
||||
|
||||
return entityConstructor.createPacket(entity);
|
||||
}
|
||||
|
||||
public int getEntityID() {
|
||||
return this.handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
public Entity getEntity(World world) {
|
||||
return this.handle.getEntityModifier(world).read(0);
|
||||
}
|
||||
|
||||
public Entity getEntity(PacketEvent event) {
|
||||
return this.getEntity(event.getPlayer().getWorld());
|
||||
}
|
||||
|
||||
public void setEntityID(int value) {
|
||||
this.handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public EntityType getType() {
|
||||
return EntityType.fromId(this.handle.getIntegers().read(1));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setType(EntityType value) {
|
||||
this.handle.getIntegers().write(1, (int) value.getTypeId());
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.handle.getDoubles().read(0);
|
||||
}
|
||||
|
||||
public void setX(double value) {
|
||||
this.handle.getDoubles().write(0, value);
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.handle.getDoubles().read(1);
|
||||
}
|
||||
|
||||
public void setY(double value) {
|
||||
this.handle.getDoubles().write(1, value);
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.handle.getDoubles().read(2);
|
||||
}
|
||||
|
||||
public void setZ(double value) {
|
||||
this.handle.getDoubles().write(2, value);
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return this.handle.getBytes().read(0) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setYaw(float value) {
|
||||
this.handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return this.handle.getBytes().read(1) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setPitch(float value) {
|
||||
this.handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public float getHeadPitch() {
|
||||
return this.handle.getBytes().read(2) * 360.0F / 256.0F;
|
||||
}
|
||||
|
||||
public void setHeadPitch(float value) {
|
||||
this.handle.getBytes().write(2, (byte) (value * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public double getVelocityX() {
|
||||
return this.handle.getIntegers().read(5) / 8000.0;
|
||||
}
|
||||
|
||||
public void setVelocityX(double value) {
|
||||
this.handle.getIntegers().write(5, (int) (value * 8000.0));
|
||||
}
|
||||
|
||||
public double getVelocityY() {
|
||||
return this.handle.getIntegers().read(6) / 8000.0;
|
||||
}
|
||||
|
||||
public void setVelocityY(double value) {
|
||||
this.handle.getIntegers().write(6, (int) (value * 8000.0));
|
||||
}
|
||||
|
||||
public double getVelocityZ() {
|
||||
return this.handle.getIntegers().read(7) / 8000.0;
|
||||
}
|
||||
|
||||
public void setVelocityZ(double value) {
|
||||
this.handle.getIntegers().write(7, (int) (value * 8000.0));
|
||||
}
|
||||
|
||||
public WrappedDataWatcher getMetadata() {
|
||||
return this.handle.getDataWatcherModifier().read(0);
|
||||
}
|
||||
|
||||
public void setMetadata(WrappedDataWatcher value) {
|
||||
this.handle.getDataWatcherModifier().write(0, value);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user