Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3073342482 | ||
|
|
e83086fd21 | ||
|
|
9c886d8abb | ||
|
|
36b574edda | ||
|
|
90e490466e | ||
|
|
2743dafc40 | ||
|
|
7443f3f965 | ||
|
|
5e493a386c | ||
|
|
321b306a34 | ||
|
|
08996c3e17 | ||
|
|
39fc28def6 | ||
|
|
c2b0109820 | ||
|
|
86dbca109b | ||
|
|
904a9c458d | ||
|
|
36431251c0 | ||
|
|
d51eb9b11e | ||
|
|
9af0183a04 |
No files matched your search
@@ -1,17 +1,18 @@
|
||||
# PacketEvents
|
||||
Listen to minecraft packets.
|
||||
# packetevents by purplex
|
||||
|
||||
PacketEvents coded by purplex.
|
||||
PacketListener coded by purplex.
|
||||
|
||||
Licensed with the GPL3 license.
|
||||
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
|
||||
Coding help discord server: https://discord.gg/ZWTkg4v
|
||||
|
||||
Examples can be found in this class->
|
||||
me/purplex/packetevents/example/TestExample.java
|
||||
How to use with **Gradle, Maven, sbt and leiningen**.
|
||||
|
||||
The lastest stable tested versions are displayed below.
|
||||
|
||||
How to use with gradle, maven, sbt and leiningen.
|
||||
The last stable tested versions are displayed below.
|
||||
Updated daily.
|
||||
[](https://jitpack.io/#purplexdev/packetevents)
|
||||
|
||||
# Gradle
|
||||
|
||||
@@ -24,7 +25,7 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.purplexdev:packetevents:1.1.3'
|
||||
implementation 'com.github.purplexdev:packetevents:1.1.8'
|
||||
}
|
||||
```
|
||||
|
||||
@@ -43,7 +44,7 @@ dependencies {
|
||||
<dependency>
|
||||
<groupId>com.github.purplexdev</groupId>
|
||||
<artifactId>packetevents</artifactId>
|
||||
<version>1.1.3</version>
|
||||
<version>1.1.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
@@ -53,16 +54,15 @@ dependencies {
|
||||
```
|
||||
resolvers += "jitpack" at "https://jitpack.io"
|
||||
|
||||
libraryDependencies += "com.github.purplexdev" % "packetevents" % "1.1.3"
|
||||
libraryDependencies += "com.github.purplexdev" % "packetevents" % "1.1.8"
|
||||
```
|
||||
|
||||
# leiningen
|
||||
```
|
||||
:repositories [["jitpack" "https://jitpack.io"]]
|
||||
|
||||
:dependencies [[com.github.purplexdev/packetevents "1.1.3"]]
|
||||
:dependencies [[com.github.purplexdev/packetevents "1.1.8"]]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
<groupId>me.purplex</groupId>
|
||||
<artifactId>packetevents</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.8</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>
|
||||
@@ -182,7 +182,7 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Bukkit-->
|
||||
<!--Spigot API-->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package me.purplex.packetevents;
|
||||
|
||||
import me.purplex.packetevents.customlistener.injector.PacketInjector;
|
||||
import me.purplex.packetevents.events.packetevent.ServerTickEvent;
|
||||
import me.purplex.packetevents.injector.PacketInjector;
|
||||
import me.purplex.packetevents.packetevent.impl.ServerTickEvent;
|
||||
import me.purplex.packetevents.example.TestExample;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
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;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
public class Main extends JavaPlugin implements Listener {
|
||||
|
||||
private static Main instance;
|
||||
@@ -19,14 +25,15 @@ public class Main extends JavaPlugin implements Listener {
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
packetInjector = new PacketInjector();
|
||||
PacketEvents.getPacketManager().registerPacketListener(new TestExample());
|
||||
|
||||
packetInjector = new PacketInjector();
|
||||
//PacketEvents.getPacketManager().registerListener(new TestExample());
|
||||
//Bukkit.getPluginManager().registerEvents(new TestExample(),this);
|
||||
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,17 +41,26 @@ public class Main extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
/**
|
||||
* You don't need to unregister all events when the plugin disables,
|
||||
* This is just an example
|
||||
*/
|
||||
|
||||
//PacketEvents.getPacketManager().unregisterListener(new TestExample());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
packetInjector.injectPlayer(e.getPlayer());
|
||||
}
|
||||
});
|
||||
final Player player = e.getPlayer();
|
||||
Callable<Void> callable = new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
packetInjector.injectPlayer(player);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||
Future<Void> future = threadPool.submit(callable);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -56,5 +72,4 @@ public class Main extends JavaPlugin implements Listener {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package me.purplex.packetevents;
|
||||
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import me.purplex.packetevents.events.manager.PacketManager;
|
||||
import me.purplex.packetevents.packetevent.manager.PacketManager;
|
||||
|
||||
public class PacketEvents {
|
||||
private static PacketManager packetManager;
|
||||
private final static PacketManager packetManager;
|
||||
|
||||
static {
|
||||
packetManager = new PacketManager();
|
||||
}
|
||||
public static ServerVersion getServerVersion() {
|
||||
return ServerVersion.getVersion();
|
||||
}
|
||||
|
||||
|
||||
public static PacketManager getPacketManager() {
|
||||
if (packetManager == null) {
|
||||
packetManager = new PacketManager();
|
||||
}
|
||||
return packetManager;
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package me.purplex.packetevents.customlistener.injector;
|
||||
|
||||
|
||||
import io.netty.channel.*;
|
||||
import me.purplex.packetevents.PacketEvents;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import me.purplex.packetevents.events.packetevent.*;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class PacketInjector {
|
||||
private final static ServerVersion version = ServerVersion.getVersion();
|
||||
|
||||
public void injectPlayer(Player player) {
|
||||
ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object packet) {
|
||||
String packetName = packet.getClass().getSimpleName();
|
||||
PacketReceiveEvent e = new PacketReceiveEvent(player, packetName, packet);
|
||||
PacketEvents.getPacketManager().callPacketReceiveEvent(e);
|
||||
if(e.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
super.channelRead(ctx, packet);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promise) {
|
||||
String packetName = packet.getClass().getSimpleName();
|
||||
PacketSendEvent e = new PacketSendEvent(player, packetName, packet);
|
||||
PacketEvents.getPacketManager().callPacketSendEvent(e);
|
||||
if(e.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
super.write(ctx, packet, promise);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
Channel channel = getChannel(player);
|
||||
ChannelPipeline pipeline = channel.pipeline();
|
||||
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
|
||||
}
|
||||
|
||||
public void uninjectPlayer(Player player) {
|
||||
Channel channel = getChannel(player);
|
||||
channel.eventLoop().submit(()->{
|
||||
channel.pipeline().remove(player.getName());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
public Channel getChannel(Player player) {
|
||||
Channel channel = null;
|
||||
if (version == ServerVersion.v_1_8) {
|
||||
net.minecraft.server.v1_8_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
|
||||
try {
|
||||
channel = (Channel) networkManager.getClass().getField("i").get(networkManager);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
net.minecraft.server.v1_15_R1.NetworkManager networkManager = ((org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer) player).getHandle().playerConnection.networkManager;
|
||||
channel = networkManager.channel;
|
||||
}
|
||||
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,5 @@
|
||||
package me.purplex.packetevents.enums;
|
||||
|
||||
public enum EntityUseAction {
|
||||
INTERACT, INTERACT_AT, ATTACK, INVALID;
|
||||
INTERACT, INTERACT_AT, ATTACK, INVALID
|
||||
}
|
||||
@@ -17,5 +17,5 @@ public enum PlayerAction {
|
||||
|
||||
OPEN_INVENTORY,
|
||||
|
||||
START_FALL_FLYING;
|
||||
START_FALL_FLYING
|
||||
}
|
||||
@@ -16,8 +16,7 @@ public enum PlayerDigType {
|
||||
|
||||
SWAP_HELD_ITEMS,
|
||||
|
||||
WRONG_PACKET;
|
||||
|
||||
WRONG_PACKET
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package me.purplex.packetevents.events;
|
||||
|
||||
|
||||
public class PacketEvent {
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package me.purplex.packetevents.events.eventmanager;
|
||||
|
||||
import me.purplex.packetevents.events.packetevent.ServerTickEvent;
|
||||
import me.purplex.packetevents.events.listener.PacketListener;
|
||||
import me.purplex.packetevents.events.packetevent.PacketReceiveEvent;
|
||||
import me.purplex.packetevents.events.packetevent.PacketSendEvent;
|
||||
|
||||
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 registerPacketListener(PacketListener e);
|
||||
public void unregisterPacketListener(PacketListener e);
|
||||
|
||||
public void callServerTickEvent(ServerTickEvent e);
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package me.purplex.packetevents.events.listener;
|
||||
|
||||
public interface PacketListener {
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_10;
|
||||
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_10 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_10(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_10;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_10 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_10(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
net.minecraft.server.v1_10_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_10_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
net.minecraft.server.v1_10_R1.WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_10_R1.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_10_R1.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_10_R1.Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
net.minecraft.server.v1_10_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_10_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_11;
|
||||
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_11 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_11(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_11;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_11 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_11(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
net.minecraft.server.v1_11_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_11_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
net.minecraft.server.v1_11_R1.WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_11_R1.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_11_R1.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_11_R1.Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
net.minecraft.server.v1_11_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_11_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_12;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_12 {
|
||||
private final Object packet;
|
||||
public WrappedPacketPlayInBlockDig_1_12(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.c().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_12;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_12 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_12(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
net.minecraft.server.v1_12_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_12_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
net.minecraft.server.v1_12_R1.WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_12_R1.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_12_R1.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_12_R1.Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
net.minecraft.server.v1_12_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_12_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import net.minecraft.server.v1_13_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_13 {
|
||||
private final Object packet;
|
||||
public WrappedPacketPlayInBlockDig_1_13(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2;
|
||||
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_13_2 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_13_2(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.b();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.d();
|
||||
this.d = p.e();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13_2;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_13_2 {
|
||||
private final Object packet;
|
||||
public WrappedPacketPlayInBlockDig_1_13_2(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_14;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_14 {
|
||||
private final Object packet;
|
||||
public WrappedPacketPlayInBlockDig_1_14(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_14;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_14 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_14(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_14_R1.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_14_R1.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_14_R1.Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.b().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_15;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_15 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_15(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.b();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.d();
|
||||
this.d = p.e();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_15;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_15 {
|
||||
private final Object packet;
|
||||
public WrappedPacketPlayInBlockDig_1_15(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_7_10;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import net.minecraft.server.v1_7_R4.Entity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_7_10 {
|
||||
private final ServerVersion version;
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_7_10(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
if (version == ServerVersion.v_1_8) {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
CraftWorld craftWorld = (CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.c().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8;
|
||||
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_8 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_8(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3;
|
||||
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_8_3 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_8_3(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_3;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_8_3 {
|
||||
private final Object packet;
|
||||
public WrappedPacketPlayInBlockDig_1_8_3(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.c().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_8_8;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_8_8 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_8_8(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
net.minecraft.server.v1_8_R3.PacketPlayInUseEntity packet = (net.minecraft.server.v1_8_R3.PacketPlayInUseEntity) getRawPacket();
|
||||
net.minecraft.server.v1_8_R3.WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_8_R3.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_8_R3.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_8_R3.Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
net.minecraft.server.v1_8_R3.PacketPlayInUseEntity packet = (net.minecraft.server.v1_8_R3.PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9;
|
||||
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_9 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_9(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_9 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_9(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
net.minecraft.server.v1_9_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_9_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
net.minecraft.server.v1_9_R1.WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_9_R1.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_9_R1.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_9_R1.Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
if (version == ServerVersion.v_1_8) {
|
||||
net.minecraft.server.v1_9_R1.PacketPlayInUseEntity packet = (net.minecraft.server.v1_9_R1.PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_9_4 {
|
||||
private final Object packet;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_9_4(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException illegalAccessException) {
|
||||
illegalAccessException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_9_4;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_9_4 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_9_4(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
net.minecraft.server.v1_9_R2.PacketPlayInUseEntity packet = (net.minecraft.server.v1_9_R2.PacketPlayInUseEntity) getRawPacket();
|
||||
net.minecraft.server.v1_9_R2.WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_9_R2.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_9_R2.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_9_R2.Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
net.minecraft.server.v1_9_R2.PacketPlayInUseEntity packet = (net.minecraft.server.v1_9_R2.PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package me.purplex.packetevents.example;
|
||||
|
||||
import me.purplex.packetevents.packetevent.PacketEvent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Example packetevent
|
||||
* Make sure to initiate the super timestamp variable,
|
||||
* if you want to use the getTimestamp() function
|
||||
*/
|
||||
public class CustomMoveEvent extends PacketEvent {
|
||||
private final Player player;
|
||||
private Location to, from;
|
||||
private boolean cancelled;
|
||||
|
||||
public CustomMoveEvent(final Player player, final Location to, final Location from) {
|
||||
this.player = player;
|
||||
this.to = to;
|
||||
this.from = from;
|
||||
this.cancelled = false;
|
||||
|
||||
//IMPORTANT to initialize the timestamp variable
|
||||
this.timestamp = (System.nanoTime() / 1000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimestamp() {
|
||||
return super.getTimestamp();
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public Location getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public Location getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public void setTo(Location loc) {
|
||||
this.to = loc;
|
||||
}
|
||||
|
||||
public void setFrom(Location loc) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +1,116 @@
|
||||
package me.purplex.packetevents.example;
|
||||
|
||||
import me.purplex.packetevents.PacketEvents;
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
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.packets.Packet;
|
||||
import me.purplex.packetevents.packetevent.PacketEvent;
|
||||
import me.purplex.packetevents.packetevent.impl.PacketReceiveEvent;
|
||||
import me.purplex.packetevents.packetevent.impl.PacketSendEvent;
|
||||
import me.purplex.packetevents.packetevent.impl.ServerTickEvent;
|
||||
import me.purplex.packetevents.packetevent.handler.PacketHandler;
|
||||
import me.purplex.packetevents.packetevent.listener.PacketListener;
|
||||
import me.purplex.packetevents.packetevent.packet.Packet;
|
||||
import me.purplex.packetevents.packetwrappers.in.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class TestExample implements PacketListener {
|
||||
public class TestExample implements PacketListener, Listener {
|
||||
/**
|
||||
* How to register a packet listener?
|
||||
* <p>
|
||||
* PacketEvents.getPacketManager().registerPacketListener(new TestExample());
|
||||
* PacketEvents.getPacketManager().registerListener(new TestExample());
|
||||
*/
|
||||
|
||||
/**
|
||||
* How to unregister a packet listener?
|
||||
* PacketEvents.getPacketManager().unregisterListener(new TestExample());
|
||||
*/
|
||||
|
||||
private int tick;
|
||||
|
||||
private static ServerVersion serverVersion = ServerVersion.getVersion();
|
||||
|
||||
@PacketHandler
|
||||
public void onPacketReceive(PacketReceiveEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
final Player p = e.getPlayer();
|
||||
final long timestamp = e.getTimestamp();
|
||||
//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;
|
||||
//just like the 1.8 NMS classes.
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@PacketHandler
|
||||
public void onPacket(PacketEvent e) {
|
||||
if(e instanceof PacketSendEvent) {
|
||||
PacketSendEvent p = (PacketSendEvent)e;
|
||||
onPacketSend(p);
|
||||
}
|
||||
}
|
||||
|
||||
private void onPacketSend(PacketSendEvent e) {
|
||||
//code
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
CustomMoveEvent customMoveEvent = new CustomMoveEvent(e.getPlayer(),e.getTo(), e.getFrom());
|
||||
e.setCancelled(customMoveEvent.isCancelled());
|
||||
PacketEvents.getPacketManager().callEvent(customMoveEvent);
|
||||
|
||||
if(e.getTo() != customMoveEvent.getTo()) {
|
||||
e.setTo(customMoveEvent.getTo());
|
||||
}
|
||||
if(e.getFrom() != customMoveEvent.getFrom()) {
|
||||
e.setFrom(customMoveEvent.getFrom());
|
||||
}
|
||||
}
|
||||
|
||||
@PacketHandler
|
||||
public void onServerTick(ServerTickEvent e) {
|
||||
//CALLED EVERY TICK
|
||||
tick++;
|
||||
|
||||
if (tick % 20 == 0) {
|
||||
/*for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
p.sendMessage("One second has passed!");
|
||||
}*/
|
||||
//one tick passed
|
||||
}
|
||||
tick++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package me.purplex.packetevents.injector;
|
||||
|
||||
|
||||
import io.netty.channel.*;
|
||||
import me.purplex.packetevents.PacketEvents;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import me.purplex.packetevents.injector.channels._1_10.Channel_1_10;
|
||||
import me.purplex.packetevents.injector.channels._1_11.Channel_1_11;
|
||||
import me.purplex.packetevents.injector.channels._1_12.Channel_1_12;
|
||||
import me.purplex.packetevents.injector.channels._1_13.Channel_1_13;
|
||||
import me.purplex.packetevents.injector.channels._1_13_2.Channel_1_13_2;
|
||||
import me.purplex.packetevents.injector.channels._1_14.Channel_1_14;
|
||||
import me.purplex.packetevents.injector.channels._1_15.Channel_1_15;
|
||||
import me.purplex.packetevents.injector.channels._1_7_10.Channel_1_7_10;
|
||||
import me.purplex.packetevents.injector.channels._1_8.Channel_1_8;
|
||||
import me.purplex.packetevents.injector.channels._1_8_3.Channel_1_8_3;
|
||||
import me.purplex.packetevents.injector.channels._1_8_8.Channel_1_8_8;
|
||||
import me.purplex.packetevents.injector.channels._1_9.Channel_1_9;
|
||||
import me.purplex.packetevents.injector.channels._1_9_4.Channel_1_9_4;
|
||||
import me.purplex.packetevents.packetevent.impl.PacketReceiveEvent;
|
||||
import me.purplex.packetevents.packetevent.impl.PacketSendEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class PacketInjector {
|
||||
private final static ServerVersion version;
|
||||
|
||||
static {
|
||||
version = ServerVersion.getVersion();
|
||||
}
|
||||
|
||||
public void injectPlayer(Player player) {
|
||||
ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object packet) throws Exception {
|
||||
String packetName = packet.getClass().getSimpleName();
|
||||
PacketReceiveEvent e = new PacketReceiveEvent(player, packetName, packet);
|
||||
PacketEvents.getPacketManager().callEvent(e);
|
||||
if (e.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
super.channelRead(ctx, packet);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
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().callEvent(e);
|
||||
if (e.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
super.write(ctx, packet, promise);
|
||||
}
|
||||
};
|
||||
Channel channel = getChannel(player);
|
||||
ChannelPipeline pipeline = channel.pipeline();
|
||||
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
|
||||
}
|
||||
|
||||
public void uninjectPlayer(Player player) {
|
||||
Channel channel = getChannel(player);
|
||||
channel.eventLoop().submit(() -> {
|
||||
channel.pipeline().remove(player.getName());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
public Channel getChannel(Player player) {
|
||||
Channel channel = null;
|
||||
if (version == ServerVersion.v_1_7_10) {
|
||||
channel = new Channel_1_7_10().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_8) {
|
||||
channel = new Channel_1_8().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_8_3) {
|
||||
channel = new Channel_1_8_3().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_8_8) {
|
||||
channel = new Channel_1_8_8().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_9) {
|
||||
channel = new Channel_1_9().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_9_4) {
|
||||
channel = new Channel_1_9_4().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_10) {
|
||||
channel = new Channel_1_10().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_11) {
|
||||
channel = new Channel_1_11().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_12) {
|
||||
channel = new Channel_1_12().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_13) {
|
||||
channel = new Channel_1_13().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_13_2) {
|
||||
channel = new Channel_1_13_2().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_14) {
|
||||
channel = new Channel_1_14().getChannel(player);
|
||||
} else if (version == ServerVersion.v_1_15) {
|
||||
channel = new Channel_1_15().getChannel(player);
|
||||
} else {
|
||||
String err = "Version unsupported, please contact purplex#0001 and tell him what version your server is running on! Make sure you are using paperspigot or spigot.";
|
||||
throw new IllegalStateException(err);
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.purplex.packetevents.injector.channels._1_10;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_10_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_10_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_10 {
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.purplex.packetevents.injector.channels._1_11;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_11_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_11 {
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.purplex.packetevents.injector.channels._1_12;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_12_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_12 {
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.purplex.packetevents.injector.channels._1_13;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_13_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_13_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_13 {
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.purplex.packetevents.injector.channels._1_13_2;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_13_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_13_R2.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_13_2 {
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.purplex.packetevents.injector.channels._1_14;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_14_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_14_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_14 {
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.purplex.packetevents.injector.channels._1_15;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_15_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_15 {
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package me.purplex.packetevents.injector.channels._1_7_10;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class Channel_1_7_10 {
|
||||
|
||||
private static Field field;
|
||||
static {
|
||||
try {
|
||||
field = NetworkManager.class.getDeclaredField("m");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
field.setAccessible(true);
|
||||
}
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = null;
|
||||
try {
|
||||
channel = (Channel) field.get(networkManager);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.purplex.packetevents.injector.channels._1_8;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_8_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class Channel_1_8 {
|
||||
|
||||
private static Field field;
|
||||
static {
|
||||
try {
|
||||
field = NetworkManager.class.getDeclaredField("i");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
field.setAccessible(true);
|
||||
}
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = null;
|
||||
try {
|
||||
channel = (Channel) field.get(networkManager);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.purplex.packetevents.injector.channels._1_8_3;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_8_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R2.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_8_3 {
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.k;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.purplex.packetevents.injector.channels._1_8_8;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_8_8 {
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package me.purplex.packetevents.injector.channels._1_9;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_9_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R1.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_9 {
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
entityPlayer.playerConnection.networkManager.sendPacket(null);
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package me.purplex.packetevents.injector.channels._1_9_4;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.server.v1_9_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R2.NetworkManager;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel_1_9_4 {
|
||||
|
||||
public Channel getChannel(Player p) {
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)p).getHandle();
|
||||
NetworkManager networkManager = entityPlayer.playerConnection.networkManager;
|
||||
|
||||
Channel channel = networkManager.channel;
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package me.purplex.packetevents.packetevent;
|
||||
|
||||
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
|
||||
public class PacketEvent {
|
||||
protected long timestamp;
|
||||
protected static ServerVersion version;
|
||||
static {
|
||||
version = ServerVersion.getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp of the packet
|
||||
* @return
|
||||
*/
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -1,4 +1,4 @@
|
||||
package me.purplex.packetevents.events.handler;
|
||||
package me.purplex.packetevents.packetevent.handler;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -7,6 +7,11 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* Just like Bukkit's @EventHandler, but for packets.
|
||||
* Make sure your class implements the PacketListener interface, and is registered!
|
||||
*/
|
||||
public @interface PacketHandler {
|
||||
|
||||
|
||||
}
|
||||
+2
-16
@@ -1,21 +1,16 @@
|
||||
package me.purplex.packetevents.events.packetevent;
|
||||
package me.purplex.packetevents.packetevent.impl;
|
||||
|
||||
|
||||
import me.purplex.packetevents.PacketEvents;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import me.purplex.packetevents.events.PacketEvent;
|
||||
import me.purplex.packetevents.packetevent.PacketEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PacketReceiveEvent extends PacketEvent {
|
||||
private final Player player;
|
||||
private final String name;
|
||||
private final Object packet;
|
||||
private final long timestamp;
|
||||
private boolean cancelled;
|
||||
public final ServerVersion version;
|
||||
|
||||
public PacketReceiveEvent(Player player, String packetName, Object packet) {
|
||||
this.version = PacketEvents.getServerVersion();
|
||||
this.player = player;
|
||||
this.name = packetName;
|
||||
this.packet = packet;
|
||||
@@ -50,15 +45,6 @@ public class PacketReceiveEvent extends PacketEvent {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
/**
|
||||
* The time the packet was received(ms)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the packet
|
||||
*
|
||||
+2
-13
@@ -1,20 +1,15 @@
|
||||
package me.purplex.packetevents.events.packetevent;
|
||||
package me.purplex.packetevents.packetevent.impl;
|
||||
|
||||
import me.purplex.packetevents.PacketEvents;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import me.purplex.packetevents.events.PacketEvent;
|
||||
import me.purplex.packetevents.packetevent.PacketEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PacketSendEvent extends PacketEvent {
|
||||
private final Player player;
|
||||
private final String name;
|
||||
private final Object packet;
|
||||
private final long timestamp;
|
||||
private boolean cancelled;
|
||||
public final ServerVersion version;
|
||||
|
||||
public PacketSendEvent(Player player, String packetName, Object packet) {
|
||||
this.version = PacketEvents.getServerVersion();
|
||||
this.player = player;
|
||||
this.name = packetName;
|
||||
this.packet = packet;
|
||||
@@ -41,12 +36,6 @@ public class PacketSendEvent extends PacketEvent {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
package me.purplex.packetevents.events.packetevent;
|
||||
package me.purplex.packetevents.packetevent.impl;
|
||||
|
||||
import me.purplex.packetevents.events.PacketEvent;
|
||||
|
||||
import me.purplex.packetevents.packetevent.PacketEvent;
|
||||
|
||||
public class ServerTickEvent extends PacketEvent {
|
||||
|
||||
private long timestamp;
|
||||
private final long timestamp;
|
||||
public ServerTickEvent(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package me.purplex.packetevents.packetevent.listener;
|
||||
|
||||
public interface PacketListener {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package me.purplex.packetevents.packetevent.manager;
|
||||
|
||||
import me.purplex.packetevents.packetevent.PacketEvent;
|
||||
import me.purplex.packetevents.packetevent.listener.PacketListener;
|
||||
import me.purplex.packetevents.packetwrappers.api.WrappedPacket;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
public interface PacketEventManager {
|
||||
public LinkedList<PacketListener> packetListeners = new LinkedList<>();
|
||||
public void callEvent(PacketEvent e);
|
||||
|
||||
public void registerListener(PacketListener e);
|
||||
public void unregisterListener(PacketListener e);
|
||||
|
||||
public void unregisterAllListeners(PacketListener e);
|
||||
|
||||
//public void sendPacket(Player player, WrappedPacket packet);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package me.purplex.packetevents.packetevent.manager;
|
||||
|
||||
import me.purplex.packetevents.packetevent.PacketEvent;
|
||||
import me.purplex.packetevents.packetevent.impl.ServerTickEvent;
|
||||
import me.purplex.packetevents.packetevent.manager.PacketEventManager;
|
||||
import me.purplex.packetevents.packetevent.handler.PacketHandler;
|
||||
import me.purplex.packetevents.packetevent.listener.PacketListener;
|
||||
import me.purplex.packetevents.packetevent.impl.PacketReceiveEvent;
|
||||
import me.purplex.packetevents.packetevent.impl.PacketSendEvent;
|
||||
import me.purplex.packetevents.packetwrappers.api.WrappedPacket;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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 (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();
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void sendPacket(Player player, WrappedPacket packet) {
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.purplex.packetevents.packets;
|
||||
package me.purplex.packetevents.packetevent.packet;
|
||||
|
||||
public abstract class Packet {
|
||||
public static class Client {
|
||||
@@ -0,0 +1,28 @@
|
||||
package me.purplex.packetevents.packetwrappers.api;
|
||||
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
|
||||
public class WrappedPacket {
|
||||
protected Object packet;
|
||||
protected static ServerVersion version;
|
||||
static {
|
||||
version = ServerVersion.getVersion();
|
||||
}
|
||||
public WrappedPacket(Object packet) {
|
||||
this.packet = packet;
|
||||
setup();
|
||||
}
|
||||
|
||||
/* public WrappedPacket(String name, PacketData data) {
|
||||
String packetName = "PacketPlayOut" + name;
|
||||
|
||||
}*/
|
||||
|
||||
protected void setup() {
|
||||
|
||||
}
|
||||
|
||||
public Object getPacket() {
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package me.purplex.packetevents.packetwrappers.api.sendable;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Unfinished
|
||||
*/
|
||||
public class WrappedServerPacket {
|
||||
public WrappedServerPacket(Player target) {
|
||||
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package me.purplex.packetevents.packetwrappers.api.version;
|
||||
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
|
||||
public abstract class WrappedVersionPacket {
|
||||
protected final Object packet;
|
||||
protected static ServerVersion version;
|
||||
static {
|
||||
version = ServerVersion.getVersion();
|
||||
}
|
||||
public WrappedVersionPacket(Object packet) {
|
||||
this.packet = packet;
|
||||
setup();
|
||||
}
|
||||
|
||||
protected abstract void setup();
|
||||
}
|
||||
+19
-22
@@ -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;
|
||||
+26
-22
@@ -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) {
|
||||
+439
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+22
-21
@@ -1,32 +1,31 @@
|
||||
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;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity extends WrappedPacket {
|
||||
|
||||
public class WrappedPacketPlayInUseEntity {
|
||||
private final ServerVersion version;
|
||||
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 +36,9 @@ 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();
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_10;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_10 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
public WrappedPacketPlayInAbilities_1_10(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -1,21 +1,21 @@
|
||||
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 me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_10 {
|
||||
private final Object packet;
|
||||
public class WrappedPacketPlayInBlockDig_1_10 extends WrappedVersionPacket {
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
public WrappedPacketPlayInBlockDig_1_10(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.c().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_10;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayInFlying;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_10 extends WrappedVersionPacket {
|
||||
|
||||
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) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInFlying p = (PacketPlayInFlying) packet;
|
||||
try {
|
||||
this.hasPos = fieldHasPos.getBoolean(p);
|
||||
this.hasLook = fieldHasLook.getBoolean(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasPos) {
|
||||
this.x = p.a(0.0D);
|
||||
this.y = p.b(0.0D);
|
||||
this.z = p.c(0.0D);
|
||||
} else {
|
||||
try {
|
||||
this.x = fieldX.getDouble(p);
|
||||
this.y = fieldY.getDouble(p);
|
||||
this.z = fieldZ.getDouble(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasLook) {
|
||||
this.yaw = p.a(0.0F);
|
||||
this.pitch = p.b(0.0F);
|
||||
} else {
|
||||
try {
|
||||
this.yaw = fieldYaw.getFloat(p);
|
||||
this.pitch = fieldPitch.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
fieldHasPos.setAccessible(true);
|
||||
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
|
||||
fieldHasLook.setAccessible(true);
|
||||
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
|
||||
fieldX.setAccessible(true);
|
||||
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
|
||||
fieldY.setAccessible(true);
|
||||
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
|
||||
fieldZ.setAccessible(true);
|
||||
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
|
||||
fieldYaw.setAccessible(true);
|
||||
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
|
||||
fieldPitch.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_10;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_10_R1.Entity;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_10_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_10 extends WrappedVersionPacket {
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_10(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
CraftWorld craftWorld = (CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (p.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Entity entity = p.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
String name = p.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_11;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_11 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
public WrappedPacketPlayInAbilities_1_11(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -1,21 +1,22 @@
|
||||
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 me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_11 {
|
||||
private final Object packet;
|
||||
public class WrappedPacketPlayInBlockDig_1_11 extends WrappedVersionPacket {
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
public WrappedPacketPlayInBlockDig_1_11(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.c().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_11;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayInFlying;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_11 extends WrappedVersionPacket {
|
||||
|
||||
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) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInFlying p = (PacketPlayInFlying) packet;
|
||||
try {
|
||||
this.hasPos = fieldHasPos.getBoolean(p);
|
||||
this.hasLook = fieldHasLook.getBoolean(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasPos) {
|
||||
this.x = p.a(0.0D);
|
||||
this.y = p.b(0.0D);
|
||||
this.z = p.c(0.0D);
|
||||
} else {
|
||||
try {
|
||||
this.x = fieldX.getDouble(p);
|
||||
this.y = fieldY.getDouble(p);
|
||||
this.z = fieldZ.getDouble(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasLook) {
|
||||
this.yaw = p.a(0.0F);
|
||||
this.pitch = p.b(0.0F);
|
||||
} else {
|
||||
try {
|
||||
this.yaw = fieldYaw.getFloat(p);
|
||||
this.pitch = fieldPitch.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
fieldHasPos.setAccessible(true);
|
||||
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
|
||||
fieldHasLook.setAccessible(true);
|
||||
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
|
||||
fieldX.setAccessible(true);
|
||||
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
|
||||
fieldY.setAccessible(true);
|
||||
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
|
||||
fieldZ.setAccessible(true);
|
||||
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
|
||||
fieldYaw.setAccessible(true);
|
||||
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
|
||||
fieldPitch.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_11;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_11_R1.Entity;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_11 extends WrappedVersionPacket {
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_11(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
CraftWorld craftWorld = (CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (p.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Entity entity = p.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
String name = p.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+28
-25
@@ -1,31 +1,25 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_12;
|
||||
package me.purplex.packetevents.packetwrappers.in._1_12;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_12 {
|
||||
private final Object packet;
|
||||
public class WrappedPacketPlayInAbilities_1_12 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_12(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
@@ -43,10 +37,19 @@ public class WrappedPacketPlayInAbilities_1_12 {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_12;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_12 extends WrappedVersionPacket {
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
public WrappedPacketPlayInBlockDig_1_12(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig) packet;
|
||||
String name = p.c().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_12;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayInFlying;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_12 extends WrappedVersionPacket {
|
||||
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) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInFlying p = (PacketPlayInFlying) packet;
|
||||
try {
|
||||
this.hasPos = fieldHasPos.getBoolean(p);
|
||||
this.hasLook = fieldHasLook.getBoolean(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasPos) {
|
||||
this.x = p.a(0.0D);
|
||||
this.y = p.b(0.0D);
|
||||
this.z = p.c(0.0D);
|
||||
} else {
|
||||
try {
|
||||
this.x = fieldX.getDouble(p);
|
||||
this.y = fieldY.getDouble(p);
|
||||
this.z = fieldZ.getDouble(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasLook) {
|
||||
this.yaw = p.a(0.0F);
|
||||
this.pitch = p.b(0.0F);
|
||||
} else {
|
||||
try {
|
||||
this.yaw = fieldYaw.getFloat(p);
|
||||
this.pitch = fieldPitch.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
fieldHasPos.setAccessible(true);
|
||||
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
|
||||
fieldHasLook.setAccessible(true);
|
||||
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
|
||||
fieldX.setAccessible(true);
|
||||
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
|
||||
fieldY.setAccessible(true);
|
||||
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
|
||||
fieldZ.setAccessible(true);
|
||||
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
|
||||
fieldYaw.setAccessible(true);
|
||||
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
|
||||
fieldPitch.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_12;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_12_R1.Entity;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_12 extends WrappedVersionPacket {
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_12(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInUseEntity p = (net.minecraft.server.v1_12_R1.PacketPlayInUseEntity) packet;
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
org.bukkit.craftbukkit.v1_12_R1.CraftWorld craftWorld = (org.bukkit.craftbukkit.v1_12_R1.CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (p.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Entity entity = p.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
String name = p.a().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+27
-25
@@ -1,31 +1,25 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13;
|
||||
package me.purplex.packetevents.packetwrappers.in._1_13;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_13 {
|
||||
private final Object packet;
|
||||
public class WrappedPacketPlayInAbilities_1_13 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_13(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.b();
|
||||
this.b = p.isFlying();
|
||||
@@ -43,10 +37,18 @@ public class WrappedPacketPlayInAbilities_1_13 {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_13;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_13 extends WrappedVersionPacket {
|
||||
public PlayerDigType digType;
|
||||
|
||||
public WrappedPacketPlayInBlockDig_1_13(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig) packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_13;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R1.PacketPlayInFlying;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_13 extends WrappedVersionPacket {
|
||||
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) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInFlying p = (PacketPlayInFlying) packet;
|
||||
try {
|
||||
this.hasPos = fieldHasPos.getBoolean(p);
|
||||
this.hasLook = fieldHasLook.getBoolean(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasPos) {
|
||||
this.x = p.a(0.0D);
|
||||
this.y = p.b(0.0D);
|
||||
this.z = p.c(0.0D);
|
||||
} else {
|
||||
try {
|
||||
this.x = fieldX.getDouble(p);
|
||||
this.y = fieldY.getDouble(p);
|
||||
this.z = fieldZ.getDouble(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasLook) {
|
||||
this.yaw = p.a(0.0F);
|
||||
this.pitch = p.b(0.0F);
|
||||
} else {
|
||||
try {
|
||||
this.yaw = fieldYaw.getFloat(p);
|
||||
this.pitch = fieldPitch.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
fieldHasPos.setAccessible(true);
|
||||
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
|
||||
fieldHasLook.setAccessible(true);
|
||||
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
|
||||
fieldX.setAccessible(true);
|
||||
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
|
||||
fieldY.setAccessible(true);
|
||||
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
|
||||
fieldZ.setAccessible(true);
|
||||
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
|
||||
fieldYaw.setAccessible(true);
|
||||
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
|
||||
fieldPitch.setAccessible(true);
|
||||
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_13;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R1.Entity;
|
||||
import net.minecraft.server.v1_13_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_13_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.CraftWorld;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_13 extends WrappedVersionPacket {
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_13(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
CraftWorld craftWorld = (CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (p.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Entity entity = p.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
String name = p.b().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_13_2;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_13_2 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
public WrappedPacketPlayInAbilities_1_13_2(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.b();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.d();
|
||||
this.d = p.e();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_13_2;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_13_2 extends WrappedVersionPacket {
|
||||
public PlayerDigType digType;
|
||||
|
||||
public WrappedPacketPlayInBlockDig_1_13_2(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig) packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_13_2;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayInFlying;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_13_2 extends WrappedVersionPacket {
|
||||
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) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInFlying p = (PacketPlayInFlying) packet;
|
||||
try {
|
||||
this.hasPos = fieldHasPos.getBoolean(p);
|
||||
this.hasLook = fieldHasLook.getBoolean(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasPos) {
|
||||
this.x = p.a(0.0D);
|
||||
this.y = p.b(0.0D);
|
||||
this.z = p.c(0.0D);
|
||||
} else {
|
||||
try {
|
||||
this.x = fieldX.getDouble(p);
|
||||
this.y = fieldY.getDouble(p);
|
||||
this.z = fieldZ.getDouble(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasLook) {
|
||||
this.yaw = p.a(0.0F);
|
||||
this.pitch = p.b(0.0F);
|
||||
} else {
|
||||
try {
|
||||
this.yaw = fieldYaw.getFloat(p);
|
||||
this.pitch = fieldPitch.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
fieldHasPos.setAccessible(true);
|
||||
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
|
||||
fieldHasLook.setAccessible(true);
|
||||
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
|
||||
fieldY.setAccessible(true);
|
||||
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
|
||||
fieldX.setAccessible(true);
|
||||
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
|
||||
fieldZ.setAccessible(true);
|
||||
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
|
||||
fieldPitch.setAccessible(true);
|
||||
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
|
||||
fieldYaw.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+19
-21
@@ -1,31 +1,23 @@
|
||||
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;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_13_R2.Entity;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_13_R2.WorldServer;
|
||||
public class WrappedPacketPlayInUseEntity_1_13_2 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
public class WrappedPacketPlayInUseEntity_1_13_2 extends WrappedVersionPacket {
|
||||
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_13_2(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -33,24 +25,30 @@ public class WrappedPacketPlayInUseEntity_1_13_2 {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity packet = (net.minecraft.server.v1_13_R2.PacketPlayInUseEntity) getRawPacket();
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
CraftWorld craftWorld = (CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
if (p.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_13_R2.Entity entity = packet.a(worldServer);
|
||||
Entity entity = p.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.b().name();
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
String name = p.b().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+26
-25
@@ -1,31 +1,25 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_14;
|
||||
package me.purplex.packetevents.packetwrappers.in._1_14;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_14 {
|
||||
private final Object packet;
|
||||
public class WrappedPacketPlayInAbilities_1_14 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
private Field fieldE;
|
||||
private Field fieldF;
|
||||
public WrappedPacketPlayInAbilities_1_14(Object packet) {
|
||||
this.packet = packet;
|
||||
try {
|
||||
this.fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setupFields();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.b();
|
||||
this.b = p.isFlying();
|
||||
@@ -43,10 +37,17 @@ public class WrappedPacketPlayInAbilities_1_14 {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_14;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_14 extends WrappedVersionPacket {
|
||||
public PlayerDigType digType;
|
||||
|
||||
public WrappedPacketPlayInBlockDig_1_14(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig) packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_14;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInFlying;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_14 extends WrappedVersionPacket {
|
||||
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) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInFlying p = (PacketPlayInFlying) packet;
|
||||
try {
|
||||
this.hasPos = fieldHasPos.getBoolean(p);
|
||||
this.hasLook = fieldHasLook.getBoolean(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasPos) {
|
||||
this.x = p.a(0.0D);
|
||||
this.y = p.b(0.0D);
|
||||
this.z = p.c(0.0D);
|
||||
} else {
|
||||
try {
|
||||
this.x = fieldX.getDouble(p);
|
||||
this.y = fieldY.getDouble(p);
|
||||
this.z = fieldZ.getDouble(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasLook) {
|
||||
this.yaw = p.a(0.0F);
|
||||
this.pitch = p.b(0.0F);
|
||||
} else {
|
||||
try {
|
||||
this.yaw = fieldYaw.getFloat(p);
|
||||
this.pitch = fieldPitch.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
fieldHasPos.setAccessible(true);
|
||||
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
|
||||
fieldHasLook.setAccessible(true);
|
||||
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
|
||||
fieldX.setAccessible(true);
|
||||
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
|
||||
fieldY.setAccessible(true);
|
||||
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
|
||||
fieldZ.setAccessible(true);
|
||||
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
|
||||
fieldYaw.setAccessible(true);
|
||||
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
|
||||
fieldPitch.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_14;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_14_R1.Entity;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_14 extends WrappedVersionPacket {
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_14(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityUseAction getEntityUseAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
CraftWorld craftWorld = (CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (p.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Entity entity = p.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
String name = p.b().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_15;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_15 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
public WrappedPacketPlayInAbilities_1_15(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.b();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.d();
|
||||
this.d = p.e();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_15;
|
||||
|
||||
import me.purplex.packetevents.enums.PlayerDigType;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_15 extends WrappedVersionPacket {
|
||||
public PlayerDigType digType;
|
||||
|
||||
public WrappedPacketPlayInBlockDig_1_15(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig) packet;
|
||||
String name = p.d().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_15;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_15 extends WrappedVersionPacket {
|
||||
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) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInFlying p = (PacketPlayInFlying) packet;
|
||||
try {
|
||||
this.hasPos = fieldHasPos.getBoolean(p);
|
||||
this.hasLook = fieldHasLook.getBoolean(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasPos) {
|
||||
this.x = p.a(0.0D);
|
||||
this.y = p.b(0.0D);
|
||||
this.z = p.c(0.0D);
|
||||
} else {
|
||||
try {
|
||||
this.x = fieldX.getDouble(p);
|
||||
this.y = fieldY.getDouble(p);
|
||||
this.z = fieldZ.getDouble(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasLook) {
|
||||
this.yaw = p.a(0.0F);
|
||||
this.pitch = p.b(0.0F);
|
||||
} else {
|
||||
try {
|
||||
this.yaw = fieldYaw.getFloat(p);
|
||||
this.pitch = fieldPitch.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
fieldHasPos.setAccessible(true);
|
||||
fieldHasLook = PacketPlayInFlying.class.getDeclaredField("hasLook");
|
||||
fieldHasLook.setAccessible(true);
|
||||
fieldX = PacketPlayInFlying.class.getDeclaredField("x");
|
||||
fieldX.setAccessible(true);
|
||||
fieldY = PacketPlayInFlying.class.getDeclaredField("y");
|
||||
fieldY.setAccessible(true);
|
||||
fieldZ = PacketPlayInFlying.class.getDeclaredField("z");
|
||||
fieldZ.setAccessible(true);
|
||||
fieldYaw = PacketPlayInFlying.class.getDeclaredField("yaw");
|
||||
fieldYaw.setAccessible(true);
|
||||
fieldPitch = PacketPlayInFlying.class.getDeclaredField("pitch");
|
||||
fieldPitch.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+18
-21
@@ -1,32 +1,24 @@
|
||||
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;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_15_R1.Entity;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_15 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
public class WrappedPacketPlayInUseEntity_1_15 extends WrappedVersionPacket {
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_15(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -34,24 +26,29 @@ public class WrappedPacketPlayInUseEntity_1_15 {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
WorldServer worldServer = null;
|
||||
for (World bukkitWorld : Bukkit.getWorlds()) {
|
||||
CraftWorld craftWorld = (CraftWorld) bukkitWorld;
|
||||
worldServer = craftWorld.getHandle();
|
||||
if (packet.a(worldServer) != null) {
|
||||
if (p.a(worldServer) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_15_R1.Entity entity = packet.a(worldServer);
|
||||
Entity entity = p.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.b().name();
|
||||
PacketPlayInUseEntity p = (PacketPlayInUseEntity) packet;
|
||||
String name = p.b().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -1,18 +1,17 @@
|
||||
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.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInAbilities;
|
||||
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_7_10 {
|
||||
private final Object packet;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_7_10 extends WrappedVersionPacket {
|
||||
public WrappedPacketPlayInAbilities_1_7_10(Object packet) {
|
||||
this.packet = packet;
|
||||
setupFields();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
|
||||
private void setupFields() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.c();
|
||||
this.b = p.isFlying();
|
||||
+6
-6
@@ -1,16 +1,16 @@
|
||||
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 me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_7_10 {
|
||||
private final Object packet;
|
||||
public class WrappedPacketPlayInBlockDig_1_7_10 extends WrappedVersionPacket {
|
||||
public WrappedPacketPlayInBlockDig_1_7_10(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
int status = p.e();
|
||||
this.digType = PlayerDigType.values()[status];
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_7_10;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInFlying;
|
||||
|
||||
public class WrappedPacketPlayInFlying_1_7_10 extends WrappedVersionPacket {
|
||||
public WrappedPacketPlayInFlying_1_7_10(Object packet) {
|
||||
super(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;
|
||||
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+20
-18
@@ -1,32 +1,29 @@
|
||||
package me.purplex.packetevents.events.packetevent.packet.impl.in._1_13;
|
||||
package me.purplex.packetevents.packetwrappers.in._1_7_10;
|
||||
|
||||
import me.purplex.packetevents.enums.EntityUseAction;
|
||||
import me.purplex.packetevents.enums.ServerVersion;
|
||||
import net.minecraft.server.v1_13_R1.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_13_R1.WorldServer;
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_7_R4.Entity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
|
||||
public class WrappedPacketPlayInUseEntity_1_13 {
|
||||
private final ServerVersion version;
|
||||
private Entity entity;
|
||||
public class WrappedPacketPlayInUseEntity_1_7_10 extends WrappedVersionPacket {
|
||||
private org.bukkit.entity.Entity entity;
|
||||
private EntityUseAction action;
|
||||
private final Object packet;
|
||||
|
||||
public WrappedPacketPlayInUseEntity_1_13(Object packet) {
|
||||
this.version = ServerVersion.getVersion();
|
||||
this.packet = packet;
|
||||
setupEntity();
|
||||
setupAction();
|
||||
public WrappedPacketPlayInUseEntity_1_7_10(Object packet) {
|
||||
super(packet);
|
||||
version = ServerVersion.getVersion();
|
||||
}
|
||||
|
||||
private Object getRawPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
public org.bukkit.entity.Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -34,6 +31,12 @@ public class WrappedPacketPlayInUseEntity_1_13 {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
setupEntity();
|
||||
setupAction();
|
||||
}
|
||||
|
||||
private void setupEntity() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
WorldServer worldServer = null;
|
||||
@@ -44,14 +47,13 @@ public class WrappedPacketPlayInUseEntity_1_13 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
net.minecraft.server.v1_13_R1.Entity entity = packet.a(worldServer);
|
||||
Entity entity = packet.a(worldServer);
|
||||
this.entity = entity.getBukkitEntity();
|
||||
|
||||
}
|
||||
|
||||
private void setupAction() {
|
||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) getRawPacket();
|
||||
String name = packet.b().name();
|
||||
String name = packet.c().name();
|
||||
this.action = EntityUseAction.valueOf(name);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package me.purplex.packetevents.packetwrappers.in._1_8;
|
||||
|
||||
import me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayInAbilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrappedPacketPlayInAbilities_1_8 extends WrappedVersionPacket {
|
||||
|
||||
public boolean a;
|
||||
public boolean b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
public float e;
|
||||
public float f;
|
||||
|
||||
|
||||
public WrappedPacketPlayInAbilities_1_8(Object packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInAbilities p = (PacketPlayInAbilities) packet;
|
||||
this.a = p.a();
|
||||
this.b = p.isFlying();
|
||||
this.c = p.c();
|
||||
this.d = p.d();
|
||||
try {
|
||||
this.e = fieldE.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.f = fieldF.getFloat(p);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static Field fieldE;
|
||||
private static Field fieldF;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldE = PacketPlayInAbilities.class.getDeclaredField("e");
|
||||
fieldE.setAccessible(true);
|
||||
fieldF = PacketPlayInAbilities.class.getDeclaredField("f");
|
||||
fieldF.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -1,21 +1,20 @@
|
||||
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 me.purplex.packetevents.packetwrappers.api.version.WrappedVersionPacket;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayInBlockDig;
|
||||
|
||||
public class WrappedPacketPlayInBlockDig_1_8 {
|
||||
private final Object packet;
|
||||
public class WrappedPacketPlayInBlockDig_1_8 extends WrappedVersionPacket {
|
||||
public WrappedPacketPlayInBlockDig_1_8(Object packet) {
|
||||
this.packet = packet;
|
||||
setupDigType();
|
||||
super(packet);
|
||||
}
|
||||
|
||||
private void setupDigType() {
|
||||
@Override
|
||||
protected void setup() {
|
||||
PacketPlayInBlockDig p = (PacketPlayInBlockDig)packet;
|
||||
String name = p.c().name();
|
||||
this.digType = PlayerDigType.valueOf(name);
|
||||
}
|
||||
|
||||
public PlayerDigType digType;
|
||||
|
||||
}
|
||||
Loaded 100 of 119 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user