Хелпаните прошу я уже конкретно з@ебался

Получается мне нужно перенести переменную и ее свойства из одного класса в другой.

Из этого класса нужно перенести переменную $clannamee и ее свойство $this->clannamee = $this->getServer()->getPluginManager()->getPlugin("Clan");

<?php

/**
 *  _                               _ _
 * | |   _   _ _ __   __ _ _ __ ___| | |_   _
 * | |  | | | |  _ \ / _  |  __/ _ \ | | | | |
 * | |__| |_| | | | | (_| | | |  __/ | | |_| |
 * |_____\____|_| |_|\____|_|  \___|_|_|\___ |
 *                                      |___/
 *
 * @author Lunarelly
 * @link https://github.com/Lunarelly
 *
 */

declare(strict_types=1);

namespace lunarelly\ranks;

use LevelDB;
use Will\Clan;
use Fred\sclansscore\listener\TagResolveListener;
use lunarelly\ranks\api\command\CommandManager;
use lunarelly\ranks\command\RankCommand;
use lunarelly\ranks\event\PlayerRankChangeEvent;
use lunarelly\ranks\exception\RanksException;
use lunarelly\ranks\listener\chat\ChatListener;
use lunarelly\ranks\listener\RankListener;
use lunarelly\ranks\object\Rank;
use pocketmine\network\mcpe\protocol\types\DeviceOS;
use pocketmine\permission\PermissionAttachment;
use pocketmine\permission\PermissionManager;
use pocketmine\player\Player;
use pocketmine\plugin\PluginBase;

final class LunarRanks extends PluginBase
{
	public $clannamee;

	private static self $instance;

	private LevelDB $database;

	private array $settings;
	private array $ranks;
	private array $rankList;
	private array $rankInheritances;
	private array $permissions;
	private array $aliasesToRanks;
	private array $messages;

	private string $defaultRank;

	private bool $localChatEnabled;
	private array $localChatSettings;

	/** @var array<string, PermissionAttachment> */
	private array $attachments = [];
	/** @var array<string, Rank> */
	private array $playerRanks = [];

	private function initializeDatabase(): void
	{
		if (!(is_dir($this->getDataFolder() . "data"))) {
			@mkdir($this->getDataFolder() . "data");
		}
		$this->database = new LevelDB($this->getDataFolder() . "data/ranks");
	}

	private function readInheritances(): void
	{
		foreach ($this->ranks as $rankName => $rankData) {
			if ($rankData["inheritance"] !== []) {
				foreach ($rankData["inheritance"] as $inheritance) {
					$this->rankInheritances[$rankName][] = $inheritance;
				}
			} else {
				$this->rankInheritances[$rankName] = [];
			}
		}
	}

	private function readPermissions(): void
	{
		foreach ($this->ranks as $rankName => $rankData) {
			$permissions = $rankData["permissions"];
			foreach ($this->rankInheritances[$rankName] as $childRank) {
				$permissions = array_merge($permissions, $this->ranks[$childRank]["permissions"]);
			}
			$this->permissions[$rankName] = $permissions;
		}
	}

	private function readAliases(): void
	{
		foreach ($this->ranks as $rankName => $rankData) {
			if ($rankData["alias"] === "") {
				continue;
			}
			$this->aliasesToRanks[$rankData["alias"]] = $rankName;
		}
	}

	private function initializeConfigData(): void
	{
		$configData = $this->getConfig()->getAll();
		$this->settings = $configData["settings"];
		$this->ranks = $configData["ranks"];
		$this->rankList = array_keys($configData["ranks"]);

		$this->readInheritances();
		$this->readPermissions();
		$this->readAliases();

		$this->messages = $configData["messages"];

		$defaultRank = strtolower($configData["settings"]["default-rank"]);
		if (!(in_array($defaultRank, $this->rankList))) {
			throw new RanksException(sprintf("Default rank '%s' does not exist", $defaultRank));
		}

		$this->defaultRank = $defaultRank;
		$this->localChatEnabled = (bool)$configData["settings"]["local-chat"]["enabled"];
		$this->localChatSettings = $configData["settings"]["local-chat"];
	}

	private function registerCommands(): void
	{
		(new CommandManager($this))->addCommand($rankCommand = new RankCommand($this));
		$this->getServer()->getCommandMap()->register("lunarranks", $rankCommand);
	}

	private function registerListeners(): void
	{
		$pluginManager = $this->getServer()->getPluginManager();
		$pluginManager->registerEvents(new RankListener($this), $this);
		$pluginManager->registerEvents(new ChatListener($this), $this);
	}

	protected function onEnable(): void
	{
		self::$instance = $this;

		$this->saveDefaultConfig();
		$this->clannamee = $this->getServer()->getPluginManager()->getPlugin("Clan");

		$this->initializeDatabase();
		$this->initializeConfigData();

		$this->registerCommands();
		$this->registerListeners();
	}

