Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Don't try and perform the auth flow if the floodgate player is null #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.geysermc.floodgate.addon.data;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.logging.LogUtils;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.AttributeKey;
import net.minecraft.DefaultUncaughtExceptionHandler;
import net.minecraft.network.Connection;
Expand All @@ -12,12 +14,10 @@
import net.minecraft.server.network.ServerLoginPacketListenerImpl;
import org.geysermc.floodgate.MinecraftServerHolder;
import org.geysermc.floodgate.api.logger.FloodgateLogger;
import org.geysermc.floodgate.mixin.ConnectionMixin;
import org.geysermc.floodgate.mixin.ClientIntentionPacketMixinInterface;
import com.mojang.authlib.GameProfile;
import io.netty.channel.ChannelHandlerContext;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
import org.geysermc.floodgate.config.FloodgateConfig;
import org.geysermc.floodgate.mixin.ClientIntentionPacketMixinInterface;
import org.geysermc.floodgate.mixin.ConnectionMixin;
import org.geysermc.floodgate.player.FloodgateHandshakeHandler;
import org.geysermc.floodgate.player.FloodgateHandshakeHandler.HandshakeResult;
import org.slf4j.Logger;
Expand Down Expand Up @@ -86,6 +86,11 @@ protected boolean channelRead(Object packet) {

private boolean checkAndHandleLogin(Object packet) {
if (packet instanceof ServerboundHelloPacket) {
// Can occur if channelRead() is called even after we determine it is not a floodgate player
if (player == null) {
return false;
}

String kickMessage = getKickMessage();
if (kickMessage != null) {
networkManager.disconnect(Component.nullToEmpty(kickMessage));
Expand Down