mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Allow plugins to cancel some kicks better, closes #2743
This commit is contained in:
parent
3e893ed0f7
commit
ffcdf49912
@ -1249,16 +1249,16 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
|
|
||||||
$this->entityBaseTick(1);
|
$this->entityBaseTick(1);
|
||||||
|
|
||||||
if($this->speed and $this->isSurvival()){
|
if($this->speed and $this->forceMovement === null and $this->isSurvival()){
|
||||||
$speed = sqrt($this->speed->x ** 2 + $this->speed->z ** 2);
|
$speed = sqrt($this->speed->x ** 2 + $this->speed->z ** 2);
|
||||||
if($speed > 0.45){
|
if($speed > 0.45){
|
||||||
$this->highSpeedTicks += $speed > 3 ? 2 : 1;
|
$this->highSpeedTicks += $speed > 3 ? 2 : 1;
|
||||||
if($this->highSpeedTicks > 40 and !$this->server->getAllowFlight()){
|
if($this->highSpeedTicks > 40 and !$this->server->getAllowFlight()){
|
||||||
$this->kick("Flying is not enabled on this server");
|
if($this->kick("Flying is not enabled on this server")){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}elseif($this->highSpeedTicks >= 10 and $this->highSpeedTicks % 4 === 0){
|
}elseif($this->highSpeedTicks >= 10 and $this->highSpeedTicks % 4 === 0){
|
||||||
$this->forceMovement = $this->getPosition();
|
$this->forceMovement = $this->getPosition();
|
||||||
$this->speed = null;
|
|
||||||
}
|
}
|
||||||
}elseif($this->highSpeedTicks > 0){
|
}elseif($this->highSpeedTicks > 0){
|
||||||
if($speed < 22){
|
if($speed < 22){
|
||||||
@ -1279,8 +1279,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
if($diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
if($diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
||||||
if($this->inAirTicks < 100){
|
if($this->inAirTicks < 100){
|
||||||
$this->setMotion(new Vector3(0, $expectedVelocity, 0));
|
$this->setMotion(new Vector3(0, $expectedVelocity, 0));
|
||||||
}else{
|
}elseif($this->kick("Flying is not enabled on this server"))
|
||||||
$this->kick("Flying is not enabled on this server");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user