From 1a9ec65983a585d7d489d8024e0dd1958099dede Mon Sep 17 00:00:00 2001 From: "Luca P." Date: Sat, 22 Aug 2015 15:58:45 +0200 Subject: [PATCH 1/9] Spelling fix --- src/pocketmine/utils/ServerKiller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/utils/ServerKiller.php b/src/pocketmine/utils/ServerKiller.php index d5c710f07..2e3326ebb 100644 --- a/src/pocketmine/utils/ServerKiller.php +++ b/src/pocketmine/utils/ServerKiller.php @@ -33,11 +33,11 @@ class ServerKiller extends Thread{ public function run(){ sleep($this->time); - echo "\nTook to long to stop, server was killed forcefully!\n"; + echo "\nTook too long to stop, server was killed forcefully!\n"; @\pocketmine\kill(getmypid()); } public function getThreadName(){ return "Server Killer"; } -} \ No newline at end of file +} From 0b9b1738b314af0d9562213da05d15c159ef96b7 Mon Sep 17 00:00:00 2001 From: Sjoerd Date: Thu, 27 Aug 2015 10:44:44 +0200 Subject: [PATCH 2/9] Block cache not cleared with a call to clearcache While trying to figure out Github and looking for a different bug I found this small bug in the code. The ClearCache function on Level.php did not correctly clear the blockcache. --- src/pocketmine/level/Level.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index f1881148e..b1d5ed97c 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -855,7 +855,7 @@ class Level implements ChunkManager, Metadatable{ } if(count($this->blockCache) > 2048){ - $this->chunkCache = []; + $this->blockCache = []; } } From 0348d181d4dfea065a430778b0f748575d8bf4fd Mon Sep 17 00:00:00 2001 From: PEMapModder Date: Sat, 29 Aug 2015 18:03:40 +0800 Subject: [PATCH 3/9] Remove unused parameter in Level::requestChunk --- src/pocketmine/level/Level.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index f1881148e..177435ffe 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2251,7 +2251,7 @@ class Level implements ChunkManager, Metadatable{ $this->server->getPluginManager()->callEvent(new SpawnChangeEvent($this, $previousSpawn)); } - public function requestChunk($x, $z, Player $player, $order = LevelProvider::ORDER_ZXY){ + public function requestChunk($x, $z, Player $player){ $index = Level::chunkHash($x, $z); if(!isset($this->chunkSendQueue[$index])){ $this->chunkSendQueue[$index] = []; From 9adcc19154e1a448ff5ff894a9ff804f17b066f1 Mon Sep 17 00:00:00 2001 From: PEMapModder Date: Mon, 31 Aug 2015 22:05:49 +0930 Subject: [PATCH 4/9] @PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427. --- src/pocketmine/entity/Living.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 4bfe52ccf..d336fae22 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -132,7 +132,18 @@ abstract class Living extends Entity implements Damageable{ $this->attackTime = 10; //0.5 seconds cooldown } - public function knockBack(Entity $attacker, $damage, $x, $z, $base = 0.4){ + /** + * Note: Variadic function is used to preserve BC + * @param int $x + * @param int $z + * @param float $base Default 0.4 + */ + public function knockBack($x, $z, $base = 0.4){ + if(func_num_args() >= 4){ + $args = func_get_args(); + list(, , $x, $z) = $args; + $base = isset($args[4]) ? $args[4] : 0.4; + } $f = sqrt($x * $x + $z * $z); if($f <= 0){ return; From a18826473b45e446e6213dd1c912002e12ff20ed Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 31 Aug 2015 17:48:28 +0200 Subject: [PATCH 5/9] Added enderman teleport sound --- .../level/sound/EndermanTeleportSound.php | 31 +++++++++++++++++++ .../network/protocol/LevelEventPacket.php | 1 + 2 files changed, 32 insertions(+) create mode 100644 src/pocketmine/level/sound/EndermanTeleportSound.php diff --git a/src/pocketmine/level/sound/EndermanTeleportSound.php b/src/pocketmine/level/sound/EndermanTeleportSound.php new file mode 100644 index 000000000..c4e43130e --- /dev/null +++ b/src/pocketmine/level/sound/EndermanTeleportSound.php @@ -0,0 +1,31 @@ + Date: Mon, 31 Aug 2015 17:48:52 +0200 Subject: [PATCH 6/9] Revert commit that removed useful parameter for plugins that made backwards-incompatible changes Revert "@PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427." This reverts commit 9adcc19154e1a448ff5ff894a9ff804f17b066f1. --- src/pocketmine/entity/Living.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index d336fae22..4bfe52ccf 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -132,18 +132,7 @@ abstract class Living extends Entity implements Damageable{ $this->attackTime = 10; //0.5 seconds cooldown } - /** - * Note: Variadic function is used to preserve BC - * @param int $x - * @param int $z - * @param float $base Default 0.4 - */ - public function knockBack($x, $z, $base = 0.4){ - if(func_num_args() >= 4){ - $args = func_get_args(); - list(, , $x, $z) = $args; - $base = isset($args[4]) ? $args[4] : 0.4; - } + public function knockBack(Entity $attacker, $damage, $x, $z, $base = 0.4){ $f = sqrt($x * $x + $z * $z); if($f <= 0){ return; From 5baa87e9febc7312406e8ca263af292136c01ad4 Mon Sep 17 00:00:00 2001 From: Sjoerd Date: Fri, 4 Sep 2015 23:40:19 +0200 Subject: [PATCH 7/9] First item in the hotbar is not loaded correctly When you logon the first hotbar item contains the first item of the inventory, but it should contain the previously selected item. --- src/pocketmine/Player.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 5ab3ba015..ae38135f3 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1769,7 +1769,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade if($this->isCreative()){ $this->inventory->setHeldItemSlot(0); }else{ - $this->inventory->setHeldItemSlot(0); + $this->inventory->setHeldItemSlot($this->inventory->getHotbarSlotIndex(0)); } $pk = new PlayStatusPacket(); From cb222601fde55c1393065095915c6fe334327fad Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Fri, 11 Sep 2015 16:50:57 +0200 Subject: [PATCH 8/9] Haters gonna hate, also fix misleading interface default parameter --- src/pocketmine/event/Cancellable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/event/Cancellable.php b/src/pocketmine/event/Cancellable.php index ea7f18268..81d2abca9 100644 --- a/src/pocketmine/event/Cancellable.php +++ b/src/pocketmine/event/Cancellable.php @@ -28,5 +28,5 @@ namespace pocketmine\event; interface Cancellable{ public function isCancelled(); - public function setCancelled($forceCancel = false); -} \ No newline at end of file + public function setCancelled($value = true); +} From a1a132741596823772582bb83bd8c6f22ca4c864 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 12 Sep 2015 00:56:54 +0200 Subject: [PATCH 9/9] Removed signed parameter in BinaryStream->getShort() in favor of getSignedShort() --- src/pocketmine/utils/BinaryStream.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/utils/BinaryStream.php b/src/pocketmine/utils/BinaryStream.php index 40aeb192c..d4ec2a96e 100644 --- a/src/pocketmine/utils/BinaryStream.php +++ b/src/pocketmine/utils/BinaryStream.php @@ -105,14 +105,22 @@ class BinaryStream extends \stdClass{ $this->buffer .= Binary::writeLInt($v); } - public function getShort($signed = true){ - return $signed ? Binary::readSignedShort($this->get(2)) : Binary::readShort($this->get(2)); + public function getSignedShort(){ + return Binary::readSignedShort($this->get(2)); } public function putShort($v){ $this->buffer .= Binary::writeShort($v); } + public function getShort(){ + return Binary::readShort($this->get(2)); + } + + public function putSignedShort($v){ + $this->buffer .= Binary::writeShort($v); + } + public function getFloat(){ return Binary::readFloat($this->get(4)); } @@ -188,7 +196,7 @@ class BinaryStream extends \stdClass{ } public function getSlot(){ - $id = $this->getShort(true); + $id = $this->getSignedShort(); if($id <= 0){ return Item::get(0, 0, 0);