	public static function getInstance(): self
	{
		return self::$instance;
	}

	/** @internal */
	public function getDatabase(): LevelDB
	{
		return $this->database;
	}

	public function getSettings(): array
	{
		return $this->settings;
	}

	public function getRanks(): array
	{
		return $this->ranks;
	}

	public function getRankList(): array
	{
		return $this->rankList;
	}

	public function getRankInheritances(): array
	{
		return $this->rankInheritances;
	}

	public function getPermissions(): array
	{
		return $this->permissions;
	}

	public function getAliasesToRanks(): array
	{
		return $this->aliasesToRanks;
	}

	public function getMessages(): array
	{
		return $this->messages;
	}

	public function getDefaultRank(): string
	{
		return $this->defaultRank;
	}

	public function doesRankExist(string $rank): bool
	{
		return in_array(strtolower($rank), $this->getRankList(), true);
	}

	public function isDefaultRank(string $rank): bool
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		return strtolower($rank) === $this->getDefaultRank();
	}

	public function isLocalChatEnabled(): bool
	{
		return $this->localChatEnabled;
	}

	public function getLocalChatSettings(): array
	{
		return $this->localChatSettings;
	}

	public function getRankPriority(string $rank): int
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		return (int)$this->getRanks()[strtolower($rank)]["priority"];
	}

	public function getRankColor(string $rank): string
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		return $this->getRanks()[strtolower($rank)]["color"];
	}

	public function getRankDisplayName(string $rank): string
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		return $this->getRanks()[strtolower($rank)]["display-name"];
	}

	public function getRankChatFormat(string $rank): string
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		return $this->getRanks()[strtolower($rank)]["chat-format"];
	}

	public function getRankNameTag(string $rank): string
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		return $this->getRanks()[strtolower($rank)]["name-tag"];
	}

	public function getRankPermissions(string $rank): array
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		return $this->getPermissions()[strtolower($rank)];
	}

	public function getRankFromAlias(string $alias): string
	{
		return $this->getAliasesToRanks()[strtolower($alias)] ?? $alias;
	}

	public function getRank(Player $player): Rank
	{
		$nickname = strtolower($player->getName());
		$rank = $this->getRankFromDatabase($nickname);
		$rankData = $this->getRanks()[$rank];

		return $this->playerRanks[$nickname] ?? new Rank(
			$rank,
			$rankData["priority"],
			$rankData["color"],
			$rankData["display-name"],
			$rankData["chat-format"],
			$rankData["name-tag"],
			$this->getRankPermissions($rank)
		);
	}

	public function getRankFromDatabase(string $nickname): string
	{
		$rank = $this->getDatabase()->get(strtolower($nickname));
		return $rank !== false ? $rank : $this->getDefaultRank();
	}

	public function setRank(Player $player, string $rank): void
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		$rank = strtolower($rank);
		$nickname = strtolower($player->getName());
		$oldRank = $this->getRank($player);

		$database = $this->getDatabase();
		if ($database->get($nickname) !== false) {
			$database->delete($nickname);
		}

		if (!($this->isDefaultRank($rank))) {
			$database->put($nickname, $rank);
		}

		$this->addRank($player, $rank);

		$event = new PlayerRankChangeEvent($player, $oldRank);
		$event->call();
	}

	public function setRankOffline(string $nickname, string $rank): void
	{
		if (!($this->doesRankExist($rank))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rank));
		}

		$rank = strtolower($rank);
		$nickname = strtolower($nickname);

		$database = $this->getDatabase();
		if ($database->get($nickname) !== false) {
			$database->delete($nickname);
		}

		if (!($this->isDefaultRank($rank))) {
			$database->put($nickname, $rank);
		}
	}

	/** @internal */
	public function addRank(Player $player, string $rankName): void
	{
		$rankName = strtolower($rankName);
		if (!($this->doesRankExist($rankName))) {
			throw new RanksException(sprintf("Rank '%s' does not exist", $rankName));
		}

		$this->removeRank($player);

		$rankData = $this->getRanks()[$rankName];
		$this->playerRanks[strtolower($player->getName())] = new Rank(
			$rankName,
			$rankData["priority"],
			$rankData["color"],
			$rankData["display-name"],
			$rankData["chat-format"],
			$rankData["name-tag"],
			$this->getRankPermissions($rankName)
		);
	}

	/** @internal */
	public function removeRank(Player $player): void
	{
		$nickname = strtolower($player->getName());
		if (isset($this->playerRanks[$nickname])) {
			unset($this->playerRanks[$nickname]);
		}
	}

	/** @internal */
	public function getAttachment(Player $player): PermissionAttachment
	{
		$nickname = strtolower($player->getName());
		if (!(isset($this->attachments[$nickname]))) {
			throw new RanksException(sprintf("Player '%s' has no PermissionAttachment?", $nickname));
		}

		return $this->attachments[$nickname];
	}

	/** @internal */
	public function setAttachment(Player $player, PermissionAttachment $attachment): void
	{
		$this->attachments[strtolower($player->getName())] = $attachment;
	}

	/** @internal */
	public function removeAttachment(Player $player): void
	{
		$nickname = strtolower($player->getName());
		if (isset($this->attachments[$nickname])) {
			unset($this->attachments[$nickname]);
		}
	}

	public function updatePermissions(Player $player): void
	{
		$attachment = $this->getAttachment($player);

		$attachment->clearPermissions();
		foreach ($this->getRank($player)->getPermissions() as $permission) {
			if ($permission === "*") {
				foreach (PermissionManager::getInstance()->getPermissions() as $tempPermission) {
					$attachment->setPermission($tempPermission->getName(), true);
				}
				break;
			}
			$attachment->setPermission($permission, true);
		}
	}

	/** @internal */
	public function notifyRankChange(string $issuer, string $target, string $rank): void
	{
		$messages = $this->getMessages();
		foreach ($this->getServer()->getOnlinePlayers() as $player) {
			if ($player->hasPermission("lunarranks.notifications")) {
				$player->sendMessage(str_replace(["{ISSUER}", "{TARGET}", "{RANK}"], [$issuer, $target, $rank], $messages["player"]["rank-change-notification"]));
			}
		}
		$this->getLogger()->info(str_replace(["{ISSUER}", "{TARGET}", "{RANK}"], [$issuer, $target, $rank], $messages["console"]["rank-change-notification"]));
	}

	public function getPlatform(Player $player): string
	{
		$extraData = $player->getPlayerInfo()->getExtraData();

		if ($extraData["DeviceOS"] === DeviceOS::ANDROID && $extraData["DeviceModel"] === "") {
			return "Linux";
		}

		return match ($extraData["DeviceOS"]) {
			DeviceOS::ANDROID => "",
			DeviceOS::IOS => "",
			DeviceOS::OSX => "§7[§bPC§7]",
			DeviceOS::AMAZON => "",
			DeviceOS::GEAR_VR => "",
			DeviceOS::HOLOLENS => "",
			DeviceOS::WINDOWS_10, DeviceOS::WIN32 => "§7[§bPC§7]",
			DeviceOS::DEDICATED => "",
			DeviceOS::TVOS => "",
			DeviceOS::PLAYSTATION => "",
			DeviceOS::NINTENDO => "",
			DeviceOS::XBOX => "",
			DeviceOS::WINDOWS_PHONE => "",
			default => ""
		};
	}

	public function getPlayerClan(Player $player): void
	{
		$player->str_replace("{CLANNAME}", $this->clannamee->getPlayerClan($player));
	}

	public function updateNameTag(Player $player): void
	{
		$player->setNameTag(str_replace(
			["{NAME}", "{DISPLAY_NAME}", "{PLATFORM}", "{CLANNAME}", "{LINE}"],
			[$player->getName(), $player->getDisplayName(), $this->getPlatform($player), $this->clannamee->getPlayerClan($player), "\n"],
			$this->getRank($player)->getNameTag()
		));
	}
}

