From aa26c6626abf2bef22d68fe5c1df8b1c58f7bf0f Mon Sep 17 00:00:00 2001 From: Shevchik Date: Sat, 14 Dec 2013 21:45:04 +0400 Subject: [PATCH] Properly eject player Actually i don't know why it works like that --- src/com/cnaude/chairs/Chairs.java | 9 ++------- src/com/cnaude/chairs/EventListener.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index 8565e35..540a70e 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -189,13 +189,8 @@ public class Chairs extends JavaPlugin { final Entity arrow = sit.get(player.getName()); sit.remove(player.getName()); player.eject(); - Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() - { - public void run() - { - arrow.remove(); - } - },20); + player.eject(); + arrow.remove(); final Location tploc = sitstopteleportloc.get(player.getName()); if (tploc != null && !ignoretp) { diff --git a/src/com/cnaude/chairs/EventListener.java b/src/com/cnaude/chairs/EventListener.java index 43a9f89..950ad6d 100644 --- a/src/com/cnaude/chairs/EventListener.java +++ b/src/com/cnaude/chairs/EventListener.java @@ -45,11 +45,17 @@ public class EventListener implements Listener { { if (e.getVehicle().getPassenger() instanceof Player) { - Player player = (Player) e.getVehicle().getPassenger(); + final Player player = (Player) e.getVehicle().getPassenger(); if (plugin.sit.containsKey(player.getName())) { e.setCancelled(true); - plugin.unSitPlayer(player, false); + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() + { + public void run() + { + plugin.unSitPlayer(player, false); + } + }); } } }