mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
Replaced Position->getLevel() null checks with isValid()
This commit is contained in:
@@ -67,10 +67,9 @@ class SpawnpointCommand extends VanillaCommand{
|
||||
}
|
||||
}
|
||||
|
||||
$level = $target->getLevel();
|
||||
|
||||
if(count($args) === 4){
|
||||
if($level !== null){
|
||||
if($target->isValid()){
|
||||
$level = $target->getLevel();
|
||||
$pos = $sender instanceof Player ? $sender->getPosition() : $level->getSpawnLocation();
|
||||
$x = $this->getRelativeDouble($pos->x, $sender, $args[1]);
|
||||
$y = $this->getRelativeDouble($pos->y, $sender, $args[2], 0, Level::Y_MAX);
|
||||
|
@@ -97,7 +97,7 @@ class TeleportCommand extends VanillaCommand{
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.tp.success", [$origin->getName(), $target->getName()]));
|
||||
|
||||
return true;
|
||||
}elseif($target->getLevel() !== null){
|
||||
}elseif($target->isValid()){
|
||||
if(count($args) === 4 or count($args) === 6){
|
||||
$pos = 1;
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user