mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 13:57:35 +01:00
Fix buffer-joins-to-world patch
This commit is contained in:
parent
b28618e07c
commit
583c8afcd8
@ -21,17 +21,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public void tick() {
|
public void tick() {
|
||||||
this.flushQueue();
|
this.flushQueue();
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (currTick != net.minecraft.server.MinecraftServer.currentTick) {
|
+ if (Connection.currTick != net.minecraft.server.MinecraftServer.currentTick) {
|
||||||
+ currTick = net.minecraft.server.MinecraftServer.currentTick;
|
+ Connection.currTick = net.minecraft.server.MinecraftServer.currentTick;
|
||||||
+ joinAttemptsThisTick = 0;
|
+ Connection.joinAttemptsThisTick = 0;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+ if (this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl) {
|
|
||||||
+ if ( ((net.minecraft.server.network.ServerLoginPacketListenerImpl) this.packetListener).state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
|
|
||||||
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
|
|
||||||
+ ((net.minecraft.server.network.ServerLoginPacketListenerImpl) this.packetListener).tick();
|
|
||||||
+ } // Paper
|
|
||||||
+ }
|
|
||||||
PacketListener packetlistener = this.packetListener;
|
PacketListener packetlistener = this.packetListener;
|
||||||
|
|
||||||
if (packetlistener instanceof TickablePacketListener) {
|
if (packetlistener instanceof TickablePacketListener) {
|
||||||
|
TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener;
|
||||||
|
|
||||||
|
+ // Paper start - limit the number of joins which can be processed each tick
|
||||||
|
+ if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
|
||||||
|
+ || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT
|
||||||
|
+ || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
|
||||||
|
tickablepacketlistener.tick();
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.isConnected() && !this.disconnectionHandled) {
|
||||||
|
@ -52,4 +52,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ executor.setMaximumPoolSize(_chatExecutorMaxSize);
|
+ executor.setMaximumPoolSize(_chatExecutorMaxSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int maxJoinsPerTick = 3;
|
public int maxJoinsPerTick = 5;
|
||||||
|
@ -11,21 +11,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
PacketListener packetlistener = this.packetListener;
|
if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
|
||||||
|
|| loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT
|
||||||
if (packetlistener instanceof TickablePacketListener) {
|
|| Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
|
||||||
+ // Paper start - detailed watchdog information
|
+ // Paper start - detailed watchdog information
|
||||||
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.push(this.packetListener);
|
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.push(this.packetListener);
|
||||||
+ try { // Paper end - detailed watchdog information
|
+ try { // Paper end - detailed watchdog information
|
||||||
TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener;
|
|
||||||
|
|
||||||
tickablepacketlistener.tick();
|
tickablepacketlistener.tick();
|
||||||
+ } finally { // Paper start - detailed watchdog information
|
+ } finally { // Paper start - detailed watchdog information
|
||||||
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.pop();
|
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.pop();
|
||||||
+ } // Paper start - detailed watchdog information
|
+ } // Paper end - detailed watchdog information
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isConnected() && !this.disconnectionHandled) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||||
|
@ -709,7 +709,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // TODO: FILL
|
+ // TODO: FILL
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ public int maxJoinsPerTick = 3;
|
+ public int maxJoinsPerTick = 5;
|
||||||
+ public boolean fixEntityPositionDesync = true;
|
+ public boolean fixEntityPositionDesync = true;
|
||||||
+ public boolean loadPermissionsYmlBeforePlugins = true;
|
+ public boolean loadPermissionsYmlBeforePlugins = true;
|
||||||
+ @Constraints.Min(4)
|
+ @Constraints.Min(4)
|
||||||
|
Loading…
Reference in New Issue
Block a user