Merge branch master

This commit is contained in:
Jorge González
2016-05-18 10:07:57 -05:00
parent 012d46dfd8
commit 292a212827
11 changed files with 33 additions and 39 deletions

2
.gitignore vendored
View File

@ -7,7 +7,7 @@ timings/*
*.txt *.txt
*.phar *.phar
server.properties server.properties
pocketmine.yml /pocketmine.yml
# Common IDEs # Common IDEs
.idea/* .idea/*

View File

@ -1177,6 +1177,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$pk = new AdventureSettingsPacket(); $pk = new AdventureSettingsPacket();
$pk->flags = $flags; $pk->flags = $flags;
$pk->userPermission = 2;
$pk->globalPermission = 2;
$this->dataPacket($pk); $this->dataPacket($pk);
} }

View File

@ -75,8 +75,8 @@ namespace pocketmine {
const VERSION = "1.6dev"; const VERSION = "1.6dev";
const API_VERSION = "2.0.0"; const API_VERSION = "2.0.0";
const CODENAME = "[REDACTED]"; const CODENAME = "[REDACTED]";
const MINECRAFT_VERSION = "v0.14.0.0 alpha"; const MINECRAFT_VERSION = "v0.14.2.0 alpha";
const MINECRAFT_VERSION_NETWORK = "0.14.0.0"; const MINECRAFT_VERSION_NETWORK = "0.14.2.0";
/* /*
* Startup code. Do not look at it, it may harm you. * Startup code. Do not look at it, it may harm you.

View File

@ -22,51 +22,27 @@
namespace pocketmine\block; namespace pocketmine\block;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level; use pocketmine\level\Level;
class GlowingRedstoneOre extends Solid{ class GlowingRedstoneOre extends RedstoneOre{
protected $id = self::GLOWING_REDSTONE_ORE; protected $id = self::GLOWING_REDSTONE_ORE;
public function __construct(){
}
public function getHardness(){
return 15;
}
public function getName(){ public function getName(){
return "Glowing Redstone Ore"; return "Glowing Redstone Ore";
} }
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){ public function getLightLevel(){
return 9; return 9;
} }
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){ if($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){
$this->getLevel()->setBlock($this, Block::get(Item::REDSTONE_ORE, $this->meta), false, false, true); $this->getLevel()->setBlock($this, Block::get(Item::REDSTONE_ORE, $this->meta), false, false);
return Level::BLOCK_UPDATE_WEAK; return Level::BLOCK_UPDATE_WEAK;
} }
return false; return false;
} }
public function getDrops(Item $item){
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
];
}else{
return [];
}
}
} }

View File

@ -43,7 +43,7 @@ class RedstoneOre extends Solid{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL or $type === Level::BLOCK_UPDATE_TOUCH){ if($type === Level::BLOCK_UPDATE_NORMAL or $type === Level::BLOCK_UPDATE_TOUCH){
$this->getLevel()->setBlock($this, Block::get(Item::GLOWING_REDSTONE_ORE, $this->meta), false, true); $this->getLevel()->setBlock($this, Block::get(Item::GLOWING_REDSTONE_ORE, $this->meta));
return Level::BLOCK_UPDATE_WEAK; return Level::BLOCK_UPDATE_WEAK;
} }
@ -51,14 +51,12 @@ class RedstoneOre extends Solid{
return false; return false;
} }
public function getToolType(){ public function getToolType(){
return Tool::TYPE_PICKAXE; return Tool::TYPE_PICKAXE;
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= Tool::TIER_GOLD){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)], [Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
]; ];

View File

@ -139,7 +139,13 @@ class BaseLang{
for($i = 0; $i < $len; ++$i){ for($i = 0; $i < $len; ++$i){
$c = $text{$i}; $c = $text{$i};
if($replaceString !== null){ if($replaceString !== null){
if((ord($c) >= 0x30 and ord($c) <= 0x39) or (ord($c) >= 0x41 and ord($c) <= 0x5a) or (ord($c) >= 0x61 and ord($c) <= 0x7a) or $c === "."){ $ord = ord($c);
if(
($ord >= 0x30 and $ord <= 0x39) // 0-9
or ($ord >= 0x41 and $ord <= 0x5a) // A-Z
or ($ord >= 0x61 and $ord <= 0x7a) or // a-z
$c === "." or $c === "-"
){
$replaceString .= $c; $replaceString .= $c;
}else{ }else{
if(($t = $this->internalGet(substr($replaceString, 1))) !== null and ($onlyPrefix === null or strpos($replaceString, $onlyPrefix) === 1)){ if(($t = $this->internalGet(substr($replaceString, 1))) !== null and ($onlyPrefix === null or strpos($replaceString, $onlyPrefix) === 1)){

View File

@ -28,6 +28,8 @@ class AdventureSettingsPacket extends DataPacket{
const NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET; const NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET;
public $flags; public $flags;
public $userPermission;
public $globalPermission;
public function decode(){ public function decode(){
@ -36,6 +38,8 @@ class AdventureSettingsPacket extends DataPacket{
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putInt($this->flags); $this->putInt($this->flags);
$this->putInt($this->userPermission);
$this->putInt($this->globalPermission);
} }
} }

View File

@ -30,7 +30,7 @@ interface Info{
/** /**
* Actual Minecraft: PE protocol version * Actual Minecraft: PE protocol version
*/ */
const CURRENT_PROTOCOL = 45; const CURRENT_PROTOCOL = 60;
const LOGIN_PACKET = 0x8f; const LOGIN_PACKET = 0x8f;
const PLAY_STATUS_PACKET = 0x90; const PLAY_STATUS_PACKET = 0x90;

View File

@ -38,6 +38,7 @@ class StartGamePacket extends DataPacket{
public $x; public $x;
public $y; public $y;
public $z; public $z;
public $unknown;
public function decode(){ public function decode(){
@ -56,7 +57,10 @@ class StartGamePacket extends DataPacket{
$this->putFloat($this->x); $this->putFloat($this->x);
$this->putFloat($this->y); $this->putFloat($this->y);
$this->putFloat($this->z); $this->putFloat($this->z);
$this->putByte(1);
$this->putByte(1);
$this->putByte(0); $this->putByte(0);
$this->putString($this->unknown);
} }
} }

View File

@ -68,7 +68,7 @@ class PluginManager{
protected $defaultPermsOp = []; protected $defaultPermsOp = [];
/** /**
* @var Permissible[] * @var Permissible[][]
*/ */
protected $permSubs = []; protected $permSubs = [];

View File

@ -94,9 +94,13 @@ class ScriptPluginLoader implements PluginLoader{
$insideHeader = true; $insideHeader = true;
} }
if(preg_match("/^[ \t]+\\*[ \t]+@([a-zA-Z]+)[ \t]+(.*)$/", $line, $matches) > 0){ if(preg_match("/^[ \t]+\\*[ \t]+@([a-zA-Z]+)([ \t]+(.*))?$/", $line, $matches) > 0){
$key = $matches[1]; $key = $matches[1];
$content = trim($matches[2]); $content = trim($matches[3] ?? "");
if($key === "notscript"){
return null;
}
$data[$key] = $content; $data[$key] = $content;
} }
@ -157,4 +161,4 @@ class ScriptPluginLoader implements PluginLoader{
$plugin->setEnabled(false); $plugin->setEnabled(false);
} }
} }
} }