mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-25 20:15:55 +01:00
Force random location to the middle of block before teleporting (#33)
Also add 0.1 to the y so that the player is guaranteed to be above the below block
This commit is contained in:
parent
4c1b8a7c9a
commit
dd6fffe0d5
@ -364,6 +364,9 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI {
|
|||||||
Block belowBlock = belowLoc.getBlock();
|
Block belowBlock = belowLoc.getBlock();
|
||||||
((Player) e).sendBlockChange(belowLoc, belowBlock.getType(), belowBlock.getData());
|
((Player) e).sendBlockChange(belowLoc, belowBlock.getType(), belowBlock.getData());
|
||||||
}
|
}
|
||||||
|
targetLoc.setX(targetLoc.getBlockX() + 0.5);
|
||||||
|
targetLoc.setY(targetLoc.getY() + 0.1);
|
||||||
|
targetLoc.setZ(targetLoc.getBlockZ() + 0.5);
|
||||||
e.teleport(targetLoc);
|
e.teleport(targetLoc);
|
||||||
sendMessage(e, "teleport",
|
sendMessage(e, "teleport",
|
||||||
"worldname", targetLoc.getWorld().getName(),
|
"worldname", targetLoc.getWorld().getName(),
|
||||||
|
Loading…
Reference in New Issue
Block a user