diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index befe7c73c..b202e0f05 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -263,7 +263,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade } public function getClientSecret(){ - return $this->clientSecretId; + return $this->clientSecret; } public function isBanned(){ @@ -1691,7 +1691,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(); @@ -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; @@ -1809,7 +1810,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $this->setNameTag($this->username); $this->iusername = strtolower($this->username); - 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; } 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); +} 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); diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 173d367bb..dec5d55aa 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -872,7 +872,7 @@ class Level implements ChunkManager, Metadatable{ } if(count($this->blockCache) > 2048){ - $this->chunkCache = []; + $this->blockCache = []; } } @@ -2340,7 +2340,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] = []; 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 @@ +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: 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(){ 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); 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 +}