mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
SPIGOT-3283: Don't allow plugin induced infinite velocity / position
This commit is contained in:
parent
9496c2dad1
commit
921ba53556
@ -236,10 +236,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return new Vector(entity.motX, entity.motY, entity.motZ);
|
||||
}
|
||||
|
||||
public void setVelocity(Vector vel) {
|
||||
entity.motX = vel.getX();
|
||||
entity.motY = vel.getY();
|
||||
entity.motZ = vel.getZ();
|
||||
public void setVelocity(Vector velocity) {
|
||||
Preconditions.checkArgument(velocity != null, "velocity");
|
||||
velocity.checkFinite();
|
||||
entity.motX = velocity.getX();
|
||||
entity.motY = velocity.getY();
|
||||
entity.motZ = velocity.getZ();
|
||||
entity.velocityChanged = true;
|
||||
}
|
||||
|
||||
@ -269,6 +271,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
public boolean teleport(Location location, TeleportCause cause) {
|
||||
Preconditions.checkArgument(location != null, "location");
|
||||
location.checkFinite();
|
||||
|
||||
if (entity.isVehicle() || entity.dead) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user