Mineplex2018-withcommit/Patches/CraftBukkit-Patches/0161-Mineplex-Packet-Changes.patch

1177 lines
40 KiB
Diff
Raw Normal View History

2015-04-22 02:15:32 +02:00
From e218bdb001b6480be6e7aa4118a8b5c2a88aa598 Mon Sep 17 00:00:00 2001
From: Shaun Bennett <phination@me.com>
Date: Tue, 21 Apr 2015 19:48:02 -0400
Subject: [PATCH] Mineplex - Packet Changes
diff --git a/src/main/java/com/mineplex/spigot/IPacketVerifier.java b/src/main/java/com/mineplex/spigot/IPacketVerifier.java
new file mode 100644
index 0000000..4ada0b2
--- /dev/null
+++ b/src/main/java/com/mineplex/spigot/IPacketVerifier.java
@@ -0,0 +1,8 @@
+package com.mineplex.spigot;
+
+import net.minecraft.server.Packet;
+
+public interface IPacketVerifier
+{
+ public boolean verify(Packet packet);
+}
diff --git a/src/main/java/com/mineplex/spigot/PacketProcessor.java b/src/main/java/com/mineplex/spigot/PacketProcessor.java
new file mode 100644
index 0000000..e372c4f
--- /dev/null
+++ b/src/main/java/com/mineplex/spigot/PacketProcessor.java
@@ -0,0 +1,42 @@
+package com.mineplex.spigot;
+
+import net.minecraft.server.NetworkManager;
+import net.minecraft.server.Packet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PacketProcessor
+{
+ private List<IPacketVerifier> _packetVerifiers;
+
+ public PacketProcessor()
+ {
+ _packetVerifiers = new ArrayList<IPacketVerifier>();
+ }
+
+ public void addPacketVerifier(IPacketVerifier verifier)
+ {
+ _packetVerifiers.add(verifier);
+ }
+
+ public void processPacket(Packet packet, NetworkManager networkManager)
+ {
+ boolean addDefaultPacket = true;
+
+ for (IPacketVerifier verifier : _packetVerifiers)
+ {
+ if (!verifier.verify(packet))
+ addDefaultPacket = false;
+ }
+
+ if (addDefaultPacket)
+ networkManager.handle(packet);
+ }
+
+ public void clearVerifiers()
+ {
+ _packetVerifiers.clear();
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 01c09b1..5d36e16 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -325,7 +325,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
this.a(channelhandlercontext, (Packet) object);
}
- static class QueuedPacket {
+ public static class QueuedPacket {
private final Packet a;
private final GenericFutureListener<? extends Future<? super Void>>[] b;
diff --git a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java
index 4dfb6c0..05c88a6 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java
@@ -4,7 +4,7 @@ import java.io.IOException;
public class PacketPlayInCloseWindow implements Packet<PacketListenerPlayIn> {
- private int id;
+ public int id;
public PacketPlayInCloseWindow() {}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java
new file mode 100644
index 0000000..b5fdd87
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java
@@ -0,0 +1,30 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutAnimation implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public int b;
+
+ public PacketPlayOutAnimation() {}
+
+ public PacketPlayOutAnimation(Entity entity, int i) {
+ this.a = entity.getId();
+ this.b = i;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ this.b = packetdataserializer.readUnsignedByte();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ packetdataserializer.writeByte(this.b);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java
new file mode 100644
index 0000000..6e17e4b
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java
@@ -0,0 +1,41 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutAttachEntity implements Packet<PacketListenerPlayOut>
+{
+
+ public int a;
+ public int b;
+ public int c;
+
+ public PacketPlayOutAttachEntity()
+ {
+ }
+
+ public PacketPlayOutAttachEntity(int i, Entity entity, Entity entity1)
+ {
+ this.a = i;
+ this.b = entity.getId();
+ this.c = entity1 != null ? entity1.getId() : -1;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException
+ {
+ this.b = packetdataserializer.readInt();
+ this.c = packetdataserializer.readInt();
+ this.a = packetdataserializer.readUnsignedByte();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException
+ {
+ packetdataserializer.writeInt(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeByte(this.a);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout)
+ {
+ packetlistenerplayout.a(this);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
new file mode 100644
index 0000000..702d33d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
@@ -0,0 +1,134 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public byte b;
+ public byte c;
+ public byte d;
+ public byte e;
+ public byte f;
+ public boolean g;
+ public boolean h;
+
+ public PacketPlayOutEntity() {}
+
+ public PacketPlayOutEntity(int i) {
+ this.a = i;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+ public String toString() {
+ return "Entity_" + super.toString();
+ }
+
+ public static class PacketPlayOutEntityLook extends PacketPlayOutEntity {
+
+ public PacketPlayOutEntityLook() {
+ this.h = true;
+ }
+
+ public PacketPlayOutEntityLook(int i, byte b0, byte b1, boolean flag) {
+ super(i);
+ this.e = b0;
+ this.f = b1;
+ this.h = true;
+ this.g = flag;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ super.a(packetdataserializer);
+ this.e = packetdataserializer.readByte();
+ this.f = packetdataserializer.readByte();
+ this.g = packetdataserializer.readBoolean();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ super.b(packetdataserializer);
+ packetdataserializer.writeByte(this.e);
+ packetdataserializer.writeByte(this.f);
+ packetdataserializer.writeBoolean(this.g);
+ }
+
+ }
+
+ public static class PacketPlayOutRelEntityMove extends PacketPlayOutEntity {
+
+ public PacketPlayOutRelEntityMove() {}
+
+ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2, boolean flag) {
+ super(i);
+ this.b = b0;
+ this.c = b1;
+ this.d = b2;
+ this.g = flag;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ super.a(packetdataserializer);
+ this.b = packetdataserializer.readByte();
+ this.c = packetdataserializer.readByte();
+ this.d = packetdataserializer.readByte();
+ this.g = packetdataserializer.readBoolean();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ super.b(packetdataserializer);
+ packetdataserializer.writeByte(this.b);
+ packetdataserializer.writeByte(this.c);
+ packetdataserializer.writeByte(this.d);
+ packetdataserializer.writeBoolean(this.g);
+ }
+ }
+
+ public static class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity {
+
+ public PacketPlayOutRelEntityMoveLook() {
+ this.h = true;
+ }
+
+ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4, boolean flag) {
+ super(i);
+ this.b = b0;
+ this.c = b1;
+ this.d = b2;
+ this.e = b3;
+ this.f = b4;
+ this.g = flag;
+ this.h = true;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ super.a(packetdataserializer);
+ this.b = packetdataserializer.readByte();
+ this.c = packetdataserializer.readByte();
+ this.d = packetdataserializer.readByte();
+ this.e = packetdataserializer.readByte();
+ this.f = packetdataserializer.readByte();
+ this.g = packetdataserializer.readBoolean();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ super.b(packetdataserializer);
+ packetdataserializer.writeByte(this.b);
+ packetdataserializer.writeByte(this.c);
+ packetdataserializer.writeByte(this.d);
+ packetdataserializer.writeByte(this.e);
+ packetdataserializer.writeByte(this.f);
+ packetdataserializer.writeBoolean(this.g);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java
new file mode 100644
index 0000000..ecc2e78
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java
@@ -0,0 +1,35 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutEntityEquipment implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public int b;
+ public ItemStack c;
+
+ public PacketPlayOutEntityEquipment() {}
+
+ public PacketPlayOutEntityEquipment(int i, int j, ItemStack itemstack) {
+ this.a = i;
+ this.b = j;
+ this.c = itemstack == null ? null : itemstack.cloneItemStack();
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ this.b = packetdataserializer.readShort();
+ this.c = packetdataserializer.i();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ packetdataserializer.writeShort(this.b);
+ packetdataserializer.a(this.c);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java
new file mode 100644
index 0000000..dbfcc3c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java
@@ -0,0 +1,37 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+import java.util.List;
+
+public class PacketPlayOutEntityMetadata implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public List<DataWatcher.WatchableObject> b;
+
+ public PacketPlayOutEntityMetadata() {}
+
+ public PacketPlayOutEntityMetadata(int i, DataWatcher datawatcher, boolean flag) {
+ this.a = i;
+ if (flag) {
+ this.b = datawatcher.c();
+ } else {
+ this.b = datawatcher.b();
+ }
+
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ this.b = DataWatcher.b(packetdataserializer);
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ DataWatcher.a(this.b, packetdataserializer);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
new file mode 100644
index 0000000..786047c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
@@ -0,0 +1,58 @@
+package net.minecraft.server;
+
+public class PacketPlayOutEntityTeleport implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public int b;
+ public int c;
+ public int d;
+ public byte e;
+ public byte f;
+ public boolean g;
+
+ public PacketPlayOutEntityTeleport() {}
+
+ public PacketPlayOutEntityTeleport(Entity entity) {
+ this.a = entity.getId();
+ this.b = MathHelper.floor(entity.locX * 32.0D);
+ this.c = MathHelper.floor(entity.locY * 32.0D);
+ this.d = MathHelper.floor(entity.locZ * 32.0D);
+ this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F));
+ this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F));
+ this.g = entity.onGround;
+ }
+
+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean flag) {
+ this.a = i;
+ this.b = j;
+ this.c = k;
+ this.d = l;
+ this.e = b0;
+ this.f = b1;
+ this.g = flag;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) {
+ this.a = packetdataserializer.e();
+ this.b = packetdataserializer.readInt();
+ this.c = packetdataserializer.readInt();
+ this.d = packetdataserializer.readInt();
+ this.e = packetdataserializer.readByte();
+ this.f = packetdataserializer.readByte();
+ this.g = packetdataserializer.readBoolean();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) {
+ packetdataserializer.b(this.a);
+ packetdataserializer.writeInt(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeByte(this.e);
+ packetdataserializer.writeByte(this.f);
+ packetdataserializer.writeBoolean(this.g);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java
new file mode 100644
index 0000000..6c8dbbc
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java
@@ -0,0 +1,69 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutEntityVelocity implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public int b;
+ public int c;
+ public int d;
+
+ public PacketPlayOutEntityVelocity() {}
+
+ public PacketPlayOutEntityVelocity(Entity entity) {
+ this(entity.getId(), entity.motX, entity.motY, entity.motZ);
+ }
+
+ public PacketPlayOutEntityVelocity(int i, double d0, double d1, double d2) {
+ this.a = i;
+ double d3 = 3.9D;
+
+ if (d0 < -d3) {
+ d0 = -d3;
+ }
+
+ if (d1 < -d3) {
+ d1 = -d3;
+ }
+
+ if (d2 < -d3) {
+ d2 = -d3;
+ }
+
+ if (d0 > d3) {
+ d0 = d3;
+ }
+
+ if (d1 > d3) {
+ d1 = d3;
+ }
+
+ if (d2 > d3) {
+ d2 = d3;
+ }
+
+ this.b = (int) (d0 * 8000.0D);
+ this.c = (int) (d1 * 8000.0D);
+ this.d = (int) (d2 * 8000.0D);
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ this.b = packetdataserializer.readShort();
+ this.c = packetdataserializer.readShort();
+ this.d = packetdataserializer.readShort();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ packetdataserializer.writeShort(this.b);
+ packetdataserializer.writeShort(this.c);
+ packetdataserializer.writeShort(this.d);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
new file mode 100644
index 0000000..23fa49d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
@@ -0,0 +1,64 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.UUID;
+
+public class PacketPlayOutNamedEntitySpawn implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public UUID b;
+ public int c;
+ public int d;
+ public int e;
+ public byte f;
+ public byte g;
+ public int h;
+ public DataWatcher i;
+ public List<DataWatcher.WatchableObject> j;
+
+ public PacketPlayOutNamedEntitySpawn() {}
+
+ public PacketPlayOutNamedEntitySpawn(EntityHuman entityhuman) {
+ this.a = entityhuman.getId();
+ this.b = entityhuman.getProfile().getId();
+ this.c = MathHelper.floor(entityhuman.locX * 32.0D);
+ this.d = MathHelper.floor(entityhuman.locY * 32.0D);
+ this.e = MathHelper.floor(entityhuman.locZ * 32.0D);
+ this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F));
+ this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F));
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
+
+ this.h = itemstack == null ? 0 : Item.getId(itemstack.getItem());
+ this.i = entityhuman.getDataWatcher();
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ this.b = packetdataserializer.g();
+ this.c = packetdataserializer.readInt();
+ this.d = packetdataserializer.readInt();
+ this.e = packetdataserializer.readInt();
+ this.f = packetdataserializer.readByte();
+ this.g = packetdataserializer.readByte();
+ this.h = packetdataserializer.readShort();
+ this.j = DataWatcher.b(packetdataserializer);
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ packetdataserializer.a(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeInt(this.e);
+ packetdataserializer.writeByte(this.f);
+ packetdataserializer.writeByte(this.g);
+ packetdataserializer.writeShort(this.h);
+ this.i.a(packetdataserializer);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java
new file mode 100644
index 0000000..99809cd
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java
@@ -0,0 +1,254 @@
+package net.minecraft.server;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Lists;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.properties.Property;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+public class PacketPlayOutPlayerInfo implements Packet<PacketListenerPlayOut> {
+
+ public PacketPlayOutPlayerInfo.EnumPlayerInfoAction a;
+ public final List<PacketPlayOutPlayerInfo.PlayerInfoData> b = Lists.newArrayList();
+
+ public PacketPlayOutPlayerInfo() {}
+
+ public PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction packetplayoutplayerinfo_enumplayerinfoaction, EntityPlayer... aentityplayer) {
+ this.a = packetplayoutplayerinfo_enumplayerinfoaction;
+ EntityPlayer[] aentityplayer1 = aentityplayer;
+ int i = aentityplayer.length;
+
+ for (int j = 0; j < i; ++j) {
+ EntityPlayer entityplayer = aentityplayer1[j];
+
+ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(entityplayer.getProfile(), entityplayer.ping, entityplayer.playerInteractManager.getGameMode(), entityplayer.getPlayerListName()));
+ }
+
+ }
+
+ public PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction packetplayoutplayerinfo_enumplayerinfoaction, Iterable<EntityPlayer> iterable) {
+ this.a = packetplayoutplayerinfo_enumplayerinfoaction;
+ Iterator iterator = iterable.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+
+ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(entityplayer.getProfile(), entityplayer.ping, entityplayer.playerInteractManager.getGameMode(), entityplayer.getPlayerListName()));
+ }
+
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = (PacketPlayOutPlayerInfo.EnumPlayerInfoAction) packetdataserializer.a(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.class);
+ int i = packetdataserializer.e();
+
+ for (int j = 0; j < i; ++j) {
+ GameProfile gameprofile = null;
+ int k = 0;
+ WorldSettings.EnumGamemode worldsettings_enumgamemode = null;
+ IChatBaseComponent ichatbasecomponent = null;
+
+ switch (PacketPlayOutPlayerInfo.SyntheticClass_1.a[this.a.ordinal()]) {
+ case 1:
+ gameprofile = new GameProfile(packetdataserializer.g(), packetdataserializer.c(16));
+ int l = packetdataserializer.e();
+
+ for (int i1 = 0; i1 < l; ++i1) {
+ String s = packetdataserializer.c(32767);
+ String s1 = packetdataserializer.c(32767);
+
+ if (packetdataserializer.readBoolean()) {
+ gameprofile.getProperties().put(s, new Property(s, s1, packetdataserializer.c(32767)));
+ } else {
+ gameprofile.getProperties().put(s, new Property(s, s1));
+ }
+ }
+
+ worldsettings_enumgamemode = WorldSettings.EnumGamemode.getById(packetdataserializer.e());
+ k = packetdataserializer.e();
+ if (packetdataserializer.readBoolean()) {
+ ichatbasecomponent = packetdataserializer.d();
+ }
+ break;
+
+ case 2:
+ gameprofile = new GameProfile(packetdataserializer.g(), (String) null);
+ worldsettings_enumgamemode = WorldSettings.EnumGamemode.getById(packetdataserializer.e());
+ break;
+
+ case 3:
+ gameprofile = new GameProfile(packetdataserializer.g(), (String) null);
+ k = packetdataserializer.e();
+ break;
+
+ case 4:
+ gameprofile = new GameProfile(packetdataserializer.g(), (String) null);
+ if (packetdataserializer.readBoolean()) {
+ ichatbasecomponent = packetdataserializer.d();
+ }
+ break;
+
+ case 5:
+ gameprofile = new GameProfile(packetdataserializer.g(), (String) null);
+ }
+
+ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(gameprofile, k, worldsettings_enumgamemode, ichatbasecomponent));
+ }
+
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.a((Enum) this.a);
+ packetdataserializer.b(this.b.size());
+ Iterator iterator = this.b.iterator();
+
+ while (iterator.hasNext()) {
+ PacketPlayOutPlayerInfo.PlayerInfoData packetplayoutplayerinfo_playerinfodata = (PacketPlayOutPlayerInfo.PlayerInfoData) iterator.next();
+
+ switch (PacketPlayOutPlayerInfo.SyntheticClass_1.a[this.a.ordinal()]) {
+ case 1:
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId());
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getName());
+ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.a().getProperties().size());
+ Iterator iterator1 = packetplayoutplayerinfo_playerinfodata.a().getProperties().values().iterator();
+
+ while (iterator1.hasNext()) {
+ Property property = (Property) iterator1.next();
+
+ packetdataserializer.a(property.getName());
+ packetdataserializer.a(property.getValue());
+ if (property.hasSignature()) {
+ packetdataserializer.writeBoolean(true);
+ packetdataserializer.a(property.getSignature());
+ } else {
+ packetdataserializer.writeBoolean(false);
+ }
+ }
+
+ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.c().getId());
+ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.b());
+ if (packetplayoutplayerinfo_playerinfodata.d() == null) {
+ packetdataserializer.writeBoolean(false);
+ } else {
+ packetdataserializer.writeBoolean(true);
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.d());
+ }
+ break;
+
+ case 2:
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId());
+ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.c().getId());
+ break;
+
+ case 3:
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId());
+ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.b());
+ break;
+
+ case 4:
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId());
+ if (packetplayoutplayerinfo_playerinfodata.d() == null) {
+ packetdataserializer.writeBoolean(false);
+ } else {
+ packetdataserializer.writeBoolean(true);
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.d());
+ }
+ break;
+
+ case 5:
+ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId());
+ }
+ }
+
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+ public String toString() {
+ return Objects.toStringHelper(this).add("action", this.a).add("entries", this.b).toString();
+ }
+
+ static class SyntheticClass_1 {
+
+ static final int[] a = new int[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.values().length];
+
+ static {
+ try {
+ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER.ordinal()] = 1;
+ } catch (NoSuchFieldError nosuchfielderror) {
+ ;
+ }
+
+ try {
+ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE.ordinal()] = 2;
+ } catch (NoSuchFieldError nosuchfielderror1) {
+ ;
+ }
+
+ try {
+ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY.ordinal()] = 3;
+ } catch (NoSuchFieldError nosuchfielderror2) {
+ ;
+ }
+
+ try {
+ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME.ordinal()] = 4;
+ } catch (NoSuchFieldError nosuchfielderror3) {
+ ;
+ }
+
+ try {
+ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER.ordinal()] = 5;
+ } catch (NoSuchFieldError nosuchfielderror4) {
+ ;
+ }
+
+ }
+ }
+
+ public class PlayerInfoData {
+
+ public final int b;
+ public final WorldSettings.EnumGamemode c;
+ public final GameProfile d;
+ public final IChatBaseComponent e;
+
+ public PlayerInfoData(GameProfile gameprofile, int i, WorldSettings.EnumGamemode worldsettings_enumgamemode, IChatBaseComponent ichatbasecomponent) {
+ this.d = gameprofile;
+ this.b = i;
+ this.c = worldsettings_enumgamemode;
+ this.e = ichatbasecomponent;
+ }
+
+ public GameProfile a() {
+ return this.d;
+ }
+
+ public int b() {
+ return this.b;
+ }
+
+ public WorldSettings.EnumGamemode c() {
+ return this.c;
+ }
+
+ public IChatBaseComponent d() {
+ return this.e;
+ }
+
+ public String toString() {
+ return Objects.toStringHelper(this).add("latency", this.b).add("gameMode", this.c).add("profile", this.d).add("displayName", this.e == null ? null : IChatBaseComponent.ChatSerializer.a(this.e)).toString();
+ }
+ }
+
+ public static enum EnumPlayerInfoAction {
+
+ ADD_PLAYER, UPDATE_GAME_MODE, UPDATE_LATENCY, UPDATE_DISPLAY_NAME, REMOVE_PLAYER;
+
+ private EnumPlayerInfoAction() {}
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
new file mode 100644
index 0000000..d34f59b
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
@@ -0,0 +1,133 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutSpawnEntity implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public int b;
+ public int c;
+ public int d;
+ public int e;
+ public int f;
+ public int g;
+ public int h;
+ public int i;
+ public int j;
+ public int k;
+
+ public PacketPlayOutSpawnEntity() {}
+
+ public PacketPlayOutSpawnEntity(Entity entity, int i) {
+ this(entity, i, 0);
+ }
+
+ public PacketPlayOutSpawnEntity(Entity entity, int i, int j) {
+ this.a = entity.getId();
+ this.b = MathHelper.floor(entity.locX * 32.0D);
+ this.c = MathHelper.floor(entity.locY * 32.0D);
+ this.d = MathHelper.floor(entity.locZ * 32.0D);
+ this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F);
+ this.i = MathHelper.d(entity.yaw * 256.0F / 360.0F);
+ this.j = i;
+ this.k = j;
+ if (j > 0) {
+ double d0 = entity.motX;
+ double d1 = entity.motY;
+ double d2 = entity.motZ;
+ double d3 = 3.9D;
+
+ if (d0 < -d3) {
+ d0 = -d3;
+ }
+
+ if (d1 < -d3) {
+ d1 = -d3;
+ }
+
+ if (d2 < -d3) {
+ d2 = -d3;
+ }
+
+ if (d0 > d3) {
+ d0 = d3;
+ }
+
+ if (d1 > d3) {
+ d1 = d3;
+ }
+
+ if (d2 > d3) {
+ d2 = d3;
+ }
+
+ this.e = (int) (d0 * 8000.0D);
+ this.f = (int) (d1 * 8000.0D);
+ this.g = (int) (d2 * 8000.0D);
+ }
+
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ this.j = packetdataserializer.readByte();
+ this.b = packetdataserializer.readInt();
+ this.c = packetdataserializer.readInt();
+ this.d = packetdataserializer.readInt();
+ this.h = packetdataserializer.readByte();
+ this.i = packetdataserializer.readByte();
+ this.k = packetdataserializer.readInt();
+ if (this.k > 0) {
+ this.e = packetdataserializer.readShort();
+ this.f = packetdataserializer.readShort();
+ this.g = packetdataserializer.readShort();
+ }
+
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ packetdataserializer.writeByte(this.j);
+ packetdataserializer.writeInt(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeByte(this.h);
+ packetdataserializer.writeByte(this.i);
+ packetdataserializer.writeInt(this.k);
+ if (this.k > 0) {
+ packetdataserializer.writeShort(this.e);
+ packetdataserializer.writeShort(this.f);
+ packetdataserializer.writeShort(this.g);
+ }
+
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+ public void a(int i) {
+ this.b = i;
+ }
+
+ public void b(int i) {
+ this.c = i;
+ }
+
+ public void c(int i) {
+ this.d = i;
+ }
+
+ public void d(int i) {
+ this.e = i;
+ }
+
+ public void e(int i) {
+ this.f = i;
+ }
+
+ public void f(int i) {
+ this.g = i;
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
new file mode 100644
index 0000000..61aa281
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
@@ -0,0 +1,102 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+import java.util.List;
+
+public class PacketPlayOutSpawnEntityLiving implements Packet<PacketListenerPlayOut> {
+
+ public int a;
+ public int b;
+ public int c;
+ public int d;
+ public int e;
+ public int f;
+ public int g;
+ public int h;
+ public byte i;
+ public byte j;
+ public byte k;
+ public DataWatcher l;
+ public List<DataWatcher.WatchableObject> m;
+
+ public PacketPlayOutSpawnEntityLiving() {}
+
+ public PacketPlayOutSpawnEntityLiving(EntityLiving entityliving) {
+ this.a = entityliving.getId();
+ this.b = (byte) EntityTypes.a(entityliving);
+ this.c = MathHelper.floor(entityliving.locX * 32.0D);
+ this.d = MathHelper.floor(entityliving.locY * 32.0D);
+ this.e = MathHelper.floor(entityliving.locZ * 32.0D);
+ this.i = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F));
+ this.j = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F));
+ this.k = (byte) ((int) (entityliving.aK * 256.0F / 360.0F));
+ double d0 = 3.9D;
+ double d1 = entityliving.motX;
+ double d2 = entityliving.motY;
+ double d3 = entityliving.motZ;
+
+ if (d1 < -d0) {
+ d1 = -d0;
+ }
+
+ if (d2 < -d0) {
+ d2 = -d0;
+ }
+
+ if (d3 < -d0) {
+ d3 = -d0;
+ }
+
+ if (d1 > d0) {
+ d1 = d0;
+ }
+
+ if (d2 > d0) {
+ d2 = d0;
+ }
+
+ if (d3 > d0) {
+ d3 = d0;
+ }
+
+ this.f = (int) (d1 * 8000.0D);
+ this.g = (int) (d2 * 8000.0D);
+ this.h = (int) (d3 * 8000.0D);
+ this.l = entityliving.getDataWatcher();
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.e();
+ this.b = packetdataserializer.readByte() & 255;
+ this.c = packetdataserializer.readInt();
+ this.d = packetdataserializer.readInt();
+ this.e = packetdataserializer.readInt();
+ this.i = packetdataserializer.readByte();
+ this.j = packetdataserializer.readByte();
+ this.k = packetdataserializer.readByte();
+ this.f = packetdataserializer.readShort();
+ this.g = packetdataserializer.readShort();
+ this.h = packetdataserializer.readShort();
+ this.m = DataWatcher.b(packetdataserializer);
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ packetdataserializer.writeByte(this.b & 255);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeInt(this.e);
+ packetdataserializer.writeByte(this.i);
+ packetdataserializer.writeByte(this.j);
+ packetdataserializer.writeByte(this.k);
+ packetdataserializer.writeShort(this.f);
+ packetdataserializer.writeShort(this.g);
+ packetdataserializer.writeShort(this.h);
+ this.l.a(packetdataserializer);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3108938..69f4762 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.Futures;
+import com.mineplex.spigot.PacketProcessor;
import io.netty.buffer.Unpooled;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
@@ -84,6 +85,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
private boolean checkMovement = true;
private boolean processedDisconnect; // CraftBukkit - added
+ public PacketProcessor PacketVerifier;
+
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
this.networkManager = networkmanager;
@@ -91,6 +94,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
this.player = entityplayer;
entityplayer.playerConnection = this;
+ PacketVerifier = new PacketProcessor();
+
// CraftBukkit start - add fields and methods
this.server = minecraftserver.server;
}
@@ -881,7 +886,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
// CraftBukkit end
try {
- this.networkManager.handle(packet);
+ PacketVerifier.processPacket(packet, networkManager);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
@@ -1398,9 +1403,13 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
if (this.player.dead) return; // CraftBukkit
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u());
- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
+ if (packetplayinclosewindow.id == player.activeContainer.windowId)
+ {
+ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
+
+ this.player.p();
+ }
- this.player.p();
}
public void a(PacketPlayInWindowClick packetplayinwindowclick) {
--
2.3.5