diff --git a/resources/server-icon.png b/resources/server-icon.png new file mode 100644 index 00000000..1a5bef5b Binary files /dev/null and b/resources/server-icon.png differ diff --git a/src/shoghicp/BigBrother/network/protocol/BlockChangePacket.php b/src/shoghicp/BigBrother/network/protocol/BlockChangePacket.php new file mode 100644 index 00000000..3772054a --- /dev/null +++ b/src/shoghicp/BigBrother/network/protocol/BlockChangePacket.php @@ -0,0 +1,45 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class BlockChangePacket extends Packet{ + + public $x; + public $y; + public $z; + public $blockId; + public $blockMeta; + + public function pid(){ + return 0x23; + } + + public function encode(){ + $this->putInt($this->x); + $this->putByte($this->y); + $this->putInt($this->z); + $this->putVarInt($this->blockId); + $this->putByte($this->blockMeta); + } + + public function decode(){ + + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/network/protocol/EntityHeadLookPacket.php b/src/shoghicp/BigBrother/network/protocol/EntityHeadLookPacket.php new file mode 100644 index 00000000..8cd24150 --- /dev/null +++ b/src/shoghicp/BigBrother/network/protocol/EntityHeadLookPacket.php @@ -0,0 +1,39 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class EntityHeadLookPacket extends Packet{ + + public $eid; + public $yaw; + + public function pid(){ + return 0x19; + } + + public function encode(){ + $this->putInt($this->eid); + $this->putByte((int) ($this->yaw * (256 / 360))); + } + + public function decode(){ + + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/network/protocol/PlayerBlockPlacementPacket.php b/src/shoghicp/BigBrother/network/protocol/PlayerBlockPlacementPacket.php new file mode 100644 index 00000000..47b4033c --- /dev/null +++ b/src/shoghicp/BigBrother/network/protocol/PlayerBlockPlacementPacket.php @@ -0,0 +1,52 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class PlayerBlockPlacementPacket extends Packet{ + + public $x; + public $y; + public $z; + public $direction; + /** @var \pocketmine\item\Item */ + public $heldItem; + public $cursorX; + public $cursorY; + public $cursorZ; + + public function pid(){ + return 0x08; + } + + public function encode(){ + + } + + public function decode(){ + $this->x = $this->getInt(); + $this->y = $this->getByte(); + $this->z = $this->getInt(); + $this->direction = $this->getByte(); + $this->heldItem = $this->getSlot(); + $this->cursorX = $this->getByte(); + $this->cursorY = $this->getByte(); + $this->cursorZ = $this->getByte(); + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/network/protocol/PlayerDiggingPacket.php b/src/shoghicp/BigBrother/network/protocol/PlayerDiggingPacket.php new file mode 100644 index 00000000..63fd28ad --- /dev/null +++ b/src/shoghicp/BigBrother/network/protocol/PlayerDiggingPacket.php @@ -0,0 +1,45 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class PlayerDiggingPacket extends Packet{ + + public $status; + public $x; + public $y; + public $z; + public $face; + + public function pid(){ + return 0x07; + } + + public function encode(){ + + } + + public function decode(){ + $this->status = $this->getByte(); + $this->x = $this->getInt(); + $this->y = $this->getByte(); + $this->z = $this->getInt(); + $this->face = $this->getByte(); + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/utils/AES.php b/src/shoghicp/BigBrother/utils/AES.php new file mode 100644 index 00000000..c09fba11 --- /dev/null +++ b/src/shoghicp/BigBrother/utils/AES.php @@ -0,0 +1,67 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\utils; + +class AES{ + private $key, $keyLenght, $IV, $IVLenght, $enc, $dec, $mode, $algorithm; + + function __construct($bits, $mode, $blockSize){ + $this->algorithm = "rijndael-".intval($bits); + $this->mode = strtolower($mode); + $mcrypt = mcrypt_module_open($this->algorithm, "", $this->mode, ""); + $this->IVLenght = mcrypt_enc_get_iv_size($mcrypt); + mcrypt_module_close($mcrypt); + $this->keyLenght = $bits >> 3; + $this->setKey(); + $this->setIV(); + $this->init(); + } + + public function init(){ + if(is_resource($this->enc)){ + mcrypt_generic_deinit($this->enc); + mcrypt_module_close($this->enc); + } + $this->enc = mcrypt_module_open($this->algorithm, "", $this->mode, ""); + mcrypt_generic_init($this->enc, $this->key, $this->IV); + + if(is_resource($this->dec)){ + mcrypt_generic_deinit($this->dec); + mcrypt_module_close($this->dec); + } + $this->dec = mcrypt_module_open($this->algorithm, "", $this->mode, ""); + mcrypt_generic_init($this->dec, $this->key, $this->IV); + } + + public function setKey($key = ""){ + $this->key = str_pad($key, $this->keyLenght, "\x00", STR_PAD_RIGHT); + } + + public function setIV($IV = ""){ + $this->IV = str_pad($IV, $this->IVLenght, "\x00", STR_PAD_RIGHT); + } + + public function encrypt($plaintext){ + return mcrypt_generic($this->enc, $plaintext); + } + + public function decrypt($ciphertext){ + return mdecrypt_generic($this->dec, $ciphertext); + } + +} \ No newline at end of file