diff --git a/DungeonsXL/src/com/dre/dungeonsxl/listener/PlayerListener.java b/DungeonsXL/src/com/dre/dungeonsxl/listener/PlayerListener.java index a5d350d7..04b6b6cb 100644 --- a/DungeonsXL/src/com/dre/dungeonsxl/listener/PlayerListener.java +++ b/DungeonsXL/src/com/dre/dungeonsxl/listener/PlayerListener.java @@ -199,17 +199,26 @@ public class PlayerListener implements Listener{ DGroup dgroup=DGroup.get(dplayer.player); if(dplayer.checkpoint==null){ event.setRespawnLocation(dgroup.gworld.locStart); + + //Da einige Plugins einen anderen Respawn setzen wird ein Scheduler gestartet der den Player nach einer Sekunde teleportiert. + p.getServer().getScheduler().scheduleSyncDelayedTask(p, new RespawnRunnable(player,dgroup.gworld.locStart), 20); + if(dplayer.wolf!=null){ dplayer.wolf.teleport(dgroup.gworld.locStart); } }else{ event.setRespawnLocation(dplayer.checkpoint.location); + + //Da einige Plugins einen anderen Respawn setzen wird ein Scheduler gestartet der den Player nach einer Sekunde teleportiert. + p.getServer().getScheduler().scheduleSyncDelayedTask(p, new RespawnRunnable(player,dplayer.checkpoint.location), 20); + if(dplayer.wolf!=null){ dplayer.wolf.teleport(dplayer.checkpoint.location); } } + //Respawn Items for(ItemStack istack:dplayer.respawnInventory){ if(istack!=null){ @@ -218,13 +227,6 @@ public class PlayerListener implements Listener{ } dplayer.respawnInventory.clear(); DungeonsXL.p.updateInventory(dplayer.player); - - /*if(gworld.locLobby==null){ - event.setRespawnLocation(gworld.world.getSpawnLocation()); - }else{ - event.setRespawnLocation(gworld.locLobby); - } - dplayer.isReady=false;*/ } } } @@ -334,4 +336,26 @@ public class PlayerListener implements Listener{ public void onInventoryOpen(InventoryOpenEvent event){ GameChest.onOpenInventory(event); } + + + + //Etc. --------------------------------- + + public class RespawnRunnable implements Runnable{ + private Player player; + private Location location; + + public RespawnRunnable(Player player, Location location){ + this.location = location; + this.player = player; + } + + @Override + public void run() { + this.player.teleport(this.location); + } + + } + + }