diff --git a/src/com/dre/managerxl/listeners/PlayerListener.java b/src/com/dre/managerxl/listeners/PlayerListener.java index 397a179..739f958 100644 --- a/src/com/dre/managerxl/listeners/PlayerListener.java +++ b/src/com/dre/managerxl/listeners/PlayerListener.java @@ -16,6 +16,7 @@ import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; import com.dre.managerxl.MPlayer; import com.dre.managerxl.P; @@ -73,6 +74,15 @@ public void onPlayerQuit(PlayerQuitEvent event) { player.setOnline(false); } + + @EventHandler() + public void onPlayerRespawn(PlayerRespawnEvent event) { + MPlayer player = MPlayer.getOrCreate(event.getPlayer().getName()); + + if(player.getHome()!=null){ + event.setRespawnLocation(player.getHome()); + } + } @EventHandler() public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {