/** * Returns the * * @param Player|string $player the partial name (same rules as {@link \pocketmine\Server#getPlayer}) of the * player, or the {@link Player} object representing the player. * * @return WorldEditSession|null An instance of {@link WorldEditSession} if found, <code>null</code> otherwise. */ public function getSession($player) { if (is_string($player)) { $player = $this->main->getServer()->getPlayer($player); } if (!$player instanceof Player) { return null; } return isset($this->sessions[$player->getId()]) ? $this->sessions[$player->getId()] : null; }
public function __construct(WorldEditArt $main) { $this->main = $main; $this->registerCmds(); $aliases = []; foreach ($this->cmds as $cmd) { foreach ($cmd->getNames() as $name) { $aliases[] = "/" . strtolower($name); } } parent::__construct("/", "WorldEditArt main command.", "Use `//` for detailed help.", $aliases); $main->getServer()->getCommandMap()->register("/", $this); }