diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index c9f6569da..34f8de51e 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -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; diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index ce92ed6ac..f8cc822a7 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -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; } diff --git a/src/pocketmine/block/Cactus.php b/src/pocketmine/block/Cactus.php index bc6358a2c..9d2b1e401 100644 --- a/src/pocketmine/block/Cactus.php +++ b/src/pocketmine/block/Cactus.php @@ -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; } } diff --git a/src/pocketmine/block/Carrot.php b/src/pocketmine/block/Carrot.php index de62111cc..a8fd22353 100644 --- a/src/pocketmine/block/Carrot.php +++ b/src/pocketmine/block/Carrot.php @@ -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){ diff --git a/src/pocketmine/block/Potato.php b/src/pocketmine/block/Potato.php index 7eedab8f3..5c003da56 100644 --- a/src/pocketmine/block/Potato.php +++ b/src/pocketmine/block/Potato.php @@ -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){ diff --git a/src/pocketmine/block/PumpkinStem.php b/src/pocketmine/block/PumpkinStem.php index b819da990..7123e7201 100644 --- a/src/pocketmine/block/PumpkinStem.php +++ b/src/pocketmine/block/PumpkinStem.php @@ -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{ diff --git a/src/pocketmine/block/TNT.php b/src/pocketmine/block/TNT.php index 97e18cb12..7850a7475 100644 --- a/src/pocketmine/block/TNT.php +++ b/src/pocketmine/block/TNT.php @@ -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; diff --git a/src/pocketmine/entity/Skeleton.php b/src/pocketmine/entity/Skeleton.php index 7c6793d37..b30723198 100644 --- a/src/pocketmine/entity/Skeleton.php +++ b/src/pocketmine/entity/Skeleton.php @@ -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"); } } \ No newline at end of file diff --git a/src/pocketmine/event/Event.php b/src/pocketmine/event/Event.php index adf72c966..b1b0e54f7 100644 --- a/src/pocketmine/event/Event.php +++ b/src/pocketmine/event/Event.php @@ -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; } diff --git a/src/pocketmine/event/entity/ProjectileHitEvent.php b/src/pocketmine/event/entity/ProjectileHitEvent.php index 2d60056a0..1da3406b3 100644 --- a/src/pocketmine/event/entity/ProjectileHitEvent.php +++ b/src/pocketmine/event/entity/ProjectileHitEvent.php @@ -22,7 +22,6 @@ namespace pocketmine\event\entity; use pocketmine\entity\Projectile; -use pocketmine\event\Cancellable; class ProjectileHitEvent extends EntityEvent{ public static $handlerList = null; diff --git a/src/pocketmine/level/Explosion.php b/src/pocketmine/level/Explosion.php index 3ba58fd4d..52cb6faae 100644 --- a/src/pocketmine/level/Explosion.php +++ b/src/pocketmine/level/Explosion.php @@ -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){ diff --git a/src/pocketmine/level/format/anvil/Chunk.php b/src/pocketmine/level/format/anvil/Chunk.php index df551777e..02c22ddee 100644 --- a/src/pocketmine/level/format/anvil/Chunk.php +++ b/src/pocketmine/level/format/anvil/Chunk.php @@ -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); } diff --git a/src/pocketmine/level/format/generic/BaseLevelProvider.php b/src/pocketmine/level/format/generic/BaseLevelProvider.php index 0897c2f01..418b7339e 100644 --- a/src/pocketmine/level/format/generic/BaseLevelProvider.php +++ b/src/pocketmine/level/format/generic/BaseLevelProvider.php @@ -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){ diff --git a/src/pocketmine/plugin/Plugin.php b/src/pocketmine/plugin/Plugin.php index ff90009b4..d01083536 100644 --- a/src/pocketmine/plugin/Plugin.php +++ b/src/pocketmine/plugin/Plugin.php @@ -65,6 +65,8 @@ interface Plugin extends CommandExecutor{ /** * Gets an embedded resource in the plugin file. + * + * @param string $filename */ public function getResource($filename); diff --git a/src/pocketmine/scheduler/ServerScheduler.php b/src/pocketmine/scheduler/ServerScheduler.php index 5ad84a392..f64d39f83 100644 --- a/src/pocketmine/scheduler/ServerScheduler.php +++ b/src/pocketmine/scheduler/ServerScheduler.php @@ -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); } } } diff --git a/start.sh b/start.sh index 6a0c7b43e..4c852959b 100755 --- a/start.sh +++ b/start.sh @@ -5,7 +5,7 @@ cd "$DIR" DO_LOOP="no" while getopts "p:f:l" OPTION 2> /dev/null; do - case $OPTION in + case ${OPTION} in p) PHP_BINARY="$OPTARG" ;;