This commit is contained in:
Shoghi Cervantes 2014-01-28 11:36:18 +01:00
parent 763adb0360
commit 4002d3013d
8 changed files with 21 additions and 26 deletions

View File

@ -207,22 +207,16 @@ class ConsoleAPI{
break; break;
case "a": case "a":
case "all": case "all":
if($issuer instanceof Player) if($issuer instanceof Player){
{ if($this->server->api->ban->isOp($issuer->username)){
if($this->server->api->ban->isOp($issuer->username))
{
$output = ""; $output = "";
foreach($this->server->api->player->getAll() as $p){ foreach($this->server->api->player->getAll() as $p){
$output .= $this->run($cmd . " ". substr_replace($params, $p->username, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1), $issuer, $alias); $output .= $this->run($cmd . " ". substr_replace($params, $p->username, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1), $issuer, $alias);
} }
} }else{
else
{
$issuer->sendChat("You don't have permissions to use this command.\n"); $issuer->sendChat("You don't have permissions to use this command.\n");
} }
} }else{
else
{
$output = ""; $output = "";
foreach($this->server->api->player->getAll() as $p){ foreach($this->server->api->player->getAll() as $p){
$output .= $this->run($cmd . " ". substr_replace($params, $p->username, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1), $issuer, $alias); $output .= $this->run($cmd . " ". substr_replace($params, $p->username, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1), $issuer, $alias);

View File

@ -1851,7 +1851,7 @@ class Player{
$this->entity->air = 300; $this->entity->air = 300;
$this->entity->setHealth(20, "respawn"); $this->entity->setHealth(20, "respawn");
$this->entity->updateMetadata(); $this->entity->updateMetadata();
} else { }else{
break; break;
} }
$this->sendInventory(); $this->sendInventory();

View File

@ -99,7 +99,7 @@ class LavaBlock extends LiquidBlock{
$b = $this->getSide($side); $b = $this->getSide($side);
if($b instanceof LavaBlock){ if($b instanceof LavaBlock){
}else if($b->isFlowable === true){ }elseif($b->isFlowable === true){
$this->level->setBlock($b, new LavaBlock( min($level + 2,7) ), false, false, true); $this->level->setBlock($b, new LavaBlock( min($level + 2,7) ), false, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
} }

View File

@ -467,14 +467,15 @@ class PMFLevel extends PMF{
++$this->chunkChange[$index][$Y]; ++$this->chunkChange[$index][$Y];
} }
$this->chunkChange[$index][-1] = true; $this->chunkChange[$index][-1] = true;
if($old_b instanceof LiquidBlock) if($old_b instanceof LiquidBlock){
{
$pos = new Position($x, $y, $z, $this->level); $pos = new Position($x, $y, $z, $this->level);
for($side = 0; $side <= 5; ++$side) for($side = 0; $side <= 5; ++$side){
{
$b = $pos->getSide($side); $b = $pos->getSide($side);
if($b instanceof LavaBlock) { ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); } if($b instanceof LavaBlock){
else { ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL); } ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
}else{
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
}
} }
} }
return true; return true;

View File

@ -598,7 +598,7 @@ class Entity extends Position{
public function getDirection(){ public function getDirection(){
$rotation = ($this->yaw - 90) % 360; $rotation = ($this->yaw - 90) % 360;
if ($rotation < 0) { if($rotation < 0) {
$rotation += 360.0; $rotation += 360.0;
} }
if((0 <= $rotation and $rotation < 45) or (315 <= $rotation and $rotation < 360)){ if((0 <= $rotation and $rotation < 45) or (315 <= $rotation and $rotation < 360)){

View File

@ -64,17 +64,17 @@ class PineTreeObject extends TreeObject{
$firstMaxedRadius = false; $firstMaxedRadius = false;
for($leavesY = 0; $leavesY <= $leavesBottomY; ++$leavesY) { for($leavesY = 0; $leavesY <= $leavesBottomY; ++$leavesY) {
$yy = $this->totalHeight - $leavesY; $yy = $this->totalHeight - $leavesY;
for ($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) { for($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
for ($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) { for($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) { if(abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
$level->setBlockRaw(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBlock($this->type)); $level->setBlockRaw(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBlock($this->type));
} }
} }
} }
if ($leavesRadius >= $leavesMaxRadius) { if($leavesRadius >= $leavesMaxRadius) {
$leavesRadius = $firstMaxedRadius ? 1 : 0; $leavesRadius = $firstMaxedRadius ? 1 : 0;
$firstMaxedRadius = true; $firstMaxedRadius = true;
if (++$leavesMaxRadius > $this->leavesAbsoluteMaxRadius) { if(++$leavesMaxRadius > $this->leavesAbsoluteMaxRadius) {
$leavesMaxRadius = $this->leavesAbsoluteMaxRadius; $leavesMaxRadius = $this->leavesAbsoluteMaxRadius;
} }
}else{ }else{

View File

@ -36,7 +36,7 @@ class SmallTreeObject extends TreeObject{
public function canPlaceObject(Level $level, Vector3 $pos, Random $random){ public function canPlaceObject(Level $level, Vector3 $pos, Random $random){
$radiusToCheck = 0; $radiusToCheck = 0;
for ($yy = 0; $yy < $this->trunkHeight + 3; ++$yy) { for ($yy = 0; $yy < $this->trunkHeight + 3; ++$yy) {
if ($yy == 1 or $yy === $this->trunkHeight) { if($yy == 1 or $yy === $this->trunkHeight) {
++$radiusToCheck; ++$radiusToCheck;
} }
for($xx = -$radiusToCheck; $xx < ($radiusToCheck + 1); ++$xx){ for($xx = -$radiusToCheck; $xx < ($radiusToCheck + 1); ++$xx){

View File

@ -62,7 +62,7 @@ class SpruceTreeObject extends TreeObject{
for($yy = $this->totalHeight; $yy >= $this->leavesBottomY; --$yy){ for($yy = $this->totalHeight; $yy >= $this->leavesBottomY; --$yy){
for($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) { for($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
for($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) { for($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) { if(abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
$level->setBlockRaw(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBlock($this->type)); $level->setBlockRaw(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBlock($this->type));
} }
} }