From c458bd383a9517b19914aaeb7b75e36ed72d121f Mon Sep 17 00:00:00 2001 From: juanmuscaria Date: Fri, 17 Sep 2021 10:00:45 -0300 Subject: [PATCH] Only remove the texture property from the player profile if forwardSkin is disabled --- .../velocity/listener/ConnectListener.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java index 76742e4f..73f73963 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java @@ -42,8 +42,10 @@ import com.velocitypowered.api.event.player.ServerConnectedEvent; import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.server.RegisteredServer; +import com.velocitypowered.api.util.GameProfile; import java.util.ArrayList; +import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -95,12 +97,20 @@ public class ConnectListener { } if (!plugin.getCore().getConfig().get("forwardSkin", true)) { - //FIXME: Do I need to remove *all* properties or only the skin related ones? - event.setGameProfile(event.getGameProfile().withProperties(new ArrayList<>())); + event.setGameProfile(event.getGameProfile().withProperties(removeSkin(event.getGameProfile().getProperties()))); } } } + private List removeSkin(List oldProperties) { + List newProperties = new ArrayList<>(oldProperties.size() - 1); + for (GameProfile.Property property : oldProperties) { + if (!property.getName().equals("textures")) + newProperties.add(property); + } + return newProperties; + } + @Subscribe public void onServerConnected(ServerConnectedEvent serverConnectedEvent) { Player player = serverConnectedEvent.getPlayer();