From c7b915639db3b3915b24865b1a837aaf794af00d Mon Sep 17 00:00:00 2001 From: LouisBHirst Date: Sun, 13 Sep 2015 11:43:51 -0400 Subject: [PATCH 1/4] getOnlinePlayers() only returns the players already connected --- 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 ae38135f3..9dc8a8e36 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1624,7 +1624,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $this->uuid = Utils::dataToUUID($this->randomClientId, $this->iusername, $this->getAddress()); - if(count($this->server->getOnlinePlayers()) > $this->server->getMaxPlayers() and $this->kick("disconnectionScreen.serverFull", false)){ + if(count($this->server->getOnlinePlayers()) >= $this->server->getMaxPlayers() and $this->kick("disconnectionScreen.serverFull", false)){ break; } From 24f8de2cc3a82c6651b93040f2a1e8d04961d977 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 14 Sep 2015 20:25:46 +0200 Subject: [PATCH 2/4] Bad hack, TODO REMOVE, workarounds client bug by sending inventory contents specifically for creative players <-- this commit is full of sadness --- src/pocketmine/Player.php | 1 + src/pocketmine/inventory/PlayerInventory.php | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index cd46b5c1e..b202e0f05 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1706,6 +1706,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $pk = new StartGamePacket(); $pk->seed = -1; + $pk->dimension = 0; $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; diff --git a/src/pocketmine/inventory/PlayerInventory.php b/src/pocketmine/inventory/PlayerInventory.php index db3cac450..e788421c6 100644 --- a/src/pocketmine/inventory/PlayerInventory.php +++ b/src/pocketmine/inventory/PlayerInventory.php @@ -383,10 +383,17 @@ class PlayerInventory extends BaseInventory{ } $pk = new ContainerSetContentPacket(); - $pk; $pk->slots = []; - for($i = 0; $i < $this->getSize(); ++$i){ //Do not send armor by error here - $pk->slots[$i] = $this->getItem($i); + $holder = $this->getHolder(); + if($holder instanceof Player and $holder->isCreative()){ + //TODO: Remove this workaround because of broken client + foreach(Item::getCreativeItems() as $i => $item){ + $pk->slots[$i] = Item::getCreativeItem($i); + } + }else{ + for($i = 0; $i < $this->getSize(); ++$i){ //Do not send armor by error here + $pk->slots[$i] = $this->getItem($i); + } } foreach($target as $player){ @@ -416,7 +423,6 @@ class PlayerInventory extends BaseInventory{ } $pk = new ContainerSetSlotPacket(); - $pk; $pk->slot = $index; $pk->item = clone $this->getItem($index); From ed559fdf98456b9bb6ff77c1bf09da397f91ecf8 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 15 Sep 2015 12:23:15 +0200 Subject: [PATCH 3/4] Fixed not sending UUIDs properly --- src/pocketmine/scheduler/SendUsageTask.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/scheduler/SendUsageTask.php b/src/pocketmine/scheduler/SendUsageTask.php index 632d0563a..fbd285afa 100644 --- a/src/pocketmine/scheduler/SendUsageTask.php +++ b/src/pocketmine/scheduler/SendUsageTask.php @@ -25,6 +25,7 @@ use pocketmine\network\protocol\Info; use pocketmine\Server; use pocketmine\utils\Utils; use pocketmine\utils\VersionString; +use pocketmine\utils\UUID; class SendUsageTask extends AsyncTask{ @@ -39,9 +40,9 @@ class SendUsageTask extends AsyncTask{ $endpoint = "http://" . $server->getProperty("anonymous-statistics.host", "stats.pocketmine.net") . "/"; $data = []; - $data["uniqueServerId"] = $server->getServerUniqueId(); - $data["uniqueMachineId"] = Utils::getMachineUniqueId(); - $data["uniqueRequestId"] = Utils::dataToUUID($server->getServerUniqueId(), microtime(true)); + $data["uniqueServerId"] = $server->getServerUniqueId()->toString(); + $data["uniqueMachineId"] = Utils::getMachineUniqueId()->toString(); + $data["uniqueRequestId"] = UUID::fromData($server->getServerUniqueId(), microtime(true))->toString(); switch($type){ case self::TYPE_OPEN: From 9665dfd63eb75afafacee9e657dac6baaa3ee0fb Mon Sep 17 00:00:00 2001 From: 0929hitoshi Date: Wed, 16 Sep 2015 01:21:07 +0900 Subject: [PATCH 4/4] Changing the return value of getName --- src/pocketmine/tile/EnchantTable.php | 2 +- src/pocketmine/tile/Furnace.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/tile/EnchantTable.php b/src/pocketmine/tile/EnchantTable.php index 09e3cfc48..a94ae40bc 100644 --- a/src/pocketmine/tile/EnchantTable.php +++ b/src/pocketmine/tile/EnchantTable.php @@ -29,7 +29,7 @@ class EnchantTable extends Spawnable implements Nameable{ public function getName(){ - return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Chest"; + return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Enchanting Table"; } public function hasName(){ diff --git a/src/pocketmine/tile/Furnace.php b/src/pocketmine/tile/Furnace.php index e24a0bb86..6da32496c 100644 --- a/src/pocketmine/tile/Furnace.php +++ b/src/pocketmine/tile/Furnace.php @@ -71,7 +71,7 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{ } public function getName(){ - return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Chest"; + return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Furnace"; } public function hasName(){