diff --git a/patches/server/Add-PlayerConnectionCloseEvent.patch b/patches/server/Add-PlayerConnectionCloseEvent.patch index d474d2e1c1..93c371cb87 100644 --- a/patches/server/Add-PlayerConnectionCloseEvent.patch +++ b/patches/server/Add-PlayerConnectionCloseEvent.patch @@ -43,12 +43,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.queue.clear(); // Free up packet queue. + // Paper start - Add PlayerConnectionCloseEvent + final PacketListener packetListener = this.getPacketListener(); -+ if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl playerConnection) { ++ if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl) { + /* Player was logged in */ ++ final net.minecraft.server.network.ServerGamePacketListenerImpl playerConnection = (net.minecraft.server.network.ServerGamePacketListenerImpl) packetListener; + new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(playerConnection.player.getUUID(), + playerConnection.player.getScoreboardName(), ((java.net.InetSocketAddress)address).getAddress(), false).callEvent(); -+ } else if (packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginListener) { ++ } else if (packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl) { + /* 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: diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index ddbf13804d..db6880ebe8 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -1472,7 +1472,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected Object evaluate() { - ServerGamePacketListenerImpl.this.disconnect(s); -+ ServerGamePacketListenerImpl.this.disconnect(reason); // Paper - adventure ++ ServerGamePacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure return null; } }; diff --git a/patches/server/Buffer-joins-to-world.patch b/patches/server/Buffer-joins-to-world.patch index 7589335ec3..546cac47b8 100644 --- a/patches/server/Buffer-joins-to-world.patch +++ b/patches/server/Buffer-joins-to-world.patch @@ -26,10 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + joinAttemptsThisTick = 0; + } + // Paper end -+ if (this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl serverLoginPacketListener) { -+ if ( serverLoginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper ++ 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 -+ serverLoginPacketListener.tick(); ++ ((net.minecraft.server.network.ServerLoginPacketListenerImpl) this.packetListener).tick(); + } // Paper + } PacketListener packetlistener = this.packetListener; diff --git a/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch index b777030b12..bcdebf1f3d 100644 --- a/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -275,7 +275,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + clearPacketQueue(); // Paper // Paper start - Add PlayerConnectionCloseEvent final PacketListener packetListener = this.getPacketListener(); - if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl playerConnection) { + if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl) { diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/Packet.java diff --git a/patches/server/Rewrite-dataconverter-system.patch b/patches/server/Rewrite-dataconverter-system.patch index e70e7417b2..d0957b44fe 100644 --- a/patches/server/Rewrite-dataconverter-system.patch +++ b/patches/server/Rewrite-dataconverter-system.patch @@ -203,18 +203,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package ca.spottedleaf.dataconverter.minecraft; + +import ca.spottedleaf.dataconverter.converters.DataConverter; -+import ca.spottedleaf.dataconverter.minecraft.versions.V3093; +import com.mojang.logging.LogUtils; +import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntLinkedOpenHashSet; +import it.unimi.dsi.fastutil.ints.IntRBTreeSet; +import it.unimi.dsi.fastutil.longs.LongArrayList; ++import it.unimi.dsi.fastutil.longs.LongComparator; +import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet; +import org.slf4j.Logger; +import java.lang.reflect.Field; +import java.util.Arrays; -+import java.util.Comparator; +import java.util.Locale; + +public final class MCVersionRegistry { @@ -401,8 +400,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 3090, + 3093, + 3094, -+ 3097 -+ // All up to 1.19-pre1 ++ 3097, ++ 3108 ++ // All up to 1.19.1-pre2 + }; + Arrays.sort(converterVersions); + @@ -495,7 +495,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ DATA_VERSION_LIST.sort(Comparator.naturalOrder()); ++ DATA_VERSION_LIST.sort((LongComparator)null); + + for (final int version : DATACONVERTER_VERSIONS_MAJOR) { + DATACONVERTER_VERSIONS.add(DataConverter.encodeVersions(version, 0)); @@ -986,6 +986,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static final int V1_19_PRE5 = 3102; + public static final int V1_19_RC1 = 3103; + public static final int V1_19_RC2 = 3104; ++ public static final int V1_19 = 3105; ++ public static final int V22W24A = 3106; ++ public static final int V1_19_1_PRE1 = 3107; ++ public static final int V1_19_1_RC1 = 3109; ++ public static final int V1_19_1_PRE2 = 3110; +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/advancements/ConverterAbstractAdvancementsRename.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/advancements/ConverterAbstractAdvancementsRename.java new file mode 100644 @@ -6783,6 +6788,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + V3093.register(); + V3094.register(); + V3097.register(); ++ V3108.register(); + } + + private MCTypeRegistry() {} @@ -17431,6 +17437,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public MapType convert(final MapType data, final long sourceVersion, final long toVersion) { + data.remove("blending_data"); ++ final MapType context = data.getMap("__context"); ++ if (!"minecraft:overworld".equals(context == null ? null : context.getString("dimension"))) { ++ return null; ++ } + + final String status = NamespaceUtil.correctNamespace(data.getString("Status")); + if (status == null) { @@ -17625,6 +17635,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + MCTypeRegistry.POI_CHUNK.addStructureConverter(new ConverterPoiDelete(VERSION, poiRemove::contains)); + } +} +diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3108.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3108.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3108.java +@@ -0,0 +0,0 @@ ++package ca.spottedleaf.dataconverter.minecraft.versions; ++ ++import ca.spottedleaf.dataconverter.converters.DataConverter; ++import ca.spottedleaf.dataconverter.minecraft.MCVersions; ++import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry; ++import ca.spottedleaf.dataconverter.types.MapType; ++ ++public final class V3108 { ++ ++ private static final int VERSION = MCVersions.V1_19_1_PRE1 + 1; ++ ++ public static void register() { ++ MCTypeRegistry.CHUNK.addStructureConverter(new DataConverter<>(VERSION) { ++ @Override ++ public MapType convert(final MapType data, final long sourceVersion, final long toVersion) { ++ final MapType context = data.getMap("__context"); ++ if ("minecraft:overworld".equals(context == null ? null : context.getString("dimension"))) { ++ return null; ++ } ++ ++ data.remove("blending_data"); ++ ++ return null; ++ } ++ }); ++ } ++} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000