mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Removed anti-noclip checks
This commit is contained in:
parent
44a205b1cc
commit
0d769aab48
@ -105,9 +105,6 @@ debug:
|
||||
player:
|
||||
#Choose whether to enable player data saving.
|
||||
save-player-data: true
|
||||
anti-cheat:
|
||||
#If false, will try to prevent speed and noclip cheats. May cause movement issues.
|
||||
allow-movement-cheats: true
|
||||
|
||||
level-settings:
|
||||
#The default format that levels will use when created
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Events called when the server detected that a player is cheating
|
||||
*/
|
||||
namespace pocketmine\event\player\cheat;
|
||||
|
||||
use pocketmine\event\player\PlayerEvent;
|
||||
|
||||
/**
|
||||
* @allowHandle
|
||||
*/
|
||||
abstract class PlayerCheatEvent extends PlayerEvent{
|
||||
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace pocketmine\event\player\cheat;
|
||||
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\player\Player;
|
||||
|
||||
/**
|
||||
* Called when a player attempts to perform movement cheats such as clipping through blocks.
|
||||
*/
|
||||
class PlayerIllegalMoveEvent extends PlayerCheatEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
|
||||
/** @var Vector3 */
|
||||
private $attemptedPosition;
|
||||
/** @var Vector3 */
|
||||
private $originalPosition;
|
||||
/** @var Vector3 */
|
||||
private $expectedPosition;
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @param Vector3 $attemptedPosition
|
||||
* @param Vector3 $originalPosition
|
||||
*/
|
||||
public function __construct(Player $player, Vector3 $attemptedPosition, Vector3 $originalPosition){
|
||||
$this->player = $player;
|
||||
$this->attemptedPosition = $attemptedPosition;
|
||||
$this->originalPosition = $originalPosition;
|
||||
$this->expectedPosition = $player->asVector3();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the position the player attempted to move to.
|
||||
* @return Vector3
|
||||
*/
|
||||
public function getAttemptedPosition() : Vector3{
|
||||
return $this->attemptedPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Vector3
|
||||
*/
|
||||
public function getOriginalPosition() : Vector3{
|
||||
return $this->originalPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Vector3
|
||||
*/
|
||||
public function getExpectedPosition() : Vector3{
|
||||
return $this->expectedPosition;
|
||||
}
|
||||
}
|
@ -40,7 +40,6 @@ use pocketmine\event\entity\EntityDamageByEntityEvent;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\inventory\InventoryCloseEvent;
|
||||
use pocketmine\event\inventory\InventoryOpenEvent;
|
||||
use pocketmine\event\player\cheat\PlayerIllegalMoveEvent;
|
||||
use pocketmine\event\player\PlayerAchievementAwardedEvent;
|
||||
use pocketmine\event\player\PlayerBedEnterEvent;
|
||||
use pocketmine\event\player\PlayerBedLeaveEvent;
|
||||
@ -228,8 +227,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
protected $inAirTicks = 0;
|
||||
/** @var float */
|
||||
protected $stepHeight = 0.6;
|
||||
/** @var bool */
|
||||
protected $allowMovementCheats = false;
|
||||
|
||||
/** @var Vector3|null */
|
||||
protected $sleeping = null;
|
||||
@ -292,8 +289,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
$this->chunksPerTick = (int) $this->server->getProperty("chunk-sending.per-tick", 4);
|
||||
$this->spawnThreshold = (int) (($this->server->getProperty("chunk-sending.spawn-radius", 4) ** 2) * M_PI);
|
||||
|
||||
$this->allowMovementCheats = (bool) $this->server->getProperty("player.anti-cheat.allow-movement-cheats", false);
|
||||
|
||||
$namedtag = $this->server->getOfflinePlayerData($this->username); //TODO: make this async
|
||||
|
||||
$spawnReset = false;
|
||||
@ -369,7 +364,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
}
|
||||
|
||||
$this->allowFlight = $this->isCreative();
|
||||
$this->keepMovement = $this->isSpectator() || $this->allowMovementCheats();
|
||||
$this->keepMovement = true;
|
||||
if($this->isOp()){
|
||||
$this->setRemoveFormat(false);
|
||||
}
|
||||
@ -533,14 +528,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
return $this->autoJump;
|
||||
}
|
||||
|
||||
public function allowMovementCheats() : bool{
|
||||
return $this->allowMovementCheats;
|
||||
}
|
||||
|
||||
public function setAllowMovementCheats(bool $value = true){
|
||||
$this->allowMovementCheats = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
*/
|
||||
@ -1224,10 +1211,8 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
$this->allowFlight = $this->isCreative();
|
||||
if($this->isSpectator()){
|
||||
$this->setFlying(true);
|
||||
$this->keepMovement = true;
|
||||
$this->despawnFromAll();
|
||||
}else{
|
||||
$this->keepMovement = $this->allowMovementCheats;
|
||||
if($this->isSurvival()){
|
||||
$this->setFlying(false);
|
||||
}
|
||||
@ -1416,25 +1401,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
$dz = $newPos->z - $this->z;
|
||||
|
||||
$this->move($dx, $dy, $dz);
|
||||
|
||||
$diff = $this->distanceSquared($newPos) / $tickDiff ** 2;
|
||||
|
||||
if($this->isSurvival() and !$revert and $diff > 0.0625){
|
||||
$ev = new PlayerIllegalMoveEvent($this, $newPos, $this->lastLocation->asVector3());
|
||||
$ev->setCancelled($this->allowMovementCheats);
|
||||
|
||||
$ev->call();
|
||||
|
||||
if(!$ev->isCancelled()){
|
||||
$revert = true;
|
||||
$this->logger->warning($this->getServer()->getLanguage()->translateString("pocketmine.player.invalidMove", [$this->getName()]));
|
||||
$this->logger->debug("Old position: " . $this->asVector3() . ", new position: " . $this->newPosition);
|
||||
}
|
||||
}
|
||||
|
||||
if($diff > 0 and !$revert){
|
||||
$this->setPosition($newPos);
|
||||
}
|
||||
}
|
||||
|
||||
$from = clone $this->lastLocation;
|
||||
|
Loading…
x
Reference in New Issue
Block a user