Search in sources :

Example 1 with Property

use of com.velocitypowered.api.util.GameProfile.Property in project Floodgate by GeyserMC.

the class VelocityListener method onGameProfileRequest.

@Subscribe(order = PostOrder.EARLY)
public void onGameProfileRequest(GameProfileRequestEvent event) {
    FloodgatePlayer player = playerCache.getIfPresent(event.getConnection());
    if (player != null) {
        playerCache.invalidate(event.getConnection());
        // The texture properties addition is to fix the February 2 2022 Mojang authentication changes
        event.setGameProfile(new GameProfile(player.getCorrectUniqueId(), player.getCorrectUsername(), Collections.singletonList(new Property("textures", "", ""))));
    }
}
Also used : FloodgatePlayer(org.geysermc.floodgate.api.player.FloodgatePlayer) GameProfile(com.velocitypowered.api.util.GameProfile) Property(com.velocitypowered.api.util.GameProfile.Property) Subscribe(com.velocitypowered.api.event.Subscribe)

Example 2 with Property

use of com.velocitypowered.api.util.GameProfile.Property in project Floodgate by GeyserMC.

the class VelocitySkinApplier method applySkin.

@Override
public void applySkin(FloodgatePlayer floodgatePlayer, SkinData skinData) {
    server.getPlayer(floodgatePlayer.getCorrectUniqueId()).ifPresent(player -> {
        List<Property> properties = new ArrayList<>(player.getGameProfileProperties());
        properties.add(new Property("textures", skinData.getValue(), skinData.getSignature()));
        player.setGameProfileProperties(properties);
    });
}
Also used : ArrayList(java.util.ArrayList) Property(com.velocitypowered.api.util.GameProfile.Property)

Aggregations

Property (com.velocitypowered.api.util.GameProfile.Property)2 Subscribe (com.velocitypowered.api.event.Subscribe)1 GameProfile (com.velocitypowered.api.util.GameProfile)1 ArrayList (java.util.ArrayList)1 FloodgatePlayer (org.geysermc.floodgate.api.player.FloodgatePlayer)1