Added Inventory interfaces and types, updated long array() to []

This commit is contained in:
Shoghi Cervantes
2014-05-22 18:59:16 +02:00
parent 0be679c9d5
commit 6cbd39de9b
102 changed files with 637 additions and 334 deletions

View File

@@ -24,8 +24,8 @@ namespace pocketmine\network\protocol;
class ContainerSetContentPacket extends DataPacket{
public $windowid;
public $slots = array();
public $hotbar = array();
public $slots = [];
public $hotbar = [];
public function pid(){
return Info::CONTAINER_SET_CONTENT_PACKET;

View File

@@ -137,7 +137,7 @@ abstract class DataPacket extends \stdClass{
}
protected function getDataArray($len = 10){
$data = array();
$data = [];
for($i = 1; $i <= $len and !$this->feof(); ++$i){
$data[] = $this->get($this->getTriad());
}
@@ -145,7 +145,7 @@ abstract class DataPacket extends \stdClass{
return $data;
}
protected function putDataArray(array $data = array()){
protected function putDataArray(array $data = []){
foreach($data as $v){
$this->putTriad(strlen($v));
$this->put($v);

View File

@@ -24,7 +24,7 @@ namespace pocketmine\network\protocol;
class PlayerArmorEquipmentPacket extends DataPacket{
public $eid;
public $slots = array();
public $slots = [];
public function pid(){
return Info::PLAYER_ARMOR_EQUIPMENT_PACKET;

View File

@@ -25,8 +25,8 @@ namespace pocketmine\network\protocol;
class SendInventoryPacket extends DataPacket{
public $eid;
public $windowid;
public $slots = array();
public $armor = array();
public $slots = [];
public $armor = [];
public function pid(){
return Info::SEND_INVENTORY_PACKET;

View File

@@ -84,7 +84,7 @@ use pocketmine\utils\Utils;
class Packet extends NetworkPacket{
private $packetID;
private $offset = 1;
public $data = array();
public $data = [];
public function __construct($packetID){
$this->packetID = (int) $packetID;
@@ -172,7 +172,7 @@ class Packet extends NetworkPacket{
case Info::DATA_PACKET_E:
case Info::DATA_PACKET_F:
$this->seqNumber = $this->getLTriad();
$this->data = array();
$this->data = [];
while(!$this->feof() and $this->parseDataPacket() !== false){
}
@@ -180,7 +180,7 @@ class Packet extends NetworkPacket{
case Info::NACK:
case Info::ACK:
$count = $this->getShort();
$this->packets = array();
$this->packets = [];
for($i = 0; $i < $count and !$this->feof(); ++$i){
if($this->getByte() === 0){
$start = $this->getLTriad();

View File

@@ -41,7 +41,7 @@ class RCON{
private $rconSender;
public function __construct($password, $port = 19132, $interface = "0.0.0.0", $threads = 1, $clientsPerThread = 50){
$this->workers = array();
$this->workers = [];
$this->password = (string) $password;
console("[INFO] Starting remote control listener");
if($this->password === ""){