1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Fix Velocity with Mojang authentication change

This commit is contained in:
Camotoy
2022-02-02 13:10:47 -05:00
parent 4537fea569
commit aa0a8405c2

View File

@@ -44,6 +44,7 @@ import com.velocitypowered.api.event.connection.PreLoginEvent;
import com.velocitypowered.api.event.player.GameProfileRequestEvent; import com.velocitypowered.api.event.player.GameProfileRequestEvent;
import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.InboundConnection;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.api.util.GameProfile.Property;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.util.AttributeKey; import io.netty.util.AttributeKey;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@@ -141,8 +142,11 @@ public final class VelocityListener {
FloodgatePlayer player = playerCache.getIfPresent(event.getConnection()); FloodgatePlayer player = playerCache.getIfPresent(event.getConnection());
if (player != null) { if (player != null) {
playerCache.invalidate(event.getConnection()); playerCache.invalidate(event.getConnection());
event.setGameProfile(new GameProfile( GameProfile profile = new GameProfile(
player.getCorrectUniqueId(), player.getCorrectUsername(), new ArrayList<>())); player.getCorrectUniqueId(), player.getCorrectUsername(), new ArrayList<>());
// To fix the February 2 2022 Mojang authentication changes
profile.addProperty(new Property("textures", "", ""));
event.setGameProfile(profile);
} }
} }