It staaaarts!

This commit is contained in:
Shoghi Cervantes 2014-03-06 20:41:04 +01:00
parent 56d3b89f57
commit 331a26931f
183 changed files with 1220 additions and 1192 deletions

View File

@ -19,347 +19,354 @@
* *
*/ */
namespace PocketMine; namespace{
function console($message, $EOL = true, $log = true, $level = 1){
const VERSION = "Alpha_1.4dev"; return PocketMine\console($message, $EOL, $log, $level);
const API_VERSION = "1.0.0";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.8.1 alpha";
const PHP_VERSION = "5.5";
\spl_autoload_register(function ($load){
$path = explode('\\', trim($load, '\\'));
if(($parent = array_shift($path)) === "PocketMine"){ //part of the PocketMine-MP code
$className = array_pop($path);
if(count($path) > 0){
$path = implode(DIRECTORY_SEPARATOR, array_map("strtolower", $path)) . DIRECTORY_SEPARATOR;
}else{
$path = "";
}
$fPath = \PocketMine\PATH . "src" . DIRECTORY_SEPARATOR . $path . $className . ".php";
if(file_exists($fPath)){
require_once($fPath);
}
}else{ //Try plugin
$className = array_pop($path);
if(count($path) > 0){
$path = implode(DIRECTORY_SEPARATOR, array_map("strtolower", $path)) . DIRECTORY_SEPARATOR;
}else{
$path = "";
}
$fPath = \PocketMine\PATH . "plugins". DIRECTORY_SEPARATOR . $parent . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR . $path . $className . ".php";
if(file_exists($fPath)){
require_once($fPath);
}
} }
}); }
define("PocketMine\PATH", realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR); namespace PocketMine{
const VERSION = "Alpha_1.4dev";
const API_VERSION = "1.0.0";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.8.1 alpha";
const PHP_VERSION = "5.5";
//Startup code. Do not look at it, it can harm you. Most of them are hacks to fix date-related bugs, or basic functions used after this \spl_autoload_register(function ($load){
$path = explode('\\', trim($load, '\\'));
if(($parent = array_shift($path)) === "PocketMine"){ //part of the PocketMine-MP code
$className = array_pop($path);
if(count($path) > 0){
$path = implode(DIRECTORY_SEPARATOR, array_map("strtolower", $path)) . DIRECTORY_SEPARATOR;
}else{
$path = "";
}
$fPath = \PocketMine\PATH . "src" . DIRECTORY_SEPARATOR . $path . $className . ".php";
if(file_exists($fPath)){
require_once($fPath);
}
}else{ //Try plugin
$className = array_pop($path);
if(count($path) > 0){
$path = implode(DIRECTORY_SEPARATOR, array_map("strtolower", $path)) . DIRECTORY_SEPARATOR;
}else{
$path = "";
}
$fPath = \PocketMine\PATH . "plugins". DIRECTORY_SEPARATOR . $parent . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR . $path . $className . ".php";
if(file_exists($fPath)){
require_once($fPath);
}
}
});
set_time_limit(0); //Who set it to 30 seconds?!?! define("PocketMine\PATH", realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
if(ini_get("date.timezone") == ""){ //No Timezone set //Startup code. Do not look at it, it can harm you. Most of them are hacks to fix date-related bugs, or basic functions used after this
date_default_timezone_set("GMT");
if(strpos(" ".strtoupper(php_uname("s")), " WIN") !== false){
$time = time();
$time -= $time % 60;
//TODO: Parse different time & date formats by region. ¬¬ world
//Example: USA
exec("time.exe /T", $hour);
$i = array_map("intval", explode(":", trim($hour[0])));
exec("date.exe /T", $date);
$j = array_map("intval", explode(substr($date[0], 2, 1), trim($date[0])));
$offset = round((mktime($i[0], $i[1], 0, $j[1], $j[0], $j[2]) - $time) / 60) * 60;
}else{
exec("date +%s", $t);
$offset = round((intval(trim($t[0])) - time()) / 60) * 60;
}
$daylight = (int) date("I"); set_time_limit(0); //Who set it to 30 seconds?!?!
$d = timezone_name_from_abbr("", $offset, $daylight);
@ini_set("date.timezone", $d); if(ini_get("date.timezone") == ""){ //No Timezone set
date_default_timezone_set($d); date_default_timezone_set("GMT");
}else{ if(strpos(" ".strtoupper(php_uname("s")), " WIN") !== false){
$d = @date_default_timezone_get(); $time = time();
if(strpos($d, "/") === false){ $time -= $time % 60;
$d = timezone_name_from_abbr($d); //TODO: Parse different time & date formats by region. ¬¬ world
//Example: USA
exec("time.exe /T", $hour);
$i = array_map("intval", explode(":", trim($hour[0])));
exec("date.exe /T", $date);
$j = array_map("intval", explode(substr($date[0], 2, 1), trim($date[0])));
$offset = round((mktime($i[0], $i[1], 0, $j[1], $j[0], $j[2]) - $time) / 60) * 60;
}else{
exec("date +%s", $t);
$offset = round((intval(trim($t[0])) - time()) / 60) * 60;
}
$daylight = (int) date("I");
$d = timezone_name_from_abbr("", $offset, $daylight);
@ini_set("date.timezone", $d); @ini_set("date.timezone", $d);
date_default_timezone_set($d); date_default_timezone_set($d);
}
}
gc_enable();
error_reporting(E_ALL | E_STRICT);
ini_set("allow_url_fopen", 1);
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
ini_set("default_charset", "utf-8");
ini_set("memory_limit", "128M"); //Default
define("PocketMine\START_TIME", microtime(true));
$opts = getopt("", array("enable-ansi", "disable-ansi", "data-path:", "no-wizard"));
define("PocketMine\DATA", isset($opts["data-path"]) ? realpath($opts["data-path"]) . DIRECTORY_SEPARATOR : PATH);
if((strpos(strtoupper(php_uname("s")), "WIN") or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])){
define("PocketMine\ANSI", true);
}else{
define("PocketMine\ANSI", false);
}
function dummy(){
}
function safe_var_dump($var, $cnt = 0){
switch(true){
case is_array($var):
echo str_repeat(" ", $cnt)."array(".count($var).") {".PHP_EOL;
foreach($var as $key => $value){
echo str_repeat(" ", $cnt + 1)."[".(is_integer($key) ? $key:'"'.$key.'"')."]=>".PHP_EOL;
safe_var_dump($value, $cnt + 1);
}
echo str_repeat(" ", $cnt)."}".PHP_EOL;
break;
case is_integer($var):
echo str_repeat(" ", $cnt)."int(".$var.")".PHP_EOL;
break;
case is_float($var):
echo str_repeat(" ", $cnt)."float(".$var.")".PHP_EOL;
break;
case is_bool($var):
echo str_repeat(" ", $cnt)."bool(".($var === true ? "true":"false").")".PHP_EOL;
break;
case is_string($var):
echo str_repeat(" ", $cnt)."string(".strlen($var).") \"$var\"".PHP_EOL;
break;
case is_resource($var):
echo str_repeat(" ", $cnt)."resource() of type (".get_resource_type($var).")".PHP_EOL;
break;
case is_object($var):
echo str_repeat(" ", $cnt)."object(".get_class($var).")".PHP_EOL;
break;
case is_null($var):
echo str_repeat(" ", $cnt)."NULL".PHP_EOL;
break;
}
}
function kill($pid){
switch(Utils\Utils::getOS()){
case "win":
exec("taskkill.exe /F /PID ".((int) $pid)." > NUL");
break;
case "mac":
case "linux":
default:
exec("kill -9 ".((int) $pid)." > /dev/null 2>&1");
}
}
function hard_unset(&$var){
if(is_object($var)){
$unset = new \ReflectionClass($var);
foreach($unset->getProperties() as $prop){
$prop->setAccessible(true);
@hard_unset($prop->getValue($var));
$prop->setValue($var, null);
}
$var = null;
unset($var);
}elseif(is_array($var)){
foreach($var as $i => $v){
hard_unset($var[$i]);
}
$var = null;
unset($var);
}else{ }else{
$var = null; $d = @date_default_timezone_get();
unset($var); if(strpos($d, "/") === false){
} $d = timezone_name_from_abbr($d);
} @ini_set("date.timezone", $d);
date_default_timezone_set($d);
function console($message, $EOL = true, $log = true, $level = 1){
if(!defined("DEBUG") or DEBUG >= $level){
$message .= $EOL === true ? PHP_EOL:"";
$time = (ANSI === true ? Utils\TextFormat::AQUA . date("H:i:s") . Utils\TextFormat::RESET:date("H:i:s")) . " ";
$replaced = Utils\TextFormat::clean(preg_replace('/\x1b\[[0-9;]*m/', "", $time . $message));
if($log === true and (!defined("LOG") or LOG === true)){
log(date("Y-m-d")." ".$replaced, "console", false, $level);
} }
if(ANSI === true){ }
$add = "";
if(preg_match("/\[([a-zA-Z0-9]*)\]/", $message, $matches) > 0){ gc_enable();
switch($matches[1]){ error_reporting(E_ALL | E_STRICT);
case "ERROR": ini_set("allow_url_fopen", 1);
case "SEVERE": ini_set("display_errors", 1);
$add .= Utils\TextFormat::RED; ini_set("display_startup_errors", 1);
break; ini_set("default_charset", "utf-8");
case "INTERNAL":
case "DEBUG": ini_set("memory_limit", "128M"); //Default
$add .= Utils\TextFormat::GRAY; define("PocketMine\START_TIME", microtime(true));
break;
case "WARNING": $opts = getopt("", array("enable-ansi", "disable-ansi", "data-path:", "no-wizard"));
$add .= Utils\TextFormat::YELLOW; define("PocketMine\DATA", isset($opts["data-path"]) ? realpath($opts["data-path"]) . DIRECTORY_SEPARATOR : PATH);
break;
case "NOTICE": if((strpos(strtoupper(php_uname("s")), "WIN") or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])){
$add .= Utils\TextFormat::AQUA; define("PocketMine\ANSI", true);
break; }else{
default: define("PocketMine\ANSI", false);
$add = ""; }
break;
function dummy(){
}
function safe_var_dump($var, $cnt = 0){
switch(true){
case is_array($var):
echo str_repeat(" ", $cnt)."array(".count($var).") {".PHP_EOL;
foreach($var as $key => $value){
echo str_repeat(" ", $cnt + 1)."[".(is_integer($key) ? $key:'"'.$key.'"')."]=>".PHP_EOL;
safe_var_dump($value, $cnt + 1);
}
echo str_repeat(" ", $cnt)."}".PHP_EOL;
break;
case is_integer($var):
echo str_repeat(" ", $cnt)."int(".$var.")".PHP_EOL;
break;
case is_float($var):
echo str_repeat(" ", $cnt)."float(".$var.")".PHP_EOL;
break;
case is_bool($var):
echo str_repeat(" ", $cnt)."bool(".($var === true ? "true":"false").")".PHP_EOL;
break;
case is_string($var):
echo str_repeat(" ", $cnt)."string(".strlen($var).") \"$var\"".PHP_EOL;
break;
case is_resource($var):
echo str_repeat(" ", $cnt)."resource() of type (".get_resource_type($var).")".PHP_EOL;
break;
case is_object($var):
echo str_repeat(" ", $cnt)."object(".get_class($var).")".PHP_EOL;
break;
case is_null($var):
echo str_repeat(" ", $cnt)."NULL".PHP_EOL;
break;
}
}
function kill($pid){
switch(Utils\Utils::getOS()){
case "win":
exec("taskkill.exe /F /PID ".((int) $pid)." > NUL");
break;
case "mac":
case "linux":
default:
exec("kill -9 ".((int) $pid)." > /dev/null 2>&1");
}
}
function hard_unset(&$var){
if(is_object($var)){
$unset = new \ReflectionClass($var);
foreach($unset->getProperties() as $prop){
$prop->setAccessible(true);
@hard_unset($prop->getValue($var));
$prop->setValue($var, null);
}
$var = null;
unset($var);
}elseif(is_array($var)){
foreach($var as $i => $v){
hard_unset($var[$i]);
}
$var = null;
unset($var);
}else{
$var = null;
unset($var);
}
}
function console($message, $EOL = true, $log = true, $level = 1){
if(!defined("DEBUG") or DEBUG >= $level){
$message .= $EOL === true ? PHP_EOL:"";
$time = (ANSI === true ? Utils\TextFormat::AQUA . date("H:i:s") . Utils\TextFormat::RESET:date("H:i:s")) . " ";
$replaced = Utils\TextFormat::clean(preg_replace('/\x1b\[[0-9;]*m/', "", $time . $message));
if($log === true and (!defined("LOG") or LOG === true)){
log(date("Y-m-d")." ".$replaced, "console", false, $level);
}
if(ANSI === true){
$add = "";
if(preg_match("/\[([a-zA-Z0-9]*)\]/", $message, $matches) > 0){
switch($matches[1]){
case "ERROR":
case "SEVERE":
$add .= Utils\TextFormat::RED;
break;
case "INTERNAL":
case "DEBUG":
$add .= Utils\TextFormat::GRAY;
break;
case "WARNING":
$add .= Utils\TextFormat::YELLOW;
break;
case "NOTICE":
$add .= Utils\TextFormat::AQUA;
break;
default:
$add = "";
break;
}
}
$message = Utils\TextFormat::toANSI($time . $add . $message . Utils\TextFormat::RESET);
}else{
$message = $replaced;
}
echo $message;
}
}
function getTrace($start = 1){
$e = new \Exception();
$trace = $e->getTrace();
$messages = array();
$j = 0;
for($i = (int) $start; isset($trace[$i]); ++$i, ++$j){
$params = "";
if(isset($trace[$i]["args"])){
foreach($trace[$i]["args"] as $name => $value){
$params .= (is_object($value) ? get_class($value)." ".(method_exists($value, "__toString") ? $value->__toString() : "object"):gettype($value)." ".@strval($value)).", ";
} }
} }
$message = Utils\TextFormat::toANSI($time . $add . $message . Utils\TextFormat::RESET); $messages[] = "#$j ".(isset($trace[$i]["file"]) ? $trace[$i]["file"]:"")."(".(isset($trace[$i]["line"]) ? $trace[$i]["line"]:"")."): ".(isset($trace[$i]["class"]) ? $trace[$i]["class"].$trace[$i]["type"]:"").$trace[$i]["function"]."(".substr($params, 0, -2).")";
}else{
$message = $replaced;
} }
echo $message; return $messages;
} }
}
function getTrace($start = 1){ function error_handler($errno, $errstr, $errfile, $errline){
$e = new \Exception(); if(error_reporting() === 0){ //@ error-control
$trace = $e->getTrace(); return false;
$messages = array(); }
$j = 0; $errorConversion = array(
for($i = (int) $start; isset($trace[$i]); ++$i, ++$j){ E_ERROR => "E_ERROR",
$params = ""; E_WARNING => "E_WARNING",
if(isset($trace[$i]["args"])){ E_PARSE => "E_PARSE",
foreach($trace[$i]["args"] as $name => $value){ E_NOTICE => "E_NOTICE",
$params .= (is_object($value) ? get_class($value)." ".(method_exists($value, "__toString") ? $value->__toString() : "object"):gettype($value)." ".@strval($value)).", "; E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
);
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno]:$errno;
console("[ERROR] A ".$errno." error happened: \"$errstr\" in \"$errfile\" at line $errline", true, true, 0);
foreach(getTrace() as $i => $line){
console("[TRACE] $line");
}
return true;
}
function log($message, $name, $EOL = true, $level = 2, $close = false){
global $fpointers;
if((!defined("DEBUG") or DEBUG >= $level) and (!defined("LOG") or LOG === true)){
$message .= $EOL === true ? PHP_EOL:"";
if(!isset($fpointers)){
$fpointers = array();
}
if(!isset($fpointers[$name]) or $fpointers[$name] === false){
$fpointers[$name] = @fopen(\PocketMine\DATA."/".$name.".log", "ab");
}
@fwrite($fpointers[$name], $message);
if($close === true){
fclose($fpointers[$name]);
unset($fpointers[$name]);
} }
} }
$messages[] = "#$j ".(isset($trace[$i]["file"]) ? $trace[$i]["file"]:"")."(".(isset($trace[$i]["line"]) ? $trace[$i]["line"]:"")."): ".(isset($trace[$i]["class"]) ? $trace[$i]["class"].$trace[$i]["type"]:"").$trace[$i]["function"]."(".substr($params, 0, -2).")";
} }
return $messages;
}
function error_handler($errno, $errstr, $errfile, $errline){
if(error_reporting() === 0){ //@ error-control
return false;
}
$errorConversion = array(
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
E_NOTICE => "E_NOTICE",
E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
);
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno]:$errno;
console("[ERROR] A ".$errno." error happened: \"$errstr\" in \"$errfile\" at line $errline", true, true, 0);
foreach(getTrace() as $i => $line){
console("[TRACE] $line");
}
return true;
}
function log($message, $name, $EOL = true, $level = 2, $close = false){
global $fpointers;
if((!defined("DEBUG") or DEBUG >= $level) and (!defined("LOG") or LOG === true)){
$message .= $EOL === true ? PHP_EOL:"";
if(!isset($fpointers)){
$fpointers = array();
}
if(!isset($fpointers[$name]) or $fpointers[$name] === false){
$fpointers[$name] = @fopen(\PocketMine\DATA."/".$name.".log", "ab");
}
@fwrite($fpointers[$name], $message);
if($close === true){
fclose($fpointers[$name]);
unset($fpointers[$name]);
}
}
}
set_error_handler("\PocketMine\\error_handler", E_ALL); set_error_handler("\PocketMine\\error_handler", E_ALL);
$errors = 0; $errors = 0;
if(version_compare("5.4.0", PHP_VERSION) > 0){ if(version_compare("5.4.0", PHP_VERSION) > 0){
console("[ERROR] Use PHP >= 5.4.0", true, true, 0); console("[ERROR] Use PHP >= 5.4.0", true, true, 0);
++$errors;
}
if(php_sapi_name() !== "cli"){
console("[ERROR] You must run PocketMine-MP using the CLI.", true, true, 0);
++$errors;
}
if(!extension_loaded("sockets") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sockets." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the Socket extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("pthreads") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "pthreads." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the pthreads extension.", true, true, 0);
++$errors;
}else{
$pthreads_version = phpversion("pthreads");
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "0.1.0") < 0){
console("[ERROR] pthreads >= 0.1.0 is required, while you have $pthreads_version.", true, true, 0);
++$errors; ++$errors;
} }
if(php_sapi_name() !== "cli"){
console("[ERROR] You must run PocketMine-MP using the CLI.", true, true, 0);
++$errors;
}
if(!extension_loaded("sockets") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sockets." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the Socket extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("pthreads") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "pthreads." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the pthreads extension.", true, true, 0);
++$errors;
}else{
$pthreads_version = phpversion("pthreads");
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "0.1.0") < 0){
console("[ERROR] pthreads >= 0.1.0 is required, while you have $pthreads_version.", true, true, 0);
++$errors;
}
}
if(!extension_loaded("curl") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "curl." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the cURL extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("sqlite3") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sqlite3." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the SQLite3 extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("yaml") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "yaml." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the YAML extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("zlib") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "zlib." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the Zlib extension.", true, true, 0);
++$errors;
}
if($errors > 0){
console("[ERROR] Please use the installer provided on the homepage, or recompile PHP again.", true, true, 0);
exit(1); //Exit with error
}
$gitsha1 = false;
if(file_exists(\PocketMine\PATH . ".git/refs/heads/master")){ //Found Git information!
define("PocketMine\GIT_COMMIT", strtolower(trim(file_get_contents(\PocketMine\PATH .".git/refs/heads/master"))));
}else{ //Unknown :(
define("PocketMine\GIT_COMMIT", str_repeat("00", 20));
}
ini_set("opcache.mmap_base", bin2hex(Utils\Utils::getRandomBytes(8, false))); //Fix OPCache address errors
require_once(\PocketMine\PATH . "src/utils/pthreads.php");
if(!file_exists(\PocketMine\DATA . "server.properties") and !isset($opts["no-wizard"])){
$installer = new Wizard\Installer();
}
$server = new ServerAPI();
$server->start();
kill(getmypid()); //Fix for ConsoleAPI being blocked
exit(0);
} }
if(!extension_loaded("curl") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "curl." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the cURL extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("sqlite3") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sqlite3." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the SQLite3 extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("yaml") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "yaml." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the YAML extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("zlib") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "zlib." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the Zlib extension.", true, true, 0);
++$errors;
}
if($errors > 0){
console("[ERROR] Please use the installer provided on the homepage, or recompile PHP again.", true, true, 0);
exit(1); //Exit with error
}
$gitsha1 = false;
if(file_exists(\PocketMine\PATH . ".git/refs/heads/master")){ //Found Git information!
define("PocketMine\GIT_COMMIT", strtolower(trim(file_get_contents(\PocketMine\PATH .".git/refs/heads/master"))));
}else{ //Unknown :(
define("PocketMine\GIT_COMMIT", str_repeat("00", 20));
}
ini_set("opcache.mmap_base", bin2hex(Utils\Utils::getRandomBytes(8, false))); //Fix OPCache address errors
require_once(\PocketMine\PATH . "src/utils/pthreads.php");
if(!file_exists(\PocketMine\DATA . "server.properties") and !isset($opts["no-wizard"])){
$installer = new Wizard\Installer();
}
$server = new ServerAPI();
$server->start();
kill(getmypid()); //Fix for ConsoleAPI being blocked
exit(0);

