diff --git a/src/main/java/dev/array21/respawn/listeners/PlayerRespawnEventListener.java b/src/main/java/dev/array21/respawn/listeners/PlayerRespawnEventListener.java index 3896eb8..af3144d 100644 --- a/src/main/java/dev/array21/respawn/listeners/PlayerRespawnEventListener.java +++ b/src/main/java/dev/array21/respawn/listeners/PlayerRespawnEventListener.java @@ -6,6 +6,7 @@ import org.bukkit.Location; import org.bukkit.World; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.scheduler.BukkitRunnable; @@ -20,8 +21,12 @@ public PlayerRespawnEventListener(ReSpawn module) { this.module = module; } - @EventHandler - public void onPlayerRespawnEvent(PlayerRespawnEvent event) { + @EventHandler(priority = EventPriority.HIGH) + public void onPlayerRespawnEvent(PlayerRespawnEvent event) { + if(event.getPlayer().getBedSpawnLocation() == null) { + return; + } + String spawnPos = (String) this.module.getModuleFileHandler().getModuleConfiguration().getValue("spawnPos"); if(spawnPos == null) { return;