Update upstrean CB/S

This commit is contained in:
Zach Brown 2016-09-11 14:55:02 -05:00
parent 2e880e7676
commit 2b244fb51e
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76
13 changed files with 83 additions and 120 deletions

View file

@ -1,4 +1,4 @@
From 3f9b16f14813d438308eb3fac33ad4416b74e945 Mon Sep 17 00:00:00 2001
From ad312eb4160456b4bef80ad7b7984b4cdb9d609c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 21:02:09 -0600
Subject: [PATCH] Paper config files
@ -6,7 +6,7 @@ Subject: [PATCH] Paper config files
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
new file mode 100644
index 0000000..2de9b21
index 0000000..3d0a005
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +1,164 @@
@ -66,8 +66,8 @@ index 0000000..2de9b21
+
+ commands = new HashMap<String, Command>();
+
+ version = getInt("config-version", 10);
+ set("config-version", 10);
+ version = getInt("config-version", 11);
+ set("config-version", 11);
+ readConfig(PaperConfig.class, null);
+ }
+
@ -335,5 +335,5 @@ index 337aa29..979adad 100644
};
--
2.5.0
2.10.0.windows.1

View file

@ -1,4 +1,4 @@
From 374f421a7115fbc6e66d34e36cb6276a1adebb75 Mon Sep 17 00:00:00 2001
From 0504c5dc3eb712b43ba408c346d2a84e752ffc16 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -371,7 +371,7 @@ index 0000000..36aafb2
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 2de9b21..858eb9a 100644
index 3d0a005..f509bed 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit;
@ -939,7 +939,7 @@ index b0249ff..797a84f 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d5dd29b..13a6cfe 100644
index f47c5fc..ae576f0 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -57,6 +57,7 @@ import org.bukkit.inventory.CraftingInventory;
@ -950,7 +950,7 @@ index d5dd29b..13a6cfe 100644
// CraftBukkit end
public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1332,7 +1333,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1339,7 +1340,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end
private void handleCommand(String s) {
@ -959,7 +959,7 @@ index d5dd29b..13a6cfe 100644
// CraftBukkit start - whole method
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getName() + " issued server command: " + s);
@@ -1343,22 +1344,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1350,22 +1351,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -1539,10 +1539,10 @@ index 3c75538..5874554 100644
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 93d8d42..2a22697 100644
index 92d217b..198c37c 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -186,7 +186,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -189,7 +189,7 @@ public class CraftScheduler implements BukkitScheduler {
}
}
return false;
@ -1551,7 +1551,7 @@ index 93d8d42..2a22697 100644
handle(task, 0l);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -219,7 +219,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -222,7 +222,7 @@ public class CraftScheduler implements BukkitScheduler {
}
}
}
@ -1560,7 +1560,7 @@ index 93d8d42..2a22697 100644
handle(task, 0l);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -251,7 +251,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -254,7 +254,7 @@ public class CraftScheduler implements BukkitScheduler {
CraftScheduler.this.pending.clear();
CraftScheduler.this.temp.clear();
}
@ -1569,7 +1569,7 @@ index 93d8d42..2a22697 100644
handle(task, 0l);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -346,9 +346,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -349,9 +349,7 @@ public class CraftScheduler implements BukkitScheduler {
}
if (task.isSync()) {
try {

View file

@ -1,4 +1,4 @@
From a3f1b920e6fe3e658415a0a3b8b4ea9bff990ab1 Mon Sep 17 00:00:00 2001
From 472b4ef245572864c66a7dac62b80bf422de4c7c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 01:17:12 -0600
Subject: [PATCH] Ensure commands are not ran async
@ -14,10 +14,10 @@ big slowdown in execution but throwing an exception at same time to raise awaren
that it is happening so that plugin authors can fix their code to stop executing commands async.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index f1ac7bc..c6785c8 100644
index ae576f0..4e75202 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1265,6 +1265,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1272,6 +1272,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (!async && s.startsWith("/")) {

View file

@ -1,4 +1,4 @@
From 67cefb5448ca6c3964a3a37e7e423f068901f12a Mon Sep 17 00:00:00 2001
From 236c046bc5e75574bc47475a4969553a0830b522 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
@ -328,7 +328,7 @@ index a905ff9..48c0e14 100644
this.tileEntityListTick.remove(tileTickPosition--);
continue;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 2a22697..d82dddf 100644
index 198c37c..cdb836a 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -14,6 +14,9 @@ import java.util.concurrent.atomic.AtomicInteger;
@ -341,7 +341,7 @@ index 2a22697..d82dddf 100644
import org.apache.commons.lang.Validate;
import org.bukkit.plugin.IllegalPluginAccessException;
import org.bukkit.plugin.Plugin;
@@ -348,18 +351,24 @@ public class CraftScheduler implements BukkitScheduler {
@@ -351,18 +354,24 @@ public class CraftScheduler implements BukkitScheduler {
try {
task.run();
} catch (final Throwable throwable) {

View file

@ -1,14 +1,14 @@
From f865c4ed737abbf9b84a2b21cebdf4641b0e57e7 Mon Sep 17 00:00:00 2001
From 6c6a041bda7c2a5953894142871485d45df86b56 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 4 Apr 2015 23:17:52 -0400
Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index c6785c8..4911787 100644
index 4e75202..9d1c255 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1026,7 +1026,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1033,7 +1033,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit start
public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {

View file

@ -1,4 +1,4 @@
From eaaea6854f6043beee68f09d8fa74e1cab306c90 Mon Sep 17 00:00:00 2001
From 12ce90221506ab023761bb3421b51dacc6766516 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 2 Apr 2016 05:09:16 -0400
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
@ -18,10 +18,10 @@ index 2b23a5d..6464a84 100644
private Vec3D c;
private EnumHand d;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 4911787..d087f86 100644
index 9d1c255..cad016a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1615,6 +1615,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1622,6 +1622,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
}
}

View file

@ -1,4 +1,4 @@
From 00cfdb221ae532845b6c8373225fdb0f1ecac463 Mon Sep 17 00:00:00 2001
From 4bc7f05b857898c95fbb2b0c7d6bee3c1d46d1c0 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 6 Apr 2016 01:04:23 -0500
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
@ -31,10 +31,10 @@ index 1106bd8..a17355c 100644
public ScoreboardTeamBase aQ() {
if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d087f86..89bf52f 100644
index cad016a..df6cb13 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1345,7 +1345,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1352,7 +1352,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
return;
}

View file

@ -1,14 +1,14 @@
From 0dfc95c05231450a8acec2d8d53c6e8c492b3b63 Mon Sep 17 00:00:00 2001
From 8debac859916f49cb64523bc834de01bb25baeb9 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sun, 4 Sep 2016 16:35:43 -0500
Subject: [PATCH] Fix AIOOBE in inventory handling
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 90f2247..3d04119 100644
index 972b85b..50b23ed 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1815,7 +1815,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1822,7 +1822,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
case CLONE:
if (packetplayinwindowclick.c() == 2) {
click = ClickType.MIDDLE;

View file

@ -0,0 +1,48 @@
From 773bff8a1da3bc233cf712731981aa3020669410 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 11 Sep 2016 14:30:57 -0500
Subject: [PATCH] Configurable packet in spam threshold
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 91546b6..211b88a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -225,4 +225,13 @@ public class PaperConfig {
private static void bungeeOnlineMode() {
bungeeOnlineMode = getBoolean("settings.bungee-online-mode", true);
}
+
+ public static int packetInSpamThreshold = 300;
+ private static void packetInSpamThreshold() {
+ if (version < 11) {
+ int oldValue = getInt("settings.play-in-use-item-spam-threshold", 300);
+ set("settings.incoming-packet-spam-threshold", oldValue);
+ }
+ packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300);
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 50b23ed..29653cf 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -868,13 +868,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// Spigot start - limit place/interactions
private int limitedPackets;
private long lastLimitedPacket = -1;
+ private static final int THRESHOLD = com.destroystokyo.paper.PaperConfig.packetInSpamThreshold; // Paper - Configurable threshold
private boolean checkLimit(long timestamp) {
- if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < 30 && limitedPackets++ >= 4) {
+ if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < THRESHOLD && limitedPackets++ >= 4) { // Paper
return false;
}
- if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= 30) {
+ if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= THRESHOLD) { // Paper
lastLimitedPacket = timestamp;
limitedPackets = 0;
return true;
--
2.10.0.windows.1

View file

@ -1,84 +0,0 @@
From 49a2546fd62526b61f8dc3b7e88093a5cbcb709a Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 10 Sep 2016 21:40:51 -0500
Subject: [PATCH] Rate limit PacketPlayInUseItem
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index f40440f..f1973e3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -225,4 +225,9 @@ public class PaperConfig {
private static void bungeeOnlineMode() {
bungeeOnlineMode = getBoolean("settings.bungee-online-mode", true);
}
+
+ public static int playInUseItemThreshold = 300;
+ private static void playInUseItemThreshold() {
+ playInUseItemThreshold = getInt("settings.play-in-use-item-spam-threshold", 300);
+ }
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseItem.java b/src/main/java/net/minecraft/server/PacketPlayInUseItem.java
index 82e09c1..88ac278 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInUseItem.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInUseItem.java
@@ -10,6 +10,7 @@ public class PacketPlayInUseItem implements Packet<PacketListenerPlayIn> {
private float d;
private float e;
private float f;
+ public long timestamp; // Paper - Used for rate limiting
public PacketPlayInUseItem() {}
@@ -20,6 +21,7 @@ public class PacketPlayInUseItem implements Packet<PacketListenerPlayIn> {
this.d = (float) packetdataserializer.readUnsignedByte() / 16.0F;
this.e = (float) packetdataserializer.readUnsignedByte() / 16.0F;
this.f = (float) packetdataserializer.readUnsignedByte() / 16.0F;
+ this.timestamp = System.currentTimeMillis(); // Paper
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
@@ -29,6 +31,7 @@ public class PacketPlayInUseItem implements Packet<PacketListenerPlayIn> {
packetdataserializer.writeByte((int) (this.d * 16.0F));
packetdataserializer.writeByte((int) (this.e * 16.0F));
packetdataserializer.writeByte((int) (this.f * 16.0F));
+ this.timestamp = System.currentTimeMillis(); // Paper
}
public void a(PacketListenerPlayIn packetlistenerplayin) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3d04119..ab30d39 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -865,6 +865,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end
}
+ // Paper start - Rate limit UseItem as well, copied from Spigot implementation below in BlockPlace
+ private long lastPlaceUse = -1;
+ private int packetsUse = 0;
+ private static final int THRESHOLD = com.destroystokyo.paper.PaperConfig.playInUseItemThreshold;
+ // Paper end
public void a(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.x());
if (this.player.cj()) return; // CraftBukkit
@@ -875,6 +880,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
EnumDirection enumdirection = packetplayinuseitem.b();
this.player.resetIdleTimer();
+
+ // Paper start - Rate limit UseItem as well, copied from Spigot implementation below in BlockPlace
+ if (lastPlaceUse != -1 && packetplayinuseitem.timestamp - lastPlaceUse < THRESHOLD && packetsUse++ >= 4) {
+ return;
+ } else if (packetplayinuseitem.timestamp - lastPlaceUse >= THRESHOLD || lastPlaceUse == -1) {
+ lastPlaceUse = packetplayinuseitem.timestamp;
+ packetsUse = 0;
+ }
+ // Paper end
+
if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && (enumdirection == EnumDirection.UP || blockposition.getY() >= this.minecraftServer.getMaxBuildHeight())) {
ChatMessage chatmessage = new ChatMessage("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())});
--
2.10.0.windows.1

View file

@ -68,7 +68,6 @@ import NBTTagCompound
import NBTTagList
import PersistentScoreboard
import PacketPlayInUseEntity
import PacketPlayInUseItem
import PacketPlayOutPlayerListHeaderFooter
import PacketPlayOutScoreboardTeam
import PacketPlayOutTitle

@ -1 +1 @@
Subproject commit 8788b79a48a324130c400658c13f8176787d742a
Subproject commit 75a8885d1fbb8f1bb38ef3d6a0f03598893c01ed

@ -1 +1 @@
Subproject commit 80fccb72715ba063c2ec0e038bf7ddb2599849ad
Subproject commit 570526c2b4840753183aa81995ea81008238eeb2