diff --git a/src/com/cnaude/chairs/core/PlayerSitData.java b/src/com/cnaude/chairs/core/PlayerSitData.java index 2189b12..3092ddc 100644 --- a/src/com/cnaude/chairs/core/PlayerSitData.java +++ b/src/com/cnaude/chairs/core/PlayerSitData.java @@ -32,19 +32,18 @@ public class PlayerSitData { return Bukkit.getPlayerExact(sitblock.get(chair)); } - public void sitPlayer(Player player, Location sitlocation) { + public void sitPlayer(Player player, Block blocktooccupy, Location sitlocation) { try { if (plugin.notifyplayer) { player.sendMessage(plugin.msgSitting); } - Block block = sitlocation.getBlock(); sitstopteleportloc.put(player.getName(), player.getLocation()); player.teleport(sitlocation); - Location arrowloc = block.getLocation().add(0.5, 0 , 0.5); + Location arrowloc = sitlocation.getBlock().getLocation().add(0.5, 0 , 0.5); Entity arrow = plugin.getNMSAccess().spawnArrow(arrowloc); arrow.setPassenger(player); sit.put(player.getName(), arrow); - sitblock.put(block, player.getName()); + sitblock.put(blocktooccupy, player.getName()); startReSitTask(player); } catch (Exception e) { e.printStackTrace(); diff --git a/src/com/cnaude/chairs/listeners/TrySitEventListener.java b/src/com/cnaude/chairs/listeners/TrySitEventListener.java index f0714a3..abeacbc 100644 --- a/src/com/cnaude/chairs/listeners/TrySitEventListener.java +++ b/src/com/cnaude/chairs/listeners/TrySitEventListener.java @@ -39,7 +39,7 @@ public class TrySitEventListener implements Listener { if (sitAllowed(player, block)) { event.setCancelled(true); Location sitLocation = getSitLocation(block, player.getLocation().getYaw()); - plugin.getPlayerSitData().sitPlayer(player, sitLocation); + plugin.getPlayerSitData().sitPlayer(player, block, sitLocation); } } }