22declare(strict_types=1);
24namespace pocketmine\command\defaults;
38use
function strtolower;
43 public function __construct(){
46 KnownTranslationFactory::pocketmine_command_version_description(),
47 KnownTranslationFactory::pocketmine_command_version_usage(),
50 $this->setPermission(DefaultPermissionNames::COMMAND_VERSION);
54 if(count($args) === 0){
55 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_serverSoftwareName(
56 TextFormat::GREEN . VersionInfo::NAME . TextFormat::RESET
58 $versionColor = VersionInfo::IS_DEVELOPMENT_BUILD ? TextFormat::YELLOW : TextFormat::GREEN;
59 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_serverSoftwareVersion(
60 $versionColor . VersionInfo::VERSION()->getFullVersion() . TextFormat::RESET,
61 TextFormat::GREEN . VersionInfo::GIT_HASH() . TextFormat::RESET
63 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_minecraftVersion(
67 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_phpVersion(TextFormat::GREEN . PHP_VERSION . TextFormat::RESET));
70 if($jitMode !==
null){
72 $jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitEnabled(sprintf(
"CRTO: %d", $jitMode));
74 $jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitDisabled();
77 $jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitNotSupported();
79 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_phpJitStatus($jitStatus->format(TextFormat::GREEN, TextFormat::RESET)));
80 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_operatingSystem(TextFormat::GREEN .
Utils::getOS() . TextFormat::RESET));
82 $pluginName = implode(
" ", $args);
83 $exactPlugin = $sender->getServer()->getPluginManager()->getPlugin($pluginName);
85 if($exactPlugin instanceof
Plugin){
86 $this->describeToSender($exactPlugin, $sender);
92 $pluginName = strtolower($pluginName);
93 foreach($sender->getServer()->getPluginManager()->getPlugins() as $plugin){
94 if(stripos($plugin->getName(), $pluginName) !==
false){
95 $this->describeToSender($plugin, $sender);
101 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_noSuchPlugin());
109 $desc = $plugin->getDescription();
110 $sender->sendMessage(TextFormat::DARK_GREEN . $desc->getName() . TextFormat::RESET .
" version " . TextFormat::DARK_GREEN . $desc->getVersion());
112 if($desc->getDescription() !==
""){
113 $sender->sendMessage($desc->getDescription());
116 if($desc->getWebsite() !==
""){
117 $sender->sendMessage(
"Website: " . $desc->getWebsite());
120 if(count($authors = $desc->getAuthors()) > 0){
121 if(count($authors) === 1){
122 $sender->sendMessage(
"Author: " . implode(
", ", $authors));
124 $sender->sendMessage(
"Authors: " . implode(
", ", $authors));
execute(CommandSender $sender, string $commandLabel, array $args)
const MINECRAFT_VERSION_NETWORK
static getOS(bool $recalculate=false)
static getOpcacheJitMode()