mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
code style fix
This commit is contained in:
parent
fc5c5625cb
commit
5e8e9330e2
361 changed files with 4766 additions and 4650 deletions
|
|
@ -235,7 +235,7 @@ class BlockAPI{
|
|||
break;
|
||||
}
|
||||
$itemheld = $issuer->getSlot($issuer->slot);
|
||||
$output = self::getItem($itemheld->getID(), $itemheld->getMetadata())."";
|
||||
$output = self::getItem($itemheld->getID(), $itemheld->getMetadata()) . "";
|
||||
break;
|
||||
case "setblock":
|
||||
if(!($issuer instanceof Player)){
|
||||
|
|
@ -259,7 +259,7 @@ class BlockAPI{
|
|||
$output .= "Usage: /setblock <x> <y> <z> <block[:damage]>";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$level = $issuer->entity->level;
|
||||
$block = self::fromString($args[3])->getBlock();
|
||||
}
|
||||
|
|
@ -289,13 +289,13 @@ class BlockAPI{
|
|||
break;
|
||||
}else{
|
||||
$level->setBlock($pos, $block, true, false, true);
|
||||
$output .= "Placed $block in ".implode(", ", $coords).", w:".$level->getName();
|
||||
$output .= "Placed $block in " . implode(", ", $coords) . ", w:" . $level->getName();
|
||||
}
|
||||
break;
|
||||
case "give":
|
||||
$player = $this->server->api->player->get($args[0] ?? "");
|
||||
|
||||
if($player instanceof Player){
|
||||
|
||||
if($player instanceof Player){
|
||||
$item = self::fromString($args[1] ?? "");
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return "Player is in creative mode.";
|
||||
|
|
@ -303,18 +303,18 @@ class BlockAPI{
|
|||
if($item->getID() === 0){
|
||||
return "You cannot give an air block to a player.";
|
||||
}
|
||||
|
||||
|
||||
if(!isset($args[2])){
|
||||
$item->count = $item->getMaxStackSize();
|
||||
}else{
|
||||
$item->count = (int) $args[2];
|
||||
}
|
||||
|
||||
|
||||
$player->addItem($item->getID(), $item->getMetadata(), $item->count);
|
||||
$output .= "Giving ".$item->count." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$player->username;
|
||||
$output .= "Giving " . $item->count . " of " . $item->getName() . " (" . $item->getID() . ":" . $item->getMetadata() . ") to " . $player->username;
|
||||
break;
|
||||
}else{
|
||||
$item = self::fromString($args[0] ?? "");
|
||||
$item = self::fromString($args[0] ?? "");
|
||||
if(!($issuer instanceof Player)){
|
||||
return "You cant give an item to a non-player.";
|
||||
}
|
||||
|
|
@ -334,7 +334,7 @@ class BlockAPI{
|
|||
}
|
||||
|
||||
$issuer->addItem($item->getID(), $item->getMetadata(), $item->count);
|
||||
$output .= "Giving ".$item->count." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$issuer->username;
|
||||
$output .= "Giving " . $item->count . " of " . $item->getName() . " (" . $item->getID() . ":" . $item->getMetadata() . ") to " . $issuer->username;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -412,7 +412,6 @@ class BlockAPI{
|
|||
return $this->cancelAction($target, $player, false);
|
||||
}
|
||||
|
||||
|
||||
if(is_array($drops) && ($player->gamemode & 0x01) === 0x00 and count($drops) > 0){
|
||||
foreach($drops as $drop){
|
||||
$this->server->api->entity->drop(new Position($target->x + 0.5, $target->y, $target->z + 0.5, $target->level), BlockAPI::getItem($drop[0] & 0xFFFF, $drop[1] & 0xFFFF, $drop[2]));
|
||||
|
|
@ -456,7 +455,7 @@ class BlockAPI{
|
|||
return $this->cancelAction($block, $player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StaticBlock::getBlock($target->getID())::interact($target->level, $target->x, $target->y, $target->z, $player);
|
||||
|
||||
if($target->isActivable === true){
|
||||
|
|
@ -501,14 +500,14 @@ class BlockAPI{
|
|||
$hand->position($block);
|
||||
//$face = -1;
|
||||
}
|
||||
|
||||
|
||||
if($hand->isSolid === true && ($hand->getID() != BED_BLOCK && $hand->getID() != CARPET)){
|
||||
$aabb = $hand->getAABB($block->level, $block->x, $block->y, $block->z);
|
||||
$playerbb = $player->entity->boundingBox;
|
||||
if(($aabb->maxX > $playerbb->minX && $aabb->minX < $playerbb->maxX) && ($aabb->maxY > ($playerbb->minY+0.21) && $aabb->minY < $playerbb->maxY) && ($aabb->maxZ > $playerbb->minZ && $aabb->minZ < $playerbb->maxZ)){
|
||||
if(($aabb->maxX > $playerbb->minX && $aabb->minX < $playerbb->maxX) && ($aabb->maxY > ($playerbb->minY + 0.21) && $aabb->minY < $playerbb->maxY) && ($aabb->maxZ > $playerbb->minZ && $aabb->minZ < $playerbb->maxZ)){
|
||||
return $this->cancelAction($block, $player, false); //Entity in block
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($this->server->api->dhandle("player.block.place", ["player" => $player, "block" => $block, "target" => $target, "item" => $item]) === false){
|
||||
|
|
@ -537,14 +536,12 @@ class BlockAPI{
|
|||
return false;
|
||||
}
|
||||
$level = $block::onUpdate($pos->level, $pos->x, $pos->y, $pos->z, $type);
|
||||
|
||||
|
||||
return $level;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function blockUpdateAround(Position $pos, $type = BLOCK_UPDATE_NORMAL, $delay = false){
|
||||
|
||||
|
||||
if($type == BLOCK_UPDATE_NORMAL){
|
||||
try{
|
||||
throw new Exception("Deprecated: tried updating $pos using BLOCK_UPDATE_NORMAL.");
|
||||
|
|
@ -554,7 +551,7 @@ class BlockAPI{
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($delay !== false){
|
||||
$this->scheduleBlockUpdate($pos->getSide(0), $delay, $type);
|
||||
$this->scheduleBlockUpdate($pos->getSide(1), $delay, $type);
|
||||
|
|
@ -576,7 +573,7 @@ class BlockAPI{
|
|||
if($delay < 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$index = $x . "." . $y . "." . $z . "." . $level->getName() . "." . $type;
|
||||
$delay = microtime(true) + $delay * 0.05;
|
||||
if(!isset($this->scheduledUpdates[$index])){
|
||||
|
|
@ -586,7 +583,7 @@ class BlockAPI{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function scheduleBlockUpdate(Position $pos, $delay, $type = BLOCK_UPDATE_SCHEDULED){
|
||||
$type = (int) $type;
|
||||
if($delay < 0){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue