diff --git a/bungeecord/pom.xml b/bungeecord/pom.xml index 05ceb40..56d9523 100644 --- a/bungeecord/pom.xml +++ b/bungeecord/pom.xml @@ -7,7 +7,7 @@ GeyserSkinManager com.github.camotoy.geyserskinmanager - 1.7 + 1.8 bungeecord jar diff --git a/common/pom.xml b/common/pom.xml index b2af01f..49cab75 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ GeyserSkinManager com.github.camotoy.geyserskinmanager - 1.7 + 1.8 4.0.0 diff --git a/common/src/main/java/com/github/camotoy/geyserskinmanager/common/Constants.java b/common/src/main/java/com/github/camotoy/geyserskinmanager/common/Constants.java index 012c69f..7cb24f4 100644 --- a/common/src/main/java/com/github/camotoy/geyserskinmanager/common/Constants.java +++ b/common/src/main/java/com/github/camotoy/geyserskinmanager/common/Constants.java @@ -19,4 +19,9 @@ public final class Constants { * Used for future-proofing, in case the contents of a plugin message changes. */ public static final int SKIN_PLUGIN_MESSAGE_VERSION = 1; + + /** + * The Steve skin applied to Floodgate players with no skin. + */ + public static final String FLOODGATE_STEVE_SKIN = "ewogICJ0aW1lc3RhbXAiIDogMTcxNTcxNzM1NTI2MywKICAicHJvZmlsZUlkIiA6ICIyMWUzNjdkNzI1Y2Y0ZTNiYjI2OTJjNGEzMDBhNGRlYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJHZXlzZXJNQyIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zMWY0NzdlYjFhN2JlZWU2MzFjMmNhNjRkMDZmOGY2OGZhOTNhMzM4NmQwNDQ1MmFiMjdmNDNhY2RmMWI2MGNiIgogICAgfQogIH0KfQ"; } diff --git a/pom.xml b/pom.xml index 25b3f78..264f395 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.github.camotoy.geyserskinmanager GeyserSkinManager pom - 1.7 + 1.8 bungeecord common diff --git a/spigot/pom.xml b/spigot/pom.xml index 18e64b0..c7be837 100644 --- a/spigot/pom.xml +++ b/spigot/pom.xml @@ -7,7 +7,7 @@ GeyserSkinManager com.github.camotoy.geyserskinmanager - 1.7 + 1.8 GeyserSkinManager-Spigot diff --git a/spigot/src/main/java/com/github/camotoy/geyserskinmanager/spigot/listener/PaperEventListener.java b/spigot/src/main/java/com/github/camotoy/geyserskinmanager/spigot/listener/PaperEventListener.java index 17fc85c..28047a8 100644 --- a/spigot/src/main/java/com/github/camotoy/geyserskinmanager/spigot/listener/PaperEventListener.java +++ b/spigot/src/main/java/com/github/camotoy/geyserskinmanager/spigot/listener/PaperEventListener.java @@ -1,6 +1,8 @@ package com.github.camotoy.geyserskinmanager.spigot.listener; import com.destroystokyo.paper.profile.PlayerProfile; +import com.destroystokyo.paper.profile.ProfileProperty; +import com.github.camotoy.geyserskinmanager.common.Constants; import com.github.camotoy.geyserskinmanager.common.RawSkin; import com.github.camotoy.geyserskinmanager.spigot.GeyserSkinManager; import com.github.camotoy.geyserskinmanager.spigot.profile.MinecraftProfileWrapper; @@ -8,6 +10,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; +import java.util.Optional; + public class PaperEventListener extends SpigotPlatformEventListener { public PaperEventListener(GeyserSkinManager plugin, boolean showSkins) { super(plugin, showSkins); @@ -19,7 +23,7 @@ public void onPlayerJoin(PlayerJoinEvent event) { RawSkin skin = null; if (this.skinApplier != null) { PlayerProfile playerProfile = event.getPlayer().getPlayerProfile(); - if (!playerProfile.hasTextures()) { // Don't add new textures if the player already has some. This behavior may change in the future. + if (hasNoTextures(playerProfile)) { // Don't add new textures if the player already has some. This behavior may change in the future. skin = skinRetriever.getBedrockSkin(event.getPlayer().getUniqueId()); if (skin != null) { MinecraftProfileWrapper profile = new PaperProfileWrapper(playerProfile); @@ -35,4 +39,12 @@ public void onPlayerJoin(PlayerJoinEvent event) { modListener.onBedrockPlayerJoin(event.getPlayer(), skin); } } + + private boolean hasNoTextures(final PlayerProfile playerProfile) { + final Optional property = playerProfile.getProperties() + .stream() + .filter(aProperty -> aProperty.getName().equals("textures")) + .findFirst(); + return property.map(profileProperty -> Constants.FLOODGATE_STEVE_SKIN.equals(profileProperty.getValue())).orElse(true); + } } diff --git a/velocity/pom.xml b/velocity/pom.xml index fc867ef..b81c4fe 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -7,7 +7,7 @@ GeyserSkinManager com.github.camotoy.geyserskinmanager - 1.7 + 1.8 velocity jar diff --git a/velocity/src/main/java/com/github/camotoy/geyserskinmanager/velocity/VelocitySkinEventListener.java b/velocity/src/main/java/com/github/camotoy/geyserskinmanager/velocity/VelocitySkinEventListener.java index 3e385db..f598508 100644 --- a/velocity/src/main/java/com/github/camotoy/geyserskinmanager/velocity/VelocitySkinEventListener.java +++ b/velocity/src/main/java/com/github/camotoy/geyserskinmanager/velocity/VelocitySkinEventListener.java @@ -1,5 +1,6 @@ package com.github.camotoy.geyserskinmanager.velocity; +import com.github.camotoy.geyserskinmanager.common.Constants; import com.github.camotoy.geyserskinmanager.common.RawSkin; import com.github.camotoy.geyserskinmanager.common.SkinEntry; import com.github.camotoy.geyserskinmanager.common.platform.ProxyPluginMessageSend; @@ -37,7 +38,7 @@ public void onServerConnected(ServerPostConnectEvent event) { boolean shouldApply = true; if (showSkins) { for (GameProfile.Property property : event.getPlayer().getGameProfileProperties()) { - if (property.getName().equals("textures") && !property.getValue().isEmpty()) { + if (property.getName().equals("textures") && (!property.getValue().isEmpty() && !property.getValue().equals(Constants.FLOODGATE_STEVE_SKIN))) { // Don't overwrite existing textures shouldApply = false; break;