Return of the Netty... dun dun dun

This commit is contained in:
md_5 2013-07-02 15:06:15 +10:00
parent 0f94ebdabe
commit 79d9e36303
3 changed files with 98 additions and 50 deletions

View File

@ -1,4 +1,4 @@
From d1aafbeed41761872184e2f9d161b1faecd818f0 Mon Sep 17 00:00:00 2001 From d4173f0bd000a1152b28e206169701f250ffc058 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 13:13:29 +1000 Date: Tue, 2 Jul 2013 13:13:29 +1000
Subject: [PATCH] mc-dev imports Subject: [PATCH] mc-dev imports
@ -317,6 +317,65 @@ index 0000000..53c1cb5
+ } + }
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/Packet254GetInfo.java b/src/main/java/net/minecraft/server/Packet254GetInfo.java
new file mode 100644
index 0000000..9afa795
--- /dev/null
+++ b/src/main/java/net/minecraft/server/Packet254GetInfo.java
@@ -0,0 +1,53 @@
+package net.minecraft.server;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+
+public class Packet254GetInfo extends Packet {
+
+ private static final int d = (new Packet250CustomPayload()).n();
+ public int a;
+ public String b;
+ public int c;
+
+ public Packet254GetInfo() {}
+
+ public void a(DataInput datainput) throws java.io.IOException { // Spigot - throws
+ try {
+ datainput.readByte();
+ datainput.readByte();
+ a(datainput, 255);
+ datainput.readShort();
+ this.a = datainput.readByte();
+ if (this.a >= 73) {
+ this.b = a(datainput, 255);
+ this.c = datainput.readInt();
+ }
+ } catch (Throwable throwable) {
+ this.a = 0;
+ this.b = "";
+ }
+ }
+
+ public void a(DataOutput dataoutput) throws java.io.IOException { // Spigot - throws
+ dataoutput.writeByte(1);
+ dataoutput.writeByte(d);
+ Packet.a("MC|PingHost", dataoutput);
+ dataoutput.writeShort(3 + 2 * this.b.length() + 4);
+ dataoutput.writeByte(this.a);
+ Packet.a(this.b, dataoutput);
+ dataoutput.writeInt(this.c);
+ }
+
+ public void handle(Connection connection) {
+ connection.a(this);
+ }
+
+ public int a() {
+ return 3 + this.b.length() * 2 + 4;
+ }
+
+ public boolean d() {
+ return this.a == 0;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Packet63WorldParticles.java b/src/main/java/net/minecraft/server/Packet63WorldParticles.java diff --git a/src/main/java/net/minecraft/server/Packet63WorldParticles.java b/src/main/java/net/minecraft/server/Packet63WorldParticles.java
new file mode 100644 new file mode 100644
index 0000000..f036c53 index 0000000..f036c53

View File

@ -1,4 +1,4 @@
From eabbbdf2f175c602d04575c0d90062bba6e316b2 Mon Sep 17 00:00:00 2001 From dec4a7481c02848ccfee73ae5800132d7480268f Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 09:06:29 +1000 Date: Tue, 2 Jul 2013 09:06:29 +1000
Subject: [PATCH] Netty Subject: [PATCH] Netty
@ -94,6 +94,19 @@ index c60abf1..e1b259b 100644
+ +
+ public void setSocketAddress(SocketAddress address) { k = address; } // Spigot + public void setSocketAddress(SocketAddress address) { k = address; } // Spigot
} }
diff --git a/src/main/java/net/minecraft/server/Packet254GetInfo.java b/src/main/java/net/minecraft/server/Packet254GetInfo.java
index 9afa795..32704e8 100644
--- a/src/main/java/net/minecraft/server/Packet254GetInfo.java
+++ b/src/main/java/net/minecraft/server/Packet254GetInfo.java
@@ -23,7 +23,7 @@ public class Packet254GetInfo extends Packet {
this.b = a(datainput, 255);
this.c = datainput.readInt();
}
- } catch (Throwable throwable) {
+ } catch (java.io.IOException throwable) { // Spigot Throwable -> IOException
this.a = 0;
this.b = "";
}
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
index 252cea7..d07973d 100644 index 252cea7..d07973d 100644
--- a/src/main/java/net/minecraft/server/PendingConnection.java --- a/src/main/java/net/minecraft/server/PendingConnection.java
@ -1166,10 +1179,10 @@ index 0000000..5da8a59
+} +}
diff --git a/src/main/java/org/spigotmc/netty/PacketDecoder.java b/src/main/java/org/spigotmc/netty/PacketDecoder.java diff --git a/src/main/java/org/spigotmc/netty/PacketDecoder.java b/src/main/java/org/spigotmc/netty/PacketDecoder.java
new file mode 100644 new file mode 100644
index 0000000..b955914 index 0000000..0860655
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/netty/PacketDecoder.java +++ b/src/main/java/org/spigotmc/netty/PacketDecoder.java
@@ -0,0 +1,69 @@ @@ -0,0 +1,67 @@
+package org.spigotmc.netty; +package org.spigotmc.netty;
+ +
+import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBuf;
@ -1208,34 +1221,32 @@ index 0000000..b955914
+ input = new ByteBufInputStream( in ); + input = new ByteBufInputStream( in );
+ } + }
+ +
+ while ( true ) + try
+ { + {
+ switch ( state() ) + while ( true )
+ { + {
+ case HEADER: + switch ( state() )
+ int packetId = input.readUnsignedByte(); + {
+ packet = Packet.a( MinecraftServer.getServer().getLogger(), packetId ); + case HEADER:
+ if ( packet == null ) + int packetId = input.readUnsignedByte();
+ { + packet = Packet.a( MinecraftServer.getServer().getLogger(), packetId );
+ throw new IOException( "Bad packet id " + packetId ); + if ( packet == null )
+ } + {
+ checkpoint( ReadState.DATA ); + throw new IOException( "Bad packet id " + packetId );
+ case DATA: + }
+ try + checkpoint( ReadState.DATA );
+ { + case DATA:
+ packet.a( input ); + packet.a( input );
+ } catch ( EOFException ex ) + checkpoint( ReadState.HEADER );
+ { + out.add( packet );
+ return; + packet = null;
+ } + break;
+ + default:
+ checkpoint( ReadState.HEADER ); + throw new IllegalStateException();
+ out.add( packet ); + }
+ packet = null;
+ break;
+ default:
+ throw new IllegalStateException();
+ } + }
+ } catch ( EOFException ex )
+ {
+ } + }
+ } + }
+} +}

View File

@ -1,22 +0,0 @@
From 314e1a289073e5ffdd6853a686121a1eacaf6d53 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 14:30:00 +1000
Subject: [PATCH] Really Disable Netty
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index ccbd6bc..fead3d5 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -101,7 +101,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
try {
// Spigot start
- this.s = ( org.spigotmc.SpigotConfig.listeners.get( 0 ).netty )
+ this.s = ( false )
? new org.spigotmc.netty.NettyServerConnection( this, inetaddress, this.I() )
: new DedicatedServerConnection( this, inetaddress, this.I() );
// Spigot end
--
1.8.1.2