Skip to content

Commit

Permalink
Minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
matcracker committed May 8, 2020
1 parent 486098b commit 654f14a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/matcracker/BedcoreProtect/Inspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
namespace matcracker\BedcoreProtect;

use matcracker\BedcoreProtect\enums\Action;
use matcracker\BedcoreProtect\utils\EntityUtils;
use matcracker\BedcoreProtect\utils\Utils;
use pocketmine\block\BlockFactory;
use pocketmine\command\CommandSender;
use pocketmine\item\ItemFactory;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use UnexpectedValueException;
use function array_chunk;
use function array_key_exists;
use function count;
Expand Down Expand Up @@ -58,15 +58,7 @@ public static function addInspector(CommandSender $inspector): void

private static function getSenderUUID(CommandSender $sender): string
{
if ($sender instanceof Player) {
if (($uuid = $sender->getUniqueId()) === null) {
throw new UnexpectedValueException($sender->getName() . " has an invalid UUID.");
}

return $uuid->toString();
} else {
return $sender->getServer()->getServerUniqueId()->toString();
}
return $sender instanceof Player ? EntityUtils::getUniqueId($sender) : $sender->getServer()->getServerUniqueId()->toString();
}

/**
Expand Down

0 comments on commit 654f14a

Please sign in to comment.