mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
Says "no" to teleport hacks!
This commit is contained in:
parent
b038afc5b6
commit
413f381dcc
1 changed files with 4 additions and 3 deletions
|
|
@ -1475,15 +1475,16 @@ class Player{
|
||||||
}
|
}
|
||||||
if(($this->entity instanceof Entity) and $data["counter"] > $this->lastMovement){
|
if(($this->entity instanceof Entity) and $data["counter"] > $this->lastMovement){
|
||||||
$this->lastMovement = $data["counter"];
|
$this->lastMovement = $data["counter"];
|
||||||
|
$newPos = new Vector3($data["x"], $data["y"], $data["z"]);
|
||||||
if($this->forceMovement instanceof Vector3){
|
if($this->forceMovement instanceof Vector3){
|
||||||
if($this->forceMovement->distance(new Vector3($data["x"], $data["y"], $data["z"])) <= 0.7){
|
if($this->forceMovement->distance($newPos) <= 0.7){
|
||||||
$this->forceMovement = false;
|
$this->forceMovement = false;
|
||||||
}else{
|
}else{
|
||||||
$this->teleport($this->forceMovement, $this->entity->yaw, $this->entity->pitch, false);
|
$this->teleport($this->forceMovement, $this->entity->yaw, $this->entity->pitch, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$speed = $this->entity->getSpeedMeasure();
|
$speed = $this->entity->getSpeedMeasure();
|
||||||
if($this->blocked === true or ($this->server->api->getProperty("allow-flight") !== true and (($speed > 9 and ($this->gamemode & 0x01) === 0x00) or $speed > 20)) or $this->server->api->handle("player.move", $this->entity) === false){
|
if($this->blocked === true or ($this->server->api->getProperty("allow-flight") !== true and (($speed > 9 and ($this->gamemode & 0x01) === 0x00) or $speed > 20 or $this->entity->distance($newPos) > 7)) or $this->server->api->handle("player.move", $this->entity) === false){
|
||||||
if($this->lastCorrect instanceof Vector3){
|
if($this->lastCorrect instanceof Vector3){
|
||||||
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
|
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
|
||||||
}
|
}
|
||||||
|
|
@ -1491,7 +1492,7 @@ class Player{
|
||||||
console("[WARNING] ".$this->username." moved too quickly!");
|
console("[WARNING] ".$this->username." moved too quickly!");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->entity->setPosition(new Vector3($data["x"], $data["y"], $data["z"]), $data["yaw"], $data["pitch"]);
|
$this->entity->setPosition($newPos, $data["yaw"], $data["pitch"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue