mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
goodbye php5, u wont be missed
This commit is contained in:
parent
2858b43748
commit
d7d346a237
16 changed files with 26 additions and 33 deletions
|
|
@ -339,10 +339,10 @@ class BlockAPI{
|
|||
}
|
||||
break;
|
||||
case "give":
|
||||
$player = $this->server->api->player->get(nullsafe($args[0], ""));
|
||||
$player = $this->server->api->player->get($args[0] ?? "");
|
||||
|
||||
if($player instanceof Player){
|
||||
$item = self::fromString(nullsafe($args[1], ""));
|
||||
$item = self::fromString($args[1] ?? "");
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
$output .= "Player is in creative mode.";
|
||||
break;
|
||||
|
|
@ -362,7 +362,7 @@ class BlockAPI{
|
|||
$output .= "Giving ".$item->count." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$player->username;
|
||||
break;
|
||||
}else{
|
||||
$item = self::fromString(nullsafe($args[0], ""));
|
||||
$item = self::fromString($args[0] ?? "");
|
||||
if(!($issuer instanceof Player)){
|
||||
return "You cant give an item to a non-player.";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class EntityAPI{
|
|||
}
|
||||
|
||||
public function get($eid){
|
||||
return nullsafe($this->entities[$eid], false);
|
||||
return $this->entities[$eid] ?? false;
|
||||
}
|
||||
|
||||
public function remove($eid){
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class TimeAPI{
|
|||
$p = strtolower(array_shift($args));
|
||||
switch($p){
|
||||
case "check":
|
||||
if(substr(nullsafe($args[0], ""), 0, 2) === "w:"){
|
||||
if(substr($args[0] ?? "", 0, 2) === "w:"){
|
||||
$levelName = preg_replace("/w:/", "", $args[0]);
|
||||
$level = $this->server->api->level->get($levelName);
|
||||
if($level instanceof Level){
|
||||
|
|
@ -44,7 +44,7 @@ class TimeAPI{
|
|||
$output .= "Time" . $world . ": " . $this->getDate($level) . ", " . $this->getPhase($level) . " (" . $this->get(true, $level) . " ticks)\n";
|
||||
break;
|
||||
case "add":
|
||||
if(substr(nullsafe($args[1], ""), 0, 2) === "w:"){
|
||||
if(substr($args[1] ?? "", 0, 2) === "w:"){
|
||||
$levelName = preg_replace("/w:/", "", $args[1]);
|
||||
$level = $this->server->api->level->get($levelName);
|
||||
if($level instanceof Level){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue