mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19: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;
|
return;
|
||||||
}
|
}
|
||||||
foreach($this->plugins as $p){
|
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);
|
unset($this->plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@ class Player{
|
||||||
* @return Item
|
* @return Item
|
||||||
*/
|
*/
|
||||||
public function getSlot($slot){
|
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
|
* @return Item
|
||||||
*/
|
*/
|
||||||
public function getArmor($slot){
|
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){
|
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();
|
$this->spawnPosition = $this->server->api->level->getDefault()->getSpawn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1496,7 +1496,7 @@ class Entity extends Position
|
||||||
{
|
{
|
||||||
if($this->class === ENTITY_PLAYER){
|
if($this->class === ENTITY_PLAYER){
|
||||||
$this->player->teleport(new Vector3($this->x, $this->y, $this->z), false, false, true, false);
|
$this->player->teleport(new Vector3($this->x, $this->y, $this->z), false, false, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function moveEntityWithOffset($oX, $oY, $oZ)
|
public function moveEntityWithOffset($oX, $oY, $oZ)
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class Chicken extends Animal{
|
||||||
|
|
||||||
public function fall(){} //chickens have no fall dmg?
|
public function fall(){} //chickens have no fall dmg?
|
||||||
|
|
||||||
public function dropAnEgg(){
|
public function dropAnEgg(){
|
||||||
if($this->closed){
|
if($this->closed){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ class Arrow extends Entity{
|
||||||
++$this->groundTicks;
|
++$this->groundTicks;
|
||||||
if($this->groundTicks >= 1200){ //TODO customizeable?
|
if($this->groundTicks >= 1200){ //TODO customizeable?
|
||||||
$this->close();
|
$this->close();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->inGround = false;
|
$this->inGround = false;
|
||||||
$this->speedX *= lcg_value() * 0.2;
|
$this->speedX *= lcg_value() * 0.2;
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ function arg($name, $default = false){
|
||||||
$arguments = arguments($argv);
|
$arguments = arguments($argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arguments["commands"][$name] ?? $default;
|
return $arguments["commands"][$name] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
function arguments($args){
|
function arguments($args){
|
||||||
|
|
@ -159,7 +159,7 @@ function arguments($args){
|
||||||
|
|
||||||
$ret['input'][] = $arg;
|
$ret['input'][] = $arg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
@ -175,13 +175,13 @@ function console($message, $EOL = true, $log = true, $level = 1){
|
||||||
if(ENABLE_ANSI === true){
|
if(ENABLE_ANSI === true){
|
||||||
$add = "";
|
$add = "";
|
||||||
if(preg_match("/\[([a-zA-Z0-9]*)\]/", $message, $matches) > 0){
|
if(preg_match("/\[([a-zA-Z0-9]*)\]/", $message, $matches) > 0){
|
||||||
$add .= match ($matches[1]) {
|
$add .= match ($matches[1]) {
|
||||||
"ERROR", "SEVERE" => FORMAT_RED,
|
"ERROR", "SEVERE" => FORMAT_RED,
|
||||||
"INTERNAL", "DEBUG" => FORMAT_WHITE,
|
"INTERNAL", "DEBUG" => FORMAT_WHITE,
|
||||||
"WARNING" => FORMAT_YELLOW,
|
"WARNING" => FORMAT_YELLOW,
|
||||||
"NOTICE" => FORMAT_AQUA,
|
"NOTICE" => FORMAT_AQUA,
|
||||||
default => FORMAT_GRAY,
|
default => FORMAT_GRAY,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
$message = TextFormat::toANSI($time . $add . $message . FORMAT_RESET);
|
$message = TextFormat::toANSI($time . $add . $message . FORMAT_RESET);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class StairBlock extends TransparentBlock{
|
||||||
for($v15 = 0; $v15 < /*count($v11}*/ 2; ++$v15){
|
for($v15 = 0; $v15 < /*count($v11}*/ 2; ++$v15){
|
||||||
$v16 = $v11[$v15];
|
$v16 = $v11[$v15];
|
||||||
if($v16 == $v12){
|
if($v16 == $v12){
|
||||||
//wat
|
//wat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static function onRandomTick(Level $level, $x, $y, $z){
|
public static function onRandomTick(Level $level, $x, $y, $z){
|
||||||
if(!StaticBlock::getIsTransparent($level->level->getBlockID($x, $y + 1, $z)) && mt_rand(0, 2) == 1){
|
if(!StaticBlock::getIsTransparent($level->level->getBlockID($x, $y + 1, $z)) && mt_rand(0, 2) == 1){
|
||||||
$level->fastSetBlockUpdate($x, $y, $z, DIRT, 0);
|
$level->fastSetBlockUpdate($x, $y, $z, DIRT, 0);
|
||||||
|
|
|
||||||
|
|
@ -564,7 +564,7 @@ class Utils{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function readBool($b){
|
public static function readBool($b){
|
||||||
return !(Utils::readByte($b, false) === 0);
|
return Utils::readByte($b, false) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function writeBool($b){
|
public static function writeBool($b){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue