Teleport player to location where he was before sitting when he unsits.
This commit is contained in:
parent
c110202161
commit
b0f874fd26
@ -117,9 +117,20 @@ public class Chairs extends JavaPlugin {
|
|||||||
protected HashMap<Block, String> sitblock = new HashMap<Block, String>();
|
protected HashMap<Block, String> sitblock = new HashMap<Block, String>();
|
||||||
protected HashMap<String, Block> sitblockbr = new HashMap<String, Block>();
|
protected HashMap<String, Block> sitblockbr = new HashMap<String, Block>();
|
||||||
protected HashMap<String, Location> sitstopteleportloc = new HashMap<String, Location>();
|
protected HashMap<String, Location> sitstopteleportloc = new HashMap<String, Location>();
|
||||||
protected void ejectPlayer(Player player)
|
protected void ejectPlayer(final Player player)
|
||||||
{
|
{
|
||||||
player.eject();
|
player.eject();
|
||||||
|
final Location tploc = sitstopteleportloc.get(player.getName());
|
||||||
|
System.out.println(tploc);
|
||||||
|
if (tploc != null)
|
||||||
|
{
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
player.teleport(tploc);
|
||||||
|
}
|
||||||
|
},1);
|
||||||
|
}
|
||||||
unSit(player);
|
unSit(player);
|
||||||
}
|
}
|
||||||
protected void unSit(Player player) {
|
protected void unSit(Player player) {
|
||||||
|
@ -265,6 +265,7 @@ public class EventListener implements Listener {
|
|||||||
player.sendMessage(plugin.msgSitting);
|
player.sendMessage(plugin.msgSitting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugin.sitstopteleportloc.put(player.getName(), player.getLocation());
|
||||||
player.teleport(plocation);
|
player.teleport(plocation);
|
||||||
Entity arrow = block.getWorld().spawnArrow(getBlockCentre(block).subtract(0, 0.5, 0), new Vector(0, 0, 0), 0, 0);
|
Entity arrow = block.getWorld().spawnArrow(getBlockCentre(block).subtract(0, 0.5, 0), new Vector(0, 0, 0), 0, 0);
|
||||||
arrow.setPassenger(player);
|
arrow.setPassenger(player);
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user