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));
|
return Bukkit.getPlayerExact(sitblock.get(chair));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sitPlayer(Player player, Location sitlocation) {
|
public void sitPlayer(Player player, Block blocktooccupy, Location sitlocation) {
|
||||||
try {
|
try {
|
||||||
if (plugin.notifyplayer) {
|
if (plugin.notifyplayer) {
|
||||||
player.sendMessage(plugin.msgSitting);
|
player.sendMessage(plugin.msgSitting);
|
||||||
}
|
}
|
||||||
Block block = sitlocation.getBlock();
|
|
||||||
sitstopteleportloc.put(player.getName(), player.getLocation());
|
sitstopteleportloc.put(player.getName(), player.getLocation());
|
||||||
player.teleport(sitlocation);
|
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);
|
Entity arrow = plugin.getNMSAccess().spawnArrow(arrowloc);
|
||||||
arrow.setPassenger(player);
|
arrow.setPassenger(player);
|
||||||
sit.put(player.getName(), arrow);
|
sit.put(player.getName(), arrow);
|
||||||
sitblock.put(block, player.getName());
|
sitblock.put(blocktooccupy, player.getName());
|
||||||
startReSitTask(player);
|
startReSitTask(player);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -39,7 +39,7 @@ public class TrySitEventListener implements Listener {
|
|||||||
if (sitAllowed(player, block)) {
|
if (sitAllowed(player, block)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Location sitLocation = getSitLocation(block, player.getLocation().getYaw());
|
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