From ae6e0773ef77e531d763c02900a29af32702b8ae Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 9 Dec 2016 16:13:39 +0000 Subject: [PATCH 1/9] Do not perform scheduled updates on still lava/water (#134) --- src/pocketmine/block/StillLava.php | 9 +++++++++ src/pocketmine/block/StillWater.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/pocketmine/block/StillLava.php b/src/pocketmine/block/StillLava.php index c273860d4..4a694f195 100644 --- a/src/pocketmine/block/StillLava.php +++ b/src/pocketmine/block/StillLava.php @@ -21,10 +21,19 @@ namespace pocketmine\block; +use pocketmine\level\Level; + class StillLava extends Lava{ protected $id = self::STILL_LAVA; + public function onUpdate($type){ + if($type !== Level::BLOCK_UPDATE_SCHEDULED){ + return parent::onUpdate($type); + } + return false; + } + public function getName(){ return "Still Lava"; } diff --git a/src/pocketmine/block/StillWater.php b/src/pocketmine/block/StillWater.php index 8c67f65a3..3e308ed90 100644 --- a/src/pocketmine/block/StillWater.php +++ b/src/pocketmine/block/StillWater.php @@ -21,10 +21,19 @@ namespace pocketmine\block; +use pocketmine\level\Level; + class StillWater extends Water{ protected $id = self::STILL_WATER; + public function onUpdate($type){ + if($type !== Level::BLOCK_UPDATE_SCHEDULED){ + return parent::onUpdate($type); + } + return false; + } + public function getName(){ return "Still Water"; } From 5e6d4526783041fbbcbf6e445d5bbeae93577b18 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 9 Dec 2016 17:03:15 +0000 Subject: [PATCH 2/9] Fix TNT flashing, add explosion particles and add DATA_FUSE_LENGTH entity data constant --- src/pocketmine/entity/Entity.php | 1 + src/pocketmine/entity/PrimedTNT.php | 18 +++++++++++++----- src/pocketmine/level/Explosion.php | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 813f8ee34..6e6ce9ab9 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -104,6 +104,7 @@ abstract class Entity extends Location implements Metadatable{ * 52 (short) */ const DATA_BOUNDING_BOX_WIDTH = 53; //float const DATA_BOUNDING_BOX_HEIGHT = 54; //float + const DATA_FUSE_LENGTH = 55; //int /* 56 (vector3f) * 57 (byte) * 58 (float) diff --git a/src/pocketmine/entity/PrimedTNT.php b/src/pocketmine/entity/PrimedTNT.php index a93e43a11..a098909c4 100644 --- a/src/pocketmine/entity/PrimedTNT.php +++ b/src/pocketmine/entity/PrimedTNT.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * 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 @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -57,6 +57,9 @@ class PrimedTNT extends Entity implements Explosive{ }else{ $this->fuse = 80; } + + $this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_IGNITED, true); + $this->setDataProperty(self::DATA_FUSE_LENGTH, self::DATA_TYPE_INT, $this->fuse); } @@ -81,6 +84,11 @@ class PrimedTNT extends Entity implements Explosive{ if($tickDiff <= 0 and !$this->justCreated){ return true; } + + if($this->fuse % 5 === 0){ //don't spam it every tick, it's not necessary + $this->setDataProperty(self::DATA_FUSE_LENGTH, self::DATA_TYPE_INT, $this->fuse); + } + $this->lastUpdate = $currentTick; $hasUpdate = $this->entityBaseTick($tickDiff); diff --git a/src/pocketmine/level/Explosion.php b/src/pocketmine/level/Explosion.php index 4499e4bcb..dd73938e1 100644 --- a/src/pocketmine/level/Explosion.php +++ b/src/pocketmine/level/Explosion.php @@ -29,6 +29,7 @@ use pocketmine\event\entity\EntityDamageByEntityEvent; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\EntityExplodeEvent; use pocketmine\item\Item; +use pocketmine\level\particle\HugeExplodeSeedParticle; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Math; use pocketmine\math\Vector3; @@ -221,6 +222,8 @@ class Explosion{ $pk->records = $send; $this->level->addChunkPacket($source->x >> 4, $source->z >> 4, $pk); + $this->level->addParticle(new HugeExplodeSeedParticle($source)); + return true; } } From 544d99f161affa876a884d887844878cdfaeef92 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 12 Dec 2016 10:07:34 +0000 Subject: [PATCH 3/9] Added ability to force literal gamemode checks for Player->isSurvival(), Player->isCreative() and Player->isAdventure() (#155) --- src/pocketmine/Player.php | 50 +++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index e59d25629..21aaa1392 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1186,28 +1186,58 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade } /** - * WARNING: This method does NOT return literal gamemode is survival, it will also return true for adventure mode players. + * NOTE: Because Survival and Adventure Mode share some similar behaviour, this method will also return true if the player is + * in Adventure Mode. Supply the $literal parameter as true to force a literal Survival Mode check. + * + * @param bool $literal whether a literal check should be performed + * + * @return bool */ - public function isSurvival() : bool{ - return ($this->gamemode & 0x01) === 0; + public function isSurvival(bool $literal = false) : bool{ + if($literal){ + return $this->gamemode === Player::SURVIVAL; + }else{ + return ($this->gamemode & 0x01) === 0; + } } /** - * WARNING: This method does NOT return literal gamemode is creative, it will also return true for spectator mode players. + * NOTE: Because Creative and Spectator Mode share some similar behaviour, this method will also return true if the player is + * in Spectator Mode. Supply the $literal parameter as true to force a literal Creative Mode check. + * + * @param bool $literal whether a literal check should be performed + * + * @return bool */ - public function isCreative() : bool{ - return ($this->gamemode & 0x01) === 1; + public function isCreative(bool $literal = false) : bool{ + if($literal){ + return $this->gamemode === Player::CREATIVE; + }else{ + return ($this->gamemode & 0x01) === 1; + } } /** - * WARNING: This method does NOT return literal gamemode is adventure, it will also return true for spectator mode players. + * NOTE: Because Adventure and Spectator Mode share some similar behaviour, this method will also return true if the player is + * in Spectator Mode. Supply the $literal parameter as true to force a literal Adventure Mode check. + * + * @param bool $literal whether a literal check should be performed + * + * @return bool */ - public function isAdventure() : bool{ - return ($this->gamemode & 0x02) > 0; + public function isAdventure(bool $literal = false) : bool{ + if($literal){ + return $this->gamemode === Player::ADVENTURE; + }else{ + return ($this->gamemode & 0x02) > 0; + } } + /** + * @return bool + */ public function isSpectator() : bool{ - return $this->gamemode === 3; + return $this->gamemode === Player::SPECTATOR; } public function getDrops(){ From e790573f2ea2ca219aea0ade4225de8294a5a731 Mon Sep 17 00:00:00 2001 From: alex2534alex Date: Mon, 12 Dec 2016 18:03:05 +0200 Subject: [PATCH 4/9] Fix NBT "getArray()" (#163) --- src/pocketmine/nbt/NBT.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/nbt/NBT.php b/src/pocketmine/nbt/NBT.php index aa8f16869..ff8880a18 100644 --- a/src/pocketmine/nbt/NBT.php +++ b/src/pocketmine/nbt/NBT.php @@ -610,6 +610,7 @@ class NBT{ public function getArray(){ $data = []; self::toArray($data, $this->data); + return $data; } private static function toArray(array &$data, Tag $tag){ @@ -681,4 +682,4 @@ class NBT{ $this->data = $data; } -} \ No newline at end of file +} From 175dd0efa6f3073c48645abfdeeb0ee3600ad6ac Mon Sep 17 00:00:00 2001 From: SOFe Date: Fri, 21 Oct 2016 22:38:49 +0800 Subject: [PATCH 5/9] PhpStorm inspections Fixed some minor bugs and dropped some obsolete code pocketmine\level\generator namespace is ignored in this commit --- src/pocketmine/Player.php | 6 ++++++ src/pocketmine/Server.php | 1 - src/pocketmine/command/defaults/ParticleCommand.php | 7 ++++++- src/pocketmine/entity/Entity.php | 1 + src/pocketmine/entity/Human.php | 3 ++- src/pocketmine/event/Event.php | 2 -- src/pocketmine/inventory/Inventory.php | 4 ++-- src/pocketmine/inventory/Recipe.php | 2 ++ src/pocketmine/item/Item.php | 5 +++++ src/pocketmine/lang/BaseLang.php | 5 +++-- src/pocketmine/level/Level.php | 12 ++++++------ src/pocketmine/level/Location.php | 4 +++- .../level/format/generic/BaseFullChunk.php | 1 + src/pocketmine/nbt/NBT.php | 5 ++--- src/pocketmine/nbt/tag/ListTag.php | 2 ++ src/pocketmine/permission/Permission.php | 4 ++-- src/pocketmine/permission/PermissionAttachment.php | 3 --- src/pocketmine/plugin/PluginBase.php | 2 +- src/pocketmine/scheduler/ServerScheduler.php | 12 ------------ src/pocketmine/tile/Container.php | 1 - src/pocketmine/utils/Utils.php | 2 ++ 21 files changed, 46 insertions(+), 38 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 21aaa1392..f27566478 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2647,6 +2647,10 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade break; } + /** + * @var int $i + * @var Item $item + */ foreach($packet->input as $i => $item){ if($item->getDamage() === -1 or $item->getDamage() === 0xffff){ $item->setDamage(null); @@ -3140,6 +3144,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade /** * Handles player data saving + * + * @param bool $async */ public function save($async = false){ if($this->closed){ diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 3cc206526..acdd8e538 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -185,7 +185,6 @@ class Server{ /** @var CommandReader */ private $console = null; - private $consoleThreaded; /** @var SimpleCommandMap */ private $commandMap = null; diff --git a/src/pocketmine/command/defaults/ParticleCommand.php b/src/pocketmine/command/defaults/ParticleCommand.php index 58bea12f0..6f29e6138 100644 --- a/src/pocketmine/command/defaults/ParticleCommand.php +++ b/src/pocketmine/command/defaults/ParticleCommand.php @@ -123,8 +123,13 @@ class ParticleCommand extends VanillaCommand{ } /** - * @param $name + * @param string $name * + * @param Vector3 $pos + * @param int $xd + * @param float $yd + * @param float $zd + * @param int|null $data * @return Particle */ private function getParticle($name, Vector3 $pos, $xd, $yd, $zd, $data){ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 6e6ce9ab9..91ac5104c 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1610,6 +1610,7 @@ abstract class Entity extends Location implements Metadatable{ * @param int $id * @param int $type * @param mixed $value + * @param bool $send * * @return bool */ diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index f136b97df..870a7146e 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -236,7 +236,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ } public function recalculateXpProgress() : float{ - $this->setXpProgress($this->getRemainderXp() / self::getTotalXpForLevel($this->getXpLevel())); + $this->setXpProgress($progress = $this->getRemainderXp() / self::getTotalXpForLevel($this->getXpLevel())); + return $progress; } public static function getTotalXpForLevel(int $level) : int{ diff --git a/src/pocketmine/event/Event.php b/src/pocketmine/event/Event.php index 246a1dab6..ed1c47842 100644 --- a/src/pocketmine/event/Event.php +++ b/src/pocketmine/event/Event.php @@ -63,8 +63,6 @@ abstract class Event{ /** * @param bool $value * - * @return bool - * * @throws \BadMethodCallException */ public function setCancelled($value = true){ diff --git a/src/pocketmine/inventory/Inventory.php b/src/pocketmine/inventory/Inventory.php index cadf65fa8..f5f964d4e 100644 --- a/src/pocketmine/inventory/Inventory.php +++ b/src/pocketmine/inventory/Inventory.php @@ -68,7 +68,7 @@ interface Inventory{ * * Returns the Items that did not fit. * - * @param Item ...$item + * @param Item ...$slots * * @return Item[] */ @@ -87,7 +87,7 @@ interface Inventory{ * Removes the given Item from the inventory. * It will return the Items that couldn't be removed. * - * @param Item ...$item + * @param Item ...$slots * * @return Item[] */ diff --git a/src/pocketmine/inventory/Recipe.php b/src/pocketmine/inventory/Recipe.php index bcac5ba75..e1aa17374 100644 --- a/src/pocketmine/inventory/Recipe.php +++ b/src/pocketmine/inventory/Recipe.php @@ -36,4 +36,6 @@ interface Recipe{ * @return UUID */ public function getId(); + + public function setId(UUID $id); } \ No newline at end of file diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index eab5a0ae2..c2d18d569 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -35,6 +35,7 @@ use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\ListTag; use pocketmine\nbt\tag\ShortTag; use pocketmine\nbt\tag\StringTag; +use pocketmine\nbt\tag\Tag; use pocketmine\Player; use pocketmine\Server; use pocketmine\utils\Config; @@ -594,6 +595,10 @@ class Item implements ItemIds, \JsonSerializable{ return $this; } + /** + * @param $name + * @return Tag|null + */ public function getNamedTagEntry($name){ $tag = $this->getNamedTag(); if($tag !== null){ diff --git a/src/pocketmine/lang/BaseLang.php b/src/pocketmine/lang/BaseLang.php index 5d4a78bce..7dec752f2 100644 --- a/src/pocketmine/lang/BaseLang.php +++ b/src/pocketmine/lang/BaseLang.php @@ -89,9 +89,10 @@ class BaseLang{ } /** - * @param string $str - * @param string[] $params + * @param string $str + * @param string[] $params * + * @param string|null $onlyPrefix * @return string */ public function translateString($str, array $params = [], $onlyPrefix = null){ diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 22565e869..f93abb43f 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -287,6 +287,11 @@ class Level implements ChunkManager, Metadatable{ } } + /** + * @param string|int $hash + * @param int|null $x + * @param int|null $z + */ public static function getXZ($hash, &$x, &$z){ if(PHP_INT_SIZE === 8){ $x = ($hash >> 32) << 32 >> 32; @@ -1785,7 +1790,7 @@ class Level implements ChunkManager, Metadatable{ * Returns the entities colliding the current one inside the AxisAlignedBB * * @param AxisAlignedBB $bb - * @param Entity $entity + * @param Entity|null $entity * * @return Entity[] */ @@ -2316,8 +2321,6 @@ class Level implements ChunkManager, Metadatable{ if(count($this->chunkSendQueue) > 0){ $this->timings->syncChunkSendTimer->startTiming(); - $x = null; - $z = null; foreach($this->chunkSendQueue as $index => $players){ if(isset($this->chunkSendTasks[$index])){ continue; @@ -2778,9 +2781,6 @@ class Level implements ChunkManager, Metadatable{ public function doChunkGarbageCollection(){ $this->timings->doChunkGC->startTiming(); - $X = null; - $Z = null; - foreach($this->chunks as $index => $chunk){ if(!isset($this->unloadQueue[$index]) and (!isset($this->usedChunks[$index]) or count($this->usedChunks[$index]) === 0)){ Level::getXZ($index, $X, $Z); diff --git a/src/pocketmine/level/Location.php b/src/pocketmine/level/Location.php index e29f6fdde..f482df869 100644 --- a/src/pocketmine/level/Location.php +++ b/src/pocketmine/level/Location.php @@ -50,9 +50,11 @@ class Location extends Position{ * @param Level|null $level default null * @param float $yaw default 0.0 * @param float $pitch default 0.0 + * + * @return Location */ public static function fromObject(Vector3 $pos, Level $level = null, $yaw = 0.0, $pitch = 0.0){ - return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, ($level === null) ? (($pos instanceof Position) ? $pos->level : null) : $level); + return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, $level ?? (($pos instanceof Position) ? $pos->level : null)); } public function getYaw(){ diff --git a/src/pocketmine/level/format/generic/BaseFullChunk.php b/src/pocketmine/level/format/generic/BaseFullChunk.php index d9c2ecc23..33bf64ce8 100644 --- a/src/pocketmine/level/format/generic/BaseFullChunk.php +++ b/src/pocketmine/level/format/generic/BaseFullChunk.php @@ -84,6 +84,7 @@ abstract class BaseFullChunk implements FullChunk{ * @param int[] $heightMap * @param CompoundTag[] $entities * @param CompoundTag[] $tiles + * @param int[] $extraData */ protected function __construct($provider, $x, $z, $blocks, $data, $skyLight, $blockLight, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = [], array $extraData = []){ $this->provider = $provider; diff --git a/src/pocketmine/nbt/NBT.php b/src/pocketmine/nbt/NBT.php index ff8880a18..fcae202f1 100644 --- a/src/pocketmine/nbt/NBT.php +++ b/src/pocketmine/nbt/NBT.php @@ -34,14 +34,13 @@ use pocketmine\nbt\tag\IntArrayTag; use pocketmine\nbt\tag\IntTag; use pocketmine\nbt\tag\ListTag; use pocketmine\nbt\tag\LongTag; -use pocketmine\nbt\tag\NamedTAG; +use pocketmine\nbt\tag\NamedTag; use pocketmine\nbt\tag\ShortTag; use pocketmine\nbt\tag\StringTag; use pocketmine\nbt\tag\Tag; #ifndef COMPILE use pocketmine\utils\Binary; - #endif @@ -532,7 +531,7 @@ class NBT{ public function writeTag(Tag $tag, bool $network = false){ $this->putByte($tag->getType()); - if($tag instanceof NamedTAG){ + if($tag instanceof NamedTag){ $this->putString($tag->getName(), $network); } $tag->write($this, $network); diff --git a/src/pocketmine/nbt/tag/ListTag.php b/src/pocketmine/nbt/tag/ListTag.php index 43a5be668..4732f9a35 100644 --- a/src/pocketmine/nbt/tag/ListTag.php +++ b/src/pocketmine/nbt/tag/ListTag.php @@ -207,6 +207,8 @@ class ListTag extends NamedTag implements \ArrayAccess, \Countable{ foreach($tags as $tag){ $tag->write($nbt, $network); } + + return true; } public function __toString(){ diff --git a/src/pocketmine/permission/Permission.php b/src/pocketmine/permission/Permission.php index baeadcc22..e46216f7f 100644 --- a/src/pocketmine/permission/Permission.php +++ b/src/pocketmine/permission/Permission.php @@ -173,13 +173,13 @@ class Permission{ * @param string|Permission $name * @param $value * - * @return Permission|void Permission if $name is a string, void if it's a Permission + * @return Permission|null Permission if $name is a string, null if it's a Permission */ public function addParent($name, $value){ if($name instanceof Permission){ $name->getChildren()[$this->getName()] = $value; $name->recalculatePermissibles(); - return; + return null; }else{ $perm = Server::getInstance()->getPluginManager()->getPermission($name); if($perm === null){ diff --git a/src/pocketmine/permission/PermissionAttachment.php b/src/pocketmine/permission/PermissionAttachment.php index f87ebc000..52995431a 100644 --- a/src/pocketmine/permission/PermissionAttachment.php +++ b/src/pocketmine/permission/PermissionAttachment.php @@ -89,9 +89,6 @@ class PermissionAttachment{ return $this->permissions; } - /** - * @return bool[] - */ public function clearPermissions(){ $this->permissions = []; $this->permissible->recalculatePermissions(); diff --git a/src/pocketmine/plugin/PluginBase.php b/src/pocketmine/plugin/PluginBase.php index 963c4b411..7c0c75c6e 100644 --- a/src/pocketmine/plugin/PluginBase.php +++ b/src/pocketmine/plugin/PluginBase.php @@ -259,7 +259,7 @@ abstract class PluginBase implements Plugin{ public function reloadConfig(){ $this->config = new Config($this->configFile); if(($configStream = $this->getResource("config.yml")) !== null){ - $this->config->setDefaults(yaml_parse(config::fixYAMLIndexes(stream_get_contents($configStream)))); + $this->config->setDefaults(yaml_parse(Config::fixYAMLIndexes(stream_get_contents($configStream)))); fclose($configStream); } } diff --git a/src/pocketmine/scheduler/ServerScheduler.php b/src/pocketmine/scheduler/ServerScheduler.php index facae5d04..2c408f2c3 100644 --- a/src/pocketmine/scheduler/ServerScheduler.php +++ b/src/pocketmine/scheduler/ServerScheduler.php @@ -277,18 +277,6 @@ class ServerScheduler{ }elseif(!$task->getOwner()->isEnabled()){ throw new PluginException("Plugin '" . $task->getOwner()->getName() . "' attempted to register a task while disabled"); } - }elseif($task instanceof CallbackTask and Server::getInstance()->getProperty("settings.deprecated-verbose", true)){ - $callable = $task->getCallable(); - if(is_array($callable)){ - if(is_object($callable[0])){ - $taskName = "Callback#" . get_class($callable[0]) . "::" . $callable[1]; - }else{ - $taskName = "Callback#" . $callable[0] . "::" . $callable[1]; - } - }else{ - $taskName = "Callback#" . $callable; - } - Server::getInstance()->getLogger()->warning("A plugin attempted to register a deprecated CallbackTask ($taskName)"); } if($delay <= 0){ diff --git a/src/pocketmine/tile/Container.php b/src/pocketmine/tile/Container.php index e98e4e386..312325178 100644 --- a/src/pocketmine/tile/Container.php +++ b/src/pocketmine/tile/Container.php @@ -22,7 +22,6 @@ namespace pocketmine\tile; use pocketmine\item\Item; -use pocketmine\Network; interface Container{ diff --git a/src/pocketmine/utils/Utils.php b/src/pocketmine/utils/Utils.php index fdec8859f..7d40b427b 100644 --- a/src/pocketmine/utils/Utils.php +++ b/src/pocketmine/utils/Utils.php @@ -168,6 +168,8 @@ class Utils{ * BSD => bsd * Other => other * + * @param bool $recalculate + * * @return string */ public static function getOS($recalculate = false){ From e1253db37cddc04479b5aa19ef55eef825f221a5 Mon Sep 17 00:00:00 2001 From: SOFe Date: Sat, 22 Oct 2016 15:01:23 +0800 Subject: [PATCH 6/9] Some more minor changes for autocompletion in IDEs --- src/pocketmine/Player.php | 4 ++-- src/pocketmine/command/defaults/BanListCommand.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index f27566478..3cfd62329 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2723,8 +2723,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade foreach($ingredients as $ingredient){ $slot = -1; - foreach($this->inventory->getContents() as $index => $i){ - if($ingredient->getId() !== 0 and $ingredient->deepEquals($i, $ingredient->getDamage() !== null) and ($i->getCount() - $used[$index]) >= 1){ + foreach($this->inventory->getContents() as $index => $item){ + if($ingredient->getId() !== 0 and $ingredient->deepEquals($item, $ingredient->getDamage() !== null) and ($item->getCount() - $used[$index]) >= 1){ $slot = $index; $used[$index]++; break; diff --git a/src/pocketmine/command/defaults/BanListCommand.php b/src/pocketmine/command/defaults/BanListCommand.php index d2ecbcf3f..f63c6e213 100644 --- a/src/pocketmine/command/defaults/BanListCommand.php +++ b/src/pocketmine/command/defaults/BanListCommand.php @@ -39,7 +39,7 @@ class BanListCommand extends VanillaCommand{ if(!$this->testPermission($sender)){ return true; } - $list = $sender->getServer()->getNameBans(); + if(isset($args[0])){ $args[0] = strtolower($args[0]); if($args[0] === "ips"){ From bd722bb85f89bcf335e8bf5d3df3f86e7537d9fc Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 15 Dec 2016 09:22:51 +0000 Subject: [PATCH 7/9] fix misplaced doc --- src/pocketmine/lang/BaseLang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/lang/BaseLang.php b/src/pocketmine/lang/BaseLang.php index 7dec752f2..8370820c7 100644 --- a/src/pocketmine/lang/BaseLang.php +++ b/src/pocketmine/lang/BaseLang.php @@ -91,8 +91,8 @@ class BaseLang{ /** * @param string $str * @param string[] $params - * * @param string|null $onlyPrefix + * * @return string */ public function translateString($str, array $params = [], $onlyPrefix = null){ From 5dca11dafb0f77b8e008efadc618f026528c4409 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 15 Dec 2016 16:18:49 +0000 Subject: [PATCH 8/9] Increase ladder bounding box to 3/16, fix kicked for flying when sneaking on ladders (#168) --- src/pocketmine/block/Ladder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/block/Ladder.php b/src/pocketmine/block/Ladder.php index f69202389..508c37868 100644 --- a/src/pocketmine/block/Ladder.php +++ b/src/pocketmine/block/Ladder.php @@ -59,7 +59,7 @@ class Ladder extends Transparent{ protected function recalculateBoundingBox(){ - $f = 0.125; + $f = 0.1875; if($this->meta === 2){ return new AxisAlignedBB( From 5ce6c6227ff6ec512d89bf08cb163b3433ccb1ed Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 15 Dec 2016 23:05:26 +0000 Subject: [PATCH 9/9] Fix a couple of particle constants Thanks @thebigsmilexd for information --- src/pocketmine/level/particle/Particle.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/level/particle/Particle.php b/src/pocketmine/level/particle/Particle.php index 499d653b2..a7fb9cc22 100644 --- a/src/pocketmine/level/particle/Particle.php +++ b/src/pocketmine/level/particle/Particle.php @@ -30,8 +30,8 @@ abstract class Particle extends Vector3{ const TYPE_CRITICAL = 2; const TYPE_BLOCK_FORCE_FIELD = 3; const TYPE_SMOKE = 4; - const TYPE_EXPLODE = 5; //actually steam - const TYPE_WHITE_SMOKE = 6; //also steam, maybe bigger? + const TYPE_EXPLODE = 5; + const TYPE_EVAPORATION = 6; const TYPE_FLAME = 7; const TYPE_LAVA = 8; const TYPE_LARGE_SMOKE = 9; @@ -62,7 +62,7 @@ abstract class Particle extends Vector3{ const TYPE_ENCHANTMENT_TABLE = 34; const TYPE_TRACKING_EMITTER = 35; const TYPE_NOTE = 36; - //37 yet another SpellParticle of some description + const TYPE_WITCH_SPELL = 37; const TYPE_CARROT = 38; /**