mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-03 10:32:33 +00:00
Removed unused code, fixed undefined variables
This commit is contained in:
parent
bf89ea1cf6
commit
ebb844fa52
@ -868,7 +868,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
public function stopSleep(){
|
||||
if($this->sleeping instanceof Vector3){
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerBedLeaveEvent($this, $this->getLevel()->getBlock($pos)));
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerBedLeaveEvent($this, $this->getLevel()->getBlock($this->sleeping)));
|
||||
|
||||
$this->sleeping = null;
|
||||
|
||||
|
@ -1990,7 +1990,6 @@ class Server{
|
||||
}
|
||||
|
||||
private function tickProcessor(){
|
||||
$lastLoop = 0;
|
||||
while($this->isRunning){
|
||||
$this->tick();
|
||||
usleep((int) max(1, ($this->nextTick - microtime(true)) * 1000000));
|
||||
@ -2124,7 +2123,6 @@ class Server{
|
||||
$this->nextTick = $tickTime;
|
||||
}
|
||||
$this->nextTick += 0.05;
|
||||
$this->inTick = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -66,13 +66,11 @@ class Cactus extends Transparent{
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== self::SAND and $down->getID() !== self::CACTUS){
|
||||
$this->getLevel()->useBreakOn($this);
|
||||
return;
|
||||
}else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if(!$b->isFlowable){
|
||||
$this->getLevel()->useBreakOn($this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,8 +92,6 @@ class Cactus extends Transparent{
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,6 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\Player;
|
||||
|
||||
class Carrot extends Crops{
|
||||
public function __construct($meta = 0){
|
||||
|
@ -22,8 +22,6 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\Player;
|
||||
|
||||
class Potato extends Crops{
|
||||
public function __construct($meta = 0){
|
||||
|
@ -24,7 +24,6 @@ namespace pocketmine\block;
|
||||
use pocketmine\event\block\BlockGrowEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
|
||||
class PumpkinStem extends Crops{
|
||||
|
@ -41,14 +41,6 @@ class TNT extends Solid{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::FLINT_STEEL){
|
||||
$item->useOn($this);
|
||||
|
||||
$data = [
|
||||
"x" => $this->x + 0.5,
|
||||
"y" => $this->y + 0.5,
|
||||
"z" => $this->z + 0.5,
|
||||
"power" => 4,
|
||||
"fuse" => 20 * 4, //4 seconds
|
||||
];
|
||||
$this->getLevel()->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
$mot = (new Random())->nextSignedFloat() * M_PI * 2;
|
||||
|
@ -21,9 +21,10 @@
|
||||
|
||||
namespace pocketmine\entity;
|
||||
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Skeleton extends Monster implements ProjectileSource{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new Skeleton("id", "Chicken");
|
||||
$this->namedtag->id = new String("id", "Chicken");
|
||||
}
|
||||
}
|
@ -54,6 +54,7 @@ abstract class Event{
|
||||
throw new \BadMethodCallException("Event is not Cancellable");
|
||||
}
|
||||
|
||||
/** @var Event $this */
|
||||
return $this->isCancelled === true;
|
||||
}
|
||||
|
||||
@ -68,6 +69,8 @@ abstract class Event{
|
||||
if(!($this instanceof Cancellable)){
|
||||
throw new \BadMethodCallException("Event is not Cancellable");
|
||||
}
|
||||
|
||||
/** @var Event $this */
|
||||
$this->isCancelled = (bool) $value;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
namespace pocketmine\event\entity;
|
||||
|
||||
use pocketmine\entity\Projectile;
|
||||
use pocketmine\event\Cancellable;
|
||||
|
||||
class ProjectileHitEvent extends EntityEvent{
|
||||
public static $handlerList = null;
|
||||
|
@ -53,7 +53,7 @@ class Explosion{
|
||||
*/
|
||||
public $affectedBlocks = [];
|
||||
public $stepLen = 0.3;
|
||||
/** @var Entity|Block|Tile */
|
||||
/** @var Entity|Block */
|
||||
private $what;
|
||||
|
||||
public function __construct(Position $center, $size, $what = null){
|
||||
|
@ -85,7 +85,7 @@ class Chunk extends BaseChunk{
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($level, $this->nbt["xPos"], $this->nbt["zPos"], $sections, $this->nbt->Biomes->getValue(), $this->nbt->BiomeColors->getValue(), $this->nbt->Entities->getValue(), $this->nbt->TileEntities->getValue());
|
||||
parent::__construct($level, (int) $this->nbt["xPos"], (int) $this->nbt["zPos"], $sections, $this->nbt->Biomes->getValue(), $this->nbt->BiomeColors->getValue(), $this->nbt->Entities->getValue(), $this->nbt->TileEntities->getValue());
|
||||
|
||||
unset($this->nbt->Sections);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ abstract class BaseLevelProvider implements LevelProvider{
|
||||
}
|
||||
|
||||
public function getSpawn(){
|
||||
return new Vector3($this->levelData["SpawnX"], $this->levelData["SpawnY"], $this->levelData["SpawnZ"]);
|
||||
return new Vector3((float) $this->levelData["SpawnX"], (float) $this->levelData["SpawnY"], (float) $this->levelData["SpawnZ"]);
|
||||
}
|
||||
|
||||
public function setSpawn(Vector3 $pos){
|
||||
|
@ -65,6 +65,8 @@ interface Plugin extends CommandExecutor{
|
||||
|
||||
/**
|
||||
* Gets an embedded resource in the plugin file.
|
||||
*
|
||||
* @param string $filename
|
||||
*/
|
||||
public function getResource($filename);
|
||||
|
||||
|
@ -247,9 +247,8 @@ class ServerScheduler{
|
||||
$this->asyncPool->collect([$this, "collectAsyncTask"]);
|
||||
|
||||
if($this->asyncTasks > 0){
|
||||
//TODO: remove this workaround
|
||||
foreach($this->asyncTaskStorage as $task){
|
||||
$this->collectAsyncTask($task);
|
||||
foreach($this->asyncTaskStorage as $asyncTask){
|
||||
$this->collectAsyncTask($asyncTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user