Compare commits

...
3 Commits
68 changed files with 2051 additions and 261 deletions

No files matched your search

+5 -5
View File
@@ -1,4 +1,4 @@
# PacketEvents
# packetevents by purplex
Listen to minecraft packets.
PacketEvents coded by purplex.
@@ -24,7 +24,7 @@ allprojects {
}
dependencies {
implementation 'com.github.purplexdev:packetevents:1.1.3'
implementation 'com.github.purplexdev:packetevents:1.1.5'
}
```
@@ -43,7 +43,7 @@ dependencies {
<dependency>
<groupId>com.github.purplexdev</groupId>
<artifactId>packetevents</artifactId>
<version>1.1.3</version>
<version>1.1.5</version>
</dependency>
</dependencies>
```
@@ -53,14 +53,14 @@ dependencies {
```
resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "com.github.purplexdev" % "packetevents" % "1.1.3"
libraryDependencies += "com.github.purplexdev" % "packetevents" % "1.1.5"
```
# leiningen
```
:repositories [["jitpack" "https://jitpack.io"]]
:dependencies [[com.github.purplexdev/packetevents "1.1.3"]]
:dependencies [[com.github.purplexdev/packetevents "1.1.5"]]
```
+2 -2
View File
@@ -6,9 +6,9 @@
<groupId>me.purplex</groupId>
<artifactId>packetevents</artifactId>
<version>1.1.2</version>
<version>1.1.5</version>
<packaging>jar</packaging>
<name>PacketEvents</name>
<name>packetevents</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -5,7 +5,6 @@ import me.purplex.packetevents.events.packetevent.ServerTickEvent;
import me.purplex.packetevents.example.TestExample;
import org.bukkit.Bukkit;
import org.bukkit.event.*;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
@@ -20,13 +19,13 @@ public class Main extends JavaPlugin implements Listener {
instance = this;
Bukkit.getPluginManager().registerEvents(this, this);
packetInjector = new PacketInjector();
PacketEvents.getPacketManager().registerPacketListener(new TestExample());
PacketEvents.getPacketManager().registerListener(new TestExample());
Bukkit.getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
long now = System.currentTimeMillis();
PacketEvents.getPacketManager().callServerTickEvent(new ServerTickEvent(now));
PacketEvents.getPacketManager().callEvent(new ServerTickEvent(now));
}
}, 0L, 1L);
@@ -34,7 +33,12 @@ public class Main extends JavaPlugin implements Listener {
@Override
public void onDisable() {
/**
* You don't need to unregister all events when the server shutsdown,
* This is just an example
*/
PacketEvents.getPacketManager().unregisterListener(new TestExample());
}
@EventHandler
@@ -1,7 +1,7 @@
package me.purplex.packetevents;
import me.purplex.packetevents.enums.ServerVersion;
import me.purplex.packetevents.events.manager.PacketManager;
import me.purplex.packetevents.packetmanager.PacketManager;
public class PacketEvents {
private static PacketManager packetManager;
@@ -11,36 +11,29 @@ import org.bukkit.entity.Player;
public class PacketInjector {
private final static ServerVersion version = ServerVersion.getVersion();
public void injectPlayer(Player player) {
public void injectPlayer(Player player) {
ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object packet) {
public void channelRead(ChannelHandlerContext ctx, Object packet) throws Exception {
String packetName = packet.getClass().getSimpleName();
PacketReceiveEvent e = new PacketReceiveEvent(player, packetName, packet);
PacketEvents.getPacketManager().callPacketReceiveEvent(e);
if(e.isCancelled()) {
PacketEvents.getPacketManager().callEvent(e);
if (e.isCancelled()) {
return;
}
try {
super.channelRead(ctx, packet);
} catch (Exception exception) {
exception.printStackTrace();
}
super.channelRead(ctx, packet);
}
@Override
public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promise) {
public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promise) throws Exception {
String packetName = packet.getClass().getSimpleName();
PacketSendEvent e = new PacketSendEvent(player, packetName, packet);
PacketEvents.getPacketManager().callPacketSendEvent(e);
if(e.isCancelled()) {
PacketEvents.getPacketManager().callEvent(e);
if (e.isCancelled()) {
return;
}
try {
super.write(ctx, packet, promise);
} catch (Exception exception) {
exception.printStackTrace();
}
super.write(ctx, packet, promise);
}
};
Channel channel = getChannel(player);
@@ -50,9 +43,9 @@ public class PacketInjector {
public void uninjectPlayer(Player player) {
Channel channel = getChannel(player);
channel.eventLoop().submit(()->{
channel.pipeline().remove(player.getName());
return null;
channel.eventLoop().submit(() -> {
channel.pipeline().remove(player.getName());
return null;
});
}
@@ -65,52 +58,40 @@ public class PacketInjector {
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
}
else if(version == ServerVersion.v_1_8_3) {
} else if (version == ServerVersion.v_1_8_3) {
net.minecraft.server.v1_8_R2.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.k;
}
else if(version == ServerVersion.v_1_8_8) {
} else if (version == ServerVersion.v_1_8_8) {
net.minecraft.server.v1_8_R3.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_9) {
} else if (version == ServerVersion.v_1_9) {
net.minecraft.server.v1_9_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_9_4) {
} else if (version == ServerVersion.v_1_9_4) {
net.minecraft.server.v1_9_R2.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_10) {
} else if (version == ServerVersion.v_1_10) {
net.minecraft.server.v1_10_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_11) {
} else if (version == ServerVersion.v_1_11) {
net.minecraft.server.v1_11_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_12) {
} else if (version == ServerVersion.v_1_12) {
net.minecraft.server.v1_12_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_13) {
} else if (version == ServerVersion.v_1_13) {
net.minecraft.server.v1_13_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_13_2) {
} else if (version == ServerVersion.v_1_13_2) {
net.minecraft.server.v1_13_R2.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_14) {
} else if (version == ServerVersion.v_1_14) {
net.minecraft.server.v1_14_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else if(version == ServerVersion.v_1_15) {
} else if (version == ServerVersion.v_1_15) {
net.minecraft.server.v1_15_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
channel = networkManager.channel;
}
else {
} else {
System.err.println("Version unsupported, please contact purplex#0001 and tell him what version your server is running on! Make sure you are using paperspigot or spigot.");
}
return channel;
@@ -1,5 +1,6 @@
package me.purplex.packetevents.events.eventmanager;
package me.purplex.packetevents.eventmanager;
import me.purplex.packetevents.events.PacketEvent;
import me.purplex.packetevents.events.packetevent.ServerTickEvent;
import me.purplex.packetevents.events.listener.PacketListener;
import me.purplex.packetevents.events.packetevent.PacketReceiveEvent;
@@ -9,12 +10,13 @@ import java.util.LinkedList;
public interface PacketEventManager {
public LinkedList<PacketListener> packetListeners = new LinkedList<>();
public void callPacketReceiveEvent(PacketReceiveEvent e);
public void callPacketSendEvent(PacketSendEvent e);
public void callEvent(PacketEvent e);
public void registerListener(PacketListener e);
public void unregisterListener(PacketListener e);
public void unregisterAllListeners(PacketListener e);
public void registerPacketListener(PacketListener e);
public void unregisterPacketListener(PacketListener e);
public void callServerTickEvent(ServerTickEvent e);
}
@@ -9,4 +9,5 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
public @interface PacketHandler {
}
@@ -1,77 +0,0 @@
package me.purplex.packetevents.events.manager;
import me.purplex.packetevents.events.packetevent.ServerTickEvent;
import me.purplex.packetevents.events.eventmanager.PacketEventManager;
import me.purplex.packetevents.events.handler.PacketHandler;
import me.purplex.packetevents.events.listener.PacketListener;
import me.purplex.packetevents.events.packetevent.PacketReceiveEvent;
import me.purplex.packetevents.events.packetevent.PacketSendEvent;
import java.lang.reflect.Method;
public class PacketManager implements PacketEventManager {
@Override
public void callPacketReceiveEvent(PacketReceiveEvent e) {
for (PacketListener listener : this.packetListeners) {
Method[] methods = listener.getClass().getMethods();
for (Method m : methods) {
if (m.isAnnotationPresent(PacketHandler.class)) {
if (m.getParameterTypes()[0].getSimpleName().equals(e.getClass().getSimpleName())) {
try {
m.invoke(listener, e);
} catch (Exception ex) {
}
}
}
}
}
}
@Override
public void callPacketSendEvent(PacketSendEvent e) {
for (PacketListener listener : this.packetListeners) {
Method[] methods = listener.getClass().getMethods();
for (Method m : methods) {
if (m.isAnnotationPresent(PacketHandler.class)) {
if (m.getParameterTypes()[0].getSimpleName().equals(e.getClass().getSimpleName())) {
try {
m.invoke(listener, e);
} catch (Exception ex) {
}
}
}
}
}
}
@Override
public void registerPacketListener(PacketListener e) {
this.packetListeners.add(e);
}
@Override
public void unregisterPacketListener(PacketListener e) {
this.packetListeners.remove(e);
}
@Override
public void callServerTickEvent(ServerTickEvent e) {
for (PacketListener listener : this.packetListeners) {
Method[] methods = listener.getClass().getMethods();
for (Method m : methods) {
if (m.isAnnotationPresent(PacketHandler.class)) {
if (m.getParameterTypes()[0].getSimpleName().equals(e.getClass().getSimpleName())) {
try {
m.invoke(listener, e);
} catch (Exception ex) {
}
}
}
}
}
}
}
@@ -7,7 +7,7 @@ import me.purplex.packetevents.events.packetevent.ServerTickEvent;
import me.purplex.packetevents.events.handler.PacketHandler;
import me.purplex.packetevents.events.listener.PacketListener;
import me.purplex.packetevents.events.packetevent.*;
import me.purplex.packetevents.events.packetevent.packet.impl.in.*;
import me.purplex.packetevents.packetwrappers.in.*;
import me.purplex.packetevents.packets.Packet;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -21,35 +21,49 @@ public class TestExample implements PacketListener {
private int tick;
private static ServerVersion serverVersion = ServerVersion.getVersion();
@PacketHandler
public void onPacketReceive(PacketReceiveEvent e) {
Player p = e.getPlayer();
final Player p = e.getPlayer();
//ONLY CLIENT PACKETS ALLOWED HERE!
switch (e.getPacketName()) {
case Packet.Client.USE_ENTITY:
WrappedPacketPlayInUseEntity useEntity = new WrappedPacketPlayInUseEntity(e.getPacket());
Entity entity = useEntity.getEntity();
final WrappedPacketPlayInUseEntity useEntity = new WrappedPacketPlayInUseEntity(e.getPacket());
final Entity entity = useEntity.getEntity();
if (useEntity.getEntityUseAction() == EntityUseAction.ATTACK) {
double dist = entity.getLocation().distanceSquared(p.getLocation());
final double dist = entity.getLocation().distanceSquared(p.getLocation());
//p.sendMessage("dist: " + dist);
}
break;
case Packet.Client.ABILITIES:
WrappedPacketPlayInAbilities abilities = new WrappedPacketPlayInAbilities(e.getPacket());
boolean a = abilities.a;
boolean b = abilities.b;
boolean c = abilities.c;
boolean d = abilities.d;
float eFloat = abilities.e;
float fFloat = abilities.f;
final WrappedPacketPlayInAbilities abilities = new WrappedPacketPlayInAbilities(e.getPacket());
final boolean a = abilities.a;
final boolean b = abilities.b;
final boolean c = abilities.c;
final boolean d = abilities.d;
final float eFloat = abilities.e;
final float fFloat = abilities.f;
//just like the 1.8 NMS classes.
break;
case Packet.Client.BLOCK_DIG:
WrappedPacketPlayInBlockDig blockDig = new WrappedPacketPlayInBlockDig(e.getPacket());
PlayerDigType type = blockDig.digType;
final WrappedPacketPlayInBlockDig blockDig = new WrappedPacketPlayInBlockDig(e.getPacket());
final PlayerDigType type = blockDig.getPlayerDigType();
break;
case Packet.Client.FLYING:
final WrappedPacketPlayInFlying flying = new WrappedPacketPlayInFlying(e.getPacket());
final float pitch = flying.pitch;
final float yaw = flying.yaw;
final boolean hasPos = flying.hasPos;
final boolean hasLook = flying.hasLook;
break;
case Packet.Client.POSITION:
final WrappedPacketPlayInFlying.WrappedPacketPlayInPosition position =
new WrappedPacketPlayInFlying.WrappedPacketPlayInPosition(e.getPacket());
final boolean isPos = position.hasPos; //true
break;
case Packet.Client.POSITION_LOOK:
final WrappedPacketPlayInFlying.WrappedPacketPlayInPosition_Look position_look =
new WrappedPacketPlayInFlying.WrappedPacketPlayInPosition_Look(e.getPacket());
final boolean isLook = position_look.hasLook; //true
break;
}
}
@@ -0,0 +1,88 @@
package me.purplex.packetevents.packetmanager;
import me.purplex.packetevents.events.PacketEvent;
import me.purplex.packetevents.events.packetevent.ServerTickEvent;
import me.purplex.packetevents.eventmanager.PacketEventManager;
import me.purplex.packetevents.events.handler.PacketHandler;
import me.purplex.packetevents.events.listener.PacketListener;
import me.purplex.packetevents.events.packetevent.PacketReceiveEvent;
import me.purplex.packetevents.events.packetevent.PacketSendEvent;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class PacketManager implements PacketEventManager {
@Override
public void callEvent(PacketEvent e) {
for (PacketListener listener : this.packetListeners) {
Method[] methods = listener.getClass().getMethods();
for (Method m : methods) {
if (m.isAnnotationPresent(PacketHandler.class)) {
if(e instanceof PacketReceiveEvent) {
PacketReceiveEvent event = (PacketReceiveEvent)e;
if(m.getParameterTypes()[0].getSimpleName().equals(event.getClass().getSimpleName())) {
try {
m.invoke(listener, event);
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (InvocationTargetException ex) {
ex.printStackTrace();
}
}
}
else if(e instanceof PacketSendEvent) {
PacketSendEvent event = (PacketSendEvent)e;
if(m.getParameterTypes()[0].getSimpleName().equals(event.getClass().getSimpleName())) {
try {
m.invoke(listener, event);
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (InvocationTargetException ex) {
ex.printStackTrace();
}
}
}
else if(e instanceof ServerTickEvent) {
ServerTickEvent event = (ServerTickEvent)e;
if(m.getParameterTypes()[0].getSimpleName().equals(event.getClass().getSimpleName())) {
try {
m.invoke(listener, event);
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (InvocationTargetException ex) {
ex.printStackTrace();
}
}
}
else {
if(m.getParameterTypes()[0].getSimpleName().equals(e.getClass().getSimpleName())) {
try {
m.invoke(listener, e);
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (InvocationTargetException ex) {
ex.printStackTrace();
}
}
}
}
}
}
}
@Override
public void registerListener(PacketListener e) {
this.packetListeners.add(e);
}
@Override
public void unregisterListener(PacketListener e) {
this.packetListeners.remove(e);
}
@Override
public void unregisterAllListeners(PacketListener e) {
this.packetListeners.clear();
}
}
@@ -0,0 +1,20 @@
package me.purplex.packetevents.packetwrappers.api;
import me.purplex.packetevents.enums.ServerVersion;
/**
* All the wrappers are still under development.
* It is a lot of work, I must make 13 wrappers for each packet.
*/
public class WrappedPacket {
protected Object packet;
protected static final ServerVersion version = ServerVersion.getVersion();
public WrappedPacket(Object packet) {
this.packet = packet;
setup();
}
protected void setup() {
}
}
@@ -1,24 +1,23 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in;
package me.purplex.packetevents.packetwrappers.in;
import me.purplex.packetevents.enums.ServerVersion;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_10.WrappedPacketPlayInAbilities_1_10;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_11.WrappedPacketPlayInAbilities_1_11;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_12.WrappedPacketPlayInAbilities_1_12;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_13.WrappedPacketPlayInAbilities_1_13;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2.WrappedPacketPlayInAbilities_1_13_2;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_14.WrappedPacketPlayInAbilities_1_14;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_15.WrappedPacketPlayInAbilities_1_15;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_7_10.WrappedPacketPlayInAbilities_1_7_10;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8.WrappedPacketPlayInAbilities_1_8;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3.WrappedPacketPlayInAbilities_1_8_3;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_8.WrappedPacketPlayInAbilities_1_8_8;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_9.WrappedPacketPlayInAbilities_1_9;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4.WrappedPacketPlayInAbilities_1_9_4;
import me.purplex.packetevents.packetwrappers.api.WrappedPacket;
import me.purplex.packetevents.packetwrappers.in._1_10.WrappedPacketPlayInAbilities_1_10;
import me.purplex.packetevents.packetwrappers.in._1_11.WrappedPacketPlayInAbilities_1_11;
import me.purplex.packetevents.packetwrappers.in._1_12.WrappedPacketPlayInAbilities_1_12;
import me.purplex.packetevents.packetwrappers.in._1_13.WrappedPacketPlayInAbilities_1_13;
import me.purplex.packetevents.packetwrappers.in._1_13_2.WrappedPacketPlayInAbilities_1_13_2;
import me.purplex.packetevents.packetwrappers.in._1_14.WrappedPacketPlayInAbilities_1_14;
import me.purplex.packetevents.packetwrappers.in._1_15.WrappedPacketPlayInAbilities_1_15;
import me.purplex.packetevents.packetwrappers.in._1_7_10.WrappedPacketPlayInAbilities_1_7_10;
import me.purplex.packetevents.packetwrappers.in._1_8.WrappedPacketPlayInAbilities_1_8;
import me.purplex.packetevents.packetwrappers.in._1_8_3.WrappedPacketPlayInAbilities_1_8_3;
import me.purplex.packetevents.packetwrappers.in._1_8_8.WrappedPacketPlayInAbilities_1_8_8;
import me.purplex.packetevents.packetwrappers.in._1_9.WrappedPacketPlayInAbilities_1_9;
import me.purplex.packetevents.packetwrappers.in._1_9_4.WrappedPacketPlayInAbilities_1_9_4;
public class WrappedPacketPlayInAbilities {
private final ServerVersion version;
private final Object packet;
public class WrappedPacketPlayInAbilities extends WrappedPacket {
public boolean a;
public boolean b;
@@ -28,13 +27,11 @@ public class WrappedPacketPlayInAbilities {
public float f;
public WrappedPacketPlayInAbilities(Object packet) {
this.version = ServerVersion.getVersion();
this.packet = packet;
setupFields();
super(packet);
}
private void setupFields() {
@Override
protected void setup() {
if(version == ServerVersion.v_1_7_10) {
WrappedPacketPlayInAbilities_1_7_10 p = new WrappedPacketPlayInAbilities_1_7_10(packet);
this.a = p.a;
@@ -1,34 +1,38 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in;
package me.purplex.packetevents.packetwrappers.in;
import me.purplex.packetevents.enums.PlayerDigType;
import me.purplex.packetevents.enums.ServerVersion;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_10.WrappedPacketPlayInBlockDig_1_10;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_11.WrappedPacketPlayInBlockDig_1_11;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_12.WrappedPacketPlayInBlockDig_1_12;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_13.WrappedPacketPlayInBlockDig_1_13;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2.WrappedPacketPlayInBlockDig_1_13_2;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_14.WrappedPacketPlayInBlockDig_1_14;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_15.WrappedPacketPlayInBlockDig_1_15;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_7_10.WrappedPacketPlayInBlockDig_1_7_10;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8.WrappedPacketPlayInBlockDig_1_8;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3.WrappedPacketPlayInBlockDig_1_8_3;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_8.WrappedPacketPlayInBlockDig_1_8_8;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_9.WrappedPacketPlayInBlockDig_1_9;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4.WrappedPacketPlayInBlockDig_1_9_4;
import me.purplex.packetevents.packetwrappers.api.WrappedPacket;
import me.purplex.packetevents.packetwrappers.in._1_10.WrappedPacketPlayInBlockDig_1_10;
import me.purplex.packetevents.packetwrappers.in._1_11.WrappedPacketPlayInBlockDig_1_11;
import me.purplex.packetevents.packetwrappers.in._1_12.WrappedPacketPlayInBlockDig_1_12;
import me.purplex.packetevents.packetwrappers.in._1_13.WrappedPacketPlayInBlockDig_1_13;
import me.purplex.packetevents.packetwrappers.in._1_13_2.WrappedPacketPlayInBlockDig_1_13_2;
import me.purplex.packetevents.packetwrappers.in._1_14.WrappedPacketPlayInBlockDig_1_14;
import me.purplex.packetevents.packetwrappers.in._1_15.WrappedPacketPlayInBlockDig_1_15;
import me.purplex.packetevents.packetwrappers.in._1_7_10.WrappedPacketPlayInBlockDig_1_7_10;
import me.purplex.packetevents.packetwrappers.in._1_8.WrappedPacketPlayInBlockDig_1_8;
import me.purplex.packetevents.packetwrappers.in._1_8_3.WrappedPacketPlayInBlockDig_1_8_3;
import me.purplex.packetevents.packetwrappers.in._1_8_8.WrappedPacketPlayInBlockDig_1_8_8;
import me.purplex.packetevents.packetwrappers.in._1_9.WrappedPacketPlayInBlockDig_1_9;
import me.purplex.packetevents.packetwrappers.in._1_9_4.WrappedPacketPlayInBlockDig_1_9_4;
public class WrappedPacketPlayInBlockDig extends WrappedPacket {
private PlayerDigType digType;
public class WrappedPacketPlayInBlockDig {
private final Object packet;
private final ServerVersion version = ServerVersion.getVersion();
public WrappedPacketPlayInBlockDig(Object packet) {
this.packet = packet;
setupDigType();
super(packet);
}
public PlayerDigType digType;
public PlayerDigType getPlayerDigType() {
return digType;
}
public void setupDigType() {
@Override
public void setup() {
if(version == ServerVersion.v_1_7_10) {
WrappedPacketPlayInBlockDig_1_7_10 p = new WrappedPacketPlayInBlockDig_1_7_10(packet);
WrappedPacketPlayInBlockDig_1_7_10 p = new WrappedPacketPlayInBlockDig_1_7_10(this.packet);
this.digType = p.digType;
}
else if (version == ServerVersion.v_1_8) {
@@ -0,0 +1,439 @@
package me.purplex.packetevents.packetwrappers.in;
import me.purplex.packetevents.enums.ServerVersion;
import me.purplex.packetevents.packetwrappers.api.WrappedPacket;
import me.purplex.packetevents.packetwrappers.in._1_10.WrappedPacketPlayInFlying_1_10;
import me.purplex.packetevents.packetwrappers.in._1_11.WrappedPacketPlayInFlying_1_11;
import me.purplex.packetevents.packetwrappers.in._1_12.WrappedPacketPlayInFlying_1_12;
import me.purplex.packetevents.packetwrappers.in._1_13.WrappedPacketPlayInFlying_1_13;
import me.purplex.packetevents.packetwrappers.in._1_13_2.WrappedPacketPlayInFlying_1_13_2;
import me.purplex.packetevents.packetwrappers.in._1_14.WrappedPacketPlayInFlying_1_14;
import me.purplex.packetevents.packetwrappers.in._1_15.WrappedPacketPlayInFlying_1_15;
import me.purplex.packetevents.packetwrappers.in._1_7_10.WrappedPacketPlayInFlying_1_7_10;
import me.purplex.packetevents.packetwrappers.in._1_8.WrappedPacketPlayInFlying_1_8;
import me.purplex.packetevents.packetwrappers.in._1_8_3.WrappedPacketPlayInFlying_1_8_3;
import me.purplex.packetevents.packetwrappers.in._1_8_8.WrappedPacketPlayInFlying_1_8_8;
import me.purplex.packetevents.packetwrappers.in._1_9.WrappedPacketPlayInFlying_1_9;
import me.purplex.packetevents.packetwrappers.in._1_9_4.WrappedPacketPlayInFlying_1_9_4;
public class WrappedPacketPlayInFlying extends WrappedPacket {
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying(Object packet) {
super(packet);
}
@Override
protected void setup(){
if(version == ServerVersion.v_1_7_10) {
WrappedPacketPlayInFlying_1_7_10 p = new WrappedPacketPlayInFlying_1_7_10(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8) {
WrappedPacketPlayInFlying_1_8 p = new WrappedPacketPlayInFlying_1_8(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8_3) {
WrappedPacketPlayInFlying_1_8_3 p = new WrappedPacketPlayInFlying_1_8_3(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8_8) {
WrappedPacketPlayInFlying_1_8_8 p = new WrappedPacketPlayInFlying_1_8_8(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_9) {
WrappedPacketPlayInFlying_1_9 p = new WrappedPacketPlayInFlying_1_9(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_9_4) {
WrappedPacketPlayInFlying_1_9_4 p = new WrappedPacketPlayInFlying_1_9_4(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_10) {
WrappedPacketPlayInFlying_1_10 p = new WrappedPacketPlayInFlying_1_10(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version== ServerVersion.v_1_11) {
WrappedPacketPlayInFlying_1_11 p = new WrappedPacketPlayInFlying_1_11(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_12) {
WrappedPacketPlayInFlying_1_12 p = new WrappedPacketPlayInFlying_1_12(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version== ServerVersion.v_1_13) {
WrappedPacketPlayInFlying_1_13 p = new WrappedPacketPlayInFlying_1_13(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_13_2) {
WrappedPacketPlayInFlying_1_13_2 p = new WrappedPacketPlayInFlying_1_13_2(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_14) {
WrappedPacketPlayInFlying_1_14 p = new WrappedPacketPlayInFlying_1_14(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_15) {
WrappedPacketPlayInFlying_1_15 p = new WrappedPacketPlayInFlying_1_15(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
}
public static class WrappedPacketPlayInPosition extends WrappedPacketPlayInFlying {
public WrappedPacketPlayInPosition(Object packet) {
super(packet);
}
@Override
protected void setup() {
if(version == ServerVersion.v_1_7_10) {
WrappedPacketPlayInFlying_1_7_10.WrappedPacketPlayInPosition_1_7_10 p
= new WrappedPacketPlayInFlying_1_7_10.WrappedPacketPlayInPosition_1_7_10(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8) {
WrappedPacketPlayInFlying_1_8.WrappedPacketPlayInPosition_1_8 p
= new WrappedPacketPlayInFlying_1_8.WrappedPacketPlayInPosition_1_8(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8_3) {
WrappedPacketPlayInFlying_1_8_3.WrappedPacketPlayInPosition_1_8_3 p
= new WrappedPacketPlayInFlying_1_8_3.WrappedPacketPlayInPosition_1_8_3(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8_8) {
WrappedPacketPlayInFlying_1_8_8.WrappedPacketPlayInPosition_1_8_8 p
= new WrappedPacketPlayInFlying_1_8_8.WrappedPacketPlayInPosition_1_8_8(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_9) {
WrappedPacketPlayInFlying_1_9.WrappedPacketPlayInPosition_1_9 p
= new WrappedPacketPlayInFlying_1_9.WrappedPacketPlayInPosition_1_9(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_9_4) {
WrappedPacketPlayInFlying_1_9_4.WrappedPacketPlayInPosition_1_9_4 p
= new WrappedPacketPlayInFlying_1_9_4.WrappedPacketPlayInPosition_1_9_4(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_10) {
WrappedPacketPlayInFlying_1_10.WrappedPacketPlayInPosition_1_10 p
= new WrappedPacketPlayInFlying_1_10.WrappedPacketPlayInPosition_1_10(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version== ServerVersion.v_1_11) {
WrappedPacketPlayInFlying_1_11.WrappedPacketPlayInPosition_1_11 p
= new WrappedPacketPlayInFlying_1_11.WrappedPacketPlayInPosition_1_11(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_12) {
WrappedPacketPlayInFlying_1_12.WrappedPacketPlayInPosition_1_12 p
= new WrappedPacketPlayInFlying_1_12.WrappedPacketPlayInPosition_1_12(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version== ServerVersion.v_1_13) {
WrappedPacketPlayInFlying_1_13.WrappedPacketPlayInPosition_1_13 p
= new WrappedPacketPlayInFlying_1_13.WrappedPacketPlayInPosition_1_13(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_13_2) {
WrappedPacketPlayInFlying_1_13_2.WrappedPacketPlayInPosition_1_13_2 p
= new WrappedPacketPlayInFlying_1_13_2.WrappedPacketPlayInPosition_1_13_2(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_14) {
WrappedPacketPlayInFlying_1_14.WrappedPacketPlayInPosition_1_14 p
= new WrappedPacketPlayInFlying_1_14.WrappedPacketPlayInPosition_1_14(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_15) {
WrappedPacketPlayInFlying_1_15.WrappedPacketPlayInPosition_1_15 p
= new WrappedPacketPlayInFlying_1_15.WrappedPacketPlayInPosition_1_15(packet);
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
}
}
public static class WrappedPacketPlayInPosition_Look extends WrappedPacketPlayInFlying {
public WrappedPacketPlayInPosition_Look(Object packet) {
super(packet);
}
@Override
protected void setup() {
if(version == ServerVersion.v_1_7_10) {
WrappedPacketPlayInFlying_1_7_10.WrappedPacketPlayInPosition_Look_1_7_10 p
= new WrappedPacketPlayInFlying_1_7_10.WrappedPacketPlayInPosition_Look_1_7_10(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8) {
WrappedPacketPlayInFlying_1_8.WrappedPacketPlayInPosition_Look_1_8 p
= new WrappedPacketPlayInFlying_1_8.WrappedPacketPlayInPosition_Look_1_8(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8_3) {
WrappedPacketPlayInFlying_1_8_3.WrappedPacketPlayInPosition_Look_1_8_3 p
= new WrappedPacketPlayInFlying_1_8_3.WrappedPacketPlayInPosition_Look_1_8_3(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_8_8) {
WrappedPacketPlayInFlying_1_8_8.WrappedPacketPlayInPosition_Look_1_8_8 p
= new WrappedPacketPlayInFlying_1_8_8.WrappedPacketPlayInPosition_Look_1_8_8(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_9) {
WrappedPacketPlayInFlying_1_9.WrappedPacketPlayInPosition_Look_1_9 p
= new WrappedPacketPlayInFlying_1_9.WrappedPacketPlayInPosition_Look_1_9(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_9_4) {
WrappedPacketPlayInFlying_1_9_4.WrappedPacketPlayInPosition_Look_1_9_4 p
= new WrappedPacketPlayInFlying_1_9_4.WrappedPacketPlayInPosition_Look_1_9_4(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_10) {
WrappedPacketPlayInFlying_1_10.WrappedPacketPlayInPosition_Look_1_10 p
= new WrappedPacketPlayInFlying_1_10.WrappedPacketPlayInPosition_Look_1_10(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version== ServerVersion.v_1_11) {
WrappedPacketPlayInFlying_1_11.WrappedPacketPlayInPosition_Look_1_11 p
= new WrappedPacketPlayInFlying_1_11.WrappedPacketPlayInPosition_Look_1_11(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_12) {
WrappedPacketPlayInFlying_1_12.WrappedPacketPlayInPosition_Look_1_12 p
= new WrappedPacketPlayInFlying_1_12.WrappedPacketPlayInPosition_Look_1_12(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version== ServerVersion.v_1_13) {
WrappedPacketPlayInFlying_1_13.WrappedPacketPlayInPosition_Look_1_13 p
= new WrappedPacketPlayInFlying_1_13.WrappedPacketPlayInPosition_Look_1_13(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_13_2) {
WrappedPacketPlayInFlying_1_13_2.WrappedPacketPlayInPosition_Look_1_13_2 p
= new WrappedPacketPlayInFlying_1_13_2.WrappedPacketPlayInPosition_Look_1_13_2(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_14) {
WrappedPacketPlayInFlying_1_14.WrappedPacketPlayInPosition_Look_1_14 p
= new WrappedPacketPlayInFlying_1_14.WrappedPacketPlayInPosition_Look_1_14(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
else if(version == ServerVersion.v_1_15) {
WrappedPacketPlayInFlying_1_15.WrappedPacketPlayInPosition_Look_1_15 p
= new WrappedPacketPlayInFlying_1_15.WrappedPacketPlayInPosition_Look_1_15(packet);
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.yaw = p.yaw;
this.pitch = p.pitch;
this.f = p.f;
this.hasPos = p.hasPos;
this.hasLook = p.hasLook;
}
}
}
}
@@ -1,32 +1,30 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in;
package me.purplex.packetevents.packetwrappers.in;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_10.WrappedPacketPlayInUseEntity_1_10;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_11.WrappedPacketPlayInUseEntity_1_11;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_12.WrappedPacketPlayInUseEntity_1_12;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_13.WrappedPacketPlayInUseEntity_1_13;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2.WrappedPacketPlayInUseEntity_1_13_2;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_14.WrappedPacketPlayInUseEntity_1_14;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_15.WrappedPacketPlayInUseEntity_1_15;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_7_10.WrappedPacketPlayInUseEntity_1_7_10;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8.WrappedPacketPlayInUseEntity_1_8;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3.WrappedPacketPlayInUseEntity_1_8_3;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_8.WrappedPacketPlayInUseEntity_1_8_8;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_9.WrappedPacketPlayInUseEntity_1_9;
import me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4.WrappedPacketPlayInUseEntity_1_9_4;
import me.purplex.packetevents.packetwrappers.api.WrappedPacket;
import me.purplex.packetevents.packetwrappers.in._1_10.WrappedPacketPlayInUseEntity_1_10;
import me.purplex.packetevents.packetwrappers.in._1_11.WrappedPacketPlayInUseEntity_1_11;
import me.purplex.packetevents.packetwrappers.in._1_12.WrappedPacketPlayInUseEntity_1_12;
import me.purplex.packetevents.packetwrappers.in._1_13.WrappedPacketPlayInUseEntity_1_13;
import me.purplex.packetevents.packetwrappers.in._1_13_2.WrappedPacketPlayInUseEntity_1_13_2;
import me.purplex.packetevents.packetwrappers.in._1_14.WrappedPacketPlayInUseEntity_1_14;
import me.purplex.packetevents.packetwrappers.in._1_15.WrappedPacketPlayInUseEntity_1_15;
import me.purplex.packetevents.packetwrappers.in._1_7_10.WrappedPacketPlayInUseEntity_1_7_10;
import me.purplex.packetevents.packetwrappers.in._1_8.WrappedPacketPlayInUseEntity_1_8;
import me.purplex.packetevents.packetwrappers.in._1_8_3.WrappedPacketPlayInUseEntity_1_8_3;
import me.purplex.packetevents.packetwrappers.in._1_8_8.WrappedPacketPlayInUseEntity_1_8_8;
import me.purplex.packetevents.packetwrappers.in._1_9.WrappedPacketPlayInUseEntity_1_9;
import me.purplex.packetevents.packetwrappers.in._1_9_4.WrappedPacketPlayInUseEntity_1_9_4;
import org.bukkit.entity.Entity;
public class WrappedPacketPlayInUseEntity {
private final ServerVersion version;
public class WrappedPacketPlayInUseEntity extends WrappedPacket {
private Entity entity;
private EntityUseAction action;
private final Object packet;
public WrappedPacketPlayInUseEntity(Object packet) {
this.version = ServerVersion.getVersion();
this.packet = packet;
setup();
super(packet);
}
public Entity getEntity() {
@@ -37,7 +35,8 @@ public class WrappedPacketPlayInUseEntity {
return action;
}
private void setup() {
@Override
protected void setup() {
if(version == ServerVersion.v_1_7_10) {
WrappedPacketPlayInUseEntity_1_7_10 p = new WrappedPacketPlayInUseEntity_1_7_10(packet);
this.entity = p.getEntity();
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_10;
package me.purplex.packetevents.packetwrappers.in._1_10;
import net.minecraft.server.v1_10_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_10;
package me.purplex.packetevents.packetwrappers.in._1_10;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_10_R1.PacketPlayInBlockDig;
@@ -0,0 +1,122 @@
package me.purplex.packetevents.packetwrappers.in._1_10;
import net.minecraft.server.v1_10_R1.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_10 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_10(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_10 extends WrappedPacketPlayInFlying_1_10 {
public WrappedPacketPlayInPosition_1_10(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_10 extends WrappedPacketPlayInFlying_1_10 {
public WrappedPacketPlayInPosition_Look_1_10(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_10;
package me.purplex.packetevents.packetwrappers.in._1_10;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_11;
package me.purplex.packetevents.packetwrappers.in._1_11;
import net.minecraft.server.v1_11_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_11;
package me.purplex.packetevents.packetwrappers.in._1_11;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_11_R1.PacketPlayInBlockDig;
@@ -0,0 +1,123 @@
package me.purplex.packetevents.packetwrappers.in._1_11;
import net.minecraft.server.v1_11_R1.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_11 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_11(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_11 extends WrappedPacketPlayInFlying_1_11{
public WrappedPacketPlayInPosition_1_11(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_11 extends WrappedPacketPlayInFlying_1_11 {
public WrappedPacketPlayInPosition_Look_1_11(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_11;
package me.purplex.packetevents.packetwrappers.in._1_11;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_12;
package me.purplex.packetevents.packetwrappers.in._1_12;
import net.minecraft.server.v1_12_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_12;
package me.purplex.packetevents.packetwrappers.in._1_12;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_12_R1.PacketPlayInBlockDig;
@@ -0,0 +1,122 @@
package me.purplex.packetevents.packetwrappers.in._1_12;
import net.minecraft.server.v1_12_R1.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_12 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_12(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_12 extends WrappedPacketPlayInFlying_1_12 {
public WrappedPacketPlayInPosition_1_12(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_12 extends WrappedPacketPlayInFlying_1_12 {
public WrappedPacketPlayInPosition_Look_1_12(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_12;
package me.purplex.packetevents.packetwrappers.in._1_12;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13;
package me.purplex.packetevents.packetwrappers.in._1_13;
import net.minecraft.server.v1_13_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13;
package me.purplex.packetevents.packetwrappers.in._1_13;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_13_R1.PacketPlayInBlockDig;
@@ -0,0 +1,122 @@
package me.purplex.packetevents.packetwrappers.in._1_13;
import net.minecraft.server.v1_13_R1.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_13 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_13(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_13 extends WrappedPacketPlayInFlying_1_13{
public WrappedPacketPlayInPosition_1_13(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_13 extends WrappedPacketPlayInFlying_1_13 {
public WrappedPacketPlayInPosition_Look_1_13(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13;
package me.purplex.packetevents.packetwrappers.in._1_13;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2;
package me.purplex.packetevents.packetwrappers.in._1_13_2;
import net.minecraft.server.v1_13_R2.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2;
package me.purplex.packetevents.packetwrappers.in._1_13_2;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_13_R2.PacketPlayInBlockDig;
@@ -0,0 +1,122 @@
package me.purplex.packetevents.packetwrappers.in._1_13_2;
import net.minecraft.server.v1_13_R2.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_13_2 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_13_2(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_13_2 extends WrappedPacketPlayInFlying_1_13_2 {
public WrappedPacketPlayInPosition_1_13_2(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_13_2 extends WrappedPacketPlayInFlying_1_13_2 {
public WrappedPacketPlayInPosition_Look_1_13_2(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2;
package me.purplex.packetevents.packetwrappers.in._1_13_2;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_14;
package me.purplex.packetevents.packetwrappers.in._1_14;
import net.minecraft.server.v1_14_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_14;
package me.purplex.packetevents.packetwrappers.in._1_14;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_14_R1.PacketPlayInBlockDig;
@@ -0,0 +1,123 @@
package me.purplex.packetevents.packetwrappers.in._1_14;
import net.minecraft.server.v1_14_R1.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_14 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_14(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_14 extends WrappedPacketPlayInFlying_1_14 {
public WrappedPacketPlayInPosition_1_14(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_14 extends WrappedPacketPlayInFlying_1_14 {
public WrappedPacketPlayInPosition_Look_1_14(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_14;
package me.purplex.packetevents.packetwrappers.in._1_14;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_15;
package me.purplex.packetevents.packetwrappers.in._1_15;
import net.minecraft.server.v1_15_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_15;
package me.purplex.packetevents.packetwrappers.in._1_15;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_15_R1.PacketPlayInBlockDig;
@@ -0,0 +1,122 @@
package me.purplex.packetevents.packetwrappers.in._1_15;
import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_15 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_15(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_15 extends WrappedPacketPlayInFlying_1_15 {
public WrappedPacketPlayInPosition_1_15(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_15 extends WrappedPacketPlayInFlying_1_15 {
public WrappedPacketPlayInPosition_Look_1_15(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_15;
package me.purplex.packetevents.packetwrappers.in._1_15;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_7_10;
package me.purplex.packetevents.packetwrappers.in._1_7_10;
import net.minecraft.server.v1_7_R4.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_7_10;
package me.purplex.packetevents.packetwrappers.in._1_7_10;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_7_R4.PacketPlayInBlockDig;
@@ -0,0 +1,49 @@
package me.purplex.packetevents.packetwrappers.in._1_7_10;
import net.minecraft.server.v1_7_R4.PacketPlayInFlying;
public class WrappedPacketPlayInFlying_1_7_10 {
private final Object packet;
public WrappedPacketPlayInFlying_1_7_10(Object packet) {
this.packet = packet;
setupFields();
}
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
private void setupFields() {
PacketPlayInFlying p = (PacketPlayInFlying)packet;
this.x = p.c();
this.y = p.d();
this.z = p.e();
this.yaw = p.g();
this.pitch = p.h();
this.f = p.i();
}
public static class WrappedPacketPlayInPosition_1_7_10 extends WrappedPacketPlayInFlying_1_7_10 {
public WrappedPacketPlayInPosition_1_7_10(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_7_10 extends WrappedPacketPlayInFlying_1_7_10 {
public WrappedPacketPlayInPosition_Look_1_7_10(Object packet) {
super(packet);
this.hasLook = true;
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_7_10;
package me.purplex.packetevents.packetwrappers.in._1_7_10;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8;
package me.purplex.packetevents.packetwrappers.in._1_8;
import net.minecraft.server.v1_8_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8;
package me.purplex.packetevents.packetwrappers.in._1_8;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_8_R1.PacketPlayInBlockDig;
@@ -0,0 +1,54 @@
package me.purplex.packetevents.packetwrappers.in._1_8;
import net.minecraft.server.v1_8_R1.PacketPlayInFlying;
public class WrappedPacketPlayInFlying_1_8 {
private final Object packet;
public WrappedPacketPlayInFlying_1_8(Object packet) {
this.packet = packet;
setupFields();
}
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
private void setupFields() {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.x = p.a();
this.y = p.b();
this.z = p.c();
this.yaw = p.d();
this.pitch = p.e();
this.f = p.f();
this.hasPos = p.g();
this.hasLook = p.h();
}
public static class WrappedPacketPlayInPosition_1_8 extends WrappedPacketPlayInFlying_1_8 {
public WrappedPacketPlayInPosition_1_8(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_8 extends WrappedPacketPlayInFlying_1_8 {
public WrappedPacketPlayInPosition_Look_1_8(Object packet) {
super(packet);
this.hasLook = true;
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8;
package me.purplex.packetevents.packetwrappers.in._1_8;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3;
package me.purplex.packetevents.packetwrappers.in._1_8_3;
import net.minecraft.server.v1_8_R2.PacketPlayInAbilities;
@@ -7,8 +7,21 @@ import java.lang.reflect.Field;
public class WrappedPacketPlayInAbilities_1_8_3 {
private final Object packet;
private Field fieldE;
private Field fieldF;
private static Field fieldE;
private static Field fieldF;
static {
try {
fieldF = PacketPlayInAbilities.class.getDeclaredField("e");
} catch (NoSuchFieldException noSuchFieldException) {
noSuchFieldException.printStackTrace();
} try {
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
} catch (NoSuchFieldException noSuchFieldException) {
noSuchFieldException.printStackTrace();
}
}
public WrappedPacketPlayInAbilities_1_8_3(Object packet) {
this.packet = packet;
try {
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3;
package me.purplex.packetevents.packetwrappers.in._1_8_3;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_8_R2.PacketPlayInBlockDig;
@@ -0,0 +1,50 @@
package me.purplex.packetevents.packetwrappers.in._1_8_3;
import net.minecraft.server.v1_8_R2.PacketPlayInFlying;
public class WrappedPacketPlayInFlying_1_8_3 {
private final Object packet;
public WrappedPacketPlayInFlying_1_8_3(Object packet) {
this.packet = packet;
setupFields();
}
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
private void setupFields() {
PacketPlayInFlying p = (PacketPlayInFlying)packet;
this.x = p.a();
this.y = p.b();
this.z = p.c();
this.yaw = p.d();
this.pitch = p.e();
this.f = p.f();
this.hasPos = p.g();
this.hasLook = p.h();
}
public static class WrappedPacketPlayInPosition_1_8_3 extends WrappedPacketPlayInFlying_1_8_3 {
public WrappedPacketPlayInPosition_1_8_3(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_8_3 extends WrappedPacketPlayInFlying_1_8_3 {
public WrappedPacketPlayInPosition_Look_1_8_3(Object packet) {
super(packet);
this.hasLook = true;
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3;
package me.purplex.packetevents.packetwrappers.in._1_8_3;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_8;
package me.purplex.packetevents.packetwrappers.in._1_8_8;
import net.minecraft.server.v1_8_R3.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_8;
package me.purplex.packetevents.packetwrappers.in._1_8_8;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_8_R3.PacketPlayInBlockDig;
@@ -0,0 +1,51 @@
package me.purplex.packetevents.packetwrappers.in._1_8_8;
import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
public class WrappedPacketPlayInFlying_1_8_8 {
private final Object packet;
public WrappedPacketPlayInFlying_1_8_8(Object packet) {
this.packet = packet;
setupFields();
}
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
private void setupFields() {
PacketPlayInFlying p = (PacketPlayInFlying)packet;
this.x = p.a();
this.y = p.b();
this.z = p.c();
this.yaw = p.d();
this.pitch = p.e();
this.f = p.f();
this.hasPos = p.g();
this.hasLook = p.h();
}
public static class WrappedPacketPlayInPosition_1_8_8 extends WrappedPacketPlayInFlying_1_8_8 {
public WrappedPacketPlayInPosition_1_8_8(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_8_8 extends WrappedPacketPlayInFlying_1_8_8 {
public WrappedPacketPlayInPosition_Look_1_8_8(Object packet) {
super(packet);
this.hasLook = true;
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_8;
package me.purplex.packetevents.packetwrappers.in._1_8_8;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9;
package me.purplex.packetevents.packetwrappers.in._1_9;
import net.minecraft.server.v1_9_R1.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9;
package me.purplex.packetevents.packetwrappers.in._1_9;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_9_R1.PacketPlayInBlockDig;
@@ -0,0 +1,122 @@
package me.purplex.packetevents.packetwrappers.in._1_9;
import net.minecraft.server.v1_9_R1.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_9 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_9(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_9 extends WrappedPacketPlayInFlying_1_9 {
public WrappedPacketPlayInPosition_1_9(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_9 extends WrappedPacketPlayInFlying_1_9 {
public WrappedPacketPlayInPosition_Look_1_9(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9;
package me.purplex.packetevents.packetwrappers.in._1_9;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4;
package me.purplex.packetevents.packetwrappers.in._1_9_4;
import net.minecraft.server.v1_9_R2.PacketPlayInAbilities;
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4;
package me.purplex.packetevents.packetwrappers.in._1_9_4;
import me.purplex.packetevents.enums.PlayerDigType;
import net.minecraft.server.v1_9_R2.PacketPlayInBlockDig;
@@ -0,0 +1,122 @@
package me.purplex.packetevents.packetwrappers.in._1_9_4;
import net.minecraft.server.v1_9_R2.PacketPlayInFlying;
import java.lang.reflect.Field;
public class WrappedPacketPlayInFlying_1_9_4 {
private final Object packet;
public double x;
public double y;
public double z;
public float yaw;
public float pitch;
public boolean f;
public boolean hasPos;
public boolean hasLook;
public WrappedPacketPlayInFlying_1_9_4(Object packet) {
this.packet = packet;
try {
setupFields();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void setupFields() throws IllegalAccessException {
PacketPlayInFlying p = (PacketPlayInFlying) packet;
this.hasPos = fieldHasPos.getBoolean(p);
this.hasLook = fieldHasLook.getBoolean(p);
if (hasPos) {
this.x = p.a(0.0D);
this.y = p.b(0.0D);
this.z = p.c(0.0D);
} else {
this.x = fieldX.getDouble(p);
this.y = fieldY.getDouble(p);
this.z = fieldZ.getDouble(p);
}
if (hasLook) {
this.yaw = p.a(0.0F);
this.pitch = p.b(0.0F);
}
else {
this.yaw = fieldYaw.getFloat(p);
this.pitch = fieldPitch.getFloat(p);
}
this.f = p.a();
}
public static class WrappedPacketPlayInPosition_1_9_4 extends WrappedPacketPlayInFlying_1_9_4 {
public WrappedPacketPlayInPosition_1_9_4(Object packet) {
super(packet);
this.hasPos = true;
}
}
public static class WrappedPacketPlayInPosition_Look_1_9_4 extends WrappedPacketPlayInFlying_1_9_4 {
public WrappedPacketPlayInPosition_Look_1_9_4(Object packet) {
super(packet);
this.hasLook = true;
}
}
private static Field fieldHasPos;
private static Field fieldHasLook;
private static Field fieldX;
private static Field fieldY;
private static Field fieldZ;
private static Field fieldYaw;
private static Field fieldPitch;
static {
try {
fieldHasPos = PacketPlayInFlying.class.getDeclaredField("hasPos");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4;
package me.purplex.packetevents.packetwrappers.in._1_9_4;
import me.purplex.packetevents.enums.EntityUseAction;
import me.purplex.packetevents.enums.ServerVersion;
+1
View File
@@ -2,3 +2,4 @@ name: PacketEvents
version: ${project.version}
main: me.purplex.packetevents.Main
authors: [purplex]
description: An API you can use to listen to packets!