mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 23:07:40 +01:00
apply a couple network patches
This commit is contained in:
parent
8ca7fa95c0
commit
e516ecfd45
@ -8,24 +8,6 @@ diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- 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<?>> {
|
|
||||||
this.receiving = side;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Paper start
|
|
||||||
+ @Nullable
|
|
||||||
+ public net.minecraft.server.level.ServerPlayer getPlayer() {
|
|
||||||
+ if (this.packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl serverGamePacketListener) {
|
|
||||||
+ return serverGamePacketListener.player;
|
|
||||||
+ } else {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
+
|
|
||||||
public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception {
|
|
||||||
super.channelActive(channelhandlercontext);
|
|
||||||
this.channel = channelhandlercontext.channel();
|
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
|
|
||||||
this.handlingFault = true;
|
this.handlingFault = true;
|
||||||
|
@ -28,9 +28,9 @@ 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<?>> {
|
||||||
private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush");
|
}
|
||||||
// Paper end
|
}
|
||||||
|
// Paper end - allow controlled flushing
|
||||||
+ // Paper start - packet limiter
|
+ // Paper start - packet limiter
|
||||||
+ protected final Object PACKET_LIMIT_LOCK = new Object();
|
+ protected final Object PACKET_LIMIT_LOCK = new Object();
|
||||||
+ protected final @Nullable io.papermc.paper.util.IntervalledCounter allPacketCounts = io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.allPackets.isEnabled() ? new io.papermc.paper.util.IntervalledCounter(
|
+ protected final @Nullable io.papermc.paper.util.IntervalledCounter allPacketCounts = io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.allPackets.isEnabled() ? new io.papermc.paper.util.IntervalledCounter(
|
||||||
@ -47,10 +47,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.stopReadingPackets = true;
|
+ this.stopReadingPackets = true;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - packet limiter
|
+ // Paper end - packet limiter
|
||||||
+
|
|
||||||
public Connection(PacketFlow side) {
|
public Connection(PacketFlow side) {
|
||||||
this.receiving = side;
|
this.receiving = side;
|
||||||
}
|
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
|
|
||||||
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
|
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
|
||||||
|
@ -12,8 +12,8 @@ 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<?>> {
|
||||||
} // Paper end - add pending task queue
|
|
||||||
}
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
+ private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper
|
+ private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper
|
||||||
+ private static int joinAttemptsThisTick; // Paper
|
+ private static int joinAttemptsThisTick; // Paper
|
||||||
|
Loading…
Reference in New Issue
Block a user