mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 02:10:30 +01:00
Merge branch 'master' into pre/1.13
This commit is contained in:
commit
c63396fe6b
@ -1,4 +1,4 @@
|
|||||||
From 0a99f65b3af82daaf174c4c389994abaf8acffac Mon Sep 17 00:00:00 2001
|
From 6d3483af0bc822c5ca21a975de62af8bda28720a Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||||
Date: Mon, 29 Feb 2016 21:02:09 -0600
|
Date: Mon, 29 Feb 2016 21:02:09 -0600
|
||||||
Subject: [PATCH] Paper config files
|
Subject: [PATCH] Paper config files
|
||||||
@ -6,7 +6,7 @@ Subject: [PATCH] Paper config files
|
|||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..e8f7b7292
|
index 0000000000..e8f7b7292d
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||||
@@ -0,0 +1,237 @@
|
@@ -0,0 +1,237 @@
|
||||||
@ -249,7 +249,7 @@ index 000000000..e8f7b7292
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..d5c6c37fa
|
index 0000000000..104abab84b
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
@@ -0,0 +1,177 @@
|
@@ -0,0 +1,177 @@
|
||||||
@ -312,8 +312,8 @@ index 000000000..d5c6c37fa
|
|||||||
+ commands = new HashMap<String, Command>();
|
+ commands = new HashMap<String, Command>();
|
||||||
+ commands.put("paper", new PaperCommand("paper"));
|
+ commands.put("paper", new PaperCommand("paper"));
|
||||||
+
|
+
|
||||||
+ version = getInt("config-version", 13);
|
+ version = getInt("config-version", 14);
|
||||||
+ set("config-version", 13);
|
+ set("config-version", 14);
|
||||||
+ readConfig(PaperConfig.class, null);
|
+ readConfig(PaperConfig.class, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -432,7 +432,7 @@ index 000000000..d5c6c37fa
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..b8a6161d8
|
index 0000000000..b8a6161d84
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -0,0 +1,67 @@
|
@@ -0,0 +1,67 @@
|
||||||
@ -504,7 +504,7 @@ index 000000000..b8a6161d8
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
index 5ff1e9686..3706e44a3 100644
|
index 5ff1e96861..3706e44a34 100644
|
||||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
@@ -192,6 +192,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
@@ -192,6 +192,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||||
@ -519,7 +519,7 @@ index 5ff1e9686..3706e44a3 100644
|
|||||||
DedicatedServer.LOGGER.info("Generating keypair");
|
DedicatedServer.LOGGER.info("Generating keypair");
|
||||||
this.a(MinecraftEncryption.b());
|
this.a(MinecraftEncryption.b());
|
||||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||||
index 55bf00be9..a1050912b 100644
|
index 55bf00be93..a1050912bc 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||||
@@ -135,9 +135,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
@@ -135,9 +135,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
||||||
@ -536,7 +536,7 @@ index 55bf00be9..a1050912b 100644
|
|||||||
public boolean impulse;
|
public boolean impulse;
|
||||||
public int portalCooldown;
|
public int portalCooldown;
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
|
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
|
||||||
index ad3f89199..ca2a14d7a 100644
|
index ad3f891999..ca2a14d7ac 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityTypes.java
|
--- a/src/main/java/net/minecraft/server/EntityTypes.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
|
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
|
||||||
@@ -2,6 +2,8 @@ package net.minecraft.server;
|
@@ -2,6 +2,8 @@ package net.minecraft.server;
|
||||||
@ -560,7 +560,7 @@ index ad3f89199..ca2a14d7a 100644
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||||
index 73bd5e1d7..e1cf1e579 100644
|
index 73bd5e1d74..e1cf1e579a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java
|
+++ b/src/main/java/net/minecraft/server/World.java
|
||||||
@@ -127,6 +127,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
@@ -127,6 +127,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||||
@ -581,7 +581,7 @@ index 73bd5e1d7..e1cf1e579 100644
|
|||||||
this.world = new CraftWorld((WorldServer) this, gen, env);
|
this.world = new CraftWorld((WorldServer) this, gen, env);
|
||||||
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 7cd9b3b8c..4c1486a38 100644
|
index 7cd9b3b8cb..4c1486a38e 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -744,6 +744,7 @@ public final class CraftServer implements Server {
|
@@ -744,6 +744,7 @@ public final class CraftServer implements Server {
|
||||||
@ -636,7 +636,7 @@ index 7cd9b3b8c..4c1486a38 100644
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index df07dc594..57da619d8 100644
|
index df07dc5946..57da619d80 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -128,6 +128,14 @@ public class Main {
|
@@ -128,6 +128,14 @@ public class Main {
|
||||||
@ -655,7 +655,7 @@ index df07dc594..57da619d8 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
index 9128f7754..7b1a9a8a0 100644
|
index 9128f77543..7b1a9a8a0e 100644
|
||||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
@@ -39,31 +39,31 @@ public class SpigotWorldConfig
|
@@ -39,31 +39,31 @@ public class SpigotWorldConfig
|
||||||
@ -696,5 +696,5 @@ index 9128f7754..7b1a9a8a0 100644
|
|||||||
config.addDefault( "world-settings.default." + path, def );
|
config.addDefault( "world-settings.default." + path, def );
|
||||||
return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
|
return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
|
||||||
--
|
--
|
||||||
2.17.1
|
2.18.0
|
||||||
|
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
From cb340ef9e7dcd0c004a49efdc66336cfd9020c84 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shane Freeder <theboyetronic@gmail.com>
|
||||||
|
Date: Sun, 29 Jul 2018 05:02:15 +0100
|
||||||
|
Subject: [PATCH] Break up and make tab spam limits configurable
|
||||||
|
|
||||||
|
Due to the changes in 1.13, clients will send a tab completion request
|
||||||
|
for all bukkit commands in order to factor in the lack of support for
|
||||||
|
brigadier and provide backwards support in the API.
|
||||||
|
|
||||||
|
Craftbukkit, however; has moved the chat spam limiter to also interact
|
||||||
|
with the tab completion request, which while good for avoiding abuse,
|
||||||
|
causes 1.13 clients to easilly be kicked from a server in bukkit due
|
||||||
|
to this. Removing the spam limit could cause issues for servers, however,
|
||||||
|
there is no way for servers to manipulate this without blindly cancelling
|
||||||
|
kick events, which only causes additional complications. This also causes
|
||||||
|
issues in that the tab spam limit and chat share the same field but different
|
||||||
|
limits, meaning that a player having typed a long command may be kicked from
|
||||||
|
the server.
|
||||||
|
|
||||||
|
Splitting the field up and making it configurable allows for server owners
|
||||||
|
to take the burden of this into their own hand without having to rely on
|
||||||
|
plugins doing unsafe things.
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
|
index c457d07110..046bf33f66 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
|
@@ -327,4 +327,18 @@ public class PaperConfig {
|
||||||
|
logger.log(Level.INFO, "******************************************************");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ public static int tabSpamIncrement = 2;
|
||||||
|
+ public static int tabSpamLimit = 500;
|
||||||
|
+ private static void tabSpamLimiters() {
|
||||||
|
+ tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement);
|
||||||
|
+ // Older versions used a smaller limit, which is too low for 1.13, we'll bump this up if default
|
||||||
|
+ if (version < 14) {
|
||||||
|
+ if (tabSpamIncrement == 10) {
|
||||||
|
+ set("settings.spam-limiter.tab-spam-increment", 2);
|
||||||
|
+ tabSpamIncrement = 2;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
|
index a405cc0a2a..766f033d75 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
|
@@ -75,6 +75,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||||
|
// CraftBukkit start - multithreaded fields
|
||||||
|
private volatile int chatThrottle;
|
||||||
|
private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle");
|
||||||
|
+ private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
|
||||||
|
// CraftBukkit end
|
||||||
|
private int j;
|
||||||
|
private final IntHashMap<Short> k = new IntHashMap();
|
||||||
|
@@ -204,6 +205,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||||
|
this.minecraftServer.methodProfiler.e();
|
||||||
|
// CraftBukkit start
|
||||||
|
for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ;
|
||||||
|
+ if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable
|
||||||
|
/* Use thread-safe field access instead
|
||||||
|
if (this.chatThrottle > 0) {
|
||||||
|
--this.chatThrottle;
|
||||||
|
@@ -506,7 +508,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||||
|
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||||
|
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
|
||||||
|
// CraftBukkit start
|
||||||
|
- if (chatSpamField.addAndGet(this, 2) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) {
|
||||||
|
+ if (tabSpamLimiter.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { // Paper start - split and make configurable
|
||||||
|
this.disconnect(new ChatMessage("disconnect.spam", new Object[0]));
|
||||||
|
minecraftServer.postToMainThread(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper
|
||||||
|
return;
|
||||||
|
--
|
||||||
|
2.18.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user