Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Add some patches, fix compile
Dieser Commit ist enthalten in:
Ursprung
e88856dd75
Commit
ea01aa335a
@ -1485,10 +1485,10 @@ index 0000000000000000000000000000000000000000..f0d4ec73bc8872a85e34f5c6b4d342e7
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f45afb7e2607617d1239abeca13a9002dd9a3a18
|
||||
index 0000000000000000000000000000000000000000..ec5e23136423e42e4f55e6ea646b8285c1ca14e2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,531 @@
|
||||
@@ -0,0 +1,534 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.google.common.collect.HashBasedTable;
|
||||
@ -1800,6 +1800,8 @@ index 0000000000000000000000000000000000000000..f45afb7e2607617d1239abeca13a9002
|
||||
+ public IntOr.Default other = IntOr.Default.USE_DEFAULT;
|
||||
+
|
||||
+ public int get(Entity entity, int def) {
|
||||
+ return def; // TODO https://github.com/PaperMC/Paper/issues/9742
|
||||
+ /*
|
||||
+ switch (TrackingRange.getTrackingRangeType(entity)) {
|
||||
+ case PLAYER -> {
|
||||
+ return player.or(def);
|
||||
@ -1822,6 +1824,7 @@ index 0000000000000000000000000000000000000000..f45afb7e2607617d1239abeca13a9002
|
||||
+ }
|
||||
+
|
||||
+ return other.or(def);
|
||||
+ */
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist
@ -5524,6 +5524,29 @@ index 666df22c8f847ef7152669540a3844566ef90d78..92095b494a0c4fb89b84f0b1c0376615
|
||||
public UUID getUUID(String key) {
|
||||
return NbtUtils.loadUUID(this.get(key));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index e7a124403f2b07c96caaaf97d1c9023f9ec2f9d9..5b267514504497de3faa7ffa490a179200d9415c 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -112,6 +112,18 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
BandwidthDebugMonitor bandwidthDebugMonitor;
|
||||
public String hostname = ""; // CraftBukkit - add field
|
||||
|
||||
+ // Paper start - add utility methods
|
||||
+ public final net.minecraft.server.level.ServerPlayer getPlayer() {
|
||||
+ if (this.packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl impl) {
|
||||
+ return impl.player;
|
||||
+ } else if (this.packetListener instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl impl) {
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = impl.getCraftPlayer();
|
||||
+ return player == null ? null : player.getHandle();
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Paper end - add utility methods
|
||||
+
|
||||
public Connection(PacketFlow side) {
|
||||
this.receiving = side;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||
index 427959874b7f167184785a582163029ad4a66df2..344c5af75c4a66bb27f3f422937c6c427c15ed25 100644
|
||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||
@ -5537,6 +5560,71 @@ index 427959874b7f167184785a582163029ad4a66df2..344c5af75c4a66bb27f3f422937c6c42
|
||||
if (packet.isSkippable()) {
|
||||
throw new SkipPacketException(var13);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java b/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
|
||||
index 929d31aa624f035eb314dece08969b102f5781fc..e94f0361cbca873f05b5b768c68c0933a0ca4483 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
|
||||
@@ -38,4 +38,14 @@ public record ClientboundCustomQueryPacket(int transactionId, CustomQueryPayload
|
||||
public void handle(ClientLoginPacketListener listener) {
|
||||
listener.handleCustomQuery(this);
|
||||
}
|
||||
+
|
||||
+ // Paper start - MC Utils - default query payloads
|
||||
+ public static record PlayerInfoChannelPayload(ResourceLocation id, FriendlyByteBuf buffer) implements CustomQueryPayload {
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(final FriendlyByteBuf buf) {
|
||||
+ buf.writeBytes(this.buffer.copy());
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - MC Utils - default query payloads
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java b/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java
|
||||
index 44cac39893eb968aa8ea21ee571c0dcb866ce06c..953e7573f6b2ca73a8c27c4d63edec89b173f333 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java
|
||||
@@ -15,7 +15,18 @@ public record ServerboundCustomQueryAnswerPacket(int transactionId, @Nullable Cu
|
||||
}
|
||||
|
||||
private static CustomQueryAnswerPayload readPayload(int queryId, FriendlyByteBuf buf) {
|
||||
- return readUnknownPayload(buf);
|
||||
+ // Paper start - MC Utils - default query payloads
|
||||
+ return new net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket.QueryAnswerPayload(
|
||||
+ buf.readNullable((buf2) -> {
|
||||
+ int i = buf2.readableBytes();
|
||||
+ if (i >= 0 && i <= MAX_PAYLOAD_SIZE) {
|
||||
+ return new FriendlyByteBuf(buf2.readBytes(i));
|
||||
+ } else {
|
||||
+ throw new IllegalArgumentException("Payload may not be larger than " + MAX_PAYLOAD_SIZE + " bytes");
|
||||
+ }
|
||||
+ })
|
||||
+ );
|
||||
+ // Paper end - MC Utils - default query payloads
|
||||
}
|
||||
|
||||
private static CustomQueryAnswerPayload readUnknownPayload(FriendlyByteBuf buf) {
|
||||
@@ -40,4 +51,21 @@ public record ServerboundCustomQueryAnswerPacket(int transactionId, @Nullable Cu
|
||||
public void handle(ServerLoginPacketListener listener) {
|
||||
listener.handleCustomQueryPacket(this);
|
||||
}
|
||||
+
|
||||
+ // Paper start - MC Utils - default query payloads
|
||||
+ public static final class QueryAnswerPayload implements CustomQueryAnswerPayload {
|
||||
+
|
||||
+ public final FriendlyByteBuf buffer;
|
||||
+
|
||||
+ public QueryAnswerPayload(final net.minecraft.network.FriendlyByteBuf buffer) {
|
||||
+ this.buffer = buffer;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(final net.minecraft.network.FriendlyByteBuf buf) {
|
||||
+ buf.writeBytes(this.buffer.copy());
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - MC Utils - default query payloads
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 124fad1031d6125bca233541e2d5f256da70ca44..2a7c614df7b9c9405a5dd23e6a888ede7fc86683 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
|
@ -16818,60 +16818,6 @@ index 0000000000000000000000000000000000000000..7e8dc9e8f381abfdcce2746edc93122d
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index e7a124403f2b07c96caaaf97d1c9023f9ec2f9d9..b097bb4855ab724b2c435a9a9db450ff3ce840fe 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -111,6 +111,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@Nullable
|
||||
BandwidthDebugMonitor bandwidthDebugMonitor;
|
||||
public String hostname = ""; // CraftBukkit - add field
|
||||
+ // Paper start - add pending task queue
|
||||
+ private final Queue<Runnable> pendingTasks = new java.util.concurrent.ConcurrentLinkedQueue<>();
|
||||
+ public void execute(final Runnable run) {
|
||||
+ if (this.channel == null || !this.channel.isRegistered()) {
|
||||
+ run.run();
|
||||
+ return;
|
||||
+ }
|
||||
+ final boolean queue = !this.queue.isEmpty();
|
||||
+ if (!queue) {
|
||||
+ this.channel.eventLoop().execute(run);
|
||||
+ } else {
|
||||
+ this.pendingTasks.add(run);
|
||||
+ if (this.queue.isEmpty()) {
|
||||
+ // something flushed async, dump tasks now
|
||||
+ Runnable r;
|
||||
+ while ((r = this.pendingTasks.poll()) != null) {
|
||||
+ this.channel.eventLoop().execute(r);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - add pending task queue
|
||||
|
||||
public Connection(PacketFlow side) {
|
||||
this.receiving = side;
|
||||
@@ -368,6 +390,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
|
||||
private void flushQueue() {
|
||||
+ try { // Paper - add pending task queue
|
||||
if (this.channel != null && this.channel.isOpen()) {
|
||||
Queue queue = this.pendingActions;
|
||||
|
||||
@@ -380,6 +403,12 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
}
|
||||
}
|
||||
+ } finally { // Paper start - add pending task queue
|
||||
+ Runnable r;
|
||||
+ while ((r = this.pendingTasks.poll()) != null) {
|
||||
+ this.channel.eventLoop().execute(r);
|
||||
+ }
|
||||
+ } // Paper end - add pending task queue
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java
|
||||
index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292bf595642 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java
|
||||
@ -22175,14 +22121,14 @@ index 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bde
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index d9daf07132c46548964a75588b69d7a74680e917..e68205fe7169c7c5b7c6fdada2ee97d86107ca97 100644
|
||||
index d9daf07132c46548964a75588b69d7a74680e917..5103081e8469dd5a393595eae00c6f6c9d0a5028 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -44,6 +44,7 @@ public class RegionFile implements AutoCloseable {
|
||||
private final IntBuffer timestamps;
|
||||
@VisibleForTesting
|
||||
protected final RegionBitmap usedSectors;
|
||||
+ public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
|
||||
+ public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(); // Paper
|
||||
|
||||
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
|
||||
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
|
||||
|
@ -172,7 +172,7 @@ index 515aedcf9969b818dfdc02a16a7f7178b5bb5593..56900156d79781f15357a3d25906d32b
|
||||
// Paper end
|
||||
// Spigot start
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index e68205fe7169c7c5b7c6fdada2ee97d86107ca97..aa8972fd1a1fade05d60ab69efb8ff24f344508a 100644
|
||||
index 5103081e8469dd5a393595eae00c6f6c9d0a5028..ab9681ba3a86212e0e23a9af8788eec1dbee36ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -275,6 +275,7 @@ public class RegionFile implements AutoCloseable {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Chunk Save Reattempt
|
||||
We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index aa8972fd1a1fade05d60ab69efb8ff24f344508a..ddcc212ba83d9365adb842b3d3ced64e3d7dd155 100644
|
||||
index ab9681ba3a86212e0e23a9af8788eec1dbee36ab..2a7f17726a161ddbcd0397fb4332de6980199c38 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -275,7 +275,7 @@ public class RegionFile implements AutoCloseable {
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
index a12d23b03d64aacaf1f231039333aec94245a89a..c1eb9f999c1042da804a3560d12c14f5d67b7953 100644
|
||||
index a12d23b03d64aacaf1f231039333aec94245a89a..81bfce0374f281069f963c24040163cd968e3958 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -89,9 +89,36 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
@@ -89,9 +89,44 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
this.connection.disconnect(ichatmutablecomponent);
|
||||
} else {
|
||||
this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection));
|
||||
@ -30,7 +30,15 @@ index a12d23b03d64aacaf1f231039333aec94245a89a..c1eb9f999c1042da804a3560d12c14f5
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getServerHostname() != null) packet.hostName = event.getServerHostname();
|
||||
+ if (event.getServerHostname() != null) {
|
||||
+ // change hostname
|
||||
+ packet = new ClientIntentionPacket(
|
||||
+ packet.protocolVersion(),
|
||||
+ event.getServerHostname(),
|
||||
+ packet.port(),
|
||||
+ packet.intention()
|
||||
+ );
|
||||
+ }
|
||||
+ if (event.getSocketAddressHostname() != null) this.connection.address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
|
||||
+ this.connection.spoofedUUID = event.getUniqueId();
|
||||
+ this.connection.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
||||
|
@ -60,25 +60,25 @@ index 0000000000000000000000000000000000000000..a5a7624f1f372a26b982836cd31cff15
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index b097bb4855ab724b2c435a9a9db450ff3ce840fe..2c807e8a579de5152f99c75ea272a6483a778f17 100644
|
||||
index 5b267514504497de3faa7ffa490a179200d9415c..faac9ba36d83f537fe62e177c15ae237059cc5cc 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -133,6 +133,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
}
|
||||
// Paper end - add pending task queue
|
||||
@@ -111,6 +111,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@Nullable
|
||||
BandwidthDebugMonitor bandwidthDebugMonitor;
|
||||
public String hostname = ""; // CraftBukkit - add field
|
||||
+ // Paper start - NetworkClient implementation
|
||||
+ public int protocolVersion;
|
||||
+ public java.net.InetSocketAddress virtualHost;
|
||||
+ // Paper end
|
||||
|
||||
public Connection(PacketFlow side) {
|
||||
this.receiving = side;
|
||||
// Paper start - add utility methods
|
||||
public final net.minecraft.server.level.ServerPlayer getPlayer() {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
index c1eb9f999c1042da804a3560d12c14f5d67b7953..331af220601127872aff709c8f692fdcae81cff9 100644
|
||||
index 81bfce0374f281069f963c24040163cd968e3958..e50f0ae7ba5e0271e4c0947ea73126c953aeac6b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -157,6 +157,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
@@ -165,6 +165,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
throw new UnsupportedOperationException("Invalid intention " + packet.intention());
|
||||
}
|
||||
|
||||
|
@ -12,18 +12,18 @@ flushing on the netty event loop, so it won't do the flush on the main thread.
|
||||
Renable flushing by passing -Dpaper.explicit-flush=true
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 2c807e8a579de5152f99c75ea272a6483a778f17..837cc21af01e691eb9e877479a67ce94d5b2bc06 100644
|
||||
index faac9ba36d83f537fe62e177c15ae237059cc5cc..df5da9398c903d073485aaa0dce8e70947137cb9 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -136,6 +136,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -114,6 +114,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
// Paper start - NetworkClient implementation
|
||||
public int protocolVersion;
|
||||
public java.net.InetSocketAddress virtualHost;
|
||||
+ private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush");
|
||||
// Paper end
|
||||
|
||||
public Connection(PacketFlow side) {
|
||||
@@ -430,7 +431,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
// Paper start - add utility methods
|
||||
@@ -413,7 +414,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
|
||||
if (this.channel != null) {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Configurable connection throttle kick message
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
index 331af220601127872aff709c8f692fdcae81cff9..cbc789f0005f7ae3122950e424913ef35fc0bc5d 100644
|
||||
index e50f0ae7ba5e0271e4c0947ea73126c953aeac6b..e6275103156b720d774e197ea61659f1f1699025 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -51,7 +51,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
|
@ -7,10 +7,10 @@ If a players inventory is too big to send in a single packet,
|
||||
split the inventory set into multiple packets instead.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 837cc21af01e691eb9e877479a67ce94d5b2bc06..8af273d3aa3989e148ca93528754a13e1d1bf414 100644
|
||||
index df5da9398c903d073485aaa0dce8e70947137cb9..6fcbf8205e1852d5193a42bfe1154f62ab01e7ad 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -166,6 +166,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -156,6 +156,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
|
||||
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) {
|
||||
|
@ -39,10 +39,10 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl state
|
||||
public net.minecraft.server.network.ServerLoginPacketListenerImpl gameProfile
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 8af273d3aa3989e148ca93528754a13e1d1bf414..08361da4ebd301996b0aaafc58beb5ec6698ff44 100644
|
||||
index 6fcbf8205e1852d5193a42bfe1154f62ab01e7ad..9f8fbb8231b60c287c9442365c2f95cde92969b8 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -661,6 +661,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -644,6 +644,27 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
packetlistener1.onDisconnect(ichatbasecomponent);
|
||||
}
|
||||
this.pendingActions.clear(); // Free up packet queue.
|
||||
@ -57,10 +57,11 @@ index 8af273d3aa3989e148ca93528754a13e1d1bf414..08361da4ebd301996b0aaafc58beb5ec
|
||||
+ /* Player is login stage */
|
||||
+ final net.minecraft.server.network.ServerLoginPacketListenerImpl loginListener = (net.minecraft.server.network.ServerLoginPacketListenerImpl) packetListener;
|
||||
+ switch (loginListener.state) {
|
||||
+ case READY_TO_ACCEPT:
|
||||
+ case DELAY_ACCEPT:
|
||||
+ case VERIFYING:
|
||||
+ case WAITING_FOR_DUPE_DISCONNECT:
|
||||
+ case PROTOCOL_SWITCHING:
|
||||
+ case ACCEPTED:
|
||||
+ final com.mojang.authlib.GameProfile profile = loginListener.gameProfile; /* Should be non-null at this stage */
|
||||
+ final com.mojang.authlib.GameProfile profile = loginListener.authenticatedProfile; /* Should be non-null at this stage */
|
||||
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(profile.getId(), profile.getName(),
|
||||
+ ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
|
||||
+ }
|
||||
@ -69,3 +70,16 @@ index 8af273d3aa3989e148ca93528754a13e1d1bf414..08361da4ebd301996b0aaafc58beb5ec
|
||||
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index f870c20ecce27ebd893107a35e1b8f15e462ff85..c3e7a5f61e94d9905dc805bfc486819b61e143d1 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -58,7 +58,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@Nullable
|
||||
String requestedUsername;
|
||||
@Nullable
|
||||
- private GameProfile authenticatedProfile;
|
||||
+ public GameProfile authenticatedProfile; // Paper - public
|
||||
private final String serverId;
|
||||
private ServerPlayer player; // CraftBukkit
|
||||
|
||||
|
@ -33,7 +33,7 @@ this fix, as the data will remain in the oversized file. Once the server returns
|
||||
to a jar with this fix, the data will be restored.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..b5283dae63fa669a6d53277156c4afb6c96fc489 100644
|
||||
index 2a7f17726a161ddbcd0397fb4332de6980199c38..72dacdc271325c814fb43cd6daaf3a209801ffda 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -18,8 +18,11 @@ import java.nio.file.LinkOption;
|
||||
@ -51,7 +51,7 @@ index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..b5283dae63fa669a6d53277156c4afb6
|
||||
@@ -45,6 +48,7 @@ public class RegionFile implements AutoCloseable {
|
||||
@VisibleForTesting
|
||||
protected final RegionBitmap usedSectors;
|
||||
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
|
||||
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(); // Paper
|
||||
+ public final Path regionFile; // Paper
|
||||
|
||||
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
|
@ -93,11 +93,11 @@ index 165daf5e4b44425974703e9f603955fa09984f1b..a8533bbac77c6024cd6163149affe4f4
|
||||
// Spigot start
|
||||
return this.anyPlayerCloseEnoughForSpawning(pos, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index b5283dae63fa669a6d53277156c4afb6c96fc489..8ef37d5f9a60f1bc62d5ef54a419ec1404659dde 100644
|
||||
index 72dacdc271325c814fb43cd6daaf3a209801ffda..647ce340c81606ab86d33e1f9dec1fb0afc262d8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -50,6 +50,30 @@ public class RegionFile implements AutoCloseable {
|
||||
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
|
||||
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(); // Paper
|
||||
public final Path regionFile; // Paper
|
||||
|
||||
+ // Paper start - Cache chunk status
|
@ -6,7 +6,7 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate
|
||||
Should help if something dumb happens
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
index a7ee469bb2880a78540b79ae691ea449dfe22ce4..0d8cfc0808a8f204d57cec40929b489099eca815 100644
|
||||
index 97cdd8cd7749185230471f34f7d1ce3abcd0fd11..982fb3ef071d6a66f16744717e8e146bef6d9e8c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
@@ -94,6 +94,18 @@ public class ChunkSerializer {
|
@ -494,7 +494,7 @@ index 52eb3176437113f9a0ff85d10ce5c2415e1b5570..b54ddd0ba0b001fbcb1838a838ca4890
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 08361da4ebd301996b0aaafc58beb5ec6698ff44..69722e101f537a71576fd82957cf305c5feef5fa 100644
|
||||
index 9f8fbb8231b60c287c9442365c2f95cde92969b8..4f33d7369c95f4d2afdef1cc333a7713f08d253d 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -75,13 +75,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@ -514,7 +514,7 @@ index 08361da4ebd301996b0aaafc58beb5ec6698ff44..69722e101f537a71576fd82957cf305c
|
||||
});
|
||||
private final PacketFlow receiving;
|
||||
private final Queue<Consumer<Connection>> pendingActions = Queues.newConcurrentLinkedQueue();
|
||||
@@ -217,7 +217,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -207,7 +207,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,40 +5,31 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
index a30fa3d54b70ab63d24dd67a69f39742335aff1e..a79da4bc0ed06ff8ede0a34f00194f927251099b 100644
|
||||
index 749d2a94d07727feb6e09e8461fc457b48c5b5f7..c9a6b5be8f0e382c373bd4ecbff1269d5cf6c850 100644
|
||||
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
@@ -329,6 +329,7 @@ public enum ConnectionProtocol implements BundlerInfo.Provider {
|
||||
@@ -336,6 +336,7 @@ public enum ConnectionProtocol {
|
||||
|
||||
@Nullable
|
||||
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {
|
||||
+ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper
|
||||
Function<FriendlyByteBuf, ? extends Packet<T>> function = this.idToDeserializer.get(id);
|
||||
Function<FriendlyByteBuf, ? extends Packet<? super T>> function = this.idToDeserializer.get(id);
|
||||
return function != null ? function.apply(buf) : null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
index 99b581052f937b0f2d6b5d73de699008c1d51774..81ec2011a93bb94200ad750f4666ba1cd8be11c5 100644
|
||||
index 00c170a16a57f41f881c6b282cba474ce485b34c..1f71357a4caef4b2cbff95b560d0f3df268b3621 100644
|
||||
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
+++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
@@ -8,9 +8,20 @@ import io.netty.handler.codec.CorruptedFrameException;
|
||||
import java.util.List;
|
||||
@@ -39,6 +39,12 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder {
|
||||
}
|
||||
|
||||
public class Varint21FrameDecoder extends ByteToMessageDecoder {
|
||||
+ private final byte[] lenBuf = new byte[3]; // Paper
|
||||
+ @Override
|
||||
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) {
|
||||
+ // Paper start - if channel is not active just discard the packet
|
||||
+ if (!channelHandlerContext.channel().isActive()) {
|
||||
+ byteBuf.skipBytes(byteBuf.readableBytes());
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // Paper end - if channel is not active just discard the packet
|
||||
byteBuf.markReaderIndex();
|
||||
- byte[] bs = new byte[3];
|
||||
+ // Paper start - reuse temporary length buffer
|
||||
+ byte[] bs = lenBuf;
|
||||
+ java.util.Arrays.fill(bs, (byte) 0);
|
||||
+ // Paper end
|
||||
|
||||
for(int i = 0; i < bs.length; ++i) {
|
||||
if (!byteBuf.isReadable()) {
|
||||
this.helperBuf.clear();
|
||||
if (!copyVarint(byteBuf, this.helperBuf)) {
|
@ -9,7 +9,7 @@ the game, immediately stop the server to prevent data corruption.
|
||||
You can override this functionality at your own peril.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
index dec862552b08e6b9f9ad1f88db1e07dcc43d7fa3..fce679e2b72d2ce1c8e75710041937c2c0566044 100644
|
||||
index 982fb3ef071d6a66f16744717e8e146bef6d9e8c..9a4fa3e034108528197cca3d040d210fa819af8b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
@@ -124,8 +124,20 @@ public class ChunkSerializer {
|
@ -8,11 +8,11 @@ the world per tick, this attempts to reduce the impact that join floods
|
||||
has on the server
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 69722e101f537a71576fd82957cf305c5feef5fa..4977a4880e95c7ba235ec805c5b6dc20d87a0670 100644
|
||||
index 4f33d7369c95f4d2afdef1cc333a7713f08d253d..039c99078150d9732cfad7edc5baba11e1e3d010 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -432,14 +432,29 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
} // Paper end - add pending task queue
|
||||
@@ -415,14 +415,29 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
}
|
||||
|
||||
+ private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper
|
||||
@ -33,7 +33,7 @@ index 69722e101f537a71576fd82957cf305c5feef5fa..4977a4880e95c7ba235ec805c5b6dc20
|
||||
|
||||
+ // 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
|
||||
+ || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.VERIFYING
|
||||
+ || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
|
||||
tickablepacketlistener.tick();
|
||||
+ }
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix hex colors not working in some kick messages
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
index cbc789f0005f7ae3122950e424913ef35fc0bc5d..d00b24fb71e5b47d0a9987bc5b5197b3acf70386 100644
|
||||
index e6275103156b720d774e197ea61659f1f1699025..65ee0a7183abb0a4b1f36d2ef9631c00b52eb99e 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -77,12 +77,12 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
@ -25,7 +25,7 @@ index cbc789f0005f7ae3122950e424913ef35fc0bc5d..d00b24fb71e5b47d0a9987bc5b5197b3
|
||||
|
||||
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index f870c20ecce27ebd893107a35e1b8f15e462ff85..25afcd025d32c76232910bcc7d6607eef3c4167d 100644
|
||||
index c3e7a5f61e94d9905dc805bfc486819b61e143d1..7ae0ecc93a92edeb172d9ed0709c8f7f068cdf4e 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -97,7 +97,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add API for quit reason
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 4977a4880e95c7ba235ec805c5b6dc20d87a0670..79c55e1f9819345c46aa33f0ebf2555ee4506cce 100644
|
||||
index 039c99078150d9732cfad7edc5baba11e1e3d010..2859f5bf5a00ff6841933dd83135d89a1786e76e 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -189,12 +189,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -179,12 +179,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
this.handlingFault = true;
|
||||
if (this.channel.isOpen()) {
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren