13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-07-28 00:04:27 +02:00
Ursprung 037e6ff905
Commit 9364ea991a
5 geänderte Dateien mit 57 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -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:

Datei anzeigen

@ -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;
}
};

Datei anzeigen

@ -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;

Datei anzeigen

@ -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

Datei anzeigen

@ -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<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ data.remove("blending_data");
+ final MapType<String> 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<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ final MapType<String> 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