mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Merge branch 'master' into mcpe-1.0
This commit is contained in:
commit
d9eb767420
@ -65,6 +65,7 @@ namespace {
|
||||
}
|
||||
|
||||
namespace pocketmine {
|
||||
use pocketmine\network\protocol\Info as ProtocolInfo;
|
||||
use pocketmine\utils\Binary;
|
||||
use pocketmine\utils\MainLogger;
|
||||
use pocketmine\utils\ServerKiller;
|
||||
@ -76,8 +77,6 @@ namespace pocketmine {
|
||||
const VERSION = "1.6.2dev";
|
||||
const API_VERSION = "2.2.0";
|
||||
const CODENAME = "Unleashed";
|
||||
const MINECRAFT_VERSION = "v1.0.0.2";
|
||||
const MINECRAFT_VERSION_NETWORK = "1.0.0.2";
|
||||
|
||||
/*
|
||||
* Startup code. Do not look at it, it may harm you.
|
||||
@ -146,6 +145,16 @@ namespace pocketmine {
|
||||
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
|
||||
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
|
||||
|
||||
/**
|
||||
* @deprecated This constant has moved to {@link \pocketmine\network\protocol\Info} and will be removed from here in the future.
|
||||
*/
|
||||
const MINECRAFT_VERSION = ProtocolInfo::MINECRAFT_VERSION;
|
||||
/**
|
||||
* @deprecated This constant has moved to {@link \pocketmine\network\protocol\Info} and will be removed from here in the future.
|
||||
*/
|
||||
const MINECRAFT_VERSION_NETWORK = ProtocolInfo::MINECRAFT_VERSION_NETWORK;
|
||||
|
||||
|
||||
Terminal::init();
|
||||
|
||||
define('pocketmine\ANSI', Terminal::hasFormattingCodes());
|
||||
|
@ -87,6 +87,7 @@ use pocketmine\network\Network;
|
||||
use pocketmine\network\protocol\BatchPacket;
|
||||
use pocketmine\network\protocol\CraftingDataPacket;
|
||||
use pocketmine\network\protocol\DataPacket;
|
||||
use pocketmine\network\protocol\Info as ProtocolInfo;
|
||||
use pocketmine\network\protocol\PlayerListPacket;
|
||||
use pocketmine\network\query\QueryHandler;
|
||||
use pocketmine\network\RakLibInterface;
|
||||
@ -301,7 +302,7 @@ class Server{
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion(){
|
||||
return \pocketmine\MINECRAFT_VERSION;
|
||||
return ProtocolInfo::MINECRAFT_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ class DoublePlant extends Flowable{
|
||||
public function onUpdate($type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent() === true){ //Replace with common break method
|
||||
$this->getLevel()->setBlock($this, new Air(), false, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\tag\ByteTag;
|
||||
@ -31,16 +30,9 @@ use pocketmine\nbt\tag\DoubleTag;
|
||||
use pocketmine\nbt\tag\FloatTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\Player;
|
||||
|
||||
abstract class Fallable extends Solid{
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$ret = $this->getLevel()->setBlock($this, $this, true, true);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||
|
@ -124,11 +124,16 @@ class Ladder extends Transparent{
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
/*if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
|
||||
Server::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1));
|
||||
$this->getLevel()->setBlock($this, new Air(), true, true, true);
|
||||
$sides = [
|
||||
2 => 3,
|
||||
3 => 2,
|
||||
4 => 5,
|
||||
5 => 4
|
||||
];
|
||||
if(!$this->getSide($sides[$this->meta])->isSolid()){ //Replace with common break method
|
||||
$this->level->useBreakOn($this);
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -129,7 +129,7 @@ class Leaves extends Transparent{
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if(($this->meta & 0b00001100) === 0){
|
||||
$this->meta |= 0x08;
|
||||
$this->getLevel()->setBlock($this, $this, false, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true, false);
|
||||
}
|
||||
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
|
||||
if(($this->meta & 0b00001100) === 0x08){
|
||||
|
@ -112,7 +112,7 @@ class Leaves2 extends Leaves{
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if(($this->meta & 0b00001100) === 0){
|
||||
$this->meta |= 0x08;
|
||||
$this->getLevel()->setBlock($this, $this, false, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true, false);
|
||||
}
|
||||
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
|
||||
if(($this->meta & 0b00001100) === 0x08){
|
||||
|
@ -62,7 +62,7 @@ class TallGrass extends Flowable{
|
||||
public function onUpdate($type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent() === true){ //Replace with common break method
|
||||
$this->getLevel()->setBlock($this, new Air(), false, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ class Vine extends Transparent{
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
/*if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
|
||||
Server::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1));
|
||||
$this->getLevel()->setBlock($this, new Air(), true, true, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true, true);
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}*/
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class CommandReader extends Thread{
|
||||
/** @var \Threaded */
|
||||
protected $buffer;
|
||||
private $shutdown = false;
|
||||
private $streamBlocking = false;
|
||||
|
||||
public function __construct(){
|
||||
$this->buffer = new \Threaded;
|
||||
@ -40,15 +41,28 @@ class CommandReader extends Thread{
|
||||
$this->shutdown = true;
|
||||
}
|
||||
|
||||
private function initStdin(){
|
||||
global $stdin;
|
||||
$stdin = fopen("php://stdin", "r");
|
||||
$this->streamBlocking = (stream_set_blocking($stdin, 0) === false);
|
||||
}
|
||||
|
||||
private function readLine(){
|
||||
if(!$this->readline){
|
||||
global $stdin;
|
||||
|
||||
if(!is_resource($stdin)){
|
||||
return "";
|
||||
$this->initStdin();
|
||||
}
|
||||
|
||||
return trim(fgets($stdin));
|
||||
$line = fgets($stdin);
|
||||
|
||||
if($line === false and $this->streamBlocking === true){ //windows sucks
|
||||
$this->initStdin();
|
||||
$line = fgets($stdin);
|
||||
}
|
||||
|
||||
return trim($line);
|
||||
}else{
|
||||
$line = trim(readline("> "));
|
||||
if($line != ""){
|
||||
@ -74,9 +88,7 @@ class CommandReader extends Thread{
|
||||
|
||||
public function run(){
|
||||
if(!$this->readline){
|
||||
global $stdin;
|
||||
$stdin = fopen("php://stdin", "r");
|
||||
stream_set_blocking($stdin, 0);
|
||||
$this->initStdin();
|
||||
}
|
||||
|
||||
$lastLine = microtime(true);
|
||||
@ -91,6 +103,11 @@ class CommandReader extends Thread{
|
||||
|
||||
$lastLine = microtime(true);
|
||||
}
|
||||
|
||||
if(!$this->readline){
|
||||
global $stdin;
|
||||
fclose($stdin);
|
||||
}
|
||||
}
|
||||
|
||||
public function getThreadName(){
|
||||
|
@ -172,7 +172,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
$this->interface->sendOption("name",
|
||||
"MCPE;" . addcslashes($name, ";") . ";" .
|
||||
Info::CURRENT_PROTOCOL . ";" .
|
||||
\pocketmine\MINECRAFT_VERSION_NETWORK . ";" .
|
||||
Info::MINECRAFT_VERSION_NETWORK . ";" .
|
||||
$info->getPlayerCount() . ";" .
|
||||
$info->getMaxPlayerCount()
|
||||
);
|
||||
|
@ -31,6 +31,8 @@ interface Info{
|
||||
* Actual Minecraft: PE protocol version
|
||||
*/
|
||||
const CURRENT_PROTOCOL = 100;
|
||||
const MINECRAFT_VERSION = "v1.0.0.16";
|
||||
const MINECRAFT_VERSION_NETWORK = "1.0.0.16";
|
||||
|
||||
const LOGIN_PACKET = 0x01;
|
||||
const PLAY_STATUS_PACKET = 0x02;
|
||||
|
@ -105,7 +105,7 @@ class ScriptPluginLoader implements PluginLoader{
|
||||
$data[$key] = $content;
|
||||
}
|
||||
|
||||
if($insideHeader and strpos($line, "**/") !== false){
|
||||
if($insideHeader and strpos($line, "*/") !== false){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
echo -e "version\nmakeserver\nstop\n" | php src/pocketmine/PocketMine.php --no-wizard --disable-ansi --disable-readline
|
||||
echo -e "version\nmakeserver\nstop\n" | php src/pocketmine/PocketMine.php --no-wizard --disable-ansi --disable-readline --debug.level=2
|
||||
if ls plugins/DevTools/PocketMine*.phar >/dev/null 2>&1; then
|
||||
echo Server phar created successfully.
|
||||
else
|
||||
echo No phar created!
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user