Перенести в этот клас.

<?php

/**
 *  _                               _ _
 * | |   _   _ _ __   __ _ _ __ ___| | |_   _
 * | |  | | | |  _ \ / _  |  __/ _ \ | | | | |
 * | |__| |_| | | | | (_| | | |  __/ | | |_| |
 * |_____\____|_| |_|\____|_|  \___|_|_|\___ |
 *                                      |___/
 *
 * @author Lunarelly
 * @link https://github.com/Lunarelly
 *
 */

declare(strict_types=1);

namespace lunarelly\ranks\listener\chat;

use Will\Clan;
use Fred\sclansscore\listener\TagResolveListener;
use lunarelly\ranks\event\PlayerRankChangeEvent;
use lunarelly\ranks\LunarRanks;
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerChatEvent;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\player\Player;
use pocketmine\utils\BroadcastLoggerForwarder;
use pocketmine\utils\TextFormat;
use pocketmine\plugin\PluginBase;

final class ChatListener implements Listener
{
	private int $localChatDistance = 0;
	private string $globalSymbol = "";
	private string $localPrefix = "";
	private string $globalPrefix = "";

	public function __construct(private readonly LunarRanks $plugin)
	{
		if ($this->plugin->isLocalChatEnabled()) {
			$settings = $this->plugin->getLocalChatSettings();
			$this->localChatDistance = (int)$settings["distance"];
			$this->globalSymbol = (string)$settings["symbol"];
			$this->localPrefix = (string)$settings["local-prefix"];
			$this->globalPrefix = (string)$settings["global-prefix"];
		}
	}

