mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-01-22 15:31:28 +01:00
22w43a
This commit is contained in:
parent
6095128007
commit
e3dc9e5b66
@ -82,7 +82,7 @@ public class ProtocolVersion {
|
|||||||
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
|
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
|
||||||
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
||||||
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2));
|
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2));
|
||||||
public static final ProtocolVersion v1_19_3 = register(761, 104, "1.19.3");
|
public static final ProtocolVersion v1_19_3 = register(761, 105, "1.19.3");
|
||||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||||
|
|
||||||
public static ProtocolVersion register(int version, String name) {
|
public static ProtocolVersion register(int version, String name) {
|
||||||
|
@ -22,7 +22,6 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
|||||||
import com.viaversion.viaversion.api.data.MappingData;
|
import com.viaversion.viaversion.api.data.MappingData;
|
||||||
import com.viaversion.viaversion.api.data.MappingDataBase;
|
import com.viaversion.viaversion.api.data.MappingDataBase;
|
||||||
import com.viaversion.viaversion.api.minecraft.PlayerMessageSignature;
|
import com.viaversion.viaversion.api.minecraft.PlayerMessageSignature;
|
||||||
import com.viaversion.viaversion.api.minecraft.ProfileKey;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_3Types;
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_3Types;
|
||||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
@ -39,19 +38,16 @@ import com.viaversion.viaversion.api.type.types.version.Types1_19_3;
|
|||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
import com.viaversion.viaversion.libs.kyori.adventure.text.Component;
|
import com.viaversion.viaversion.libs.kyori.adventure.text.Component;
|
||||||
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1;
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ServerboundPackets1_19_1;
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ServerboundPackets1_19_1;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.packets.EntityPackets;
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.packets.EntityPackets;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.packets.InventoryPackets;
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.packets.InventoryPackets;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.storage.NonceStorage;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.storage.ReceivedMessagesStorage;
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.storage.ReceivedMessagesStorage;
|
||||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||||
import com.viaversion.viaversion.util.CipherUtil;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -233,51 +229,19 @@ public final class Protocol1_19_3To1_19_1 extends AbstractProtocol<ClientboundPa
|
|||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // Name
|
map(Type.STRING); // Name
|
||||||
read(Type.UUID); // Session UUID
|
create(Type.OPTIONAL_PROFILE_KEY, null);
|
||||||
handler(wrapper -> {
|
|
||||||
final ProfileKey profileKey = wrapper.read(Type.OPTIONAL_PROFILE_KEY);
|
|
||||||
wrapper.write(Type.OPTIONAL_PROFILE_KEY, null);
|
|
||||||
if (profileKey == null) {
|
|
||||||
wrapper.user().put(new NonceStorage(null));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
map(Type.STRING); // Server id
|
|
||||||
handler(wrapper -> {
|
|
||||||
if (wrapper.user().has(NonceStorage.class)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final byte[] publicKey = wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE);
|
|
||||||
final byte[] nonce = wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE);
|
|
||||||
wrapper.user().put(new NonceStorage(CipherUtil.encryptNonce(publicKey, nonce)));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE_ARRAY_PRIMITIVE); // Keys
|
map(Type.BYTE_ARRAY_PRIMITIVE); // Keys
|
||||||
handler(wrapper -> {
|
create(Type.BOOLEAN, true); // Is nonce
|
||||||
final NonceStorage nonceStorage = wrapper.user().remove(NonceStorage.class);
|
map(Type.BYTE_ARRAY_PRIMITIVE); // Encrypted challenge
|
||||||
if (nonceStorage.nonce() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isNonce = wrapper.read(Type.BOOLEAN);
|
|
||||||
wrapper.write(Type.BOOLEAN, true);
|
|
||||||
if (!isNonce) { // Should never be true at this point, but /shrug otherwise
|
|
||||||
wrapper.read(Type.LONG); // Salt
|
|
||||||
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Signature
|
|
||||||
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, nonceStorage.nonce());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cancelServerbound(ServerboundPackets1_19_3.CHAT_SESSION_UPDATE);
|
||||||
cancelClientbound(ClientboundPackets1_19_1.DELETE_CHAT_MESSAGE);
|
cancelClientbound(ClientboundPackets1_19_1.DELETE_CHAT_MESSAGE);
|
||||||
cancelClientbound(ClientboundPackets1_19_1.PLAYER_CHAT_HEADER);
|
cancelClientbound(ClientboundPackets1_19_1.PLAYER_CHAT_HEADER);
|
||||||
cancelClientbound(ClientboundPackets1_19_1.CHAT_PREVIEW);
|
cancelClientbound(ClientboundPackets1_19_1.CHAT_PREVIEW);
|
||||||
|
@ -53,6 +53,7 @@ public enum ServerboundPackets1_19_3 implements ServerboundPacketType {
|
|||||||
ENTITY_ACTION, // 0x1D
|
ENTITY_ACTION, // 0x1D
|
||||||
STEER_VEHICLE, // 0x1E
|
STEER_VEHICLE, // 0x1E
|
||||||
PONG, // 0x1F
|
PONG, // 0x1F
|
||||||
|
CHAT_SESSION_UPDATE,
|
||||||
RECIPE_BOOK_DATA, // 0x20
|
RECIPE_BOOK_DATA, // 0x20
|
||||||
SEEN_RECIPE, // 0x21
|
SEEN_RECIPE, // 0x21
|
||||||
RENAME_ITEM, // 0x22
|
RENAME_ITEM, // 0x22
|
||||||
|
@ -126,10 +126,13 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19_3To1_19_1>
|
|||||||
final int ping = wrapper.read(Type.VAR_INT);
|
final int ping = wrapper.read(Type.VAR_INT);
|
||||||
final JsonElement displayName = wrapper.read(Type.OPTIONAL_COMPONENT);
|
final JsonElement displayName = wrapper.read(Type.OPTIONAL_COMPONENT);
|
||||||
final ProfileKey profileKey = wrapper.read(Type.OPTIONAL_PROFILE_KEY);
|
final ProfileKey profileKey = wrapper.read(Type.OPTIONAL_PROFILE_KEY);
|
||||||
|
if (profileKey != null) {
|
||||||
// Salvage signed chat
|
wrapper.write(Type.BOOLEAN, true);
|
||||||
wrapper.write(Type.UUID, UUID.randomUUID());
|
wrapper.write(Type.UUID, UUID.randomUUID());
|
||||||
wrapper.write(Type.OPTIONAL_PROFILE_KEY, profileKey);
|
wrapper.write(Type.PROFILE_KEY, profileKey);
|
||||||
|
} else {
|
||||||
|
wrapper.write(Type.BOOLEAN, false);
|
||||||
|
}
|
||||||
|
|
||||||
wrapper.write(Type.VAR_INT, gamemode);
|
wrapper.write(Type.VAR_INT, gamemode);
|
||||||
wrapper.write(Type.BOOLEAN, true); // Also update listed
|
wrapper.write(Type.BOOLEAN, true); // Also update listed
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
|
||||||
* Copyright (C) 2016-2022 ViaVersion and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.storage;
|
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
|
|
||||||
public final class NonceStorage implements StorableObject {
|
|
||||||
|
|
||||||
private final byte[] nonce;
|
|
||||||
|
|
||||||
public NonceStorage(final byte @Nullable[] nonce) {
|
|
||||||
this.nonce = nonce;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte @Nullable [] nonce() {
|
|
||||||
return nonce;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||||
projectVersion=4.5.0-22w42a-SNAPSHOT
|
projectVersion=4.5.0-22w43a-SNAPSHOT
|
||||||
|
|
||||||
# Gradle properties
|
# Gradle properties
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
Loading…
Reference in New Issue
Block a user