mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
SkinApplier now only applies a skin if a player doesn't already have one (#330)
* SkinApplier now only applies a skin if a player doesn't already have one * add `hasSkin` method to SkinApplier and check for exising skins before overwriting * remove the use of Streams and Optionals * correct delay in SpigotSkinApplier to use ticks instead of milliseconds * Minor changes Co-authored-by: Tim203 <mctim203@gmail.com>
This commit is contained in:
@@ -25,10 +25,12 @@
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.util.GameProfile.Property;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.skin.SkinApplier;
|
||||
@@ -46,4 +48,20 @@ public class VelocitySkinApplier implements SkinApplier {
|
||||
player.setGameProfileProperties(properties);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSkin(FloodgatePlayer floodgatePlayer) {
|
||||
Optional<Player> player = server.getPlayer(floodgatePlayer.getCorrectUniqueId());
|
||||
|
||||
if (player.isPresent()) {
|
||||
for (Property property : player.get().getGameProfileProperties()) {
|
||||
if (property.getName().equals("textures")) {
|
||||
if (!property.getValue().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user