mirror of https://github.com/GeyserMC/Geyser.git
Compare commits
3 Commits
84963ded9c
...
af7b02524f
Author | SHA1 | Date |
---|---|---|
chris | af7b02524f | |
AJ Ferguson | b8fe71a8bc | |
onebeastchris | f16084fc2e |
|
@ -46,13 +46,35 @@ public final class ConnectionRequestEvent implements Event, Cancellable {
|
||||||
this.proxyIp = proxyIp;
|
this.proxyIp = proxyIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The IP address of the client attempting to connect
|
||||||
|
*
|
||||||
|
* @return the IP address of the client attempting to connect
|
||||||
|
* @deprecated Use {@link #inetSocketAddress()} instead
|
||||||
|
*/
|
||||||
|
@NonNull @Deprecated
|
||||||
|
public InetSocketAddress getInetSocketAddress() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The IP address of the proxy handling the connection. It will return null if there is no proxy.
|
||||||
|
*
|
||||||
|
* @return the IP address of the proxy handling the connection
|
||||||
|
* @deprecated Use {@link #proxyIp()} instead
|
||||||
|
*/
|
||||||
|
@Nullable @Deprecated
|
||||||
|
public InetSocketAddress getProxyIp() {
|
||||||
|
return proxyIp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The IP address of the client attempting to connect
|
* The IP address of the client attempting to connect
|
||||||
*
|
*
|
||||||
* @return the IP address of the client attempting to connect
|
* @return the IP address of the client attempting to connect
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public InetSocketAddress getInetSocketAddress() {
|
public InetSocketAddress inetSocketAddress() {
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +84,7 @@ public final class ConnectionRequestEvent implements Event, Cancellable {
|
||||||
* @return the IP address of the proxy handling the connection
|
* @return the IP address of the proxy handling the connection
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public InetSocketAddress getProxyIp() {
|
public InetSocketAddress proxyIp() {
|
||||||
return proxyIp;
|
return proxyIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,8 @@
|
||||||
|
|
||||||
package org.geysermc.geyser.network;
|
package org.geysermc.geyser.network;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
|
||||||
import io.netty.channel.DefaultEventLoopGroup;
|
import io.netty.channel.DefaultEventLoopGroup;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
|
||||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.cloudburstmc.protocol.bedrock.BedrockPeer;
|
import org.cloudburstmc.protocol.bedrock.BedrockPeer;
|
||||||
|
@ -37,7 +34,6 @@ import org.cloudburstmc.protocol.bedrock.BedrockServerSession;
|
||||||
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
|
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
|
||||||
import org.cloudburstmc.protocol.bedrock.netty.initializer.BedrockServerInitializer;
|
import org.cloudburstmc.protocol.bedrock.netty.initializer.BedrockServerInitializer;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.api.event.bedrock.SessionInitializeEvent;
|
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
@ -72,7 +68,6 @@ public class GeyserServerInitializer extends BedrockServerInitializer {
|
||||||
channel.pipeline().addAfter(BedrockPacketCodec.NAME, InvalidPacketHandler.NAME, new InvalidPacketHandler(session));
|
channel.pipeline().addAfter(BedrockPacketCodec.NAME, InvalidPacketHandler.NAME, new InvalidPacketHandler(session));
|
||||||
|
|
||||||
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(this.geyser, session));
|
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(this.geyser, session));
|
||||||
this.geyser.eventBus().fire(new SessionInitializeEvent(session));
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Error must be caught or it will be swallowed
|
// Error must be caught or it will be swallowed
|
||||||
this.geyser.getLogger().error("Error occurred while initializing player!", e);
|
this.geyser.getLogger().error("Error occurred while initializing player!", e);
|
||||||
|
|
|
@ -1077,9 +1077,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
loggedIn = false;
|
loggedIn = false;
|
||||||
|
|
||||||
// Fire SessionDisconnectEvent
|
|
||||||
SessionDisconnectEvent disconnectEvent = new SessionDisconnectEvent(this, reason);
|
SessionDisconnectEvent disconnectEvent = new SessionDisconnectEvent(this, reason);
|
||||||
geyser.getEventBus().fire(disconnectEvent);
|
if (authData != null && clientData != null) {
|
||||||
|
// Fire SessionDisconnectEvent
|
||||||
|
geyser.getEventBus().fire(disconnectEvent);
|
||||||
|
}
|
||||||
|
|
||||||
// Disconnect downstream if necessary
|
// Disconnect downstream if necessary
|
||||||
if (downstream != null) {
|
if (downstream != null) {
|
||||||
|
@ -1404,7 +1406,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
return null;
|
return this.isLoggedIn() ? this.javaUsername() : this.bedrockUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1941,12 +1943,12 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @MonotonicNonNull String javaUsername() {
|
public @MonotonicNonNull String javaUsername() {
|
||||||
return playerEntity.getUsername();
|
return playerEntity != null ? playerEntity.getUsername() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID javaUuid() {
|
public UUID javaUuid() {
|
||||||
return playerEntity.getUuid();
|
return playerEntity != null ? playerEntity.getUuid() : null ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.geysermc.cumulus.response.SimpleFormResponse;
|
||||||
import org.geysermc.cumulus.response.result.FormResponseResult;
|
import org.geysermc.cumulus.response.result.FormResponseResult;
|
||||||
import org.geysermc.cumulus.response.result.ValidFormResponseResult;
|
import org.geysermc.cumulus.response.result.ValidFormResponseResult;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
import org.geysermc.geyser.api.event.bedrock.SessionInitializeEvent;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.session.auth.AuthData;
|
import org.geysermc.geyser.session.auth.AuthData;
|
||||||
import org.geysermc.geyser.session.auth.BedrockClientData;
|
import org.geysermc.geyser.session.auth.BedrockClientData;
|
||||||
|
@ -100,6 +101,9 @@ public class LoginEncryptionUtils {
|
||||||
|
|
||||||
sendEncryptionFailedMessage(geyser);
|
sendEncryptionFailedMessage(geyser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fire SessionInitializeEvent here as we now know the client data etc
|
||||||
|
geyser.eventBus().fire(new SessionInitializeEvent(session));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
session.disconnect("disconnectionScreen.internalError.cantConnect");
|
session.disconnect("disconnectionScreen.internalError.cantConnect");
|
||||||
throw new RuntimeException("Unable to complete login", ex);
|
throw new RuntimeException("Unable to complete login", ex);
|
||||||
|
|
|
@ -15,7 +15,7 @@ protocol-connection = "3.0.0.Beta1-20240411.165033-128"
|
||||||
raknet = "1.0.0.CR3-20240416.144209-1"
|
raknet = "1.0.0.CR3-20240416.144209-1"
|
||||||
blockstateupdater="1.20.80-20240411.142413-1"
|
blockstateupdater="1.20.80-20240411.142413-1"
|
||||||
mcauthlib = "d9d773e"
|
mcauthlib = "d9d773e"
|
||||||
mcprotocollib = "9b96ebda" # Revert from jitpack after release
|
mcprotocollib = "c1786e2" # Revert from jitpack after release
|
||||||
adventure = "4.14.0"
|
adventure = "4.14.0"
|
||||||
adventure-platform = "4.3.0"
|
adventure-platform = "4.3.0"
|
||||||
junit = "5.9.2"
|
junit = "5.9.2"
|
||||||
|
|
Loading…
Reference in New Issue