Initial client connection pipeline, this isn't done yet.
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
package io.minimum.minecraft.velocity.proxy;
|
||||
|
||||
import io.minimum.minecraft.velocity.proxy.server.ServerConnection;
|
||||
import io.minimum.minecraft.velocity.protocol.packets.Disconnect;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
import net.kyori.text.serializer.ComponentSerializers;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -31,4 +34,17 @@ public class ConnectedPlayer {
|
||||
public ServerConnection getConnectedServer() {
|
||||
return connectedServer;
|
||||
}
|
||||
|
||||
public void handleConnectionException(Throwable throwable) {
|
||||
String error = "Exception: " + throwable.getClass().getName() + ": " + throwable.getMessage();
|
||||
|
||||
if (connectedServer == null) {
|
||||
// The player isn't yet connected to a server - we should disconnect them.
|
||||
Disconnect disconnect = new Disconnect();
|
||||
disconnect.setReason(ComponentSerializers.JSON.serialize(TextComponent.of(error, TextColor.RED)));
|
||||
connection.closeWith(disconnect);
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user