Upstream Paper w/ Removes async lighting
This commit is contained in:
@@ -81,6 +81,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();
|
||||
@@ -212,6 +213,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
this.minecraftServer.methodProfiler.b();
|
||||
// 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;
|
||||
@@ -2293,7 +2295,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
// Paper start - async tab completion
|
||||
public void a(PacketPlayInTabComplete packet) {
|
||||
// CraftBukkit start
|
||||
if (chatSpamField.addAndGet(this, 10) > 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
|
||||
minecraftServer.postToMainThread(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0])));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user