3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

Update Netty to 4.0.0-Beta3 + reapply patches for new index info.

Dieser Commit ist enthalten in:
md_5 2013-03-17 09:14:16 +11:00
Ursprung 9a81f469cf
Commit 33c2a517ec
8 geänderte Dateien mit 60 neuen und 78 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From fb119d1c590c5394eecadda95eeea26ccffc25be Mon Sep 17 00:00:00 2001
From 8878e09188c2088a60503fade58f989fc7ed12c0 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 16 Mar 2013 10:13:29 +1100
Subject: [PATCH] Spigot changes.
@ -147,7 +147,7 @@ index 8657860..def38e9 100644
world.setData(i, j, k, 0, 4);
} else {
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 4264630..402647d 100644
index 56938cd..7217ed6 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -25,7 +25,7 @@ public class BlockSapling extends BlockFlower {
@ -362,7 +362,7 @@ index 30259de..af42142 100644
super.c();
this.e = this.d;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index aeca924..b3ff786 100644
index 13c2705..9ea4ee6 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -839,8 +839,19 @@ public class PlayerConnection extends Connection {
@ -395,7 +395,7 @@ index aeca924..b3ff786 100644
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
return;
}
@@ -1340,8 +1351,9 @@ public class PlayerConnection extends Connection {
@@ -1346,8 +1357,9 @@ public class PlayerConnection extends Connection {
flag = false;
} else {
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
@ -710,7 +710,7 @@ index 9c39815..67f2560 100644
entityhuman = (EntityHuman) this.players.get(i);
j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index d99b6a3..34f7bb1 100644
index ddcaaaa..c614ecc 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1,5 +1,7 @@
@ -908,10 +908,10 @@ index 3775022..8f65601 100644
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
getLogger().log(Level.SEVERE, "Exception when " + player.getName() + " attempted to tab complete " + message, ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 9218f07..fdef910 100644
index adb2bba..3dc6f0e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -75,7 +75,81 @@ public class CraftWorld implements World {
@@ -77,7 +77,81 @@ public class CraftWorld implements World {
if (server.chunkGCPeriod > 0) {
chunkGCTickCount = rand.nextInt(server.chunkGCPeriod);
}

Datei anzeigen

@ -1,4 +1,4 @@
From 037685772e9421d9f819da76728cd90ef63f3741 Mon Sep 17 00:00:00 2001
From 3bc5c2ebab567f4e7722acab6cb465ed1673b26e Mon Sep 17 00:00:00 2001
From: md_5 <md_5@bigpond.com>
Date: Sat, 12 Jan 2013 19:57:45 +1100
Subject: [PATCH] Per world view distance.
@ -10,7 +10,7 @@ Subject: [PATCH] Per world view distance.
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index f7c1b87..2407bc6 100644
index c614ecc..5ef5067 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -50,7 +50,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
@ -23,10 +23,10 @@ index f7c1b87..2407bc6 100644
this.entitiesById = new IntHashMap();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index fdef910..359f065 100644
index 3dc6f0e..0261647 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -116,6 +116,9 @@ public class CraftWorld implements World {
@@ -118,6 +118,9 @@ public class CraftWorld implements World {
treeGrowthModifier = configuration.getInt("world-settings." + name + ".tree-growth-modifier", treeGrowthModifier);
mushroomGrowthModifier = configuration.getInt("world-settings." + name + ".mushroom-growth-modifier", mushroomGrowthModifier);
@ -36,7 +36,7 @@ index fdef910..359f065 100644
server.getLogger().info("-------------- Spigot ----------------");
server.getLogger().info("-------- World Settings For [" + name + "] --------");
server.getLogger().info("Growth Per Chunk: " + growthPerTick);
@@ -131,6 +134,7 @@ public class CraftWorld implements World {
@@ -133,6 +136,7 @@ public class CraftWorld implements World {
server.getLogger().info("Sugar Growth Modifier: " + sugarGrowthModifier);
server.getLogger().info("Tree Growth Modifier: " + treeGrowthModifier);
server.getLogger().info("Mushroom Growth Modifier: " + mushroomGrowthModifier);
@ -44,7 +44,7 @@ index fdef910..359f065 100644
server.getLogger().info("-------------------------------------------------");
// Spigot end
}
@@ -141,6 +145,7 @@ public class CraftWorld implements World {
@@ -143,6 +147,7 @@ public class CraftWorld implements World {
public boolean randomLightingUpdates = false;
public int mobSpawnRange = 4;
public int aggregateTicks = 4;

Datei anzeigen

@ -1,4 +1,4 @@
From be497e7130a81fcdaa1877cf6297141325992a16 Mon Sep 17 00:00:00 2001
From 7e3f05017b31d259c4f88ef191b69f78f0a1ef10 Mon Sep 17 00:00:00 2001
From: lishid <lishid@gmail.com>
Date: Sat, 16 Feb 2013 10:05:25 +1100
Subject: [PATCH] Add oreobfuscator for Spigot.
@ -140,10 +140,10 @@ index 8f65601..16460b6 100644
private boolean value = true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 359f065..449f3e1 100644
index 0261647..38e551b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -119,6 +119,8 @@ public class CraftWorld implements World {
@@ -121,6 +121,8 @@ public class CraftWorld implements World {
viewDistance = Bukkit.getServer().getViewDistance();
viewDistance = configuration.getInt("world-settings." + name + ".view-distance", viewDistance);
@ -152,7 +152,7 @@ index 359f065..449f3e1 100644
server.getLogger().info("-------------- Spigot ----------------");
server.getLogger().info("-------- World Settings For [" + name + "] --------");
server.getLogger().info("Growth Per Chunk: " + growthPerTick);
@@ -135,6 +137,7 @@ public class CraftWorld implements World {
@@ -137,6 +139,7 @@ public class CraftWorld implements World {
server.getLogger().info("Tree Growth Modifier: " + treeGrowthModifier);
server.getLogger().info("Mushroom Growth Modifier: " + mushroomGrowthModifier);
server.getLogger().info("View distance: " + viewDistance);
@ -160,7 +160,7 @@ index 359f065..449f3e1 100644
server.getLogger().info("-------------------------------------------------");
// Spigot end
}
@@ -146,6 +149,7 @@ public class CraftWorld implements World {
@@ -148,6 +151,7 @@ public class CraftWorld implements World {
public int mobSpawnRange = 4;
public int aggregateTicks = 4;
public int viewDistance;

Datei anzeigen

@ -1,4 +1,4 @@
From 3ba945cbabc950764794373d3a38d5fd5ce03434 Mon Sep 17 00:00:00 2001
From d78fe7a23cc168df381cd729ba08886b26c10fb2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Feb 2013 05:10:21 -0500
Subject: [PATCH] Entity Activation Range
@ -89,7 +89,7 @@ index bc69f5d..430dd79 100644
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e7354b7..46e3bc6 100644
index 24de0c7..a97649e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -13,6 +13,7 @@ import java.util.concurrent.Callable;
@ -124,10 +124,10 @@ index e7354b7..46e3bc6 100644
entity.V = entity.locY;
entity.W = entity.locZ;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 449f3e1..25c462e 100644
index 38e551b..813f662 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -100,10 +100,14 @@ public class CraftWorld implements World {
@@ -102,10 +102,14 @@ public class CraftWorld implements World {
treeGrowthModifier = configuration.getInt("world-settings.default.tree-growth-modifier", treeGrowthModifier);
mushroomGrowthModifier = configuration.getInt("world-settings.default.mushroom-growth-modifier", mushroomGrowthModifier);
@ -143,7 +143,7 @@ index 449f3e1..25c462e 100644
randomLightingUpdates = configuration.getBoolean("world-settings." + name + ".random-light-updates", randomLightingUpdates);
mobSpawnRange = configuration.getInt("world-settings." + name + ".mob-spawn-range", mobSpawnRange);
aggregateTicks = Math.max(1, configuration.getInt("world-settings." + name + ".aggregate-chunkticks", aggregateTicks));
@@ -121,6 +125,10 @@ public class CraftWorld implements World {
@@ -123,6 +127,10 @@ public class CraftWorld implements World {
obfuscated = !world.getServer().orebfuscatorDisabledWorlds.contains(name);
@ -154,7 +154,7 @@ index 449f3e1..25c462e 100644
server.getLogger().info("-------------- Spigot ----------------");
server.getLogger().info("-------- World Settings For [" + name + "] --------");
server.getLogger().info("Growth Per Chunk: " + growthPerTick);
@@ -138,6 +146,7 @@ public class CraftWorld implements World {
@@ -140,6 +148,7 @@ public class CraftWorld implements World {
server.getLogger().info("Mushroom Growth Modifier: " + mushroomGrowthModifier);
server.getLogger().info("View distance: " + viewDistance);
server.getLogger().info("Oreobfuscator: " + obfuscated);
@ -162,7 +162,7 @@ index 449f3e1..25c462e 100644
server.getLogger().info("-------------------------------------------------");
// Spigot end
}
@@ -158,6 +167,10 @@ public class CraftWorld implements World {
@@ -160,6 +169,10 @@ public class CraftWorld implements World {
public int sugarGrowthModifier = 100;
public int treeGrowthModifier = 100;
public int mushroomGrowthModifier = 100;

Datei anzeigen

@ -1,4 +1,4 @@
From 4e69548e7279f907018b2d66fb5e074be25c6ee7 Mon Sep 17 00:00:00 2001
From 5a6620a7bf57025d3a2c379b23cdf2bc04451a92 Mon Sep 17 00:00:00 2001
From: Mike Primm <mike@primmhome.com>
Date: Wed, 20 Feb 2013 23:07:53 -0500
Subject: [PATCH] Optimize getTileEntities performance
@ -9,10 +9,10 @@ Avoid traversing tile entities for every loaded chunk
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 957dbd9..b250438 100644
index 7c2db4c..01b9323 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -655,17 +655,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
@@ -657,17 +657,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public List getTileEntities(int i, int j, int k, int l, int i1, int j1) {
ArrayList arraylist = new ArrayList();

Datei anzeigen

@ -1,4 +1,4 @@
From 1413bda53653b2e552075e46b813da405d2fe290 Mon Sep 17 00:00:00 2001
From d92bd63ca5f55a56d7dea9b023dbf03ea46066ca Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 14 Feb 2013 17:32:20 +1100
Subject: [PATCH] Netty
@ -40,7 +40,7 @@ Subject: [PATCH] Netty
.../net/minecraft/server/ThreadCommandReader.java | 1 +
.../net/minecraft/server/ThreadLoginVerifier.java | 1 +
.../craftbukkit/scheduler/CraftScheduler.java | 2 +-
src/main/java/org/spigotmc/netty/CipherCodec.java | 67 ++++++
src/main/java/org/spigotmc/netty/CipherCodec.java | 49 ++++
.../org/spigotmc/netty/NettyNetworkManager.java | 229 +++++++++++++++++++
.../org/spigotmc/netty/NettyServerConnection.java | 109 +++++++++
.../org/spigotmc/netty/NettySocketAdaptor.java | 248 +++++++++++++++++++++
@ -48,7 +48,7 @@ Subject: [PATCH] Netty
.../java/org/spigotmc/netty/PacketEncoder.java | 43 ++++
.../java/org/spigotmc/netty/PacketListener.java | 100 +++++++++
src/main/java/org/spigotmc/netty/ReadState.java | 16 ++
17 files changed, 924 insertions(+), 8 deletions(-)
17 files changed, 906 insertions(+), 8 deletions(-)
create mode 100644 src/main/java/net/minecraft/server/INetworkManager.java
create mode 100644 src/main/java/org/spigotmc/netty/CipherCodec.java
create mode 100644 src/main/java/org/spigotmc/netty/NettyNetworkManager.java
@ -60,7 +60,7 @@ Subject: [PATCH] Netty
create mode 100644 src/main/java/org/spigotmc/netty/ReadState.java
diff --git a/pom.xml b/pom.xml
index e04acf9..0f9e86a 100644
index e04acf9..bd4d85f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,6 +132,11 @@
@ -70,7 +70,7 @@ index e04acf9..0f9e86a 100644
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ <version>4.0.0.Beta2</version>
+ <version>4.0.0.Beta3</version>
+ </dependency>
</dependencies>
@ -235,10 +235,10 @@ index 0a5c61a..35badf3 100644
private static final int RECENT_TICKS;
diff --git a/src/main/java/org/spigotmc/netty/CipherCodec.java b/src/main/java/org/spigotmc/netty/CipherCodec.java
new file mode 100644
index 0000000..15e3466
index 0000000..54928b4
--- /dev/null
+++ b/src/main/java/org/spigotmc/netty/CipherCodec.java
@@ -0,0 +1,67 @@
@@ -0,0 +1,49 @@
+package org.spigotmc.netty;
+
+import io.netty.buffer.ByteBuf;
@ -246,18 +246,18 @@ index 0000000..15e3466
+import io.netty.handler.codec.ByteToByteCodec;
+import javax.crypto.Cipher;
+import javax.crypto.ShortBufferException;
+import org.bouncycastle.crypto.BufferedBlockCipher;
+
+/**
+ * This class is a complete solution for encrypting and decoding bytes in a
+ * Netty stream. It takes two {@link BufferedBlockCipher} instances, used for
+ * encryption and decryption respectively.
+ * Netty stream. It takes two {@link Cipher} instances, used for encryption and
+ * decryption respectively.
+ */
+public class CipherCodec extends ByteToByteCodec {
+
+ private Cipher encrypt;
+ private Cipher decrypt;
+ private ByteBuf heapOut;
+ private byte[] heapIn = new byte[0];
+ private byte[] heapOut = new byte[0];
+
+ public CipherCodec(Cipher encrypt, Cipher decrypt) {
+ this.encrypt = encrypt;
@ -266,44 +266,26 @@ index 0000000..15e3466
+
+ @Override
+ public void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
+ if (heapOut == null) {
+ heapOut = ctx.alloc().heapBuffer();
+ }
+ cipher(encrypt, in, heapOut);
+ out.writeBytes(heapOut);
+ heapOut.discardSomeReadBytes();
+ cipher(in, out, encrypt);
+ }
+
+ @Override
+ public void decode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
+ cipher(decrypt, in, out);
+ cipher(in, out, decrypt);
+ }
+
+ @Override
+ public void freeInboundBuffer(ChannelHandlerContext ctx) throws Exception {
+ super.freeInboundBuffer(ctx);
+ decrypt = null;
+ }
+
+ @Override
+ public void freeOutboundBuffer(ChannelHandlerContext ctx) throws Exception {
+ super.freeOutboundBuffer(ctx);
+ if (heapOut != null) {
+ heapOut.release();
+ heapOut = null;
+ private void cipher(ByteBuf in, ByteBuf out, Cipher cipher) throws ShortBufferException {
+ int readableBytes = in.readableBytes();
+ if (heapIn.length < readableBytes) {
+ heapIn = new byte[readableBytes];
+ }
+ encrypt = null;
+ }
+ in.readBytes(heapIn, 0, readableBytes);
+
+ private void cipher(Cipher cipher, ByteBuf in, ByteBuf out) throws ShortBufferException {
+ int available = in.readableBytes();
+ int outputSize = cipher.getOutputSize(available);
+ if (out.capacity() < outputSize) {
+ out.capacity(outputSize);
+ int outputSize = cipher.getOutputSize(readableBytes);
+ if (heapOut.length < outputSize) {
+ heapOut = new byte[outputSize];
+ }
+ int processed = cipher.update(in.array(), in.arrayOffset() + in.readerIndex(), available, out.array(), out.arrayOffset() + out.writerIndex());
+ in.readerIndex(in.readerIndex() + processed);
+ out.writerIndex(out.writerIndex() + processed);
+ out.writeBytes(heapOut, 0, cipher.update(heapIn, 0, readableBytes, heapOut));
+ }
+}
diff --git a/src/main/java/org/spigotmc/netty/NettyNetworkManager.java b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java

Datei anzeigen

@ -1,4 +1,4 @@
From 724d6e5425b42a122cf2bde806674a327eadeefd Mon Sep 17 00:00:00 2001
From a1452c17df604ca2f6e605ceb354fe1bcc1ecfc1 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 4 Mar 2013 18:45:52 +1100
Subject: [PATCH] PlayerItemDamageEvent
@ -8,10 +8,10 @@ Subject: [PATCH] PlayerItemDamageEvent
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index cd6dd07..303d11c 100644
index 3b3a48d..f483725 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -159,7 +159,13 @@ public final class ItemStack {
@@ -170,7 +170,13 @@ public final class ItemStack {
return Item.byId[this.id].getMaxDurability();
}
@ -25,7 +25,7 @@ index cd6dd07..303d11c 100644
if (!this.g()) {
return false;
} else {
@@ -174,7 +180,16 @@ public final class ItemStack {
@@ -185,7 +191,16 @@ public final class ItemStack {
}
i -= k;
@ -43,7 +43,7 @@ index cd6dd07..303d11c 100644
return false;
}
}
@@ -187,7 +202,7 @@ public final class ItemStack {
@@ -198,7 +213,7 @@ public final class ItemStack {
public void damage(int i, EntityLiving entityliving) {
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
if (this.g()) {

Datei anzeigen

@ -1,4 +1,4 @@
From 950d9560cf2fee49bbadf1607cca570bd1c5808a Mon Sep 17 00:00:00 2001
From 50f499ed5c46af6ef6c6a2975976d7ec130636df Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 7 Mar 2013 20:12:46 +1100
Subject: [PATCH] Thread safety. Adds thread safety for chunk load / unload
@ -9,10 +9,10 @@ Subject: [PATCH] Thread safety. Adds thread safety for chunk load / unload
1 file changed, 3 insertions(+)
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 25c462e..d6a4d2d 100644
index 813f662..e3676f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -254,6 +254,7 @@ public class CraftWorld implements World {
@@ -256,6 +256,7 @@ public class CraftWorld implements World {
}
public boolean unloadChunkRequest(int x, int z, boolean safe) {
@ -20,7 +20,7 @@ index 25c462e..d6a4d2d 100644
if (safe && isChunkInUse(x, z)) {
return false;
}
@@ -264,6 +265,7 @@ public class CraftWorld implements World {
@@ -266,6 +267,7 @@ public class CraftWorld implements World {
}
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
@ -28,7 +28,7 @@ index 25c462e..d6a4d2d 100644
if (safe && isChunkInUse(x, z)) {
return false;
}
@@ -331,6 +333,7 @@ public class CraftWorld implements World {
@@ -333,6 +335,7 @@ public class CraftWorld implements World {
}
public boolean loadChunk(int x, int z, boolean generate) {