mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
readded return in reset spawn pos & some fixes to formatting
This commit is contained in:
parent
f74e6e0638
commit
ed4f820ff3
9 changed files with 25 additions and 24 deletions
|
|
@ -55,8 +55,8 @@ class PluginAPI extends stdClass{
|
|||
return;
|
||||
}
|
||||
foreach($this->plugins as $p){
|
||||
if(method_exists($p[0], "__destruct")){$p[0]->__destruct();}
|
||||
}
|
||||
if(method_exists($p[0], "__destruct")) $p[0]->__destruct();
|
||||
}
|
||||
unset($this->plugins);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ class Player{
|
|||
* @return Item
|
||||
*/
|
||||
public function getSlot($slot){
|
||||
return $this->inventory[(int)$slot] ?? BlockAPI::getItem(AIR, 0, 0);
|
||||
return $this->inventory[(int)$slot] ?? BlockAPI::getItem(AIR, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -720,7 +720,7 @@ class Player{
|
|||
* @return Item
|
||||
*/
|
||||
public function getArmor($slot){
|
||||
return $this->armor[(int)$slot] ?? BlockAPI::getItem(AIR, 0, 0);
|
||||
return $this->armor[(int)$slot] ?? BlockAPI::getItem(AIR, 0, 0);
|
||||
}
|
||||
|
||||
public function setArmor($slot, Item $armor, $send = true){
|
||||
|
|
@ -1029,7 +1029,8 @@ class Player{
|
|||
}
|
||||
}
|
||||
}
|
||||
reset_spawn_pos:
|
||||
return;
|
||||
reset_spawn_pos:
|
||||
$this->spawnPosition = $this->server->api->level->getDefault()->getSpawn();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1496,7 +1496,7 @@ class Entity extends Position
|
|||
{
|
||||
if($this->class === ENTITY_PLAYER){
|
||||
$this->player->teleport(new Vector3($this->x, $this->y, $this->z), false, false, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function moveEntityWithOffset($oX, $oY, $oZ)
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class Chicken extends Animal{
|
|||
}
|
||||
|
||||
public function fall(){} //chickens have no fall dmg?
|
||||
|
||||
public function dropAnEgg(){
|
||||
|
||||
public function dropAnEgg(){
|
||||
if($this->closed){
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class Arrow extends Entity{
|
|||
++$this->groundTicks;
|
||||
if($this->groundTicks >= 1200){ //TODO customizeable?
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$this->inGround = false;
|
||||
$this->speedX *= lcg_value() * 0.2;
|
||||
|
|
@ -277,4 +277,4 @@ class Arrow extends Entity{
|
|||
$player->dataPacket($pk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ function arg($name, $default = false){
|
|||
$arguments = arguments($argv);
|
||||
}
|
||||
|
||||
return $arguments["commands"][$name] ?? $default;
|
||||
return $arguments["commands"][$name] ?? $default;
|
||||
}
|
||||
|
||||
function arguments($args){
|
||||
|
|
@ -159,7 +159,7 @@ function arguments($args){
|
|||
|
||||
$ret['input'][] = $arg;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
|
@ -175,13 +175,13 @@ function console($message, $EOL = true, $log = true, $level = 1){
|
|||
if(ENABLE_ANSI === true){
|
||||
$add = "";
|
||||
if(preg_match("/\[([a-zA-Z0-9]*)\]/", $message, $matches) > 0){
|
||||
$add .= match ($matches[1]) {
|
||||
"ERROR", "SEVERE" => FORMAT_RED,
|
||||
"INTERNAL", "DEBUG" => FORMAT_WHITE,
|
||||
"WARNING" => FORMAT_YELLOW,
|
||||
"NOTICE" => FORMAT_AQUA,
|
||||
default => FORMAT_GRAY,
|
||||
};
|
||||
$add .= match ($matches[1]) {
|
||||
"ERROR", "SEVERE" => FORMAT_RED,
|
||||
"INTERNAL", "DEBUG" => FORMAT_WHITE,
|
||||
"WARNING" => FORMAT_YELLOW,
|
||||
"NOTICE" => FORMAT_AQUA,
|
||||
default => FORMAT_GRAY,
|
||||
};
|
||||
}
|
||||
$message = TextFormat::toANSI($time . $add . $message . FORMAT_RESET);
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class StairBlock extends TransparentBlock{
|
|||
for($v15 = 0; $v15 < /*count($v11}*/ 2; ++$v15){
|
||||
$v16 = $v11[$v15];
|
||||
if($v16 == $v12){
|
||||
//wat
|
||||
//wat
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -360,4 +360,4 @@ class StairBlock extends TransparentBlock{
|
|||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class GrassBlock extends SolidBlock{
|
|||
ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y+1, $this->z+0.5, $this->level), BlockAPI::getItem(295,0,1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static function onRandomTick(Level $level, $x, $y, $z){
|
||||
if(!StaticBlock::getIsTransparent($level->level->getBlockID($x, $y + 1, $z)) && mt_rand(0, 2) == 1){
|
||||
$level->fastSetBlockUpdate($x, $y, $z, DIRT, 0);
|
||||
|
|
@ -64,4 +64,4 @@ class GrassBlock extends SolidBlock{
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ class Utils{
|
|||
}
|
||||
|
||||
public static function readBool($b){
|
||||
return !(Utils::readByte($b, false) === 0);
|
||||
return Utils::readByte($b, false) != 0;
|
||||
}
|
||||
|
||||
public static function writeBool($b){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue