diff --git a/SpooklyCorePlugin/src/main/java/de/spookly/manager/NametagManager.java b/SpooklyCorePlugin/src/main/java/de/spookly/manager/NametagManager.java index a6a38dc..f058120 100644 --- a/SpooklyCorePlugin/src/main/java/de/spookly/manager/NametagManager.java +++ b/SpooklyCorePlugin/src/main/java/de/spookly/manager/NametagManager.java @@ -13,14 +13,18 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.scoreboard.ScoreboardManager; import org.bukkit.scoreboard.Team; public class NametagManager { public NametagManager() { - Spookly.getServer().getEventExecuter().register(PlayerRegisterEvent.class, event -> { - refreshNameTag(event.getSpooklyPlayer()); + Spookly.getServer().getEventExecuter().register(PlayerJoinEvent.class, event -> { + SpooklyPlayer spPlayer = Spookly.getPlayer(event.getPlayer().getUniqueId()); + if (spPlayer != null) { + refreshNameTag(spPlayer); + } }); } diff --git a/build.gradle b/build.gradle index 52672ce..2b05c1a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,10 @@ plugins { id 'java' id 'java-library' - id("io.freefair.lombok") version "8.6" + id "io.freefair.lombok" version "8.6" // Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev id "com.diffplug.spotless" version "6.20.0" - id("io.papermc.paperweight.userdev") version "1.7.1" + id "io.papermc.paperweight.userdev" version "1.7.1" id 'com.github.johnrengelman.shadow' version '8.1.1' id 'maven-publish' }