Removed unused code, fixed undefined variables

This commit is contained in:
Shoghi Cervantes 2014-10-11 22:22:51 +02:00
parent bf89ea1cf6
commit ebb844fa52
16 changed files with 14 additions and 29 deletions

View File

@ -868,7 +868,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
public function stopSleep(){
if($this->sleeping instanceof Vector3){
$this->server->getPluginManager()->callEvent($ev = new PlayerBedLeaveEvent($this, $this->getLevel()->getBlock($pos)));
$this->server->getPluginManager()->callEvent($ev = new PlayerBedLeaveEvent($this, $this->getLevel()->getBlock($this->sleeping)));
$this->sleeping = null;

View File

@ -1990,7 +1990,6 @@ class Server{
}
private function tickProcessor(){
$lastLoop = 0;
while($this->isRunning){
$this->tick();
usleep((int) max(1, ($this->nextTick - microtime(true)) * 1000000));
@ -2124,7 +2123,6 @@ class Server{
$this->nextTick = $tickTime;
}
$this->nextTick += 0.05;
$this->inTick = false;
return true;
}

View File

@ -66,13 +66,11 @@ class Cactus extends Transparent{
$down = $this->getSide(0);
if($down->getID() !== self::SAND and $down->getID() !== self::CACTUS){
$this->getLevel()->useBreakOn($this);
return;
}else{
for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side);
if(!$b->isFlowable){
$this->getLevel()->useBreakOn($this);
return;
}
}
}
@ -94,8 +92,6 @@ class Cactus extends Transparent{
++$this->meta;
$this->getLevel()->setBlock($this, $this);
}
return;
}
}

View File

@ -22,8 +22,6 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Carrot extends Crops{
public function __construct($meta = 0){

View File

@ -22,8 +22,6 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Potato extends Crops{
public function __construct($meta = 0){

View File

@ -24,7 +24,6 @@ namespace pocketmine\block;
use pocketmine\event\block\BlockGrowEvent;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\Server;
class PumpkinStem extends Crops{

View File

@ -41,14 +41,6 @@ class TNT extends Solid{
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::FLINT_STEEL){
$item->useOn($this);
$data = [
"x" => $this->x + 0.5,
"y" => $this->y + 0.5,
"z" => $this->z + 0.5,
"power" => 4,
"fuse" => 20 * 4, //4 seconds
];
$this->getLevel()->setBlock($this, new Air(), false, false, true);
$mot = (new Random())->nextSignedFloat() * M_PI * 2;

View File

@ -21,9 +21,10 @@
namespace pocketmine\entity;
use pocketmine\nbt\tag\String;
class Skeleton extends Monster implements ProjectileSource{
protected function initEntity(){
$this->namedtag->id = new Skeleton("id", "Chicken");
$this->namedtag->id = new String("id", "Chicken");
}
}

View File

@ -54,6 +54,7 @@ abstract class Event{
throw new \BadMethodCallException("Event is not Cancellable");
}
/** @var Event $this */
return $this->isCancelled === true;
}
@ -68,6 +69,8 @@ abstract class Event{
if(!($this instanceof Cancellable)){
throw new \BadMethodCallException("Event is not Cancellable");
}
/** @var Event $this */
$this->isCancelled = (bool) $value;
}

View File

@ -22,7 +22,6 @@
namespace pocketmine\event\entity;
use pocketmine\entity\Projectile;
use pocketmine\event\Cancellable;
class ProjectileHitEvent extends EntityEvent{
public static $handlerList = null;

View File

@ -53,7 +53,7 @@ class Explosion{
*/
public $affectedBlocks = [];
public $stepLen = 0.3;
/** @var Entity|Block|Tile */
/** @var Entity|Block */
private $what;
public function __construct(Position $center, $size, $what = null){

View File

@ -85,7 +85,7 @@ class Chunk extends BaseChunk{
}
}
parent::__construct($level, $this->nbt["xPos"], $this->nbt["zPos"], $sections, $this->nbt->Biomes->getValue(), $this->nbt->BiomeColors->getValue(), $this->nbt->Entities->getValue(), $this->nbt->TileEntities->getValue());
parent::__construct($level, (int) $this->nbt["xPos"], (int) $this->nbt["zPos"], $sections, $this->nbt->Biomes->getValue(), $this->nbt->BiomeColors->getValue(), $this->nbt->Entities->getValue(), $this->nbt->TileEntities->getValue());
unset($this->nbt->Sections);
}

View File

@ -83,7 +83,7 @@ abstract class BaseLevelProvider implements LevelProvider{
}
public function getSpawn(){
return new Vector3($this->levelData["SpawnX"], $this->levelData["SpawnY"], $this->levelData["SpawnZ"]);
return new Vector3((float) $this->levelData["SpawnX"], (float) $this->levelData["SpawnY"], (float) $this->levelData["SpawnZ"]);
}
public function setSpawn(Vector3 $pos){

View File

@ -65,6 +65,8 @@ interface Plugin extends CommandExecutor{
/**
* Gets an embedded resource in the plugin file.
*
* @param string $filename
*/
public function getResource($filename);

View File

@ -247,9 +247,8 @@ class ServerScheduler{
$this->asyncPool->collect([$this, "collectAsyncTask"]);
if($this->asyncTasks > 0){
//TODO: remove this workaround
foreach($this->asyncTaskStorage as $task){
$this->collectAsyncTask($task);
foreach($this->asyncTaskStorage as $asyncTask){
$this->collectAsyncTask($asyncTask);
}
}
}

View File

@ -5,7 +5,7 @@ cd "$DIR"
DO_LOOP="no"
while getopts "p:f:l" OPTION 2> /dev/null; do
case $OPTION in
case ${OPTION} in
p)
PHP_BINARY="$OPTARG"
;;