diff --git a/src/net/spoothie/chairs/Chairs.java b/src/net/spoothie/chairs/Chairs.java index 6283027..09093fc 100644 --- a/src/net/spoothie/chairs/Chairs.java +++ b/src/net/spoothie/chairs/Chairs.java @@ -15,6 +15,7 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.Plugin; @@ -74,6 +75,13 @@ public class Chairs extends JavaPlugin { @Override public void onDisable() { + for (String pName : sit.keySet()) { + Player player = getServer().getPlayer(pName); + Location loc = player.getLocation().clone(); + loc.setY(loc.getY() + 1); + player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN); + + } if (ignoreList != null) { ignoreList.save(); } diff --git a/src/net/spoothie/chairs/EventListener.java b/src/net/spoothie/chairs/EventListener.java index 40cc9f9..b699077 100644 --- a/src/net/spoothie/chairs/EventListener.java +++ b/src/net/spoothie/chairs/EventListener.java @@ -20,6 +20,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.material.Stairs; import org.bukkit.material.Step; import org.bukkit.permissions.Permission; @@ -73,9 +74,12 @@ public class EventListener implements Listener { @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - String pName = event.getPlayer().getName(); - if (plugin.sit.containsKey(pName)) { - plugin.sit.remove(pName); + Player player = event.getPlayer(); + if (plugin.sit.containsKey(player.getName())) { + plugin.sendStand(player); + Location loc = player.getLocation().clone(); + loc.setY(loc.getY() + 1); + player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN); } } diff --git a/src/plugin.yml b/src/plugin.yml index 237f6c0..dc524f7 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,5 +1,5 @@ name: Chairs -version: 2.0.0 +version: 2.0.1 description: Let players sit on blocks. authors: - spoothie