diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 5caffc82..93de0a08 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -41,6 +41,10 @@ com.google.gson fastlogin.gson + + io.papermc.lib + fastlogin.paperlib + @@ -56,14 +60,10 @@ - + - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - false - + papermc + https://papermc.io/repo/repository/maven-public/ @@ -108,14 +108,22 @@ ${project.version} - + - org.spigotmc - spigot-api + com.destroystokyo.paper + paper-api 1.15.2-R0.1-SNAPSHOT provided + + + io.papermc + paperlib + 1.0.6 + compile + + com.comphenix.protocol diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java index 03943e2b..eacfdfed 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java @@ -3,6 +3,7 @@ package com.github.games647.fastlogin.bukkit; import com.github.games647.fastlogin.bukkit.command.CrackedCommand; import com.github.games647.fastlogin.bukkit.command.PremiumCommand; import com.github.games647.fastlogin.bukkit.listener.ConnectionListener; +import com.github.games647.fastlogin.bukkit.listener.PaperPreLoginListener; import com.github.games647.fastlogin.bukkit.listener.protocollib.ProtocolLibListener; import com.github.games647.fastlogin.bukkit.listener.protocollib.SkinApplyListener; import com.github.games647.fastlogin.bukkit.listener.protocolsupport.ProtocolSupportListener; @@ -11,6 +12,12 @@ import com.github.games647.fastlogin.core.CommonUtil; import com.github.games647.fastlogin.core.PremiumStatus; import com.github.games647.fastlogin.core.shared.FastLoginCore; import com.github.games647.fastlogin.core.shared.PlatformPlugin; +import io.papermc.lib.PaperLib; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; +import org.slf4j.Logger; import java.net.InetSocketAddress; import java.nio.file.Path; @@ -19,12 +26,6 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.java.JavaPlugin; -import org.slf4j.Logger; - /** * This plugin checks if a player has a paid account and if so tries to skip offline mode authentication. */ @@ -75,7 +76,11 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin event.getPlayerProfile().setProperty(new ProfileProperty(Textures.KEY, + skin.getValue(), skin.getSignature()))); + break; + } + } + +} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java index 5f1df7d9..fedaa357 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java @@ -9,9 +9,6 @@ import com.comphenix.protocol.wrappers.WrappedSignedProperty; import com.github.games647.craftapi.model.skin.Textures; import com.github.games647.fastlogin.bukkit.BukkitLoginSession; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; - -import java.lang.reflect.InvocationTargetException; - import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -19,6 +16,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; +import java.lang.reflect.InvocationTargetException; + public class SkinApplyListener implements Listener { private static final Class GAME_PROFILE = MinecraftReflection.getGameProfileClass(); @@ -39,14 +38,12 @@ public class SkinApplyListener implements Listener { Player player = loginEvent.getPlayer(); - if (plugin.getConfig().getBoolean("forwardSkin")) { - //go through every session, because player.getAddress is null - //loginEvent.getAddress is just a InetAddress not InetSocketAddress, so not unique enough - for (BukkitLoginSession session : plugin.getLoginSessions().values()) { - if (session.getUsername().equals(player.getName())) { - session.getSkin().ifPresent(skin -> applySkin(player, skin.getValue(), skin.getSignature())); - break; - } + //go through every session, because player.getAddress is null + //loginEvent.getAddress is just a InetAddress not InetSocketAddress, so not unique enough + for (BukkitLoginSession session : plugin.getLoginSessions().values()) { + if (session.getUsername().equals(player.getName())) { + session.getSkin().ifPresent(skin -> applySkin(player, skin.getValue(), skin.getSignature())); + break; } } } diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index 6253ff98..1afd90a8 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -127,6 +127,9 @@ nameChangeCheck: false # the skin data is included in the Auth-Verification-Response sent by Mojang. If you want to use for other # players like cracked player, you have to use other plugins. # +# If you use PaperSpigot - FastLogin will always try to set the skin, even if forwardSkin is set to false +# It is needed to allow premium name change to work correctly +# # If you want to use skins for your cracked player, you need an additional plugin like # ChangeSkin, SkinRestorer, ... forwardSkin: true