Pass proper block as occupied block
This commit is contained in:
parent
15b3a5a4bd
commit
613f1e7b41
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user