mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-28 17:38:01 +01:00
Prevent teleporting to invalid coordinates
This commit is contained in:
parent
1e8bdb17f8
commit
0dbb1887d5
@ -122,6 +122,9 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
|
||||
@Override
|
||||
public void teleport(final Location loc) {
|
||||
if (Math.abs(loc.getX()) >= 30000000 || Math.abs(loc.getZ()) >= 30000000) {
|
||||
return;
|
||||
}
|
||||
this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()));
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,9 @@ public class SpongePlayer extends PlotPlayer {
|
||||
|
||||
@Override
|
||||
public void teleport(Location loc) {
|
||||
if (Math.abs(loc.getX()) >= 30000000 || Math.abs(loc.getZ()) >= 30000000) {
|
||||
return;
|
||||
}
|
||||
String world = player.getWorld().getName();
|
||||
if (!world.equals(loc.getWorld())) {
|
||||
player.transferToWorld(loc.getWorld(), new Vector3d(loc.getX(), loc.getY(), loc.getZ()));
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user