View File

@ -37,196 +37,196 @@ class BlockAPI{
private $randomUpdates = array(); private $randomUpdates = array();
public static $creative = array( public static $creative = array(
//Building //Building
[ItemItem::STONE, 0], [Item::STONE, 0],
[ItemItem::COBBLESTONE, 0], [Item::COBBLESTONE, 0],
[ItemItem::STONE_BRICKS, 0], [Item::STONE_BRICKS, 0],
[ItemItem::STONE_BRICKS, 1], [Item::STONE_BRICKS, 1],
[ItemItem::STONE_BRICKS, 2], [Item::STONE_BRICKS, 2],
[ItemItem::MOSS_STONE, 0], [Item::MOSS_STONE, 0],
[ItemItem::WOODEN_PLANKS, 0], [Item::WOODEN_PLANKS, 0],
[ItemItem::WOODEN_PLANKS, 1], [Item::WOODEN_PLANKS, 1],
[ItemItem::WOODEN_PLANKS, 2], [Item::WOODEN_PLANKS, 2],
[ItemItem::WOODEN_PLANKS, 3], [Item::WOODEN_PLANKS, 3],
[ItemItem::BRICKS, 0], [Item::BRICKS, 0],
[ItemItem::DIRT, 0], [Item::DIRT, 0],
[ItemItem::GRASS, 0], [Item::GRASS, 0],
[ItemItem::CLAY_BLOCK, 0], [Item::CLAY_BLOCK, 0],
[ItemItem::SANDSTONE, 0], [Item::SANDSTONE, 0],
[ItemItem::SANDSTONE, 1], [Item::SANDSTONE, 1],
[ItemItem::SANDSTONE, 2], [Item::SANDSTONE, 2],
[ItemItem::SAND, 0], [Item::SAND, 0],
[ItemItem::GRAVEL, 0], [Item::GRAVEL, 0],
[ItemItem::TRUNK, 0], [Item::TRUNK, 0],
[ItemItem::TRUNK, 1], [Item::TRUNK, 1],
[ItemItem::TRUNK, 2], [Item::TRUNK, 2],
[ItemItem::TRUNK, 3], [Item::TRUNK, 3],
[ItemItem::NETHER_BRICKS, 0], [Item::NETHER_BRICKS, 0],
[ItemItem::NETHERRACK, 0], [Item::NETHERRACK, 0],
[ItemItem::BEDROCK, 0], [Item::BEDROCK, 0],
[ItemItem::COBBLESTONE_STAIRS, 0], [Item::COBBLESTONE_STAIRS, 0],
[ItemItem::OAK_WOODEN_STAIRS, 0], [Item::OAK_WOODEN_STAIRS, 0],
[ItemItem::SPRUCE_WOODEN_STAIRS, 0], [Item::SPRUCE_WOODEN_STAIRS, 0],
[ItemItem::BIRCH_WOODEN_STAIRS, 0], [Item::BIRCH_WOODEN_STAIRS, 0],
[ItemItem::JUNGLE_WOODEN_STAIRS, 0], [Item::JUNGLE_WOODEN_STAIRS, 0],
[ItemItem::BRICK_STAIRS, 0], [Item::BRICK_STAIRS, 0],
[ItemItem::SANDSTONE_STAIRS, 0], [Item::SANDSTONE_STAIRS, 0],
[ItemItem::STONE_BRICK_STAIRS, 0], [Item::STONE_BRICK_STAIRS, 0],
[ItemItem::NETHER_BRICKS_STAIRS, 0], [Item::NETHER_BRICKS_STAIRS, 0],
[ItemItem::QUARTZ_STAIRS, 0], [Item::QUARTZ_STAIRS, 0],
[ItemItem::SLAB, 0], [Item::SLAB, 0],
[ItemItem::SLAB, 1], [Item::SLAB, 1],
[ItemItem::WOODEN_SLAB, 0], [Item::WOODEN_SLAB, 0],
[ItemItem::WOODEN_SLAB, 1], [Item::WOODEN_SLAB, 1],
[ItemItem::WOODEN_SLAB, 2], [Item::WOODEN_SLAB, 2],
[ItemItem::WOODEN_SLAB, 3], [Item::WOODEN_SLAB, 3],
[ItemItem::SLAB, 3], [Item::SLAB, 3],
[ItemItem::SLAB, 4], [Item::SLAB, 4],
[ItemItem::SLAB, 5], [Item::SLAB, 5],
[ItemItem::SLAB, 6], [Item::SLAB, 6],
[ItemItem::QUARTZ_BLOCK, 0], [Item::QUARTZ_BLOCK, 0],
[ItemItem::QUARTZ_BLOCK, 1], [Item::QUARTZ_BLOCK, 1],
[ItemItem::QUARTZ_BLOCK, 2], [Item::QUARTZ_BLOCK, 2],
[ItemItem::COAL_ORE, 0], [Item::COAL_ORE, 0],
[ItemItem::IRON_ORE, 0], [Item::IRON_ORE, 0],
[ItemItem::GOLD_ORE, 0], [Item::GOLD_ORE, 0],
[ItemItem::DIAMOND_ORE, 0], [Item::DIAMOND_ORE, 0],
[ItemItem::LAPIS_ORE, 0], [Item::LAPIS_ORE, 0],
[ItemItem::REDSTONE_ORE, 0], [Item::REDSTONE_ORE, 0],
[ItemItem::OBSIDIAN, 0], [Item::OBSIDIAN, 0],
[ItemItem::ICE, 0], [Item::ICE, 0],
[ItemItem::SNOW_BLOCK, 0], [Item::SNOW_BLOCK, 0],
//Decoration //Decoration
[ItemItem::COBBLESTONE_WALL, 0], [Item::COBBLESTONE_WALL, 0],
[ItemItem::COBBLESTONE_WALL, 1], [Item::COBBLESTONE_WALL, 1],
[ItemItem::GOLD_BLOCK, 0], [Item::GOLD_BLOCK, 0],
[ItemItem::IRON_BLOCK, 0], [Item::IRON_BLOCK, 0],
[ItemItem::DIAMOND_BLOCK, 0], [Item::DIAMOND_BLOCK, 0],
[ItemItem::LAPIS_BLOCK, 0], [Item::LAPIS_BLOCK, 0],
[ItemItem::COAL_BLOCK, 0], [Item::COAL_BLOCK, 0],
[ItemItem::SNOW_LAYER, 0], [Item::SNOW_LAYER, 0],
[ItemItem::GLASS, 0], [Item::GLASS, 0],
[ItemItem::GLOWSTONE_BLOCK, 0], [Item::GLOWSTONE_BLOCK, 0],
[ItemItem::NETHER_REACTOR, 0], [Item::NETHER_REACTOR, 0],
[ItemItem::WOOL, 0], [Item::WOOL, 0],
[ItemItem::WOOL, 7], [Item::WOOL, 7],
[ItemItem::WOOL, 6], [Item::WOOL, 6],
[ItemItem::WOOL, 5], [Item::WOOL, 5],
[ItemItem::WOOL, 4], [Item::WOOL, 4],
[ItemItem::WOOL, 3], [Item::WOOL, 3],
[ItemItem::WOOL, 2], [Item::WOOL, 2],
[ItemItem::WOOL, 1], [Item::WOOL, 1],
[ItemItem::WOOL, 15], [Item::WOOL, 15],
[ItemItem::WOOL, 14], [Item::WOOL, 14],
[ItemItem::WOOL, 13], [Item::WOOL, 13],
[ItemItem::WOOL, 12], [Item::WOOL, 12],
[ItemItem::WOOL, 11], [Item::WOOL, 11],
[ItemItem::WOOL, 10], [Item::WOOL, 10],
[ItemItem::WOOL, 9], [Item::WOOL, 9],
[ItemItem::WOOL, 8], [Item::WOOL, 8],
[ItemItem::LADDER, 0], [Item::LADDER, 0],
[ItemItem::SPONGE, 0], [Item::SPONGE, 0],
[ItemItem::GLASS_PANE, 0], [Item::GLASS_PANE, 0],
[ItemItem::WOODEN_DOOR, 0], [Item::WOODEN_DOOR, 0],
[ItemItem::TRAPDOOR, 0], [Item::TRAPDOOR, 0],
[ItemItem::FENCE, 0], [Item::FENCE, 0],
[ItemItem::FENCE_GATE, 0], [Item::FENCE_GATE, 0],
[ItemItem::IRON_BARS, 0], [Item::IRON_BARS, 0],
[ItemItem::BED, 0], [Item::BED, 0],
[ItemItem::BOOKSHELF, 0], [Item::BOOKSHELF, 0],
[ItemItem::PAINTING, 0], [Item::PAINTING, 0],
[ItemItem::WORKBENCH, 0], [Item::WORKBENCH, 0],
[ItemItem::STONECUTTER, 0], [Item::STONECUTTER, 0],
[ItemItem::CHEST, 0], [Item::CHEST, 0],
[ItemItem::FURNACE, 0], [Item::FURNACE, 0],
[ItemItem::DANDELION, 0], [Item::DANDELION, 0],
[ItemItem::CYAN_FLOWER, 0], [Item::CYAN_FLOWER, 0],
[ItemItem::BROWN_MUSHROOM, 0], [Item::BROWN_MUSHROOM, 0],
[ItemItem::RED_MUSHROOM, 0], [Item::RED_MUSHROOM, 0],
[ItemItem::CACTUS, 0], [Item::CACTUS, 0],
[ItemItem::MELON_BLOCK, 0], [Item::MELON_BLOCK, 0],
[ItemItem::PUMPKIN, 0], [Item::PUMPKIN, 0],
[ItemItem::LIT_PUMPKIN, 0], [Item::LIT_PUMPKIN, 0],
[ItemItem::COBWEB, 0], [Item::COBWEB, 0],
[ItemItem::HAY_BALE, 0], [Item::HAY_BALE, 0],
[ItemItem::TALL_GRASS, 1], [Item::TALL_GRASS, 1],
[ItemItem::TALL_GRASS, 2], [Item::TALL_GRASS, 2],
[ItemItem::DEAD_BUSH, 0], [Item::DEAD_BUSH, 0],
[ItemItem::SAPLING, 0], [Item::SAPLING, 0],
[ItemItem::SAPLING, 1], [Item::SAPLING, 1],
[ItemItem::SAPLING, 2], [Item::SAPLING, 2],
[ItemItem::SAPLING, 3], [Item::SAPLING, 3],
[ItemItem::LEAVES, 0], [Item::LEAVES, 0],
[ItemItem::LEAVES, 1], [Item::LEAVES, 1],
[ItemItem::LEAVES, 2], [Item::LEAVES, 2],
[ItemItem::LEAVES, 3], [Item::LEAVES, 3],
[ItemItem::CAKE, 0], [Item::CAKE, 0],
[ItemItem::SIGN, 0], [Item::SIGN, 0],
[ItemItem::CARPET, 0], [Item::CARPET, 0],
[ItemItem::CARPET, 7], [Item::CARPET, 7],
[ItemItem::CARPET, 6], [Item::CARPET, 6],
[ItemItem::CARPET, 5], [Item::CARPET, 5],
[ItemItem::CARPET, 4], [Item::CARPET, 4],
[ItemItem::CARPET, 3], [Item::CARPET, 3],
[ItemItem::CARPET, 2], [Item::CARPET, 2],
[ItemItem::CARPET, 1], [Item::CARPET, 1],
[ItemItem::CARPET, 15], [Item::CARPET, 15],
[ItemItem::CARPET, 14], [Item::CARPET, 14],
[ItemItem::CARPET, 13], [Item::CARPET, 13],
[ItemItem::CARPET, 12], [Item::CARPET, 12],
[ItemItem::CARPET, 11], [Item::CARPET, 11],
[ItemItem::CARPET, 10], [Item::CARPET, 10],
[ItemItem::CARPET, 9], [Item::CARPET, 9],
[ItemItem::CARPET, 8], [Item::CARPET, 8],
//Tools //Tools
//array(RAILS, 0), //[Item::RAILS, 0],
//array(POWERED_RAILS, 0), //[Item::POWERED_RAILS, 0],
[ItemItem::TORCH, 0], [Item::TORCH, 0],
[ItemItem::BUCKET, 0], [Item::BUCKET, 0],
[ItemItem::BUCKET, 8], [Item::BUCKET, 8],
[ItemItem::BUCKET, 10], [Item::BUCKET, 10],
[ItemItem::TNT, 0], [Item::TNT, 0],
[ItemItem::IRON_HOE, 0], [Item::IRON_HOE, 0],
[ItemItem::IRON_SWORD, 0], [Item::IRON_SWORD, 0],
[ItemItem::BOW, 0], [Item::BOW, 0],
[ItemItem::SHEARS, 0], [Item::SHEARS, 0],
[ItemItem::FLINT_AND_STEEL, 0], [Item::FLINT_AND_STEEL, 0],
[ItemItem::CLOCK, 0], [Item::CLOCK, 0],
[ItemItem::COMPASS, 0], [Item::COMPASS, 0],
[ItemItem::MINECART, 0], [Item::MINECART, 0],
array(SPAWN_EGG, MOB_CHICKEN), [Item::SPAWN_EGG, MOB_CHICKEN],
array(SPAWN_EGG, MOB_COW), [Item::SPAWN_EGG, MOB_COW],
array(SPAWN_EGG, MOB_PIG), [Item::SPAWN_EGG, MOB_PIG],
array(SPAWN_EGG, MOB_SHEEP), [Item::SPAWN_EGG, MOB_SHEEP],
//Seeds //Seeds
[ItemItem::SUGARCANE, 0], [Item::SUGARCANE, 0],
[ItemItem::WHEAT, 0], [Item::WHEAT, 0],
[ItemItem::SEEDS, 0], [Item::SEEDS, 0],
[ItemItem::MELON_SEEDS, 0], [Item::MELON_SEEDS, 0],
[ItemItem::PUMPKIN_SEEDS, 0], [Item::PUMPKIN_SEEDS, 0],
[ItemItem::CARROT, 0], [Item::CARROT, 0],
[ItemItem::POTATO, 0], [Item::POTATO, 0],
[ItemItem::BEETROOT_SEEDS, 0], [Item::BEETROOT_SEEDS, 0],
[ItemItem::EGG, 0], [Item::EGG, 0],
[ItemItem::DYE, 0], [Item::DYE, 0],
[ItemItem::DYE, 7], [Item::DYE, 7],
[ItemItem::DYE, 6], [Item::DYE, 6],
[ItemItem::DYE, 5], [Item::DYE, 5],
[ItemItem::DYE, 4], [Item::DYE, 4],
[ItemItem::DYE, 3], [Item::DYE, 3],
[ItemItem::DYE, 2], [Item::DYE, 2],
[ItemItem::DYE, 1], [Item::DYE, 1],
[ItemItem::DYE, 15], [Item::DYE, 15],
[ItemItem::DYE, 14], [Item::DYE, 14],
[ItemItem::DYE, 13], [Item::DYE, 13],
[ItemItem::DYE, 12], [Item::DYE, 12],
[ItemItem::DYE, 11], [Item::DYE, 11],
[ItemItem::DYE, 10], [Item::DYE, 10],
[ItemItem::DYE, 9], [Item::DYE, 9],
[ItemItem::DYE, 8], [Item::DYE, 8],
); );

View File

@ -225,7 +225,7 @@ class LevelAPI{
switch($index){ switch($index){
case "Items": case "Items":
$tag = new Enum("Items", array()); $tag = new Enum("Items", array());
$tag->setTagType(NBT\TAG_Compound); $tag->setTagType(NBT::TAG_Compound);
foreach($data as $slot => $fields){ foreach($data as $slot => $fields){
$tag[(int) $slot] = new Compound(false, array( $tag[(int) $slot] = new Compound(false, array(
"Count" => new Byte("Count", $fields["Count"]), "Count" => new Byte("Count", $fields["Count"]),

View File

@ -198,10 +198,10 @@ class Player extends RealHuman{
"NameTag" => new String("NameTag", $name), "NameTag" => new String("NameTag", $name),
)); ));
$nbt->Pos->setTagType(NBT\TAG_Double); $nbt->Pos->setTagType(NBT::TAG_Double);
$nbt->Inventory->setTagType(NBT\TAG_Compound); $nbt->Inventory->setTagType(NBT::TAG_Compound);
$nbt->Motion->setTagType(NBT\TAG_Double); $nbt->Motion->setTagType(NBT::TAG_Double);
$nbt->Rotation->setTagType(NBT\TAG_Float); $nbt->Rotation->setTagType(NBT::TAG_Float);
if(file_exists(\PocketMine\DATA . "players/" . $iname . ".yml")){ if(file_exists(\PocketMine\DATA . "players/" . $iname . ".yml")){
$data = new Config(\PocketMine\DATA . "players/" . $iname . ".yml", Config::YAML, array()); $data = new Config(\PocketMine\DATA . "players/" . $iname . ".yml", Config::YAML, array());
$nbt->playerGameType = (int) $data->get("gamemode"); $nbt->playerGameType = (int) $data->get("gamemode");
@ -257,7 +257,7 @@ class Player extends RealHuman{
} }
} else{ } else{
$nbt = new NBT(NBT\BIG_ENDIAN); $nbt = new NBT(NBT::BIG_ENDIAN);
$nbt->read(file_get_contents(\PocketMine\DATA . "players/" . $iname . ".dat")); $nbt->read(file_get_contents(\PocketMine\DATA . "players/" . $iname . ".dat"));
$nbt = $nbt->getData(); $nbt = $nbt->getData();
} }
@ -269,7 +269,7 @@ class Player extends RealHuman{
public static function saveOffline($name, Compound $nbtTag){ public static function saveOffline($name, Compound $nbtTag){
ServerAPI::request()->handle("player.offline.save", $nbtTag); ServerAPI::request()->handle("player.offline.save", $nbtTag);
$nbt = new NBT(NBT\BIG_ENDIAN); $nbt = new NBT(NBT::BIG_ENDIAN);
$nbt->setData($nbtTag); $nbt->setData($nbtTag);
file_put_contents(\PocketMine\DATA . "players/" . strtolower($name) . ".dat", $nbt->write()); file_put_contents(\PocketMine\DATA . "players/" . strtolower($name) . ".dat", $nbt->write());
} }
@ -1855,25 +1855,25 @@ class Player extends RealHuman{
switch($packet->event){ switch($packet->event){
case 9: //Eating case 9: //Eating
$items = array( $items = array(
ItemItem::APPLE => 4, Item::APPLE => 4,
ItemItem::MUSHROOM_STEW => 10, Item::MUSHROOM_STEW => 10,
ItemItem::BEETROOT_SOUP => 10, Item::BEETROOT_SOUP => 10,
ItemItem::BREAD => 5, Item::BREAD => 5,
ItemItem::RAW_PORKCHOP => 3, Item::RAW_PORKCHOP => 3,
ItemItem::COOKED_PORKCHOP => 8, Item::COOKED_PORKCHOP => 8,
ItemItem::RAW_BEEF => 3, Item::RAW_BEEF => 3,
ItemItem::STEAK => 8, Item::STEAK => 8,
ItemItem::COOKED_CHICKEN => 6, Item::COOKED_CHICKEN => 6,
ItemItem::RAW_CHICKEN => 2, Item::RAW_CHICKEN => 2,
ItemItem::MELON_SLICE => 2, Item::MELON_SLICE => 2,
ItemItem::GOLDEN_APPLE => 10, Item::GOLDEN_APPLE => 10,
ItemItem::PUMPKIN_PIE => 8, Item::PUMPKIN_PIE => 8,
ItemItem::CARROT => 4, Item::CARROT => 4,
ItemItem::POTATO => 1, Item::POTATO => 1,
ItemItem::BAKED_POTATO => 6, Item::BAKED_POTATO => 6,
//ItemItem::COOKIE => 2, //Item::COOKIE => 2,
//ItemItem::COOKED_FISH => 5, //Item::COOKED_FISH => 5,
//ItemItem::RAW_FISH => 2, //Item::RAW_FISH => 2,
); );
$slot = $this->getSlot($this->slot); $slot = $this->getSlot($this->slot);
if($this->entity->getHealth() < 20 and isset($items[$slot->getID()])){ if($this->entity->getHealth() < 20 and isset($items[$slot->getID()])){
@ -1888,7 +1888,7 @@ class Player extends RealHuman{
if($slot->getCount() <= 0){ if($slot->getCount() <= 0){
$this->setSlot($this->slot, Item::get(AIR, 0, 0)); $this->setSlot($this->slot, Item::get(AIR, 0, 0));
} }
if($slot->getID() === ItemItem::MUSHROOM_STEW or $slot->getID() === ItemItem::BEETROOT_SOUP){ if($slot->getID() === Item::MUSHROOM_STEW or $slot->getID() === Item::BEETROOT_SOUP){
$this->addItem(Item::get(BOWL, 0, 1)); $this->addItem(Item::get(BOWL, 0, 1));
} }
} }
@ -2167,7 +2167,7 @@ class Player extends RealHuman{
if($t->namedtag->creator !== $this->username){ if($t->namedtag->creator !== $this->username){
$t->spawnTo($this); $t->spawnTo($this);
} else{ } else{
$nbt = new NBT(NBT\LITTLE_ENDIAN); $nbt = new NBT(NBT::LITTLE_ENDIAN);
$nbt->read($packet->namedtag); $nbt->read($packet->namedtag);
if($nbt->id !== Tile::SIGN){ if($nbt->id !== Tile::SIGN){
$t->spawnTo($this); $t->spawnTo($this);

View File

@ -119,7 +119,7 @@ class Server{
} }
$this->schedule(20 * 15, array($this, "checkTicks"), array(), true); $this->schedule(20 * 15, array($this, "checkTicks"), array(), true);
$this->schedule(20 * 60, array($this, "checkMemory"), array(), true); $this->schedule(20 * 60, array($this, "checkMemory"), array(), true);
$this->schedule(20 * 45, "Cache::cleanup", array(), true); $this->schedule(20 * 45, "PocketMine\\Utils\\Cache::cleanup", array(), true);
$this->schedule(20, array($this, "asyncOperationChecker"), array(), true); $this->schedule(20, array($this, "asyncOperationChecker"), array(), true);
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class Air extends Transparent{ class Air extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(AIR, 0, "Air"); parent::__construct(self::AIR, 0, "Air");
$this->isActivable = false; $this->isActivable = false;
$this->breakable = false; $this->breakable = false;
$this->isFlowable = true; $this->isFlowable = true;

View File

@ -28,13 +28,13 @@ use PocketMine;
class Bed extends Transparent{ class Bed extends Transparent{
public function __construct($type = 0){ public function __construct($type = 0){
parent::__construct(BED_BLOCK, $type, "Bed Block"); parent::__construct(self::BED_BLOCK, $type, "Bed Block");
$this->isActivable = true; $this->isActivable = true;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 1; $this->hardness = 1;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){ if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
$pk = new ChatPacket; $pk = new ChatPacket;
$pk->message = "You can only sleep at night"; $pk->message = "You can only sleep at night";
@ -76,7 +76,7 @@ class Bed extends Transparent{
return true; return true;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->isTransparent === false){ if($down->isTransparent === false){
$faces = array( $faces = array(
@ -100,7 +100,7 @@ class Bed extends Transparent{
return false; return false;
} }
public function onBreak(Item $item, Player $player){ public function onBreak(Item $item, PocketMine\Player $player){
$blockNorth = $this->getSide(2); //Gets the blocks around them $blockNorth = $this->getSide(2); //Gets the blocks around them
$blockSouth = $this->getSide(3); $blockSouth = $this->getSide(3);
$blockEast = $this->getSide(5); $blockEast = $this->getSide(5);
@ -132,7 +132,7 @@ class Bed extends Transparent{
return true; return true;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(BED, 0, 1), array(BED, 0, 1),
); );

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class Bedrock extends Solid{ class Bedrock extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(BEDROCK, 0, "Bedrock"); parent::__construct(self::BEDROCK, 0, "Bedrock");
$this->breakable = false; $this->breakable = false;
$this->hardness = 18000000; $this->hardness = 18000000;
} }
public function isBreakable(Item $item, Player $player){ public function isBreakable(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return true; return true;
} }

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class Beetroot extends Flowable{ class Beetroot extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(BEETROOT_BLOCK, $meta, "Beetroot Block"); parent::__construct(self::BEETROOT_BLOCK, $meta, "Beetroot Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::FARMLAND){ if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -42,8 +42,8 @@ class Beetroot extends Flowable{
return false; return false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->getID() === ItemItem::DYE and $item->getMetadata() === 0x0F){ //Bonemeal if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07; $this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true); $this->level->setBlock($this, $this, true, false, true);
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
@ -81,13 +81,13 @@ class Beetroot extends Flowable{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
$drops = array(); $drops = array();
if($this->meta >= 0x07){ if($this->meta >= 0x07){
$drops[] = array(ItemItem::BEETROOT, 0, 1); $drops[] = array(Item::BEETROOT, 0, 1);
$drops[] = array(ItemItem::BEETROOT_SEEDS, 0, mt_rand(0, 3)); $drops[] = array(Item::BEETROOT_SEEDS, 0, mt_rand(0, 3));
} else{ } else{
$drops[] = array(ItemItem::BEETROOT_SEEDS, 0, 1); $drops[] = array(Item::BEETROOT_SEEDS, 0, 1);
} }
return $drops; return $drops;

View File

@ -26,10 +26,10 @@ use PocketMine\Item\Item as Item;
class BirchWoodStairs extends Stair{ class BirchWoodStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs"); parent::__construct(self::BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs");
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

View File

@ -24,7 +24,10 @@
*/ */
namespace PocketMine\Block; namespace PocketMine\Block;
use PocketMine; use PocketMine;
use PocketMine\Player as Player;
use PocketMine\Item\Item as Item;
use PocketMine\Level\Position as Position; use PocketMine\Level\Position as Position;
use PocketMine\Level\Level as Level;
abstract class Block extends Position{ abstract class Block extends Position{
const AIR = 0; const AIR = 0;
@ -224,131 +227,131 @@ abstract class Block extends Position{
public $z = 0; public $z = 0;
public static function init(){ public static function init(){
if(count(self::$init) === 0){ if(count(self::$list) === 0){
self::$init = array( self::$list = array(
AIR => new Air(), self::AIR => new Air(),
STONE => new Stone(), self::STONE => new Stone(),
GRASS => new Grass(), self::GRASS => new Grass(),
DIRT => new Dirt(), self::DIRT => new Dirt(),
COBBLESTONE => new Cobblestone(), self::COBBLESTONE => new Cobblestone(),
PLANKS => new Planks(), self::PLANKS => new Planks(),
SAPLING => new Sapling(), self::SAPLING => new Sapling(),
BEDROCK => new Bedrock(), self::BEDROCK => new Bedrock(),
WATER => new Water(), self::WATER => new Water(),
STILL_WATER => new StillWater(), self::STILL_WATER => new StillWater(),
LAVA => new Lava(), self::LAVA => new Lava(),
STILL_LAVA => new StillLava(), self::STILL_LAVA => new StillLava(),
SAND => new Sand(), self::SAND => new Sand(),
GRAVEL => new Gravel(), self::GRAVEL => new Gravel(),
GOLD_ORE => new GoldOre(), self::GOLD_ORE => new GoldOre(),
IRON_ORE => new IronOre(), self::IRON_ORE => new IronOre(),
COAL_ORE => new CoalOre(), self::COAL_ORE => new CoalOre(),
WOOD => new Wood(), self::WOOD => new Wood(),
LEAVES => new Leaves(), self::LEAVES => new Leaves(),
SPONGE => new Sponge(), self::SPONGE => new Sponge(),
GLASS => new Glass(), self::GLASS => new Glass(),
LAPIS_ORE => new LapisOre(), self::LAPIS_ORE => new LapisOre(),
LAPIS_BLOCK => new Lapis(), self::LAPIS_BLOCK => new Lapis(),
SANDSTONE => new Sandstone(), self::SANDSTONE => new Sandstone(),
BED_BLOCK => new Bed(), self::BED_BLOCK => new Bed(),
COBWEB => new Cobweb(), self::COBWEB => new Cobweb(),
TALL_GRASS => new TallGrass(), self::TALL_GRASS => new TallGrass(),
DEAD_BUSH => new DeadBush(), self::DEAD_BUSH => new DeadBush(),
WOOL => new Wool(), self::WOOL => new Wool(),
DANDELION => new Dandelion(), self::DANDELION => new Dandelion(),
CYAN_FLOWER => new CyanFlower(), self::CYAN_FLOWER => new CyanFlower(),
BROWN_MUSHROOM => new BrownMushroom(), self::BROWN_MUSHROOM => new BrownMushroom(),
RED_MUSHROOM => new RedMushRoom(), self::RED_MUSHROOM => new RedMushRoom(),
GOLD_BLOCK => new Gold(), self::GOLD_BLOCK => new Gold(),
IRON_BLOCK => new Iron(), self::IRON_BLOCK => new Iron(),
DOUBLE_SLAB => new DoubleSlab(), self::DOUBLE_SLAB => new DoubleSlab(),
SLAB => new Slab(), self::SLAB => new Slab(),
BRICKS_BLOCK => new Bricks(), self::BRICKS_BLOCK => new Bricks(),
TNT => new TNT(), self::TNT => new TNT(),
BOOKSHELF => new Bookshelf(), self::BOOKSHELF => new Bookshelf(),
MOSS_STONE => new MossStone(), self::MOSS_STONE => new MossStone(),
OBSIDIAN => new Obsidian(), self::OBSIDIAN => new Obsidian(),
TORCH => new Torch(), self::TORCH => new Torch(),
FIRE => new Fire(), self::FIRE => new Fire(),
WOOD_STAIRS => new WoodStairs(), self::WOOD_STAIRS => new WoodStairs(),
CHEST => new Chest(), self::CHEST => new Chest(),
DIAMOND_ORE => new DiamondOre(), self::DIAMOND_ORE => new DiamondOre(),
DIAMOND_BLOCK => new Diamond(), self::DIAMOND_BLOCK => new Diamond(),
WORKBENCH => new Workbench(), self::WORKBENCH => new Workbench(),
WHEAT_BLOCK => new Wheat(), self::WHEAT_BLOCK => new Wheat(),
FARMLAND => new Farmland(), self::FARMLAND => new Farmland(),
FURNACE => new Furnace(), self::FURNACE => new Furnace(),
BURNING_FURNACE => new BurningFurnace(), self::BURNING_FURNACE => new BurningFurnace(),
SIGN_POST => new SignPost(), self::SIGN_POST => new SignPost(),
WOOD_DOOR_BLOCK => new WoodDoor(), self::WOOD_DOOR_BLOCK => new WoodDoor(),
LADDER => new Ladder(), self::LADDER => new Ladder(),
COBBLESTONE_STAIRS => new CobblestoneStairs(), self::COBBLESTONE_STAIRS => new CobblestoneStairs(),
WALL_SIGN => new WallSign(), self::WALL_SIGN => new WallSign(),
IRON_DOOR_BLOCK => new IronDoor(), self::IRON_DOOR_BLOCK => new IronDoor(),
REDSTONE_ORE => new RedstoneOre(), self::REDSTONE_ORE => new RedstoneOre(),
GLOWING_REDSTONE_ORE => new GlowingRedstoneOre(), self::GLOWING_REDSTONE_ORE => new GlowingRedstoneOre(),
SNOW_LAYER => new SnowLayer(), self::SNOW_LAYER => new SnowLayer(),
ICE => new Ice(), self::ICE => new Ice(),
SNOW_BLOCK => new Snow(), self::SNOW_BLOCK => new Snow(),
CACTUS => new Cactus(), self::CACTUS => new Cactus(),
CLAY_BLOCK => new Clay(), self::CLAY_BLOCK => new Clay(),
SUGARCANE_BLOCK => new Sugarcane(), self::SUGARCANE_BLOCK => new Sugarcane(),
FENCE => new Fence(), self::FENCE => new Fence(),
PUMPKIN => new Pumpkin(), self::PUMPKIN => new Pumpkin(),
NETHERRACK => new Netherrack(), self::NETHERRACK => new Netherrack(),
SOUL_SAND => new SoulSand(), self::SOUL_SAND => new SoulSand(),
GLOWSTONE_BLOCK => new Glowstone(), self::GLOWSTONE_BLOCK => new Glowstone(),
LIT_PUMPKIN => new LitPumpkin(), self::LIT_PUMPKIN => new LitPumpkin(),
CAKE_BLOCK => new Cake(), self::CAKE_BLOCK => new Cake(),
TRAPDOOR => new Trapdoor(), self::TRAPDOOR => new Trapdoor(),
STONE_BRICKS => new StoneBricks(), self::STONE_BRICKS => new StoneBricks(),
IRON_BARS => new IronBars(), self::IRON_BARS => new IronBars(),
GLASS_PANE => new GlassPane(), self::GLASS_PANE => new GlassPane(),
MELON_BLOCK => new Melon(), self::MELON_BLOCK => new Melon(),
PUMPKIN_STEM => new PumpkinStem(), self::PUMPKIN_STEM => new PumpkinStem(),
MELON_STEM => new MelonStem(), self::MELON_STEM => new MelonStem(),
FENCE_GATE => new FenceGate(), self::FENCE_GATE => new FenceGate(),
BRICK_STAIRS => new BrickStairs(), self::BRICK_STAIRS => new BrickStairs(),
STONE_BRICK_STAIRS => new StoneBrickStairs(), self::STONE_BRICK_STAIRS => new StoneBrickStairs(),
NETHER_BRICKS => new NetherBricks(), self::NETHER_BRICKS => new NetherBrick(),
NETHER_BRICKS_STAIRS => new NetherBricksStairs(), self::NETHER_BRICKS_STAIRS => new NetherBrickStairs(),
SANDSTONE_STAIRS => new SandstoneStairs(), self::SANDSTONE_STAIRS => new SandstoneStairs(),
SPRUCE_WOOD_STAIRS => new SpruceWoodStairs(), self::SPRUCE_WOOD_STAIRS => new SpruceWoodStairs(),
BIRCH_WOOD_STAIRS => new BirchWoodStairs(), self::BIRCH_WOOD_STAIRS => new BirchWoodStairs(),
JUNGLE_WOOD_STAIRS => new JungleWoodStairs(), self::JUNGLE_WOOD_STAIRS => new JungleWoodStairs(),
STONE_WALL => new StoneWall(), self::STONE_WALL => new StoneWall(),
CARROT_BLOCK => new Carrot(), self::CARROT_BLOCK => new Carrot(),
POTATO_BLOCK => new Potato(), self::POTATO_BLOCK => new Potato(),
QUARTZ_BLOCK => new Quartz(), self::QUARTZ_BLOCK => new Quartz(),
QUARTZ_STAIRS => new QuartzStairs(), self::QUARTZ_STAIRS => new QuartzStairs(),
DOUBLE_WOOD_SLAB => new DoubleWoodSlab(), self::DOUBLE_WOOD_SLAB => new DoubleWoodSlab(),
WOOD_SLAB => new WoodSlab(), self::WOOD_SLAB => new WoodSlab(),
HAY_BALE => new HayBale(), self::HAY_BALE => new HayBale(),
CARPET => new Carpet(), self::CARPET => new Carpet(),
COAL_BLOCK => new Coal(), self::COAL_BLOCK => new Coal(),
BEETROOT_BLOCK => new Beetroot(), self::BEETROOT_BLOCK => new Beetroot(),
STONECUTTER => new Stonecutter(), self::STONECUTTER => new Stonecutter(),
GLOWING_OBSIDIAN => new GlowingObsidian(), self::GLOWING_OBSIDIAN => new GlowingObsidian(),
); );
} }
} }
@ -432,12 +435,12 @@ abstract class Block extends Position{
/** /**
* Returns an array of Item objects to be dropped * Returns an array of Item objects to be dropped
* *
* @param ItemItem $item * @param Item $item
* @param Player $player * @param Player $player
* *
* @return array * @return array
*/ */
public function getDrops(ItemItem $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if(!isset(self::$class[$this->id])){ //Unknown blocks if(!isset(self::$class[$this->id])){ //Unknown blocks
return array(); return array();
} else{ } else{
@ -450,13 +453,13 @@ abstract class Block extends Position{
/** /**
* Returns the seconds that this block takes to be broken using an specific Item * Returns the seconds that this block takes to be broken using an specific Item
* *
* @param ItemItem $item * @param Item $item
* @param Player $player * @param Player $player
* *
* @return float * @return float
*/ */
public function getBreakTime(ItemItem $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.15; return 0.15;
} }
@ -473,7 +476,7 @@ abstract class Block extends Position{
*/ */
public function getSide($side){ public function getSide($side){
$v = parent::getSide($side); $v = parent::getSide($side);
if($this->level instanceof LevelLevel){ if($this->level instanceof Level){
return $this->level->getBlock($v); return $this->level->getBlock($v);
} }
@ -487,27 +490,27 @@ abstract class Block extends Position{
/** /**
* Returns if the item can be broken with an specific Item * Returns if the item can be broken with an specific Item
* *
* @param ItemItem $item * @param Item $item
* @param Player $player * @param Player $player
* *
* @return bool * @return bool
*/ */
abstract function isBreakable(ItemItem $item, Player $player); abstract function isBreakable(Item $item, PocketMine\Player $player);
/** /**
* Do the actions needed so the block is broken with the Item * Do the actions needed so the block is broken with the Item
* *
* @param ItemItem $item * @param Item $item
* @param Player $player * @param Player $player
* *
* @return mixed * @return mixed
*/ */
abstract function onBreak(ItemItem $item, Player $player); abstract function onBreak(Item $item, PocketMine\Player $player);
/** /**
* Places the Block, using block space and block target, and side. Returns if the block has been placed. * Places the Block, using block space and block target, and side. Returns if the block has been placed.
* *
* @param ItemItem $item * @param Item $item
* @param Player $player * @param Player $player
* @param Block $block * @param Block $block
* @param Block $target * @param Block $target
@ -518,17 +521,17 @@ abstract class Block extends Position{
* *
* @return bool * @return bool
*/ */
abstract function place(ItemItem $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz); abstract function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz);
/** /**
* Do actions when activated by Item. Returns if it has done anything * Do actions when activated by Item. Returns if it has done anything
* *
* @param ItemItem $item * @param Item $item
* @param Player $player * @param Player $player
* *
* @return bool * @return bool
*/ */
abstract function onActivate(ItemItem $item, Player $player); abstract function onActivate(Item $item, PocketMine\Player $player);
/** /**
* Fires a block update on the Block * Fires a block update on the Block

View File

@ -25,7 +25,7 @@ use PocketMine;
class Bookshelf extends Solid{ class Bookshelf extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(BOOKSHELF, 0, "Bookshelf"); parent::__construct(self::BOOKSHELF, 0, "Bookshelf");
$this->hardness = 7.5; $this->hardness = 7.5;
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class BrickStairs extends Stair{ class BrickStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(BRICK_STAIRS, $meta, "Brick Stairs"); parent::__construct(self::BRICK_STAIRS, $meta, "Brick Stairs");
} }
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Bricks extends Solid{ class Bricks extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(BRICKS_BLOCK, 0, "Bricks"); parent::__construct(self::BRICKS_BLOCK, 0, "Bricks");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class Bricks extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(BRICKS_BLOCK, 0, 1), array(BRICKS_BLOCK, 0, 1),

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class BrownMushroom extends Flowable{ class BrownMushroom extends Flowable{
public function __construct(){ public function __construct(){
parent::__construct(BROWN_MUSHROOM, 0, "Brown Mushroom"); parent::__construct(self::BROWN_MUSHROOM, 0, "Brown Mushroom");
$this->hardness = 0; $this->hardness = 0;
} }
@ -44,7 +44,7 @@ class BrownMushroom extends Flowable{
return false; return false;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->isTransparent === false){ if($down->isTransparent === false){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);

View File

@ -32,12 +32,12 @@ use PocketMine;
class BurningFurnace extends Solid{ class BurningFurnace extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(BURNING_FURNACE, $meta, "Burning Furnace"); parent::__construct(self::BURNING_FURNACE, $meta, "Burning Furnace");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 17.5; $this->hardness = 17.5;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array( $faces = array(
0 => 4, 0 => 4,
1 => 2, 1 => 2,
@ -59,13 +59,13 @@ class BurningFurnace extends Solid{
return true; return true;
} }
public function onBreak(Item $item, Player $player){ public function onBreak(Item $item, PocketMine\Player $player){
$this->level->setBlock($this, new Air(), true, true, true); $this->level->setBlock($this, new Air(), true, true, true);
return true; return true;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
$t = $this->level->getTile($this); $t = $this->level->getTile($this);
$furnace = false; $furnace = false;
@ -92,7 +92,7 @@ class BurningFurnace extends Solid{
return true; return true;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -112,7 +112,7 @@ class BurningFurnace extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
$drops = array(); $drops = array();
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
$drops[] = array(FURNACE, 0, 1); $drops[] = array(FURNACE, 0, 1);

View File

@ -28,7 +28,7 @@ use PocketMine;
class Cactus extends Transparent{ class Cactus extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(CACTUS, $meta, "Cactus"); parent::__construct(self::CACTUS, $meta, "Cactus");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 2; $this->hardness = 2;
} }
@ -66,7 +66,7 @@ class Cactus extends Transparent{
return false; return false;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::SAND or $down->getID() === self::CACTUS){ if($down->getID() === self::SAND or $down->getID() === self::CACTUS){
$block0 = $this->getSide(2); $block0 = $this->getSide(2);
@ -83,7 +83,7 @@ class Cactus extends Transparent{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

View File

@ -26,14 +26,14 @@ use PocketMine\Item\Item as Item;
class Cake extends Transparent{ class Cake extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(CAKE_BLOCK, 0, "Cake Block"); parent::__construct(self::CAKE_BLOCK, 0, "Cake Block");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isActivable = true; $this->isActivable = true;
$this->meta = $meta & 0x07; $this->meta = $meta & 0x07;
$this->hardness = 2.5; $this->hardness = 2.5;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() !== self::AIR){ if($down->getID() !== self::AIR){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -56,11 +56,11 @@ class Cake extends Transparent{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array(); return array();
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($player->getHealth() < 20){ if($player->getHealth() < 20){
++$this->meta; ++$this->meta;
$player->heal(3, "cake"); $player->heal(3, "cake");

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class Carpet extends Flowable{ class Carpet extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(CARPET, $meta, "Carpet"); parent::__construct(self::CARPET, $meta, "Carpet");
$names = array( $names = array(
0 => "White Carpet", 0 => "White Carpet",
1 => "Orange Carpet", 1 => "Orange Carpet",
@ -51,7 +51,7 @@ class Carpet extends Flowable{
$this->isSolid = true; $this->isSolid = true;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() !== self::AIR){ if($down->getID() !== self::AIR){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class Carrot extends Flowable{ class Carrot extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(CARROT_BLOCK, $meta, "Carrot Block"); parent::__construct(self::CARROT_BLOCK, $meta, "Carrot Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::FARMLAND){ if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -42,8 +42,8 @@ class Carrot extends Flowable{
return false; return false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->getID() === ItemItem::DYE and $item->getMetadata() === 0x0F){ //Bonemeal if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07; $this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true); $this->level->setBlock($this, $this, true, false, true);
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
@ -81,7 +81,7 @@ class Carrot extends Flowable{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
$drops = array(); $drops = array();
if($this->meta >= 0x07){ if($this->meta >= 0x07){
$drops[] = array(CARROT, 0, mt_rand(1, 4)); $drops[] = array(CARROT, 0, mt_rand(1, 4));

View File

@ -32,12 +32,12 @@ use PocketMine;
class Chest extends Transparent{ class Chest extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(CHEST, $meta, "Chest"); parent::__construct(self::CHEST, $meta, "Chest");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 15; $this->hardness = 15;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array( $faces = array(
0 => 4, 0 => 4,
1 => 2, 1 => 2,
@ -82,7 +82,7 @@ class Chest extends Transparent{
return true; return true;
} }
public function onBreak(Item $item, Player $player){ public function onBreak(Item $item, PocketMine\Player $player){
$t = $this->level->getTile($this); $t = $this->level->getTile($this);
if($t instanceof TileChest){ if($t instanceof TileChest){
$t->unpair(); $t->unpair();
@ -92,7 +92,7 @@ class Chest extends Transparent{
return true; return true;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
$top = $this->getSide(1); $top = $this->getSide(1);
if($top->isTransparent !== true){ if($top->isTransparent !== true){
return true; return true;
@ -124,7 +124,7 @@ class Chest extends Transparent{
return true; return true;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
$drops = array( $drops = array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

View File

@ -26,13 +26,13 @@ use PocketMine\Item\Item as Item;
class Clay extends Solid{ class Clay extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(CLAY_BLOCK, 0, "Clay Block"); parent::__construct(self::CLAY_BLOCK, 0, "Clay Block");
$this->hardness = 3; $this->hardness = 3;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(ItemItem::CLAY, 0, 4), array(Item::CLAY, 0, 4),
); );
} }
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Coal extends Solid{ class Coal extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(COAL_BLOCK, 0, "Coal Block"); parent::__construct(self::COAL_BLOCK, 0, "Coal Block");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class Coal extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(COAL_BLOCK, 0, 1), array(COAL_BLOCK, 0, 1),

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class CoalOre extends Solid{ class CoalOre extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(COAL_ORE, 0, "Coal Ore"); parent::__construct(self::COAL_ORE, 0, "Coal Ore");
$this->hardness = 15; $this->hardness = 15;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class CoalOre extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(COAL, 0, 1), array(COAL, 0, 1),

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Cobblestone extends Solid{ class Cobblestone extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(COBBLESTONE, 0, "Cobblestone"); parent::__construct(self::COBBLESTONE, 0, "Cobblestone");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class Cobblestone extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(COBBLESTONE, 0, 1), array(COBBLESTONE, 0, 1),

View File

@ -25,7 +25,7 @@ use PocketMine;
class CobblestoneStairs extends Stair{ class CobblestoneStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(COBBLESTONE_STAIRS, $meta, "Cobblestone Stairs"); parent::__construct(self::COBBLESTONE_STAIRS, $meta, "Cobblestone Stairs");
} }
} }

View File

@ -26,13 +26,13 @@ use PocketMine\Item\Item as Item;
class Cobweb extends Flowable{ class Cobweb extends Flowable{
public function __construct(){ public function __construct(){
parent::__construct(COBWEB, 0, "Cobweb"); parent::__construct(self::COBWEB, 0, "Cobweb");
$this->isSolid = true; $this->isSolid = true;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 25; $this->hardness = 25;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array(); return array();
} }
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class CyanFlower extends Flowable{ class CyanFlower extends Flowable{
public function __construct(){ public function __construct(){
parent::__construct(CYAN_FLOWER, 0, "Cyan Flower"); parent::__construct(self::CYAN_FLOWER, 0, "Cyan Flower");
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){ if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Dandelion extends Flowable{ class Dandelion extends Flowable{
public function __construct(){ public function __construct(){
parent::__construct(DANDELION, 0, "Dandelion"); parent::__construct(self::DANDELION, 0, "Dandelion");
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){ if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);

View File

@ -25,7 +25,7 @@ use PocketMine;
class DeadBush extends Flowable{ class DeadBush extends Flowable{
public function __construct(){ public function __construct(){
parent::__construct(DEAD_BUSH, 0, "Dead Bush"); parent::__construct(self::DEAD_BUSH, 0, "Dead Bush");
//$this->isReplaceable = true; //$this->isReplaceable = true;
$this->hardness = 0; $this->hardness = 0;
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Diamond extends Solid{ class Diamond extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(DIAMOND_BLOCK, 0, "Diamond Block"); parent::__construct(self::DIAMOND_BLOCK, 0, "Diamond Block");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -44,7 +44,7 @@ class Diamond extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= 4){
return array( return array(
array(DIAMOND_BLOCK, 0, 1), array(DIAMOND_BLOCK, 0, 1),

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class DiamondOre extends Solid{ class DiamondOre extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(DIAMOND_ORE, 0, "Diamond Ore"); parent::__construct(self::DIAMOND_ORE, 0, "Diamond Ore");
$this->hardness = 15; $this->hardness = 15;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -44,7 +44,7 @@ class DiamondOre extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= 4){
return array( return array(
array(DIAMOND, 0, 1), array(DIAMOND, 0, 1),

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class Dirt extends Solid{ class Dirt extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(DIRT, 0, "Dirt"); parent::__construct(self::DIRT, 0, "Dirt");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 2.5; $this->hardness = 2.5;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->isHoe()){ if($item->isHoe()){
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
$item->useOn($this); $item->useOn($this);

View File

@ -48,7 +48,7 @@ abstract class Door extends Transparent{
return false; return false;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($face === 1){ if($face === 1){
$blockUp = $this->getSide(1); $blockUp = $this->getSide(1);
$blockDown = $this->getSide(0); $blockDown = $this->getSide(0);
@ -78,7 +78,7 @@ abstract class Door extends Transparent{
return false; return false;
} }
public function onBreak(Item $item, Player $player){ public function onBreak(Item $item, PocketMine\Player $player){
if(($this->meta & 0x08) === 0x08){ if(($this->meta & 0x08) === 0x08){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === $this->id){ if($down->getID() === $this->id){
@ -95,7 +95,7 @@ abstract class Door extends Transparent{
return true; return true;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if(($this->meta & 0x08) === 0x08){ //Top if(($this->meta & 0x08) === 0x08){ //Top
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === $this->id){ if($down->getID() === $this->id){

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class DoubleSlab extends Solid{ class DoubleSlab extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(DOUBLE_SLAB, $meta, "Double Slab"); parent::__construct(self::DOUBLE_SLAB, $meta, "Double Slab");
$names = array( $names = array(
0 => "Stone", 0 => "Stone",
1 => "Sandstone", 1 => "Sandstone",
@ -40,7 +40,7 @@ class DoubleSlab extends Solid{
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -60,7 +60,7 @@ class DoubleSlab extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(SLAB, $this->meta & 0x07, 2), array(SLAB, $this->meta & 0x07, 2),

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class DoubleWoodSlab extends Solid{ class DoubleWoodSlab extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(DOUBLE_WOOD_SLAB, $meta, "Double Wooden Slab"); parent::__construct(self::DOUBLE_WOOD_SLAB, $meta, "Double Wooden Slab");
$names = array( $names = array(
0 => "Oak", 0 => "Oak",
1 => "Spruce", 1 => "Spruce",
@ -37,7 +37,7 @@ class DoubleWoodSlab extends Solid{
$this->hardness = 15; $this->hardness = 15;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -57,7 +57,7 @@ class DoubleWoodSlab extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(WOOD_SLAB, $this->meta & 0x07, 2), array(WOOD_SLAB, $this->meta & 0x07, 2),
); );

View File

@ -32,7 +32,7 @@ class Fallable extends Solid{
$this->hasPhysics = true; $this->hasPhysics = true;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$ret = $this->level->setBlock($this, $this, true, false, true); $ret = $this->level->setBlock($this, $this, true, false, true);
ServerAPI::request()->api->block->blockUpdate(clone $this, BLOCK_UPDATE_NORMAL); ServerAPI::request()->api->block->blockUpdate(clone $this, BLOCK_UPDATE_NORMAL);

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Farmland extends Solid{ class Farmland extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(FARMLAND, $meta, "Farmland"); parent::__construct(self::FARMLAND, $meta, "Farmland");
$this->hardness = 3; $this->hardness = 3;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(DIRT, 0, 1), array(DIRT, 0, 1),
); );

View File

@ -25,7 +25,7 @@ use PocketMine;
class Fence extends Transparent{ class Fence extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(FENCE, 0, "Fence"); parent::__construct(self::FENCE, 0, "Fence");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 15; $this->hardness = 15;
} }

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class FenceGate extends Transparent{ class FenceGate extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(FENCE_GATE, $meta, "Fence Gate"); parent::__construct(self::FENCE_GATE, $meta, "Fence Gate");
$this->isActivable = true; $this->isActivable = true;
if(($this->meta & 0x04) === 0x04){ if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true; $this->isFullBlock = true;
@ -36,7 +36,7 @@ class FenceGate extends Transparent{
$this->hardness = 15; $this->hardness = 15;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array( $faces = array(
0 => 3, 0 => 3,
1 => 0, 1 => 0,
@ -49,13 +49,13 @@ class FenceGate extends Transparent{
return true; return true;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
$faces = array( $faces = array(
0 => 3, 0 => 3,
1 => 0, 1 => 0,

View File

@ -26,14 +26,14 @@ use PocketMine\Item\Item as Item;
class Fire extends Flowable{ class Fire extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(FIRE, $meta, "Fire"); parent::__construct(self::FIRE, $meta, "Fire");
$this->isReplaceable = true; $this->isReplaceable = true;
$this->breakable = false; $this->breakable = false;
$this->isFullBlock = true; $this->isFullBlock = true;
$this->hardness = 0; $this->hardness = 0;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array(); return array();
} }

View File

@ -27,7 +27,7 @@ use PocketMine;
class Furnace extends BurningFurnace{ class Furnace extends BurningFurnace{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct($meta); parent::__construct($meta);
$this->id = FURNACE; $this->id = self::FURNACE;
$this->name = "Furnace"; $this->name = "Furnace";
$this->isActivable = true; $this->isActivable = true;
} }

View File

@ -21,6 +21,7 @@
namespace PocketMine\Block; namespace PocketMine\Block;
use PocketMine\Player as Player;
use PocketMine\Item\Item as Item; use PocketMine\Item\Item as Item;
use PocketMine\ServerAPI as ServerAPI; use PocketMine\ServerAPI as ServerAPI;
use PocketMine; use PocketMine;
@ -36,15 +37,15 @@ class Generic extends Block{
parent::__construct($id, $meta, $name); parent::__construct($id, $meta, $name);
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
return $this->level->setBlock($this, $this, true, false, true); return $this->level->setBlock($this, $this, true, false, true);
} }
public function isBreakable(Item $item, Player $player){ public function isBreakable(Item $item, PocketMine\Player $player){
return $this->breakable; return $this->breakable;
} }
public function onBreak(Item $item, Player $player){ public function onBreak(Item $item, PocketMine\Player $player){
return $this->level->setBlock($this, new Air(), true, false, true); return $this->level->setBlock($this, new Air(), true, false, true);
} }
@ -72,7 +73,7 @@ class Generic extends Block{
return false; return false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
return $this->isActivable; return $this->isActivable;
} }
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Glass extends Transparent{ class Glass extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(GLASS, 0, "Glass"); parent::__construct(self::GLASS, 0, "Glass");
$this->hardness = 1.5; $this->hardness = 1.5;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array(); return array();
} }
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class GlassPane extends Transparent{ class GlassPane extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(GLASS_PANE, 0, "Glass Pane"); parent::__construct(self::GLASS_PANE, 0, "Glass Pane");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = false; $this->isSolid = false;
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class GlowingObsidian extends Solid{ class GlowingObsidian extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(GLOWING_OBSIDIAN, $meta, "Glowing Obsidian"); parent::__construct(self::GLOWING_OBSIDIAN, $meta, "Glowing Obsidian");
} }
} }

View File

@ -28,7 +28,7 @@ use PocketMine;
class GlowingRedstoneOre extends Solid{ class GlowingRedstoneOre extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore"); parent::__construct(self::GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore");
$this->hardness = 15; $this->hardness = 15;
} }
@ -45,7 +45,7 @@ class GlowingRedstoneOre extends Solid{
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -59,10 +59,10 @@ class GlowingRedstoneOre extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= 4){
return array( return array(
array(ItemItem::REDSTONE_DUST, 0, mt_rand(4, 5)), array(Item::REDSTONE_DUST, 0, mt_rand(4, 5)),
); );
} else{ } else{
return array(); return array();

View File

@ -26,13 +26,13 @@ use PocketMine\Item\Item as Item;
class Glowstone extends Transparent{ class Glowstone extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(GLOWSTONE_BLOCK, 0, "Glowstone"); parent::__construct(self::GLOWSTONE_BLOCK, 0, "Glowstone");
$this->hardness = 1.5; $this->hardness = 1.5;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(ItemItem::GLOWSTONE_DUST, 0, mt_rand(2, 4)), array(Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)),
); );
} }
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Gold extends Solid{ class Gold extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(GOLD_BLOCK, 0, "Gold Block"); parent::__construct(self::GOLD_BLOCK, 0, "Gold Block");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -44,7 +44,7 @@ class Gold extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= 4){
return array( return array(
array(GOLD_BLOCK, 0, 1), array(GOLD_BLOCK, 0, 1),

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class GoldOre extends Solid{ class GoldOre extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(GOLD_ORE, 0, "Gold Ore"); parent::__construct(self::GOLD_ORE, 0, "Gold Ore");
$this->hardness = 15; $this->hardness = 15;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -44,7 +44,7 @@ class GoldOre extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= 4){
return array( return array(
array(GOLD_ORE, 0, 1), array(GOLD_ORE, 0, 1),

View File

@ -28,19 +28,19 @@ use PocketMine;
class Grass extends Solid{ class Grass extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(GRASS, 0, "Grass"); parent::__construct(self::GRASS, 0, "Grass");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 3; $this->hardness = 3;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(DIRT, 0, 1), array(DIRT, 0, 1),
); );
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->getID() === ItemItem::DYE and $item->getMetadata() === 0x0F){ if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
$item->count--; $item->count--;
} }

View File

@ -26,14 +26,14 @@ use PocketMine\Item\Item as Item;
class Gravel extends Fallable{ class Gravel extends Fallable{
public function __construct(){ public function __construct(){
parent::__construct(GRAVEL, 0, "Gravel"); parent::__construct(self::GRAVEL, 0, "Gravel");
$this->hardness = 3; $this->hardness = 3;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if(mt_rand(1, 10) === 1){ if(mt_rand(1, 10) === 1){
return array( return array(
array(ItemItem::FLINT, 0, 1), array(Item::FLINT, 0, 1),
); );
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class HayBale extends Solid{ class HayBale extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(HAY_BALE, $meta, "Hay Bale"); parent::__construct(self::HAY_BALE, $meta, "Hay Bale");
$this->hardness = 10; $this->hardness = 10;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array( $faces = array(
0 => 0, 0 => 0,
1 => 0, 1 => 0,
@ -46,7 +46,7 @@ class HayBale extends Solid{
return true; return true;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Ice extends Transparent{ class Ice extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(ICE, 0, "Ice"); parent::__construct(self::ICE, 0, "Ice");
$this->hardness = 2.5; $this->hardness = 2.5;
} }
public function onBreak(Item $item, Player $player){ public function onBreak(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
$this->level->setBlock($this, new Water(), true, false, true); $this->level->setBlock($this, new Water(), true, false, true);
} else{ } else{
@ -40,7 +40,7 @@ class Ice extends Transparent{
return true; return true;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -60,7 +60,7 @@ class Ice extends Transparent{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array(); return array();
} }
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Iron extends Solid{ class Iron extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(IRON_BLOCK, 0, "Iron Block"); parent::__construct(self::IRON_BLOCK, 0, "Iron Block");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -46,7 +46,7 @@ class Iron extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= 3){
return array( return array(
array(IRON_BLOCK, 0, 1), array(IRON_BLOCK, 0, 1),

View File

@ -25,7 +25,7 @@ use PocketMine;
class IronBars extends Transparent{ class IronBars extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(IRON_BARS, 0, "Iron Bars"); parent::__construct(self::IRON_BARS, 0, "Iron Bars");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = false; $this->isSolid = false;
} }

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class IronDoor extends Door{ class IronDoor extends Door{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(IRON_DOOR_BLOCK, $meta, "Iron Door Block"); parent::__construct(self::IRON_DOOR_BLOCK, $meta, "Iron Door Block");
//$this->isActivable = true; //$this->isActivable = true;
$this->hardness = 25; $this->hardness = 25;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -51,10 +51,10 @@ class IronDoor extends Door{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(ItemItem::IRON_DOOR, 0, 1), array(Item::IRON_DOOR, 0, 1),
); );
} else{ } else{
return array(); return array();

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class IronOre extends Solid{ class IronOre extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(IRON_ORE, 0, "Iron Ore"); parent::__construct(self::IRON_ORE, 0, "Iron Ore");
$this->hardness = 15; $this->hardness = 15;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -46,7 +46,7 @@ class IronOre extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= 3){
return array( return array(
array(IRON_ORE, 0, 1), array(IRON_ORE, 0, 1),

View File

@ -26,10 +26,10 @@ use PocketMine\Item\Item as Item;
class JungleWoodStairs extends Stair{ class JungleWoodStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs"); parent::__construct(self::JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs");
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

View File

@ -26,13 +26,13 @@ use PocketMine\Item\Item as Item;
class Ladder extends Transparent{ class Ladder extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(LADDER, $meta, "Ladder"); parent::__construct(self::LADDER, $meta, "Ladder");
$this->isSolid = false; $this->isSolid = false;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 2; $this->hardness = 2;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($target->isTransparent === false){ if($target->isTransparent === false){
$faces = array( $faces = array(
2 => 2, 2 => 2,
@ -63,7 +63,7 @@ class Ladder extends Transparent{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Lapis extends Solid{ class Lapis extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(LAPIS_BLOCK, 0, "Lapis Block"); parent::__construct(self::LAPIS_BLOCK, 0, "Lapis Block");
$this->hardness = 15; $this->hardness = 15;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -46,7 +46,7 @@ class Lapis extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= 3){
return array( return array(
array(LAPIS_BLOCK, 0, 1), array(LAPIS_BLOCK, 0, 1),

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class LapisOre extends Solid{ class LapisOre extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(LAPIS_ORE, 0, "Lapis Ore"); parent::__construct(self::LAPIS_ORE, 0, "Lapis Ore");
$this->hardness = 15; $this->hardness = 15;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -46,10 +46,10 @@ class LapisOre extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= 3){
return array( return array(
array(ItemItem::DYE, 4, mt_rand(4, 8)), array(Item::DYE, 4, mt_rand(4, 8)),
); );
} else{ } else{
return array(); return array();

View File

@ -28,11 +28,11 @@ use PocketMine;
class Lava extends Liquid{ class Lava extends Liquid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(LAVA, $meta, "Lava"); parent::__construct(self::LAVA, $meta, "Lava");
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$ret = $this->level->setBlock($this, $this, true, false, true); $ret = $this->level->setBlock($this, $this, true, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 40, BLOCK_UPDATE_NORMAL); ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 40, BLOCK_UPDATE_NORMAL);

View File

@ -32,7 +32,7 @@ class Leaves extends Transparent{
const JUNGLE = 3; const JUNGLE = 3;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(LEAVES, $meta, "Leaves"); parent::__construct(self::LEAVES, $meta, "Leaves");
$names = array( $names = array(
self::OAK => "Oak Leaves", self::OAK => "Oak Leaves",
self::SPRUCE => "Spruce Leaves", self::SPRUCE => "Spruce Leaves",
@ -140,18 +140,18 @@ class Leaves extends Transparent{
return false; return false;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$this->meta |= 0x04; $this->meta |= 0x04;
$this->level->setBlock($this, $this, true, false, true); $this->level->setBlock($this, $this, true, false, true);
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
$drops = array(); $drops = array();
if($item->isShears()){ if($item->isShears()){
$drops[] = array(LEAVES, $this->meta & 0x03, 1); $drops[] = array(LEAVES, $this->meta & 0x03, 1);
} else{ } else{
if(mt_rand(1, 20) === 1){ //Saplings if(mt_rand(1, 20) === 1){ //Saplings
$drops[] = array(ItemItem::SAPLING, $this->meta & 0x03, 1); $drops[] = array(Item::SAPLING, $this->meta & 0x03, 1);
} }
if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples
$drops[] = array(APPLE, 0, 1); $drops[] = array(APPLE, 0, 1);

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class LitPumpkin extends Solid{ class LitPumpkin extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(LIT_PUMPKIN, "Jack o'Lantern"); parent::__construct(self::LIT_PUMPKIN, "Jack o'Lantern");
$this->hardness = 5; $this->hardness = 5;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array( $faces = array(
0 => 4, 0 => 4,
1 => 2, 1 => 2,

View File

@ -26,13 +26,13 @@ use PocketMine\Item\Item as Item;
class Melon extends Transparent{ class Melon extends Transparent{
public function __construct(){ public function __construct(){
parent::__construct(MELON_BLOCK, 0, "Melon Block"); parent::__construct(self::MELON_BLOCK, 0, "Melon Block");
$this->hardness = 5; $this->hardness = 5;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(ItemItem::MELON_SLICE, 0, mt_rand(3, 7)), array(Item::MELON_SLICE, 0, mt_rand(3, 7)),
); );
} }
} }

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class MelonStem extends Flowable{ class MelonStem extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(MELON_STEM, $meta, "Melon Stem"); parent::__construct(self::MELON_STEM, $meta, "Melon Stem");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::FARMLAND){ if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -79,8 +79,8 @@ class MelonStem extends Flowable{
return false; return false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->getID() === ItemItem::DYE and $item->getMetadata() === 0x0F){ //Bonemeal if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07; $this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true); $this->level->setBlock($this, $this, true, false, true);
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
@ -93,9 +93,9 @@ class MelonStem extends Flowable{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(ItemItem::MELON_SEEDS, 0, mt_rand(0, 2)), array(Item::MELON_SEEDS, 0, mt_rand(0, 2)),
); );
} }
} }

View File

@ -25,12 +25,12 @@ use PocketMine;
use PocketMine\Item\Item as Item; use PocketMine\Item\Item as Item;
class MossStone extends Solid{ class MossStone extends Solid{
public function __construct($meta){ public function __construct($meta = 0){
parent::__construct(MOSS_STONE, $meta, "Moss Stone"); parent::__construct(self::MOSS_STONE, $meta, "Moss Stone");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class MossStone extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(MOSS_STONE, $this->meta, 1), array(MOSS_STONE, $this->meta, 1),

View File

@ -24,13 +24,13 @@ namespace PocketMine\Block;
use PocketMine; use PocketMine;
use PocketMine\Item\Item as Item; use PocketMine\Item\Item as Item;
class NetherBricks extends Solid{ class NetherBrick extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(NETHER_BRICKS, 0, "Nether Bricks"); parent::__construct(self::NETHER_BRICKS, 0, "Nether Bricks");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class NetherBricks extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(NETHER_BRICKS, 0, 1), array(NETHER_BRICKS, 0, 1),

View File

@ -23,9 +23,9 @@ namespace PocketMine\Block;
use PocketMine; use PocketMine;
class NetherBricksStairs extends Stair{ class NetherBrickStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(NETHER_BRICKS_STAIRS, $meta, "Nether Bricks Stairs"); parent::__construct(self::NETHER_BRICKS_STAIRS, $meta, "Nether Bricks Stairs");
} }
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class NetherReactor extends Solid{ class NetherReactor extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(NETHER_REACTOR, $meta, "Nether Reactor"); parent::__construct(self::NETHER_REACTOR, $meta, "Nether Reactor");
$this->isActivable = true; $this->isActivable = true;
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Netherrack extends Solid{ class Netherrack extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(NETHERRACK, 0, "Netherrack"); parent::__construct(self::NETHERRACK, 0, "Netherrack");
$this->hardness = 2; $this->hardness = 2;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class Netherrack extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(NETHERRACK, 0, 1), array(NETHERRACK, 0, 1),

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Obsidian extends Solid{ class Obsidian extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(OBSIDIAN, 0, "Obsidian"); parent::__construct(self::OBSIDIAN, 0, "Obsidian");
$this->hardness = 6000; $this->hardness = 6000;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -41,7 +41,7 @@ class Obsidian extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 5){ if($item->isPickaxe() >= 5){
return array( return array(
array(OBSIDIAN, 0, 1), array(OBSIDIAN, 0, 1),

View File

@ -25,12 +25,12 @@ use PocketMine;
class Planks extends Solid{ class Planks extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(PLANKS, $meta, "Wooden Planks"); parent::__construct(self::PLANKS, $meta, "Wooden Planks");
$names = array( $names = array(
WoodBlock::OAK => "Oak Wooden Planks", Wood::OAK => "Oak Wooden Planks",
WoodBlock::SPRUCE => "Spruce Wooden Planks", Wood::SPRUCE => "Spruce Wooden Planks",
WoodBlock::BIRCH => "Birch Wooden Planks", Wood::BIRCH => "Birch Wooden Planks",
WoodBlock::JUNGLE => "Jungle Wooden Planks", Wood::JUNGLE => "Jungle Wooden Planks",
); );
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x03];
$this->hardness = 15; $this->hardness = 15;

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class Potato extends Flowable{ class Potato extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(POTATO_BLOCK, $meta, "Potato Block"); parent::__construct(self::POTATO_BLOCK, $meta, "Potato Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::FARMLAND){ if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -42,8 +42,8 @@ class Potato extends Flowable{
return false; return false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->getID() === ItemItem::DYE and $item->getMetadata() === 0x0F){ //Bonemeal if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07; $this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true); $this->level->setBlock($this, $this, true, false, true);
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
@ -81,7 +81,7 @@ class Potato extends Flowable{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
$drops = array(); $drops = array();
if($this->meta >= 0x07){ if($this->meta >= 0x07){
$drops[] = array(POTATO, 0, mt_rand(1, 4)); $drops[] = array(POTATO, 0, mt_rand(1, 4));

View File

@ -25,7 +25,7 @@ use PocketMine;
class Pumpkin extends Solid{ class Pumpkin extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(PUMPKIN, "Pumpkin"); parent::__construct(self::PUMPKIN, "Pumpkin");
$this->hardness = 5; $this->hardness = 5;
} }

View File

@ -26,12 +26,12 @@ use PocketMine\Item\Item as Item;
class PumpkinStem extends Flowable{ class PumpkinStem extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(PUMPKIN_STEM, $meta, "Pumpkin Stem"); parent::__construct(self::PUMPKIN_STEM, $meta, "Pumpkin Stem");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::FARMLAND){ if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -79,8 +79,8 @@ class PumpkinStem extends Flowable{
return false; return false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->getID() === ItemItem::DYE and $item->getMetadata() === 0x0F){ //Bonemeal if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07; $this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true); $this->level->setBlock($this, $this, true, false, true);
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
@ -93,9 +93,9 @@ class PumpkinStem extends Flowable{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(ItemItem::PUMPKIN_SEEDS, 0, mt_rand(0, 2)), array(Item::PUMPKIN_SEEDS, 0, mt_rand(0, 2)),
); );
} }
} }

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class Quartz extends Solid{ class Quartz extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(QUARTZ_BLOCK, $meta, "Quartz Block"); parent::__construct(self::QUARTZ_BLOCK, $meta, "Quartz Block");
$names = array( $names = array(
0 => "Quartz Block", 0 => "Quartz Block",
1 => "Chiseled Quartz Block", 1 => "Chiseled Quartz Block",
@ -36,7 +36,7 @@ class Quartz extends Solid{
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x03];
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -56,7 +56,7 @@ class Quartz extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(QUARTZ_BLOCK, $this->meta & 0x03, 1), array(QUARTZ_BLOCK, $this->meta & 0x03, 1),

View File

@ -25,7 +25,7 @@ use PocketMine;
class QuartzStairs extends Stair{ class QuartzStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(QUARTZ_STAIRS, $meta, "Quartz Stairs"); parent::__construct(self::QUARTZ_STAIRS, $meta, "Quartz Stairs");
} }
} }

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class RedMushroom extends Flowable{ class RedMushroom extends Flowable{
public function __construct(){ public function __construct(){
parent::__construct(RED_MUSHROOM, 0, "Red Mushroom"); parent::__construct(self::RED_MUSHROOM, 0, "Red Mushroom");
$this->hardness = 0; $this->hardness = 0;
} }
@ -44,7 +44,7 @@ class RedMushroom extends Flowable{
return false; return false;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->isTransparent === false){ if($down->isTransparent === false){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class RedstoneOre extends Solid{ class RedstoneOre extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(REDSTONE_ORE, 0, "Redstone Ore"); parent::__construct(self::REDSTONE_ORE, 0, "Redstone Ore");
$this->hardness = 15; $this->hardness = 15;
} }
@ -41,7 +41,7 @@ class RedstoneOre extends Solid{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 2){ if($item->isPickaxe() >= 2){
return array( return array(
array(Redstone\REDSTONE_DUST, 0, mt_rand(4, 5)), array(Redstone\REDSTONE_DUST, 0, mt_rand(4, 5)),

View File

@ -25,7 +25,7 @@ use PocketMine;
class Sand extends Fallable{ class Sand extends Fallable{
public function __construct(){ public function __construct(){
parent::__construct(SAND, 0, "Sand"); parent::__construct(self::SAND, 0, "Sand");
$this->hardness = 2.5; $this->hardness = 2.5;
} }

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class Sandstone extends Solid{ class Sandstone extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SANDSTONE, $meta, "Sandstone"); parent::__construct(self::SANDSTONE, $meta, "Sandstone");
$names = array( $names = array(
0 => "Sandstone", 0 => "Sandstone",
1 => "Chiseled Sandstone", 1 => "Chiseled Sandstone",
@ -36,7 +36,7 @@ class Sandstone extends Solid{
$this->hardness = 4; $this->hardness = 4;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -56,7 +56,7 @@ class Sandstone extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(SANDSTONE, $this->meta & 0x03, 1), array(SANDSTONE, $this->meta & 0x03, 1),

View File

@ -25,7 +25,7 @@ use PocketMine;
class SandstoneStairs extends Stair{ class SandstoneStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SANDSTONE_STAIRS, $meta, "Sandstone Stairs"); parent::__construct(self::SANDSTONE_STAIRS, $meta, "Sandstone Stairs");
} }
} }

View File

@ -34,7 +34,7 @@ class Sapling extends Flowable{
const BURN_TIME = 5; const BURN_TIME = 5;
public function __construct($meta = Sapling::OAK){ public function __construct($meta = Sapling::OAK){
parent::__construct(SAPLING, $meta, "Sapling"); parent::__construct(self::SAPLING, $meta, "Sapling");
$this->isActivable = true; $this->isActivable = true;
$names = array( $names = array(
0 => "Oak Sapling", 0 => "Oak Sapling",
@ -46,7 +46,7 @@ class Sapling extends Flowable{
$this->hardness = 0; $this->hardness = 0;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::FARMLAND){ if($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -57,8 +57,8 @@ class Sapling extends Flowable{
return false; return false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
if($item->getID() === ItemItem::DYE and $item->getMetadata() === 0x0F){ //Bonemeal if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
Tree::growTree($this->level, $this, new Random(), $this->meta & 0x03); Tree::growTree($this->level, $this, new Random(), $this->meta & 0x03);
if(($player->gamemode & 0x01) === 0){ if(($player->gamemode & 0x01) === 0){
$item->count--; $item->count--;
@ -97,7 +97,7 @@ class Sapling extends Flowable{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, $this->meta & 0x03, 1), array($this->id, $this->meta & 0x03, 1),
); );

View File

@ -26,13 +26,13 @@ use PocketMine\Item\Item as Item;
class SignPost extends Transparent{ class SignPost extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SIGN_POST, $meta, "Sign Post"); parent::__construct(self::SIGN_POST, $meta, "Sign Post");
$this->isSolid = false; $this->isSolid = false;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 5; $this->hardness = 5;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($face !== 0){ if($face !== 0){
$faces = array( $faces = array(
2 => 2, 2 => 2,
@ -70,15 +70,15 @@ class SignPost extends Transparent{
return false; return false;
} }
public function onBreak(Item $item, Player $player){ public function onBreak(Item $item, PocketMine\Player $player){
$this->level->setBlock($this, new Air(), true, true, true); $this->level->setBlock($this, new Air(), true, true, true);
return true; return true;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array(ItemItem::SIGN, 0, 1), array(Item::SIGN, 0, 1),
); );
} }
} }

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class Slab extends Transparent{ class Slab extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SLAB, $meta, "Slab"); parent::__construct(self::SLAB, $meta, "Slab");
$names = array( $names = array(
0 => "Stone", 0 => "Stone",
1 => "Sandstone", 1 => "Sandstone",
@ -46,7 +46,7 @@ class Slab extends Transparent{
$this->hardness = 30; $this->hardness = 30;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$this->meta &= 0x07; $this->meta &= 0x07;
if($face === 0){ if($face === 0){
if($target->getID() === self::SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){ if($target->getID() === self::SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
@ -95,7 +95,7 @@ class Slab extends Transparent{
return true; return true;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -115,7 +115,7 @@ class Slab extends Transparent{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array($this->id, $this->meta & 0x07, 1), array($this->id, $this->meta & 0x07, 1),

View File

@ -25,7 +25,7 @@ use PocketMine;
class Snow extends Solid{ class Snow extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(SNOW_BLOCK, 0, "Snow Block"); parent::__construct(self::SNOW_BLOCK, 0, "Snow Block");
$this->hardness = 1; $this->hardness = 1;
} }

View File

@ -26,14 +26,14 @@ use PocketMine\Item\Item as Item;
class SnowLayer extends Flowable{ class SnowLayer extends Flowable{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SNOW_LAYER, $meta, "Snow Layer"); parent::__construct(self::SNOW_LAYER, $meta, "Snow Layer");
$this->isReplaceable = true; $this->isReplaceable = true;
$this->isSolid = false; $this->isSolid = false;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 0.5; $this->hardness = 0.5;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down instanceof Solid){ if($down instanceof Solid){
$this->level->setBlock($block, $this, true, false, true); $this->level->setBlock($block, $this, true, false, true);
@ -56,10 +56,10 @@ class SnowLayer extends Flowable{
return false; return false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isShovel() !== false){ if($item->isShovel() !== false){
return array( return array(
array(ItemItem::SNOWBALL, 0, 1), array(Item::SNOWBALL, 0, 1),
); );
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class SoulSand extends Solid{ class SoulSand extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(SOUL_SAND, 0, "Soul Sand"); parent::__construct(self::SOUL_SAND, 0, "Soul Sand");
$this->hardness = 2.5; $this->hardness = 2.5;
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class Sponge extends Solid{ class Sponge extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(SPONGE, "Sponge"); parent::__construct(self::SPONGE, "Sponge");
$this->hardness = 3; $this->hardness = 3;
} }

View File

@ -26,10 +26,10 @@ use PocketMine\Item\Item as Item;
class SpruceWoodStairs extends Stair{ class SpruceWoodStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SPRUCE_WOOD_STAIRS, $meta, "Spruce Wood Stairs"); parent::__construct(self::SPRUCE_WOOD_STAIRS, $meta, "Spruce Wood Stairs");
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

View File

@ -36,7 +36,7 @@ class Stair extends Transparent{
$this->hardness = 30; $this->hardness = 30;
} }
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function place(Item $item, PocketMine\Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array( $faces = array(
0 => 0, 0 => 0,
1 => 2, 1 => 2,
@ -52,7 +52,7 @@ class Stair extends Transparent{
return true; return true;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),

View File

@ -25,7 +25,7 @@ use PocketMine;
class StillLava extends Liquid{ class StillLava extends Liquid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(STILL_LAVA, $meta, "Still Lava"); parent::__construct(self::STILL_LAVA, $meta, "Still Lava");
$this->hardness = 500; $this->hardness = 500;
} }

View File

@ -25,7 +25,7 @@ use PocketMine;
class StillWater extends Water{ class StillWater extends Water{
public function __construct($meta = 0){ public function __construct($meta = 0){
LiquidBlock::__construct(STILL_WATER, $meta, "Still Water"); Liquid::__construct(self::STILL_WATER, $meta, "Still Water");
$this->hardness = 500; $this->hardness = 500;
} }

View File

@ -26,11 +26,11 @@ use PocketMine\Item\Item as Item;
class Stone extends Solid{ class Stone extends Solid{
public function __construct(){ public function __construct(){
parent::__construct(STONE, 0, "Stone"); parent::__construct(self::STONE, 0, "Stone");
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -50,7 +50,7 @@ class Stone extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(COBBLESTONE, 0, 1), array(COBBLESTONE, 0, 1),

View File

@ -25,7 +25,7 @@ use PocketMine;
class StoneBrickStairs extends Stair{ class StoneBrickStairs extends Stair{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(STONE_BRICK_STAIRS, $meta, "Stone Brick Stairs"); parent::__construct(self::STONE_BRICK_STAIRS, $meta, "Stone Brick Stairs");
} }
} }

View File

@ -26,7 +26,7 @@ use PocketMine\Item\Item as Item;
class StoneBricks extends Solid{ class StoneBricks extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(STONE_BRICKS, $meta, "Stone Bricks"); parent::__construct(self::STONE_BRICKS, $meta, "Stone Bricks");
$names = array( $names = array(
0 => "Stone Bricks", 0 => "Stone Bricks",
1 => "Mossy Stone Bricks", 1 => "Mossy Stone Bricks",
@ -37,7 +37,7 @@ class StoneBricks extends Solid{
$this->hardness = 30; $this->hardness = 30;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, PocketMine\Player $player){
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.20; return 0.20;
} }
@ -57,7 +57,7 @@ class StoneBricks extends Solid{
} }
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= 1){
return array( return array(
array(STONE_BRICKS, $this->meta & 0x03, 1), array(STONE_BRICKS, $this->meta & 0x03, 1),

View File

@ -26,7 +26,7 @@ use PocketMine;
class StoneWall extends Transparent{ class StoneWall extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
$meta &= 0x01; $meta &= 0x01;
parent::__construct(STONE_WALL, $meta, "Cobblestone Wall"); parent::__construct(self::STONE_WALL, $meta, "Cobblestone Wall");
if($meta === 1){ if($meta === 1){
$this->name = "Mossy Cobblestone Wall"; $this->name = "Mossy Cobblestone Wall";
} }

View File

@ -26,17 +26,17 @@ use PocketMine\Item\Item as Item;
class Stonecutter extends Solid{ class Stonecutter extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(STONECUTTER, $meta, "Stonecutter"); parent::__construct(self::STONECUTTER, $meta, "Stonecutter");
$this->isActivable = true; $this->isActivable = true;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, PocketMine\Player $player){
$player->toCraft[-1] = 2; $player->toCraft[-1] = 2;
return true; return true;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, PocketMine\Player $player){
return array( return array(
array($this->id, 0, 1), array($this->id, 0, 1),
); );

Some files were not shown because too many files have changed in this diff Show More