Fix issue with players falling through the ground after logout.
This commit is contained in:
parent
4144e06170
commit
d97c1adaf0
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: Chairs
|
||||
version: 2.0.0
|
||||
version: 2.0.1
|
||||
description: Let players sit on blocks.
|
||||
authors:
|
||||
- spoothie
|
||||
|
Loading…
Reference in New Issue
Block a user