mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-23 07:58:27 -05:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
9a41bca967
7 changed files with 41 additions and 132 deletions
19
build.gradle
19
build.gradle
|
@ -60,12 +60,14 @@ dependencies {
|
||||||
exclude group: "com.google.guava", module: "guava"
|
exclude group: "com.google.guava", module: "guava"
|
||||||
}
|
}
|
||||||
include "com.viaversion:viarewind-common:3.0.3-SNAPSHOT"
|
include "com.viaversion:viarewind-common:3.0.3-SNAPSHOT"
|
||||||
include "net.raphimc:ViaLegacy:2.2.21-SNAPSHOT"
|
include("net.raphimc:ViaLegacy:2.2.21-SNAPSHOT") {
|
||||||
|
exclude group: "net.lenni0451.mcstructs", module: "text"
|
||||||
|
}
|
||||||
include "net.raphimc:ViaAprilFools:2.0.10-SNAPSHOT"
|
include "net.raphimc:ViaAprilFools:2.0.10-SNAPSHOT"
|
||||||
include("net.raphimc:ViaBedrock:0.0.3-SNAPSHOT") {
|
include("net.raphimc:ViaBedrock:0.0.3-SNAPSHOT") {
|
||||||
exclude group: "io.netty", module: "netty-codec-http"
|
exclude group: "io.netty"
|
||||||
exclude group: "io.jsonwebtoken", module: "jjwt-impl"
|
exclude group: "io.jsonwebtoken"
|
||||||
exclude group: "io.jsonwebtoken", module: "jjwt-gson"
|
exclude group: "net.lenni0451.mcstructs", module: "text"
|
||||||
}
|
}
|
||||||
include("net.raphimc:ViaLoader:2.2.11-SNAPSHOT") {
|
include("net.raphimc:ViaLoader:2.2.11-SNAPSHOT") {
|
||||||
exclude group: "org.slf4j", module: "slf4j-api"
|
exclude group: "org.slf4j", module: "slf4j-api"
|
||||||
|
@ -88,7 +90,9 @@ dependencies {
|
||||||
include "net.lenni0451.classtransform:additionalclassprovider:1.11.0"
|
include "net.lenni0451.classtransform:additionalclassprovider:1.11.0"
|
||||||
include "net.lenni0451:Reflect:1.3.0"
|
include "net.lenni0451:Reflect:1.3.0"
|
||||||
include "net.lenni0451:LambdaEvents:2.3.2"
|
include "net.lenni0451:LambdaEvents:2.3.2"
|
||||||
include "net.raphimc.netminecraft:all:2.3.7-SNAPSHOT"
|
include("net.raphimc.netminecraft:all:2.3.7-SNAPSHOT") {
|
||||||
|
exclude group: "com.google.code.gson", module: "gson"
|
||||||
|
}
|
||||||
include("net.raphimc:MinecraftAuth:2.1.7-SNAPSHOT") {
|
include("net.raphimc:MinecraftAuth:2.1.7-SNAPSHOT") {
|
||||||
exclude group: "com.google.code.gson", module: "gson"
|
exclude group: "com.google.code.gson", module: "gson"
|
||||||
exclude group: "org.slf4j", module: "slf4j-api"
|
exclude group: "org.slf4j", module: "slf4j-api"
|
||||||
|
@ -98,10 +102,7 @@ dependencies {
|
||||||
exclude group: "net.lenni0451.classtransform", module: "additionalclassprovider"
|
exclude group: "net.lenni0451.classtransform", module: "additionalclassprovider"
|
||||||
}
|
}
|
||||||
include("org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR1-SNAPSHOT") {
|
include("org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR1-SNAPSHOT") {
|
||||||
exclude group: "io.netty", module: "netty-common"
|
exclude group: "io.netty"
|
||||||
exclude group: "io.netty", module: "netty-buffer"
|
|
||||||
exclude group: "io.netty", module: "netty-codec"
|
|
||||||
exclude group: "io.netty", module: "netty-transport"
|
|
||||||
}
|
}
|
||||||
include "gs.mclo:api:3.0.1"
|
include "gs.mclo:api:3.0.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,4 +4,4 @@ org.gradle.configureondemand=true
|
||||||
|
|
||||||
maven_group=net.raphimc
|
maven_group=net.raphimc
|
||||||
maven_name=ViaProxy
|
maven_name=ViaProxy
|
||||||
maven_version=3.0.22
|
maven_version=3.0.23-SNAPSHOT
|
||||||
|
|
|
@ -24,10 +24,9 @@ import net.raphimc.viaproxy.protocolhack.viaproxy.ConsoleCommandSender;
|
||||||
import net.raphimc.viaproxy.util.ArrayHelper;
|
import net.raphimc.viaproxy.util.ArrayHelper;
|
||||||
import net.raphimc.viaproxy.util.logging.Logger;
|
import net.raphimc.viaproxy.util.logging.Logger;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class ConsoleHandler {
|
public class ConsoleHandler {
|
||||||
|
|
||||||
|
@ -43,10 +42,10 @@ public class ConsoleHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void listen() {
|
private static void listen() {
|
||||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(new DelayedStream(System.in, 500)));
|
final Scanner scanner = new Scanner(System.in);
|
||||||
try {
|
try {
|
||||||
String line;
|
while (scanner.hasNextLine()) {
|
||||||
while ((line = reader.readLine()) != null) {
|
final String line = scanner.nextLine();
|
||||||
try {
|
try {
|
||||||
final String[] parts = line.split(" ");
|
final String[] parts = line.split(" ");
|
||||||
if (parts.length == 0) continue;
|
if (parts.length == 0) continue;
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
|
|
||||||
* Copyright (C) 2023 RK_01/RaphiMC 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 net.raphimc.viaproxy.cli;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
public class DelayedStream extends InputStream {
|
|
||||||
|
|
||||||
private final InputStream parent;
|
|
||||||
private final long sleepDelay;
|
|
||||||
|
|
||||||
public DelayedStream(final InputStream parent, final long sleepDelay) {
|
|
||||||
this.parent = parent;
|
|
||||||
this.sleepDelay = sleepDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InputStream getParent() {
|
|
||||||
return this.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getSleepDelay() {
|
|
||||||
return this.sleepDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void waitForInput() throws IOException {
|
|
||||||
while (this.available() <= 0) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(this.sleepDelay);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new IOException("Interrupted", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int read() throws IOException {
|
|
||||||
this.waitForInput();
|
|
||||||
return this.parent.read();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int read(byte[] b) throws IOException {
|
|
||||||
this.waitForInput();
|
|
||||||
return this.parent.read(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
|
||||||
this.waitForInput();
|
|
||||||
return this.parent.read(b, off, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int available() throws IOException {
|
|
||||||
return this.parent.available();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() throws IOException {
|
|
||||||
this.parent.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void mark(int readlimit) {
|
|
||||||
this.parent.mark(readlimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void reset() throws IOException {
|
|
||||||
this.parent.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean markSupported() {
|
|
||||||
return this.parent.markSupported();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,11 +20,11 @@ package net.raphimc.viaproxy.plugins.events;
|
||||||
import net.raphimc.viaproxy.plugins.events.types.EventCancellable;
|
import net.raphimc.viaproxy.plugins.events.types.EventCancellable;
|
||||||
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
|
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
|
||||||
|
|
||||||
public class PreMojangAuthEvent extends EventCancellable {
|
public class ShouldVerifyOnlineModeEvent extends EventCancellable {
|
||||||
|
|
||||||
private final ProxyConnection proxyConnection;
|
private final ProxyConnection proxyConnection;
|
||||||
|
|
||||||
public PreMojangAuthEvent(final ProxyConnection proxyConnection) {
|
public ShouldVerifyOnlineModeEvent(final ProxyConnection proxyConnection) {
|
||||||
this.proxyConnection = proxyConnection;
|
this.proxyConnection = proxyConnection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,10 @@ import net.raphimc.netminecraft.packet.impl.login.*;
|
||||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ProtocolMetadataStorage;
|
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ProtocolMetadataStorage;
|
||||||
import net.raphimc.vialoader.util.VersionEnum;
|
import net.raphimc.vialoader.util.VersionEnum;
|
||||||
import net.raphimc.viaproxy.ViaProxy;
|
import net.raphimc.viaproxy.ViaProxy;
|
||||||
|
import net.raphimc.viaproxy.cli.ConsoleFormatter;
|
||||||
import net.raphimc.viaproxy.cli.options.Options;
|
import net.raphimc.viaproxy.cli.options.Options;
|
||||||
import net.raphimc.viaproxy.plugins.events.ClientLoggedInEvent;
|
import net.raphimc.viaproxy.plugins.events.ClientLoggedInEvent;
|
||||||
import net.raphimc.viaproxy.plugins.events.PreMojangAuthEvent;
|
import net.raphimc.viaproxy.plugins.events.ShouldVerifyOnlineModeEvent;
|
||||||
import net.raphimc.viaproxy.proxy.LoginState;
|
import net.raphimc.viaproxy.proxy.LoginState;
|
||||||
import net.raphimc.viaproxy.proxy.external_interface.AuthLibServices;
|
import net.raphimc.viaproxy.proxy.external_interface.AuthLibServices;
|
||||||
import net.raphimc.viaproxy.proxy.external_interface.ExternalInterface;
|
import net.raphimc.viaproxy.proxy.external_interface.ExternalInterface;
|
||||||
|
@ -92,7 +93,7 @@ public class LoginPacketHandler extends PacketHandler {
|
||||||
proxyConnection.setGameProfile(new GameProfile(null, loginHelloPacket.name));
|
proxyConnection.setGameProfile(new GameProfile(null, loginHelloPacket.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.ONLINE_MODE) {
|
if (Options.ONLINE_MODE && !ViaProxy.EVENT_MANAGER.call(new ShouldVerifyOnlineModeEvent(this.proxyConnection)).isCancelled()) {
|
||||||
this.proxyConnection.getC2P().writeAndFlush(new S2CLoginKeyPacket1_8("", KEY_PAIR.getPublic().getEncoded(), this.verifyToken)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
this.proxyConnection.getC2P().writeAndFlush(new S2CLoginKeyPacket1_8("", KEY_PAIR.getPublic().getEncoded(), this.verifyToken)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
ViaProxy.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
ViaProxy.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
||||||
|
@ -122,21 +123,19 @@ public class LoginPacketHandler extends PacketHandler {
|
||||||
final SecretKey secretKey = CryptUtil.decryptSecretKey(KEY_PAIR.getPrivate(), loginKeyPacket.encryptedSecretKey);
|
final SecretKey secretKey = CryptUtil.decryptSecretKey(KEY_PAIR.getPrivate(), loginKeyPacket.encryptedSecretKey);
|
||||||
this.proxyConnection.getC2P().attr(MCPipeline.ENCRYPTION_ATTRIBUTE_KEY).set(new AESEncryption(secretKey));
|
this.proxyConnection.getC2P().attr(MCPipeline.ENCRYPTION_ATTRIBUTE_KEY).set(new AESEncryption(secretKey));
|
||||||
|
|
||||||
if (!ViaProxy.EVENT_MANAGER.call(new PreMojangAuthEvent(this.proxyConnection)).isCancelled()) {
|
final String userName = this.proxyConnection.getGameProfile().getName();
|
||||||
final String userName = this.proxyConnection.getGameProfile().getName();
|
try {
|
||||||
try {
|
final String serverHash = new BigInteger(CryptUtil.computeServerIdHash("", KEY_PAIR.getPublic(), secretKey)).toString(16);
|
||||||
final String serverHash = new BigInteger(CryptUtil.computeServerIdHash("", KEY_PAIR.getPublic(), secretKey)).toString(16);
|
final GameProfile mojangProfile = AuthLibServices.SESSION_SERVICE.hasJoinedServer(this.proxyConnection.getGameProfile(), serverHash, null);
|
||||||
final GameProfile mojangProfile = AuthLibServices.SESSION_SERVICE.hasJoinedServer(this.proxyConnection.getGameProfile(), serverHash, null);
|
if (mojangProfile == null) {
|
||||||
if (mojangProfile == null) {
|
Logger.u_err("auth", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), "Invalid session");
|
||||||
Logger.u_err("auth", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), "Invalid session");
|
this.proxyConnection.kickClient("§cInvalid session! Please restart minecraft (and the launcher) and try again.");
|
||||||
this.proxyConnection.kickClient("§cInvalid session! Please restart minecraft (and the launcher) and try again.");
|
} else {
|
||||||
} else {
|
this.proxyConnection.setGameProfile(mojangProfile);
|
||||||
this.proxyConnection.setGameProfile(mojangProfile);
|
|
||||||
}
|
|
||||||
Logger.u_info("auth", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), "Authenticated as " + this.proxyConnection.getGameProfile().getId().toString());
|
|
||||||
} catch (Throwable e) {
|
|
||||||
throw new RuntimeException("Failed to make session request for user '" + userName + "'!", e);
|
|
||||||
}
|
}
|
||||||
|
Logger.u_info("auth", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), "Authenticated as " + this.proxyConnection.getGameProfile().getId().toString());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw new RuntimeException("Failed to make session request for user '" + userName + "'!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ViaProxy.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
ViaProxy.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
||||||
|
@ -151,7 +150,9 @@ public class LoginPacketHandler extends PacketHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleP2S(IPacket packet, List<ChannelFutureListener> listeners) throws GeneralSecurityException, ExecutionException, InterruptedException {
|
public boolean handleP2S(IPacket packet, List<ChannelFutureListener> listeners) throws GeneralSecurityException, ExecutionException, InterruptedException {
|
||||||
if (packet instanceof S2CLoginKeyPacket1_7 loginKeyPacket) {
|
if (packet instanceof S2CLoginDisconnectPacket1_7 loginDisconnectPacket) {
|
||||||
|
Logger.u_info("server kick", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), ConsoleFormatter.convert(loginDisconnectPacket.reason.asLegacyFormatString()));
|
||||||
|
} else if (packet instanceof S2CLoginKeyPacket1_7 loginKeyPacket) {
|
||||||
final PublicKey publicKey = CryptUtil.decodeRsaPublicKey(loginKeyPacket.publicKey);
|
final PublicKey publicKey = CryptUtil.decodeRsaPublicKey(loginKeyPacket.publicKey);
|
||||||
final SecretKey secretKey = CryptUtil.generateSecretKey();
|
final SecretKey secretKey = CryptUtil.generateSecretKey();
|
||||||
final String serverHash = new BigInteger(CryptUtil.computeServerIdHash(loginKeyPacket.serverId, publicKey, secretKey)).toString(16);
|
final String serverHash = new BigInteger(CryptUtil.computeServerIdHash(loginKeyPacket.serverId, publicKey, secretKey)).toString(16);
|
||||||
|
|
|
@ -27,6 +27,7 @@ import io.netty.buffer.ByteBufUtil;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.*;
|
import io.netty.channel.*;
|
||||||
import io.netty.util.AttributeKey;
|
import io.netty.util.AttributeKey;
|
||||||
|
import net.lenni0451.mcstructs.text.components.StringComponent;
|
||||||
import net.raphimc.netminecraft.constants.ConnectionState;
|
import net.raphimc.netminecraft.constants.ConnectionState;
|
||||||
import net.raphimc.netminecraft.constants.MCPackets;
|
import net.raphimc.netminecraft.constants.MCPackets;
|
||||||
import net.raphimc.netminecraft.constants.MCPipeline;
|
import net.raphimc.netminecraft.constants.MCPipeline;
|
||||||
|
@ -35,11 +36,12 @@ import net.raphimc.netminecraft.netty.crypto.AESEncryption;
|
||||||
import net.raphimc.netminecraft.packet.PacketTypes;
|
import net.raphimc.netminecraft.packet.PacketTypes;
|
||||||
import net.raphimc.netminecraft.packet.impl.login.C2SLoginHelloPacket1_7;
|
import net.raphimc.netminecraft.packet.impl.login.C2SLoginHelloPacket1_7;
|
||||||
import net.raphimc.netminecraft.packet.impl.login.S2CLoginCustomPayloadPacket;
|
import net.raphimc.netminecraft.packet.impl.login.S2CLoginCustomPayloadPacket;
|
||||||
import net.raphimc.netminecraft.packet.impl.login.S2CLoginDisconnectPacket;
|
import net.raphimc.netminecraft.packet.impl.login.S2CLoginDisconnectPacket1_20_3;
|
||||||
import net.raphimc.netminecraft.packet.impl.status.S2CStatusResponsePacket;
|
import net.raphimc.netminecraft.packet.impl.status.S2CStatusResponsePacket;
|
||||||
import net.raphimc.netminecraft.packet.registry.PacketRegistryUtil;
|
import net.raphimc.netminecraft.packet.registry.PacketRegistryUtil;
|
||||||
import net.raphimc.netminecraft.util.ServerAddress;
|
import net.raphimc.netminecraft.util.ServerAddress;
|
||||||
import net.raphimc.vialoader.util.VersionEnum;
|
import net.raphimc.vialoader.util.VersionEnum;
|
||||||
|
import net.raphimc.viaproxy.cli.ConsoleFormatter;
|
||||||
import net.raphimc.viaproxy.proxy.external_interface.OpenAuthModConstants;
|
import net.raphimc.viaproxy.proxy.external_interface.OpenAuthModConstants;
|
||||||
import net.raphimc.viaproxy.proxy.packethandler.PacketHandler;
|
import net.raphimc.viaproxy.proxy.packethandler.PacketHandler;
|
||||||
import net.raphimc.viaproxy.proxy.util.CloseAndReturn;
|
import net.raphimc.viaproxy.proxy.util.CloseAndReturn;
|
||||||
|
@ -247,7 +249,7 @@ public class ProxyConnection extends NetClient {
|
||||||
PacketTypes.writeString(disconnectPacketData, channel);
|
PacketTypes.writeString(disconnectPacketData, channel);
|
||||||
PacketTypes.writeVarInt(disconnectPacketData, id);
|
PacketTypes.writeVarInt(disconnectPacketData, id);
|
||||||
disconnectPacketData.writeBytes(data);
|
disconnectPacketData.writeBytes(data);
|
||||||
this.c2p.writeAndFlush(new S2CLoginDisconnectPacket(messageToJson("§cYou need to install OpenAuthMod in order to join this server.§k\n" + Base64.getEncoder().encodeToString(ByteBufUtil.getBytes(disconnectPacketData)) + "\n" + OpenAuthModConstants.LEGACY_MAGIC_STRING))).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
this.c2p.writeAndFlush(new S2CLoginDisconnectPacket1_20_3(new StringComponent("§cYou need to install OpenAuthMod in order to join this server.§k\n" + Base64.getEncoder().encodeToString(ByteBufUtil.getBytes(disconnectPacketData)) + "\n" + OpenAuthModConstants.LEGACY_MAGIC_STRING))).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PLAY:
|
case PLAY:
|
||||||
|
@ -275,13 +277,13 @@ public class ProxyConnection extends NetClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kickClient(final String message) throws CloseAndReturn {
|
public void kickClient(final String message) throws CloseAndReturn {
|
||||||
Logger.u_err("kick", this.c2p.remoteAddress(), this.getGameProfile(), message.replaceAll("§.", ""));
|
Logger.u_err("proxy kick", this.c2p.remoteAddress(), this.getGameProfile(), ConsoleFormatter.convert(message));
|
||||||
|
|
||||||
final ChannelFuture future;
|
final ChannelFuture future;
|
||||||
if (this.c2pConnectionState == ConnectionState.STATUS) {
|
if (this.c2pConnectionState == ConnectionState.STATUS) {
|
||||||
future = this.c2p.writeAndFlush(new S2CStatusResponsePacket("{\"players\":{\"max\":0,\"online\":0},\"description\":" + new JsonPrimitive(message) + ",\"version\":{\"protocol\":-1,\"name\":\"ViaProxy\"}}"));
|
future = this.c2p.writeAndFlush(new S2CStatusResponsePacket("{\"players\":{\"max\":0,\"online\":0},\"description\":" + new JsonPrimitive(message) + ",\"version\":{\"protocol\":-1,\"name\":\"ViaProxy\"}}"));
|
||||||
} else if (this.c2pConnectionState == ConnectionState.LOGIN) {
|
} else if (this.c2pConnectionState == ConnectionState.LOGIN) {
|
||||||
future = this.c2p.writeAndFlush(new S2CLoginDisconnectPacket(messageToJson(message)));
|
future = this.c2p.writeAndFlush(new S2CLoginDisconnectPacket1_20_3(new StringComponent(message)));
|
||||||
} else if (this.c2pConnectionState == ConnectionState.CONFIGURATION) {
|
} else if (this.c2pConnectionState == ConnectionState.CONFIGURATION) {
|
||||||
final ByteBuf disconnectPacket = Unpooled.buffer();
|
final ByteBuf disconnectPacket = Unpooled.buffer();
|
||||||
PacketTypes.writeVarInt(disconnectPacket, MCPackets.S2C_CONFIG_DISCONNECT.getId(this.clientVersion.getVersion()));
|
PacketTypes.writeVarInt(disconnectPacket, MCPackets.S2C_CONFIG_DISCONNECT.getId(this.clientVersion.getVersion()));
|
||||||
|
|
Loading…
Reference in a new issue