Merge remote-tracking branch 'origin/master' into Faster-Network

This commit is contained in:
Shoghi Cervantes 2013-12-17 11:01:12 +01:00
commit e6aeb03ec5
7 changed files with 53 additions and 16 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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){

View File

@ -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"));
}
}
}

View File

@ -46,7 +46,7 @@ class Explosion{
"level" => $this->level,
"source" => $this->source,
"size" => $this->size
))){
)) === false){
return false;
}