From 12339e7447bed9ca9ad650b7417ad213558a7dec Mon Sep 17 00:00:00 2001 From: NotCoded <66999075+not-coded@users.noreply.github.com> Date: Sat, 3 Aug 2024 23:55:56 +0200 Subject: [PATCH] fallback to duel world if no winner location --- .../nexia/core/listeners/nexus/PlayerRespawnListener.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nexia/core/listeners/nexus/PlayerRespawnListener.java b/src/main/java/com/nexia/core/listeners/nexus/PlayerRespawnListener.java index f316fbb2..92d67f49 100644 --- a/src/main/java/com/nexia/core/listeners/nexus/PlayerRespawnListener.java +++ b/src/main/java/com/nexia/core/listeners/nexus/PlayerRespawnListener.java @@ -60,8 +60,14 @@ public void registerListener() { player.getInventory().clear(); LobbyUtil.giveItems(player); + Location respawn = new Location(0,80, 0, WorldUtil.getWorld(duelsGame.level)); + + if(duelsGame.winner != null) { + respawn = duelsGame.winner.getLocation(); + } + respawnEvent.setRespawnMode(Minecraft.GameMode.SPECTATOR); - respawnEvent.setSpawnpoint(duelsGame.winner.getLocation()); + respawnEvent.setSpawnpoint(respawn); } else if(teamDuelsGame != null && duelsData.duelOptions.duelsTeam != null) { player.getInventory().clear(); LobbyUtil.giveItems(player);