Rename ViaForgeCommon attribute keys

This commit is contained in:
FlorianMichael 2024-07-11 05:35:18 +02:00
parent b23a86b6ad
commit 9cde68c619
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
8 changed files with 10 additions and 10 deletions

View File

@ -43,8 +43,8 @@ import java.io.File;
*/ */
public class ViaForgeCommon { public class ViaForgeCommon {
public static final AttributeKey<UserConnection> LOCAL_VIA_USER = AttributeKey.valueOf("local_via_user"); public static final AttributeKey<UserConnection> VF_VIA_USER = AttributeKey.valueOf("viaforge_via_user");
public static final AttributeKey<VFNetworkManager> VF_NETWORK_MANAGER = AttributeKey.valueOf("encryption_setup"); public static final AttributeKey<VFNetworkManager> VF_NETWORK_MANAGER = AttributeKey.valueOf("viaforge_network_manager");
private static ViaForgeCommon manager; private static ViaForgeCommon manager;
@ -98,7 +98,7 @@ public class ViaForgeCommon {
final UserConnection user = new UserConnectionImpl(channel, true); final UserConnection user = new UserConnectionImpl(channel, true);
new ProtocolPipelineImpl(user); new ProtocolPipelineImpl(user);
channel.attr(LOCAL_VIA_USER).set(user); channel.attr(VF_VIA_USER).set(user);
channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, targetVersion)); channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, targetVersion));
channel.closeFuture().addListener(future -> { channel.closeFuture().addListener(future -> {

View File

@ -44,7 +44,7 @@ public class MixinNetHandlerLoginClient {
public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException { public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException {
final VFNetworkManager mixinNetworkManager = (VFNetworkManager) networkManager; final VFNetworkManager mixinNetworkManager = (VFNetworkManager) networkManager;
if (mixinNetworkManager.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (mixinNetworkManager.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
final UserConnection user = networkManager.channel().attr(ViaForgeCommon.LOCAL_VIA_USER).get(); final UserConnection user = networkManager.channel().attr(ViaForgeCommon.VF_VIA_USER).get();
if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) { if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) {
// We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call // We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call
// if the server is in offline mode, due the packet changes <-> networking changes // if the server is in offline mode, due the packet changes <-> networking changes

View File

@ -44,7 +44,7 @@ public class MixinClientLoginNetHandler {
public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException { public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException {
final VFNetworkManager mixinConnection = (VFNetworkManager) connection; final VFNetworkManager mixinConnection = (VFNetworkManager) connection;
if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
final UserConnection user = connection.channel().attr(ViaForgeCommon.LOCAL_VIA_USER).get(); final UserConnection user = connection.channel().attr(ViaForgeCommon.VF_VIA_USER).get();
if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) { if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) {
// We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call // We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call
// if the server is in offline mode, due the packet changes <-> networking changes // if the server is in offline mode, due the packet changes <-> networking changes

View File

@ -44,7 +44,7 @@ public class MixinClientHandshakePacketListenerImpl {
public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException { public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException {
final VFNetworkManager mixinConnection = (VFNetworkManager) connection; final VFNetworkManager mixinConnection = (VFNetworkManager) connection;
if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
final UserConnection user = connection.channel().attr(ViaForgeCommon.LOCAL_VIA_USER).get(); final UserConnection user = connection.channel().attr(ViaForgeCommon.VF_VIA_USER).get();
if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) { if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) {
// We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call // We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call
// if the server is in offline mode, due the packet changes <-> networking changes // if the server is in offline mode, due the packet changes <-> networking changes

View File

@ -44,7 +44,7 @@ public class MixinClientHandshakePacketListenerImpl {
public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException { public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException {
final VFNetworkManager mixinConnection = (VFNetworkManager) connection; final VFNetworkManager mixinConnection = (VFNetworkManager) connection;
if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
final UserConnection user = connection.channel().attr(ViaForgeCommon.LOCAL_VIA_USER).get(); final UserConnection user = connection.channel().attr(ViaForgeCommon.VF_VIA_USER).get();
if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) { if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) {
// We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call // We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call
// if the server is in offline mode, due the packet changes <-> networking changes // if the server is in offline mode, due the packet changes <-> networking changes

View File

@ -44,7 +44,7 @@ public class MixinClientHandshakePacketListenerImpl {
public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException { public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException {
final VFNetworkManager mixinConnection = (VFNetworkManager) connection; final VFNetworkManager mixinConnection = (VFNetworkManager) connection;
if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
final UserConnection user = connection.channel().attr(ViaForgeCommon.LOCAL_VIA_USER).get(); final UserConnection user = connection.channel().attr(ViaForgeCommon.VF_VIA_USER).get();
if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) { if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) {
// We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call // We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call
// if the server is in offline mode, due the packet changes <-> networking changes // if the server is in offline mode, due the packet changes <-> networking changes

View File

@ -44,7 +44,7 @@ public class MixinClientHandshakePacketListenerImpl {
public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException { public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException {
final VFNetworkManager mixinConnection = (VFNetworkManager) connection; final VFNetworkManager mixinConnection = (VFNetworkManager) connection;
if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
final UserConnection user = connection.channel().attr(ViaForgeCommon.LOCAL_VIA_USER).get(); final UserConnection user = connection.channel().attr(ViaForgeCommon.VF_VIA_USER).get();
if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) { if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) {
// We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call // We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call
// if the server is in offline mode, due the packet changes <-> networking changes // if the server is in offline mode, due the packet changes <-> networking changes

View File

@ -45,7 +45,7 @@ public class MixinClientHandshakePacketListenerImpl {
public void onlyJoinServerIfPremium(MinecraftSessionService instance, UUID uuid, String authenticationToken, String serverId) throws AuthenticationException { public void onlyJoinServerIfPremium(MinecraftSessionService instance, UUID uuid, String authenticationToken, String serverId) throws AuthenticationException {
final VFNetworkManager mixinConnection = (VFNetworkManager) connection; final VFNetworkManager mixinConnection = (VFNetworkManager) connection;
if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (mixinConnection.viaForge$getTrackedVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
final UserConnection user = connection.channel().attr(ViaForgeCommon.LOCAL_VIA_USER).get(); final UserConnection user = connection.channel().attr(ViaForgeCommon.VF_VIA_USER).get();
if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) { if (user != null && user.has(ProtocolMetadataStorage.class) && !user.get(ProtocolMetadataStorage.class).authenticate) {
// We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call // We are in the 1.7 -> 1.6 protocol, so we need to skip the joinServer call
// if the server is in offline mode, due the packet changes <-> networking changes // if the server is in offline mode, due the packet changes <-> networking changes