mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 03:55:14 +01:00
Finish up the patches for 1.5. Now to test.
This commit is contained in:
parent
204e52aa82
commit
b8cb45d88d
@ -1,6 +1,6 @@
|
||||
From 87633bb351c719a15ec38bf63155fcffa7c89000 Mon Sep 17 00:00:00 2001
|
||||
From e3016c35f320021f736589487349f7a4887c7e38 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sat, 23 Feb 2013 11:47:02 +1100
|
||||
Date: Sat, 16 Mar 2013 08:51:12 +1100
|
||||
Subject: [PATCH] Spigot changes.
|
||||
|
||||
---
|
||||
@ -20,9 +20,9 @@ Subject: [PATCH] Spigot changes.
|
||||
.../java/net/minecraft/server/EntitySquid.java | 4 -
|
||||
.../net/minecraft/server/PlayerConnection.java | 18 ++-
|
||||
src/main/java/net/minecraft/server/PlayerList.java | 10 +-
|
||||
.../net/minecraft/server/ThreadLoginVerifier.java | 23 ++++
|
||||
.../net/minecraft/server/ThreadLoginVerifier.java | 21 +++
|
||||
src/main/java/net/minecraft/server/World.java | 152 ++++++++++++++++++---
|
||||
.../java/net/minecraft/server/WorldServer.java | 128 +++++++++++++----
|
||||
.../java/net/minecraft/server/WorldServer.java | 126 +++++++++++++----
|
||||
.../java/org/bukkit/craftbukkit/CraftServer.java | 45 +++---
|
||||
.../java/org/bukkit/craftbukkit/CraftWorld.java | 76 ++++++++++-
|
||||
src/main/java/org/bukkit/craftbukkit/Spigot.java | 20 +++
|
||||
@ -32,7 +32,7 @@ Subject: [PATCH] Spigot changes.
|
||||
.../org/bukkit/craftbukkit/util/LongHashSet.java | 11 +-
|
||||
.../bukkit/craftbukkit/util/LongObjectHashMap.java | 5 +
|
||||
src/main/resources/configurations/bukkit.yml | 27 ++++
|
||||
28 files changed, 562 insertions(+), 99 deletions(-)
|
||||
28 files changed, 559 insertions(+), 98 deletions(-)
|
||||
create mode 100644 src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
create mode 100644 src/main/java/org/bukkit/craftbukkit/util/FlatMap.java
|
||||
|
||||
@ -435,10 +435,10 @@ index 585595d..224c57f 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
index 0686ba0..58d30eb 100644
|
||||
index 0686ba0..c185f64 100644
|
||||
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
@@ -28,6 +28,29 @@ class ThreadLoginVerifier extends Thread {
|
||||
@@ -28,6 +28,27 @@ class ThreadLoginVerifier extends Thread {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
@ -455,9 +455,7 @@ index 0686ba0..58d30eb 100644
|
||||
+ if (!ip.contains("127.0.0.1")) {
|
||||
+ lookup.append("xbl.spamhaus.org.");
|
||||
+ if (java.net.InetAddress.getByName(lookup.toString()) != null) {
|
||||
+ this.pendingConnection.networkManager.queue(new Packet255KickDisconnect("Your IP address (" + ip + ") is flagged as unsafe by spamhaus.org/xbl"));
|
||||
+ this.pendingConnection.networkManager.d();
|
||||
+ this.pendingConnection.c = true;
|
||||
+ pendingConnection.disconnect("Your IP address (" + ip + ") is flagged as unsafe by spamhaus.org/xbl");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
@ -469,7 +467,7 @@ index 0686ba0..58d30eb 100644
|
||||
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
|
||||
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 9c39815..14df580 100644
|
||||
index 9c39815..7b2539b 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -67,14 +67,27 @@ public abstract class World implements IBlockAccess {
|
||||
@ -600,10 +598,10 @@ index 9c39815..14df580 100644
|
||||
+ int cz = chunkz << 4;
|
||||
+ Chunk chunk = this.getChunkAt(chunkx, chunkz);
|
||||
+ // Compute ranges within chunk
|
||||
+ int xstart = (i < cx)?cx:i;
|
||||
+ int xend = (j < (cx+16))?j:(cx+16);
|
||||
+ int zstart = (i1 < cz)?cz:i1;
|
||||
+ int zend = (j1 < (cz+16))?j1:(cz+16);
|
||||
+ int xstart = (i < cx) ? cx : i;
|
||||
+ int xend = (j < (cx + 16)) ? j : (cx + 16);
|
||||
+ int zstart = (i1 < cz) ? cz : i1;
|
||||
+ int zend = (j1 < (cz + 16)) ? j1 : (cz + 16);
|
||||
+ // Loop through blocks within chunk
|
||||
+ for (int x = xstart; x < xend; x++) {
|
||||
+ for (int z = zstart; z < zend; z++) {
|
||||
@ -613,7 +611,7 @@ index 9c39815..14df580 100644
|
||||
+ Block block = Block.byId[blkid];
|
||||
+
|
||||
+ if (block != null) {
|
||||
+ block.a(this, x, y, z, axisalignedbb, this.L, entity);
|
||||
+ block.a(this, x, y, z, axisalignedbb, this.M, entity);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@ -712,7 +710,7 @@ index 9c39815..14df580 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..f7c1b87 100644
|
||||
index d99b6a3..35c76bf 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -1,5 +1,7 @@
|
||||
@ -797,7 +795,7 @@ index d99b6a3..f7c1b87 100644
|
||||
+ } else {
|
||||
+ this.growthOdds = 100;
|
||||
+ }
|
||||
+ for (int i = 0; i < getWorld().aggregateTicks; i++) {
|
||||
+ for (int c = 0; c < getWorld().aggregateTicks; c++) {
|
||||
+ block.a(this, k2 + k, i3 + chunksection.d(), l2 + l, this.random);
|
||||
+ }
|
||||
+ // Spigot end
|
||||
@ -849,23 +847,21 @@ index d99b6a3..f7c1b87 100644
|
||||
if (i > 1000) {
|
||||
// CraftBukkit start - if the server has too much to process over time, try to alleviate that
|
||||
if (i > 20 * 1000) {
|
||||
@@ -492,10 +523,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
@@ -492,9 +523,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
break;
|
||||
}
|
||||
|
||||
- this.M.remove(nextticklistentry);
|
||||
- this.L.remove(nextticklistentry);
|
||||
- this.T.add(nextticklistentry);
|
||||
- }
|
||||
+ // Spigot start
|
||||
+ //this.M.remove(nextticklistentry);
|
||||
+ //this.L.remove(nextticklistentry);
|
||||
+ this.removeNextTickIfNeeded(nextticklistentry);
|
||||
+ // Spigot end
|
||||
+ byte b0 = 8;
|
||||
}
|
||||
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.a("ticking");
|
||||
@@ -536,10 +569,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
this.methodProfiler.b();
|
||||
this.T.clear();
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 7d3399651d3d92f03b2b87f3a67c6ab97e52bb72 Mon Sep 17 00:00:00 2001
|
||||
From ee32c90960abad2b5ea24ffc467b4adf4a01e506 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sun, 3 Feb 2013 12:28:17 +1100
|
||||
Subject: [PATCH] Tick loop optimization - sleep for as long as possible.
|
||||
@ -11,7 +11,7 @@ Subject: [PATCH] Tick loop optimization - sleep for as long as possible.
|
||||
create mode 100644 src/main/java/org/bukkit/craftbukkit/command/TicksPerSecondCommand.java
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index d3f3f86..36acefb 100644
|
||||
index d3f3f86..d363643 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -85,6 +85,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
@ -55,7 +55,7 @@ index d3f3f86..36acefb 100644
|
||||
- this.q();
|
||||
- j = 0L;
|
||||
+ // Spigot start
|
||||
+ for (long lastTick = 0L; this.isRunning; this.Q = true) {
|
||||
+ for (long lastTick = 0L; this.isRunning; this.P = true) {
|
||||
+ long curTime = System.nanoTime();
|
||||
+ long wait = TICK_TIME - (curTime - lastTick) - catchupTime;
|
||||
+ if (wait > 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
From fc7910a8c0bf1545518682ad89e434bfe09e594e Mon Sep 17 00:00:00 2001
|
||||
From be497e7130a81fcdaa1877cf6297141325992a16 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.
|
||||
@ -170,7 +170,7 @@ index 359f065..449f3e1 100644
|
||||
public int cactusGrowthModifier = 100;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
|
||||
new file mode 100644
|
||||
index 0000000..5213f99
|
||||
index 0000000..c04eec2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
|
||||
@@ -0,0 +1,146 @@
|
||||
@ -311,7 +311,7 @@ index 0000000..5213f99
|
||||
+
|
||||
+ private static boolean areAjacentBlocksTransparent(World world, int x, int y, int z, int radius) {
|
||||
+ return y > 0 && y <= world.getHeight()
|
||||
+ && !Block.i(world.getTypeId(x, y, z))
|
||||
+ && !Block.l(world.getTypeId(x, y, z))
|
||||
+ || (radius > 0 && (areAjacentBlocksTransparent(world, x, y + 1, z, radius - 1)
|
||||
+ || areAjacentBlocksTransparent(world, x, y - 1, z, radius - 1)
|
||||
+ || areAjacentBlocksTransparent(world, x + 1, y, z, radius - 1)
|
||||
|
@ -1,4 +1,4 @@
|
||||
From d9054dc5ea2715c2eb9065ad6ef3ceb47446039c Mon Sep 17 00:00:00 2001
|
||||
From 3ba945cbabc950764794373d3a38d5fd5ce03434 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 4b6c910..417189e 100644
|
||||
index e7354b7..46e3bc6 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;
|
||||
@ -174,7 +174,7 @@ index 449f3e1..25c462e 100644
|
||||
|
||||
public Block getBlockAt(int x, int y, int z) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
index ad65bca..79be52d 100644
|
||||
index ad65bca..ee0fdbf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
@@ -1,9 +1,17 @@
|
||||
@ -346,7 +346,7 @@ index ad65bca..79be52d 100644
|
||||
+ */
|
||||
+ public static boolean checkEntityImmunities(Entity entity) {
|
||||
+ // quick checks.
|
||||
+ if (entity.ad /* isInWater */ || entity.fireTicks > 0) {
|
||||
+ if (entity.ae /* isInWater */ || entity.fireTicks > 0) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if (!(entity instanceof EntityArrow)) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 5bb73d19023fdf238e475dfe5d97c91b9373a1f3 Mon Sep 17 00:00:00 2001
|
||||
From 1413bda53653b2e552075e46b813da405d2fe290 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
|
||||
@ -36,19 +36,19 @@ Subject: [PATCH] Netty
|
||||
.../java/net/minecraft/server/INetworkManager.java | 24 ++
|
||||
.../net/minecraft/server/Packet51MapChunk.java | 2 +-
|
||||
.../net/minecraft/server/Packet56MapChunkBulk.java | 2 +-
|
||||
.../net/minecraft/server/PendingConnection.java | 9 +-
|
||||
.../net/minecraft/server/PendingConnection.java | 11 +-
|
||||
.../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 ++++++
|
||||
.../org/spigotmc/netty/NettyNetworkManager.java | 229 +++++++++++++++++++
|
||||
.../org/spigotmc/netty/NettyServerConnection.java | 110 +++++++++
|
||||
.../org/spigotmc/netty/NettyServerConnection.java | 109 +++++++++
|
||||
.../org/spigotmc/netty/NettySocketAdaptor.java | 248 +++++++++++++++++++++
|
||||
.../java/org/spigotmc/netty/PacketDecoder.java | 63 ++++++
|
||||
.../java/org/spigotmc/netty/PacketDecoder.java | 64 ++++++
|
||||
.../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, 923 insertions(+), 7 deletions(-)
|
||||
17 files changed, 924 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
|
||||
@ -158,9 +158,18 @@ index 9d5cee7..8486d82 100644
|
||||
};
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
|
||||
index 5f4bcf2..7b015d7 100644
|
||||
index 5f4bcf2..58687ed 100644
|
||||
--- a/src/main/java/net/minecraft/server/PendingConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PendingConnection.java
|
||||
@@ -17,7 +17,7 @@ public class PendingConnection extends Connection {
|
||||
private static Random random = new Random();
|
||||
private byte[] d;
|
||||
private final MinecraftServer server;
|
||||
- public final NetworkManager networkManager;
|
||||
+ public final INetworkManager networkManager;
|
||||
public boolean b = false;
|
||||
private int f = 0;
|
||||
private String g = null;
|
||||
@@ -27,10 +27,15 @@ public class PendingConnection extends Connection {
|
||||
private SecretKey k = null;
|
||||
public String hostname = ""; // CraftBukkit - add field
|
||||
@ -200,7 +209,7 @@ index 489e184..9533b6f 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
index 58d30eb..e4e5049 100644
|
||||
index c185f64..abe0b81 100644
|
||||
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
@@ -21,6 +21,7 @@ class ThreadLoginVerifier extends Thread {
|
||||
@ -299,7 +308,7 @@ index 0000000..15e3466
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/netty/NettyNetworkManager.java b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java
|
||||
new file mode 100644
|
||||
index 0000000..6cb1b98
|
||||
index 0000000..be80ee2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java
|
||||
@@ -0,0 +1,229 @@
|
||||
@ -469,7 +478,7 @@ index 0000000..6cb1b98
|
||||
+ */
|
||||
+ public void b() {
|
||||
+ for (int i = 1000; !syncPackets.isEmpty() && i >= 0; i--) {
|
||||
+ if (connection instanceof PendingConnection ? ((PendingConnection) connection).c : ((PlayerConnection) connection).disconnected) {
|
||||
+ if (connection instanceof PendingConnection ? ((PendingConnection) connection).b : ((PlayerConnection) connection).disconnected) {
|
||||
+ syncPackets.clear();
|
||||
+ break;
|
||||
+ }
|
||||
@ -534,10 +543,10 @@ index 0000000..6cb1b98
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/netty/NettyServerConnection.java b/src/main/java/org/spigotmc/netty/NettyServerConnection.java
|
||||
new file mode 100644
|
||||
index 0000000..84c58ff
|
||||
index 0000000..9803105
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/netty/NettyServerConnection.java
|
||||
@@ -0,0 +1,110 @@
|
||||
@@ -0,0 +1,109 @@
|
||||
+package org.spigotmc.netty;
|
||||
+
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
@ -563,7 +572,6 @@ index 0000000..84c58ff
|
||||
+import net.minecraft.server.PendingConnection;
|
||||
+import net.minecraft.server.ServerConnection;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.Spigot;
|
||||
+
|
||||
+/**
|
||||
+ * This is the NettyServerConnection class. It implements
|
||||
@ -595,7 +603,7 @@ index 0000000..84c58ff
|
||||
+ .addLast("manager", new NettyNetworkManager());
|
||||
+ }
|
||||
+ }).group(new NioEventLoopGroup(threads, new ThreadFactoryBuilder().setNameFormat("Netty IO Thread - %1$d").build())).localAddress(host, port).bind();
|
||||
+ MinecraftServer.log.info("Using Netty NIO with " + threads + " threads for network connections.");
|
||||
+ MinecraftServer.getServer().getLogger().info("Using Netty NIO with " + threads + " threads for network connections.");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -615,7 +623,7 @@ index 0000000..84c58ff
|
||||
+ Bukkit.getServer().getLogger().log(Level.WARNING, "Failed to handle packet: " + ex, ex);
|
||||
+ }
|
||||
+
|
||||
+ if (connection.c) {
|
||||
+ if (connection.b) {
|
||||
+ pendingConnections.remove(i--);
|
||||
+ }
|
||||
+ }
|
||||
@ -904,10 +912,10 @@ index 0000000..a3b86b8
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/netty/PacketDecoder.java b/src/main/java/org/spigotmc/netty/PacketDecoder.java
|
||||
new file mode 100644
|
||||
index 0000000..6ecbca7
|
||||
index 0000000..65074d2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/netty/PacketDecoder.java
|
||||
@@ -0,0 +1,63 @@
|
||||
@@ -0,0 +1,64 @@
|
||||
+package org.spigotmc.netty;
|
||||
+
|
||||
+import io.netty.buffer.ByteBuf;
|
||||
@ -917,6 +925,7 @@ index 0000000..6ecbca7
|
||||
+import java.io.DataInputStream;
|
||||
+import java.io.EOFException;
|
||||
+import java.io.IOException;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.Packet;
|
||||
+
|
||||
+/**
|
||||
@ -942,7 +951,7 @@ index 0000000..6ecbca7
|
||||
+ switch (state()) {
|
||||
+ case HEADER:
|
||||
+ short packetId = in.readUnsignedByte();
|
||||
+ packet = Packet.d(packetId);
|
||||
+ packet = Packet.a(MinecraftServer.getServer().getLogger(), packetId);
|
||||
+ if (packet == null) {
|
||||
+ throw new IOException("Bad packet id " + packetId);
|
||||
+ }
|
||||
@ -973,7 +982,7 @@ index 0000000..6ecbca7
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/netty/PacketEncoder.java b/src/main/java/org/spigotmc/netty/PacketEncoder.java
|
||||
new file mode 100644
|
||||
index 0000000..9d0b06c
|
||||
index 0000000..e671a0d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/netty/PacketEncoder.java
|
||||
@@ -0,0 +1,43 @@
|
||||
@ -1004,7 +1013,7 @@ index 0000000..9d0b06c
|
||||
+ dataOut = new DataOutputStream(new ByteBufOutputStream(outBuf));
|
||||
+ }
|
||||
+
|
||||
+ out.writeByte(msg.k());
|
||||
+ out.writeByte(msg.n());
|
||||
+ msg.a(dataOut);
|
||||
+ out.writeBytes(outBuf);
|
||||
+ out.discardSomeReadBytes();
|
||||
|
@ -1,16 +1,25 @@
|
||||
From 8503226f492fd2dfcff2fd1cbc9b737c71c05fd0 Mon Sep 17 00:00:00 2001
|
||||
From cc1b0248bbf67e99b0862ae7ebbdd1415a288d04 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
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/ItemStack.java | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
src/main/java/net/minecraft/server/ItemStack.java | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
index cd6dd07..a2df1d5 100644
|
||||
index cd6dd07..b8c845e 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
@@ -159,7 +159,7 @@ public final class ItemStack {
|
||||
return Item.byId[this.id].getMaxDurability();
|
||||
}
|
||||
|
||||
- public boolean isDamaged(int i, Random random) {
|
||||
+ public boolean isDamaged(int i, Random random, EntityLiving entityliving) {
|
||||
if (!this.g()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -174,7 +174,16 @@ public final class ItemStack {
|
||||
}
|
||||
|
||||
@ -21,7 +30,7 @@ index cd6dd07..a2df1d5 100644
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this);
|
||||
+ org.bukkit.event.player.PlayerItemDamageEvent event = new org.bukkit.event.player.PlayerItemDamageEvent((org.bukkit.entity.Player) entityliving.getBukkitEntity(), item, i);
|
||||
+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) return;
|
||||
+ if (event.isCancelled()) return false;
|
||||
+ i = event.getDamage();
|
||||
+ }
|
||||
+ // Spigot end
|
||||
@ -29,6 +38,15 @@ index cd6dd07..a2df1d5 100644
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -187,7 +196,7 @@ public final class ItemStack {
|
||||
public void damage(int i, EntityLiving entityliving) {
|
||||
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
|
||||
if (this.g()) {
|
||||
- if (this.isDamaged(i, entityliving.aE())) {
|
||||
+ if (this.isDamaged(i, entityliving.aE(), entityliving)) {
|
||||
entityliving.a(this);
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
((EntityHuman) entityliving).a(StatisticList.F[this.id], 1);
|
||||
--
|
||||
1.8.1-rc2
|
||||
|
||||
|
34
pom.xml
34
pom.xml
@ -1,34 +0,0 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Spigot-Parent</name>
|
||||
<description>Parent project for all Spigot modules.</description>
|
||||
<url>https://github.com/EcoCityCraft/Spigot</url>
|
||||
|
||||
<modules>
|
||||
<module>Spigot-Server</module>
|
||||
<module>Spigot-API</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>md_5-releases</id>
|
||||
<url>http://repo.md-5.net/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>md_5-snapshots</id>
|
||||
<url>http://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
Loading…
Reference in New Issue
Block a user