From 32e28b169542534907fdb25c3ecaefadd7a9baf3 Mon Sep 17 00:00:00 2001 From: Shevchik Date: Fri, 6 Sep 2013 03:34:01 +0400 Subject: [PATCH] Restore player unsit locations after plugin reload --- src/com/cnaude/chairs/Chairs.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index ab060ea..a47dc22 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -69,6 +69,21 @@ public class Chairs extends JavaPlugin { } protocolManager = ProtocolLibrary.getProtocolManager(); new PacketListener(protocolManager, this); + for (final Player player : Bukkit.getOnlinePlayers()) + { + final Location loc = getPlayerSitstoploc(player.getName()); + if (loc != null) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() + { + public void run() + { + player.teleport(loc); + player.setSneaking(false); + } + },1); + } + } } @Override