	private function getPlugin(): LunarRanks
	{
		return $this->plugin;
	}

	private function getLocalChatDistance(): int
	{
		return $this->localChatDistance;
	}

	private function getGlobalSymbol(): string
	{
		return $this->globalSymbol;
	}

	private function getLocalPrefix(): string
	{
		return $this->localPrefix;
	}

	private function getGlobalPrefix(): string
	{
		return $this->globalPrefix;
	}

	/** @noinspection PhpUnused */
	public function handlePlayerJoin(PlayerJoinEvent $event): void
	{
		$this->getPlugin()->updateNameTag($event->getPlayer());
	}

	/** @noinspection PhpUnused */
	public function handleRankChange(PlayerRankChangeEvent $event): void
	{
		$this->getPlugin()->updateNameTag($event->getPlayer());
	}

	private function formatChat(Player $player, string $message, ChatType $type = ChatType::Default): string
	{
		return match ($type) {
			ChatType::Default => str_replace(
				["{NAME}", "{DISPLAY_NAME}", "{CLANNAME}", "{MESSAGE}"],
				[$player->getName(), $player->getDisplayName(), $this->clannamee->getPlayerClan($player), TextFormat::clean($message)],
				$this->getPlugin()->getRank($player)->getChatFormat()
			),
			ChatType::Local => $this->getLocalPrefix() . " " . str_replace(
					["{NAME}", "{DISPLAY_NAME}", "{CLANNAME}", "{MESSAGE}"],
					[$player->getName(), $player->getDisplayName(), $this->clannamee->getPlayerClan($player), TextFormat::clean($message)],
					$this->getPlugin()->getRank($player)->getChatFormat()
				),
			ChatType::Global => $this->getGlobalPrefix() . " " . str_replace(
					["{NAME}", "{DISPLAY_NAME}", "{CLANNAME}", "{MESSAGE}"],
					[$player->getName(), $player->getDisplayName(), $this->clannamee->getPlayerClan($player), TextFormat::clean(str_replace($this->getGlobalSymbol(), "", $message))],
					$this->getPlugin()->getRank($player)->getChatFormat()
				)
		};
	}

	/**
	 * @priority HIGHEST
	 * @noinspection PhpUnused
	 */
	public function handlePlayerChat(PlayerChatEvent $event): void
	{
		$player = $event->getPlayer();
		$plugin = $this->getPlugin();
		$message = trim($event->getMessage());
		$recipients = $event->getRecipients();

		$event->cancel();
		if ($plugin->isLocalChatEnabled()) {
			if ($message === $this->getGlobalSymbol()) {
				return;
			}

			if ($message[0] !== $this->getGlobalSymbol()) {
				foreach ($recipients as $recipient) {
					$localFormat = $this->formatChat($player, $message, ChatType::Local);
					if ($recipient instanceof Player) {
						if ($recipient->getWorld() === $player->getWorld() && $recipient->getLocation()->distance($player->getPosition()) <= $this->getLocalChatDistance()) {
							$recipient->sendMessage($localFormat);
						}
					} elseif ($recipient instanceof BroadcastLoggerForwarder) {
						$recipient->sendMessage($localFormat);
					}
				}
			} else {
				foreach ($recipients as $recipient) {
					$recipient->sendMessage($this->formatChat($player, $message, ChatType::Global));
				}
			}
		} else {
			foreach ($recipients as $recipient) {
				$recipient->sendMessage($this->formatChat($player, $message));
			}
		}
	}
}

В чём проблема создать это свойство в нужном классе и в конструкторе выдать значение

я не очень шарю за php я только учусь кодить

я смог из другого плагин вывести тег в нужный мне плагин, а перенести переменную не могу

public $clannamee;
	private int $localChatDistance = 0;
	private string $globalSymbol = "";
	private string $localPrefix = "";
	private string $globalPrefix = "";

	public function __construct(private readonly LunarRanks $plugin)
	{
		if ($this->plugin->isLocalChatEnabled()) {
			$settings = $this->plugin->getLocalChatSettings();
			$this->localChatDistance = (int)$settings["distance"];
			$this->globalSymbol = (string)$settings["symbol"];
			$this->localPrefix = (string)$settings["local-prefix"];
			$this->globalPrefix = (string)$settings["global-prefix"];
		}
	}

	private function getPlugin(): LunarRanks
	{
		return $this->plugin;
	}

	protected function setProperty()
    {
		LunarRanks::$clannamee = $this->clannamee;
	}

я попробовал так но все равно хуйня

image

можешь пожалуйста дополнить код второго класса что бы импортировать значение переменной

lunarelly

боже это ты немощь чтоли