diff --git a/src/API/BanAPI.php b/src/API/BanAPI.php index 82e89f68e..1ee8821ea 100644 --- a/src/API/BanAPI.php +++ b/src/API/BanAPI.php @@ -21,9 +21,16 @@ class BanAPI{ private $server; + /* + * I would use PHPDoc Template here but PHPStorm does not recognise it. - @sekjun9878 + */ + /** @var Config */ private $whitelist; + /** @var Config */ private $banned; + /** @var Config */ private $ops; + /** @var Config */ private $bannedIPs; private $cmdWL = array();//Command WhiteList function __construct(){ @@ -349,10 +356,13 @@ class BanAPI{ public function isIPBanned($ip){ if($this->server->api->dhandle("api.ban.ip.check", $ip) === false){ return true; - }elseif($this->bannedIPs->exists($ip)){ + }elseif($this->bannedIPs->exists($ip, true)){ return true; } - return false; + else + { + return false; + } } /** @@ -364,10 +374,13 @@ class BanAPI{ $username = strtolower($username); if($this->server->api->dhandle("api.ban.check", $username) === false){ return true; - }elseif($this->banned->exists($username)){ + }elseif($this->banned->exists($username, true)){ return true; } - return false; + else + { + return false; + } } /** @@ -381,7 +394,7 @@ class BanAPI{ return true; }elseif($this->server->api->dhandle("api.ban.whitelist.check", $username) === false){ return true; - }elseif($this->whitelist->exists($username)){ + }elseif($this->whitelist->exists($username, true)){ return true; } return false; diff --git a/src/constants/BlockIDs.php b/src/constants/BlockIDs.php index d2f572d6d..06f96cebc 100644 --- a/src/constants/BlockIDs.php +++ b/src/constants/BlockIDs.php @@ -169,7 +169,7 @@ define("STONE_WALL", 139); define("COBBLESTONE_WALL", 139); define("CARROT_BLOCK", 141); -define("POTATO_BLOCK", 141); +define("POTATO_BLOCK", 142); define("QUARTZ_BLOCK", 155); define("QUARTZ_STAIRS", 156); diff --git a/src/constants/ItemIDs.php b/src/constants/ItemIDs.php index 431e7c8aa..1082de446 100644 --- a/src/constants/ItemIDs.php +++ b/src/constants/ItemIDs.php @@ -149,7 +149,7 @@ define("SPAWN_EGG", 383); define("CARROT", 391); define("CARROTS", 391); define("POTATO", 392); -define("POTATOES", 392); +define("POTATOES", 392);//@shoghicp Why the heck do we need plural redundant Item ID here???? define("BAKED_POTATO", 393); define("BAKED_POTATOES", 393); diff --git a/src/material/block/solid/LitPumpkin.php b/src/material/block/solid/LitPumpkin.php index cebe24968..91c0dd07c 100644 --- a/src/material/block/solid/LitPumpkin.php +++ b/src/material/block/solid/LitPumpkin.php @@ -24,5 +24,16 @@ class LitPumpkinBlock extends SolidBlock{ parent::__construct(LIT_PUMPKIN, "Jack o'Lantern"); $this->hardness = 5; } - + + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + $faces = array( + 0 => 4, + 1 => 2, + 2 => 5, + 3 => 3, + ); + $this->meta = $faces[$player->entity->getDirection()]; + $this->level->setBlock($block, $this, true, false, true); + return true; + } } \ No newline at end of file diff --git a/src/utils/Config.php b/src/utils/Config.php index dc194003d..1099d5fc3 100644 --- a/src/utils/Config.php +++ b/src/utils/Config.php @@ -167,7 +167,7 @@ class Config{ } public function &get($k){ - if($this->correct === false or !isset($this->config[$k])){ + if(isset($this->correct) and ($this->correct === false or !isset($this->config[$k]))){ $false = false; return $false; } @@ -181,9 +181,21 @@ class Config{ public function setAll($v){ $this->config = $v; } - - public function exists($k){ - return isset($this->config[$k]); + + /** + * @param mixed $k + * @param bool $lowercase If set, searches Config in single-case / lowercase. + * + * @return boolean + */ + public function exists($k, $lowercase = false){ + if($lowercase === true)://Take this ridiculously retarded IF formatting! - @sekjun98888877777778888888888888 + $k = strtolower($k);//Convert requested key to lower + $array = array_change_key_case($this->config, CASE_LOWER);//Change all keys in array to lower + return isset($array[$k]);//Find $k in modified array + else: + return isset($this->config[$k]); + endif; } public function remove($k){ diff --git a/src/world/Entity.php b/src/world/Entity.php index cade713d1..218ed8e69 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -239,7 +239,7 @@ class Entity extends Position{ $time = microtime(true); if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true){ foreach($this->server->api->entity->getRadius($this, 1.5, ENTITY_ITEM) as $item){ - if($item->spawntime !== -1 and ($time - $item->spawntime) >= 0.6){ + if($item->spawntime > 0 and ($time - $item->spawntime) >= 0.6){ if((($this->player->gamemode & 0x01) === 1 or $this->player->hasSpace($item->type, $item->meta, $item->stack) === true) and $this->server->api->dhandle("player.pickup", array( "eid" => $this->player->eid, "player" => $this->player, @@ -248,8 +248,9 @@ class Entity extends Position{ "meta" => $item->meta, "target" => $item->eid )) !== false){ - $item->spawntime = -1; - $this->server->schedule(15, array($item, "close")); + $item->close(); + //$item->spawntime = 0; + //$this->server->schedule(15, array($item, "close")); } } } diff --git a/src/world/Explosion.php b/src/world/Explosion.php index 5ed0bf533..d94361d0b 100644 --- a/src/world/Explosion.php +++ b/src/world/Explosion.php @@ -46,7 +46,7 @@ class Explosion{ "level" => $this->level, "source" => $this->source, "size" => $this->size - ))){ + )) === false){ return false; }