mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 04:38:35 +00:00
Merge remote-tracking branch 'origin/minor-next' into compressor-threads
This commit is contained in:
commit
3d790e3e4b
@ -526,7 +526,7 @@ class Server{
|
|||||||
return $this->playerDataProvider->loadData($name);
|
return $this->playerDataProvider->loadData($name);
|
||||||
}catch(PlayerDataLoadException $e){
|
}catch(PlayerDataLoadException $e){
|
||||||
$this->logger->debug("Failed to load player data for $name: " . $e->getMessage());
|
$this->logger->debug("Failed to load player data for $name: " . $e->getMessage());
|
||||||
$this->logger->error($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_data_playerCorrupted($name)));
|
$this->logger->error($this->language->translate(KnownTranslationFactory::pocketmine_data_playerCorrupted($name)));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -545,7 +545,7 @@ class Server{
|
|||||||
try{
|
try{
|
||||||
$this->playerDataProvider->saveData($name, $ev->getSaveData());
|
$this->playerDataProvider->saveData($name, $ev->getSaveData());
|
||||||
}catch(PlayerDataSaveException $e){
|
}catch(PlayerDataSaveException $e){
|
||||||
$this->logger->critical($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_data_saveError($name, $e->getMessage())));
|
$this->logger->critical($this->language->translate(KnownTranslationFactory::pocketmine_data_saveError($name, $e->getMessage())));
|
||||||
$this->logger->logException($e);
|
$this->logger->logException($e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -857,7 +857,7 @@ class Server{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::language_selected($this->getLanguage()->getName(), $this->getLanguage()->getLang())));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::language_selected($this->language->getName(), $this->language->getLang())));
|
||||||
|
|
||||||
if(VersionInfo::IS_DEVELOPMENT_BUILD){
|
if(VersionInfo::IS_DEVELOPMENT_BUILD){
|
||||||
if(!$this->configGroup->getPropertyBool(Yml::SETTINGS_ENABLE_DEV_BUILDS, false)){
|
if(!$this->configGroup->getPropertyBool(Yml::SETTINGS_ENABLE_DEV_BUILDS, false)){
|
||||||
@ -880,7 +880,7 @@ class Server{
|
|||||||
|
|
||||||
$this->memoryManager = new MemoryManager($this);
|
$this->memoryManager = new MemoryManager($this);
|
||||||
|
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_start(TextFormat::AQUA . $this->getVersion() . TextFormat::RESET)));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_start(TextFormat::AQUA . $this->getVersion() . TextFormat::RESET)));
|
||||||
|
|
||||||
if(($poolSize = $this->configGroup->getPropertyString(Yml::SETTINGS_ASYNC_WORKERS, "auto")) === "auto"){
|
if(($poolSize = $this->configGroup->getPropertyString(Yml::SETTINGS_ASYNC_WORKERS, "auto")) === "auto"){
|
||||||
$poolSize = 2;
|
$poolSize = 2;
|
||||||
@ -941,11 +941,11 @@ class Server{
|
|||||||
|
|
||||||
$this->onlineMode = $this->configGroup->getConfigBool(ServerProperties::XBOX_AUTH, true);
|
$this->onlineMode = $this->configGroup->getConfigBool(ServerProperties::XBOX_AUTH, true);
|
||||||
if($this->onlineMode){
|
if($this->onlineMode){
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_auth_enabled()));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_auth_enabled()));
|
||||||
}else{
|
}else{
|
||||||
$this->logger->warning($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_auth_disabled()));
|
$this->logger->warning($this->language->translate(KnownTranslationFactory::pocketmine_server_auth_disabled()));
|
||||||
$this->logger->warning($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_authWarning()));
|
$this->logger->warning($this->language->translate(KnownTranslationFactory::pocketmine_server_authWarning()));
|
||||||
$this->logger->warning($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_authProperty_disabled()));
|
$this->logger->warning($this->language->translate(KnownTranslationFactory::pocketmine_server_authProperty_disabled()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->configGroup->getConfigBool(ServerProperties::HARDCORE, false) && $this->getDifficulty() < World::DIFFICULTY_HARD){
|
if($this->configGroup->getConfigBool(ServerProperties::HARDCORE, false) && $this->getDifficulty() < World::DIFFICULTY_HARD){
|
||||||
@ -956,17 +956,17 @@ class Server{
|
|||||||
|
|
||||||
$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
|
$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
|
||||||
|
|
||||||
$this->getLogger()->debug("Server unique id: " . $this->getServerUniqueId());
|
$this->logger->debug("Server unique id: " . $this->getServerUniqueId());
|
||||||
$this->getLogger()->debug("Machine unique id: " . Utils::getMachineUniqueId());
|
$this->logger->debug("Machine unique id: " . Utils::getMachineUniqueId());
|
||||||
|
|
||||||
$this->network = new Network($this->logger);
|
$this->network = new Network($this->logger);
|
||||||
$this->network->setName($this->getMotd());
|
$this->network->setName($this->getMotd());
|
||||||
|
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_info(
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_info(
|
||||||
$this->getName(),
|
$this->getName(),
|
||||||
(VersionInfo::IS_DEVELOPMENT_BUILD ? TextFormat::YELLOW : "") . $this->getPocketMineVersion() . TextFormat::RESET
|
(VersionInfo::IS_DEVELOPMENT_BUILD ? TextFormat::YELLOW : "") . $this->getPocketMineVersion() . TextFormat::RESET
|
||||||
)));
|
)));
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_license($this->getName())));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_license($this->getName())));
|
||||||
|
|
||||||
TimingsHandler::setEnabled($this->configGroup->getPropertyBool(Yml::SETTINGS_ENABLE_PROFILING, false));
|
TimingsHandler::setEnabled($this->configGroup->getPropertyBool(Yml::SETTINGS_ENABLE_PROFILING, false));
|
||||||
$this->profilingTickRate = $this->configGroup->getPropertyInt(Yml::SETTINGS_PROFILE_REPORT_TRIGGER, self::TARGET_TICKS_PER_SECOND);
|
$this->profilingTickRate = $this->configGroup->getPropertyInt(Yml::SETTINGS_PROFILE_REPORT_TRIGGER, self::TARGET_TICKS_PER_SECOND);
|
||||||
@ -977,7 +977,7 @@ class Server{
|
|||||||
|
|
||||||
$this->craftingManager = CraftingManagerFromDataHelper::make(Path::join(\pocketmine\BEDROCK_DATA_PATH, "recipes"));
|
$this->craftingManager = CraftingManagerFromDataHelper::make(Path::join(\pocketmine\BEDROCK_DATA_PATH, "recipes"));
|
||||||
|
|
||||||
$this->resourceManager = new ResourcePackManager(Path::join($this->getDataPath(), "resource_packs"), $this->logger);
|
$this->resourceManager = new ResourcePackManager(Path::join($this->dataPath, "resource_packs"), $this->logger);
|
||||||
|
|
||||||
$pluginGraylist = null;
|
$pluginGraylist = null;
|
||||||
$graylistFile = Path::join($this->dataPath, "plugin_list.yml");
|
$graylistFile = Path::join($this->dataPath, "plugin_list.yml");
|
||||||
@ -991,7 +991,7 @@ class Server{
|
|||||||
$this->forceShutdownExit();
|
$this->forceShutdownExit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->pluginManager = new PluginManager($this, $this->configGroup->getPropertyBool(Yml::PLUGINS_LEGACY_DATA_DIR, true) ? null : Path::join($this->getDataPath(), "plugin_data"), $pluginGraylist);
|
$this->pluginManager = new PluginManager($this, $this->configGroup->getPropertyBool(Yml::PLUGINS_LEGACY_DATA_DIR, true) ? null : Path::join($this->dataPath, "plugin_data"), $pluginGraylist);
|
||||||
$this->pluginManager->registerInterface(new PharPluginLoader($this->autoloader));
|
$this->pluginManager->registerInterface(new PharPluginLoader($this->autoloader));
|
||||||
$this->pluginManager->registerInterface(new ScriptPluginLoader());
|
$this->pluginManager->registerInterface(new ScriptPluginLoader());
|
||||||
|
|
||||||
@ -1053,9 +1053,9 @@ class Server{
|
|||||||
|
|
||||||
$this->configGroup->save();
|
$this->configGroup->save();
|
||||||
|
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_defaultGameMode($this->getGamemode()->getTranslatableName())));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_defaultGameMode($this->getGamemode()->getTranslatableName())));
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_donate(TextFormat::AQUA . "https://patreon.com/pocketminemp" . TextFormat::RESET)));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_donate(TextFormat::AQUA . "https://patreon.com/pocketminemp" . TextFormat::RESET)));
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_startFinished(strval(round(microtime(true) - $this->startTime, 3)))));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_startFinished(strval(round(microtime(true) - $this->startTime, 3)))));
|
||||||
|
|
||||||
$forwarder = new BroadcastLoggerForwarder($this, $this->logger, $this->language);
|
$forwarder = new BroadcastLoggerForwarder($this, $this->logger, $this->language);
|
||||||
$this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_ADMINISTRATIVE, $forwarder);
|
$this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_ADMINISTRATIVE, $forwarder);
|
||||||
@ -1143,13 +1143,13 @@ class Server{
|
|||||||
if($this->worldManager->getDefaultWorld() === null){
|
if($this->worldManager->getDefaultWorld() === null){
|
||||||
$default = $this->configGroup->getConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
$default = $this->configGroup->getConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
||||||
if(trim($default) == ""){
|
if(trim($default) == ""){
|
||||||
$this->getLogger()->warning("level-name cannot be null, using default");
|
$this->logger->warning("level-name cannot be null, using default");
|
||||||
$default = "world";
|
$default = "world";
|
||||||
$this->configGroup->setConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
$this->configGroup->setConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
||||||
}
|
}
|
||||||
if(!$this->worldManager->loadWorld($default, true)){
|
if(!$this->worldManager->loadWorld($default, true)){
|
||||||
if($this->worldManager->isWorldGenerated($default)){
|
if($this->worldManager->isWorldGenerated($default)){
|
||||||
$this->getLogger()->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_level_defaultError()));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_level_defaultError()));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1158,7 +1158,7 @@ class Server{
|
|||||||
$generatorClass = $getGenerator($generatorName, $generatorOptions, $default);
|
$generatorClass = $getGenerator($generatorName, $generatorOptions, $default);
|
||||||
|
|
||||||
if($generatorClass === null){
|
if($generatorClass === null){
|
||||||
$this->getLogger()->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_level_defaultError()));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_level_defaultError()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$creationOptions = WorldCreationOptions::create()
|
$creationOptions = WorldCreationOptions::create()
|
||||||
@ -1204,7 +1204,7 @@ class Server{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if($rakLibRegistered){
|
if($rakLibRegistered){
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_networkStart($prettyIp, (string) $port)));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_networkStart($prettyIp, (string) $port)));
|
||||||
}
|
}
|
||||||
if($useQuery){
|
if($useQuery){
|
||||||
if(!$rakLibRegistered){
|
if(!$rakLibRegistered){
|
||||||
@ -1212,7 +1212,7 @@ class Server{
|
|||||||
//if it's not registered we need to make sure Query still works
|
//if it's not registered we need to make sure Query still works
|
||||||
$this->network->registerInterface(new DedicatedQueryNetworkInterface($ip, $port, $ipV6, new \PrefixedLogger($this->logger, "Dedicated Query Interface")));
|
$this->network->registerInterface(new DedicatedQueryNetworkInterface($ip, $port, $ipV6, new \PrefixedLogger($this->logger, "Dedicated Query Interface")));
|
||||||
}
|
}
|
||||||
$this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_query_running($prettyIp, (string) $port)));
|
$this->logger->info($this->language->translate(KnownTranslationFactory::pocketmine_server_query_running($prettyIp, (string) $port)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1473,7 +1473,7 @@ class Server{
|
|||||||
$this->shutdown();
|
$this->shutdown();
|
||||||
|
|
||||||
if(isset($this->pluginManager)){
|
if(isset($this->pluginManager)){
|
||||||
$this->getLogger()->debug("Disabling all plugins");
|
$this->logger->debug("Disabling all plugins");
|
||||||
$this->pluginManager->disablePlugins();
|
$this->pluginManager->disablePlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1482,34 +1482,34 @@ class Server{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->worldManager)){
|
if(isset($this->worldManager)){
|
||||||
$this->getLogger()->debug("Unloading all worlds");
|
$this->logger->debug("Unloading all worlds");
|
||||||
foreach($this->worldManager->getWorlds() as $world){
|
foreach($this->worldManager->getWorlds() as $world){
|
||||||
$this->worldManager->unloadWorld($world, true);
|
$this->worldManager->unloadWorld($world, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getLogger()->debug("Removing event handlers");
|
$this->logger->debug("Removing event handlers");
|
||||||
HandlerListManager::global()->unregisterAll();
|
HandlerListManager::global()->unregisterAll();
|
||||||
|
|
||||||
if(isset($this->asyncPool)){
|
if(isset($this->asyncPool)){
|
||||||
$this->getLogger()->debug("Shutting down async task worker pool");
|
$this->logger->debug("Shutting down async task worker pool");
|
||||||
$this->asyncPool->shutdown();
|
$this->asyncPool->shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->configGroup)){
|
if(isset($this->configGroup)){
|
||||||
$this->getLogger()->debug("Saving properties");
|
$this->logger->debug("Saving properties");
|
||||||
$this->configGroup->save();
|
$this->configGroup->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->console !== null){
|
if($this->console !== null){
|
||||||
$this->getLogger()->debug("Closing console");
|
$this->logger->debug("Closing console");
|
||||||
$this->console->quit();
|
$this->console->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->network)){
|
if(isset($this->network)){
|
||||||
$this->getLogger()->debug("Stopping network interfaces");
|
$this->logger->debug("Stopping network interfaces");
|
||||||
foreach($this->network->getInterfaces() as $interface){
|
foreach($this->network->getInterfaces() as $interface){
|
||||||
$this->getLogger()->debug("Stopping network interface " . get_class($interface));
|
$this->logger->debug("Stopping network interface " . get_class($interface));
|
||||||
$this->network->unregisterInterface($interface);
|
$this->network->unregisterInterface($interface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1581,7 +1581,7 @@ class Server{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function writeCrashDumpFile(CrashDump $dump) : string{
|
private function writeCrashDumpFile(CrashDump $dump) : string{
|
||||||
$crashFolder = Path::join($this->getDataPath(), "crashdumps");
|
$crashFolder = Path::join($this->dataPath, "crashdumps");
|
||||||
if(!is_dir($crashFolder)){
|
if(!is_dir($crashFolder)){
|
||||||
mkdir($crashFolder);
|
mkdir($crashFolder);
|
||||||
}
|
}
|
||||||
@ -1612,17 +1612,17 @@ class Server{
|
|||||||
ini_set("error_reporting", '0');
|
ini_set("error_reporting", '0');
|
||||||
ini_set("memory_limit", '-1'); //Fix error dump not dumped on memory problems
|
ini_set("memory_limit", '-1'); //Fix error dump not dumped on memory problems
|
||||||
try{
|
try{
|
||||||
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_create()));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_crash_create()));
|
||||||
$dump = new CrashDump($this, $this->pluginManager ?? null);
|
$dump = new CrashDump($this, $this->pluginManager ?? null);
|
||||||
|
|
||||||
$crashDumpPath = $this->writeCrashDumpFile($dump);
|
$crashDumpPath = $this->writeCrashDumpFile($dump);
|
||||||
|
|
||||||
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_submit($crashDumpPath)));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_crash_submit($crashDumpPath)));
|
||||||
|
|
||||||
if($this->configGroup->getPropertyBool(Yml::AUTO_REPORT_ENABLED, true)){
|
if($this->configGroup->getPropertyBool(Yml::AUTO_REPORT_ENABLED, true)){
|
||||||
$report = true;
|
$report = true;
|
||||||
|
|
||||||
$stamp = Path::join($this->getDataPath(), "crashdumps", ".last_crash");
|
$stamp = Path::join($this->dataPath, "crashdumps", ".last_crash");
|
||||||
$crashInterval = 120; //2 minutes
|
$crashInterval = 120; //2 minutes
|
||||||
if(($lastReportTime = @filemtime($stamp)) !== false && $lastReportTime + $crashInterval >= time()){
|
if(($lastReportTime = @filemtime($stamp)) !== false && $lastReportTime + $crashInterval >= time()){
|
||||||
$report = false;
|
$report = false;
|
||||||
@ -1653,7 +1653,7 @@ class Server{
|
|||||||
if(isset($data->crashId) && is_int($data->crashId) && isset($data->crashUrl) && is_string($data->crashUrl)){
|
if(isset($data->crashId) && is_int($data->crashId) && isset($data->crashUrl) && is_string($data->crashUrl)){
|
||||||
$reportId = $data->crashId;
|
$reportId = $data->crashId;
|
||||||
$reportUrl = $data->crashUrl;
|
$reportUrl = $data->crashUrl;
|
||||||
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_archive($reportUrl, (string) $reportId)));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_crash_archive($reportUrl, (string) $reportId)));
|
||||||
}elseif(isset($data->error) && is_string($data->error)){
|
}elseif(isset($data->error) && is_string($data->error)){
|
||||||
$this->logger->emergency("Automatic crash report submission failed: $data->error");
|
$this->logger->emergency("Automatic crash report submission failed: $data->error");
|
||||||
}else{
|
}else{
|
||||||
@ -1667,7 +1667,7 @@ class Server{
|
|||||||
}catch(\Throwable $e){
|
}catch(\Throwable $e){
|
||||||
$this->logger->logException($e);
|
$this->logger->logException($e);
|
||||||
try{
|
try{
|
||||||
$this->logger->critical($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_error($e->getMessage())));
|
$this->logger->critical($this->language->translate(KnownTranslationFactory::pocketmine_crash_error($e->getMessage())));
|
||||||
}catch(\Throwable $e){}
|
}catch(\Throwable $e){}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,7 +1785,7 @@ class Server{
|
|||||||
|
|
||||||
echo "\x1b]0;" . $this->getName() . " " .
|
echo "\x1b]0;" . $this->getName() . " " .
|
||||||
$this->getPocketMineVersion() .
|
$this->getPocketMineVersion() .
|
||||||
" | Online $online/" . $this->getMaxPlayers() .
|
" | Online $online/" . $this->maxPlayers .
|
||||||
($connecting > 0 ? " (+$connecting connecting)" : "") .
|
($connecting > 0 ? " (+$connecting connecting)" : "") .
|
||||||
" | Memory " . $usage .
|
" | Memory " . $usage .
|
||||||
" | U " . round($bandwidthStats->getSend()->getAverageBytes() / 1024, 2) .
|
" | U " . round($bandwidthStats->getSend()->getAverageBytes() / 1024, 2) .
|
||||||
@ -1850,10 +1850,10 @@ class Server{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(($this->tickCounter % self::TICKS_PER_TPS_OVERLOAD_WARNING) === 0 && $this->getTicksPerSecondAverage() < self::TPS_OVERLOAD_WARNING_THRESHOLD){
|
if(($this->tickCounter % self::TICKS_PER_TPS_OVERLOAD_WARNING) === 0 && $this->getTicksPerSecondAverage() < self::TPS_OVERLOAD_WARNING_THRESHOLD){
|
||||||
$this->logger->warning($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_tickOverload()));
|
$this->logger->warning($this->language->translate(KnownTranslationFactory::pocketmine_server_tickOverload()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getMemoryManager()->check();
|
$this->memoryManager->check();
|
||||||
|
|
||||||
if($this->console !== null){
|
if($this->console !== null){
|
||||||
Timings::$serverCommand->startTiming();
|
Timings::$serverCommand->startTiming();
|
||||||
|
@ -173,7 +173,7 @@ class Bamboo extends Transparent{
|
|||||||
$newHeight = $height + $growAmount;
|
$newHeight = $height + $growAmount;
|
||||||
|
|
||||||
$stemBlock = (clone $this)->setReady(false)->setLeafSize(self::NO_LEAVES);
|
$stemBlock = (clone $this)->setReady(false)->setLeafSize(self::NO_LEAVES);
|
||||||
if($newHeight >= 4 && !$stemBlock->isThick()){ //don't change it to false if height is less, because it might have been chopped
|
if($newHeight >= 4 && !$stemBlock->thick){ //don't change it to false if height is less, because it might have been chopped
|
||||||
$stemBlock = $stemBlock->setThick(true);
|
$stemBlock = $stemBlock->setThick(true);
|
||||||
}
|
}
|
||||||
$smallLeavesBlock = (clone $stemBlock)->setLeafSize(self::SMALL_LEAVES);
|
$smallLeavesBlock = (clone $stemBlock)->setLeafSize(self::SMALL_LEAVES);
|
||||||
|
@ -55,12 +55,12 @@ class Barrel extends Opaque{
|
|||||||
|
|
||||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||||
if($player !== null){
|
if($player !== null){
|
||||||
if(abs($player->getPosition()->getX() - $this->position->getX()) < 2 && abs($player->getPosition()->getZ() - $this->position->getZ()) < 2){
|
if(abs($player->getPosition()->x - $this->position->x) < 2 && abs($player->getPosition()->z - $this->position->z) < 2){
|
||||||
$y = $player->getEyePos()->getY();
|
$y = $player->getEyePos()->y;
|
||||||
|
|
||||||
if($y - $this->position->getY() > 2){
|
if($y - $this->position->y > 2){
|
||||||
$this->facing = Facing::UP;
|
$this->facing = Facing::UP;
|
||||||
}elseif($this->position->getY() - $y > 0){
|
}elseif($this->position->y - $y > 0){
|
||||||
$this->facing = Facing::DOWN;
|
$this->facing = Facing::DOWN;
|
||||||
}else{
|
}else{
|
||||||
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
||||||
|
@ -65,8 +65,8 @@ abstract class BaseBigDripleaf extends Transparent{
|
|||||||
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
||||||
}
|
}
|
||||||
if($block instanceof BaseBigDripleaf){
|
if($block instanceof BaseBigDripleaf){
|
||||||
$this->facing = $block->getFacing();
|
$this->facing = $block->facing;
|
||||||
$tx->addBlock($block->getPosition(), VanillaBlocks::BIG_DRIPLEAF_STEM()->setFacing($this->facing));
|
$tx->addBlock($block->position, VanillaBlocks::BIG_DRIPLEAF_STEM()->setFacing($this->facing));
|
||||||
}
|
}
|
||||||
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ abstract class BaseBigDripleaf extends Transparent{
|
|||||||
if($head === null){
|
if($head === null){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$pos = $head->getPosition();
|
$pos = $head->position;
|
||||||
$up = $pos->up();
|
$up = $pos->up();
|
||||||
$world = $pos->getWorld();
|
$world = $pos->getWorld();
|
||||||
if(
|
if(
|
||||||
@ -110,8 +110,8 @@ abstract class BaseBigDripleaf extends Transparent{
|
|||||||
|
|
||||||
$tx = new BlockTransaction($world);
|
$tx = new BlockTransaction($world);
|
||||||
|
|
||||||
$tx->addBlock($pos, VanillaBlocks::BIG_DRIPLEAF_STEM()->setFacing($head->getFacing()));
|
$tx->addBlock($pos, VanillaBlocks::BIG_DRIPLEAF_STEM()->setFacing($head->facing));
|
||||||
$tx->addBlock($up, VanillaBlocks::BIG_DRIPLEAF_HEAD()->setFacing($head->getFacing()));
|
$tx->addBlock($up, VanillaBlocks::BIG_DRIPLEAF_HEAD()->setFacing($head->facing));
|
||||||
|
|
||||||
$ev = new StructureGrowEvent($head, $tx, $player);
|
$ev = new StructureGrowEvent($head, $tx, $player);
|
||||||
$ev->call();
|
$ev->call();
|
||||||
|
@ -145,7 +145,7 @@ class Bed extends Transparent{
|
|||||||
|
|
||||||
$b = ($this->isHeadPart() ? $this : $other);
|
$b = ($this->isHeadPart() ? $this : $other);
|
||||||
|
|
||||||
if($b->isOccupied()){
|
if($b->occupied){
|
||||||
$player->sendMessage(KnownTranslationFactory::tile_bed_occupied()->prefix(TextFormat::GRAY));
|
$player->sendMessage(KnownTranslationFactory::tile_bed_occupied()->prefix(TextFormat::GRAY));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -97,7 +97,7 @@ class ChiseledBookshelf extends Opaque{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = Facing::axis($face) === Axis::X ? $clickVector->getZ() : $clickVector->getX();
|
$x = Facing::axis($face) === Axis::X ? $clickVector->z : $clickVector->x;
|
||||||
$slot = ChiseledBookshelfSlot::fromBlockFaceCoordinates(
|
$slot = ChiseledBookshelfSlot::fromBlockFaceCoordinates(
|
||||||
Facing::isPositive(Facing::rotateY($face, true)) ? 1 - $x : $x,
|
Facing::isPositive(Facing::rotateY($face, true)) ? 1 - $x : $x,
|
||||||
$clickVector->y
|
$clickVector->y
|
||||||
|
@ -54,7 +54,7 @@ final class ChorusFlower extends Flowable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function canBeSupportedAt(Block $block) : bool{
|
private function canBeSupportedAt(Block $block) : bool{
|
||||||
$position = $block->getPosition();
|
$position = $block->position;
|
||||||
$world = $position->getWorld();
|
$world = $position->getWorld();
|
||||||
$down = $world->getBlock($position->down());
|
$down = $world->getBlock($position->down());
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ final class ChorusFlower extends Flowable{
|
|||||||
if($tx === null){
|
if($tx === null){
|
||||||
$tx = new BlockTransaction($this->position->getWorld());
|
$tx = new BlockTransaction($this->position->getWorld());
|
||||||
}
|
}
|
||||||
$tx->addBlock($this->position->getSide($facing), (clone $this)->setAge(min(self::MAX_AGE, $this->getAge() + $ageChange)));
|
$tx->addBlock($this->position->getSide($facing), (clone $this)->setAge(min(self::MAX_AGE, $this->age + $ageChange)));
|
||||||
|
|
||||||
return $tx;
|
return $tx;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ final class ChorusPlant extends Flowable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function canBeSupportedAt(Block $block) : bool{
|
private function canBeSupportedAt(Block $block) : bool{
|
||||||
$position = $block->getPosition();
|
$position = $block->position;
|
||||||
$world = $position->getWorld();
|
$world = $position->getWorld();
|
||||||
|
|
||||||
$down = $world->getBlock($position->down());
|
$down = $world->getBlock($position->down());
|
||||||
|
@ -152,7 +152,7 @@ class Farmland extends Transparent{
|
|||||||
$ev = new EntityTrampleFarmlandEvent($entity, $this);
|
$ev = new EntityTrampleFarmlandEvent($entity, $this);
|
||||||
$ev->call();
|
$ev->call();
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getPosition()->getWorld()->setBlock($this->getPosition(), VanillaBlocks::DIRT());
|
$this->position->getWorld()->setBlock($this->position, VanillaBlocks::DIRT());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -140,7 +140,7 @@ class Fire extends BaseFire{
|
|||||||
$block->onIncinerate();
|
$block->onIncinerate();
|
||||||
|
|
||||||
$world = $this->position->getWorld();
|
$world = $this->position->getWorld();
|
||||||
if($world->getBlock($block->getPosition())->isSameState($block)){
|
if($world->getBlock($block->position)->isSameState($block)){
|
||||||
$spreadedFire = false;
|
$spreadedFire = false;
|
||||||
if(mt_rand(0, $this->age + 9) < 5){ //TODO: check rain
|
if(mt_rand(0, $this->age + 9) < 5){ //TODO: check rain
|
||||||
$fire = clone $this;
|
$fire = clone $this;
|
||||||
|
@ -58,7 +58,7 @@ final class FloorCoralFan extends BaseCoral{
|
|||||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||||
if($player !== null){
|
if($player !== null){
|
||||||
$playerBlockPos = $player->getPosition()->floor();
|
$playerBlockPos = $player->getPosition()->floor();
|
||||||
$directionVector = $blockReplace->getPosition()->subtractVector($playerBlockPos)->normalize();
|
$directionVector = $blockReplace->position->subtractVector($playerBlockPos)->normalize();
|
||||||
$angle = rad2deg(atan2($directionVector->getZ(), $directionVector->getX()));
|
$angle = rad2deg(atan2($directionVector->getZ(), $directionVector->getX()));
|
||||||
|
|
||||||
if($angle <= 45 || 315 <= $angle || (135 <= $angle && $angle <= 225)){
|
if($angle <= 45 || 315 <= $angle || (135 <= $angle && $angle <= 225)){
|
||||||
|
@ -61,7 +61,7 @@ class Jukebox extends Opaque{
|
|||||||
|
|
||||||
public function ejectRecord() : void{
|
public function ejectRecord() : void{
|
||||||
if($this->record !== null){
|
if($this->record !== null){
|
||||||
$this->getPosition()->getWorld()->dropItem($this->getPosition()->add(0.5, 1, 0.5), $this->record);
|
$this->position->getWorld()->dropItem($this->position->add(0.5, 1, 0.5), $this->record);
|
||||||
$this->record = null;
|
$this->record = null;
|
||||||
$this->stopSound();
|
$this->stopSound();
|
||||||
}
|
}
|
||||||
@ -76,12 +76,12 @@ class Jukebox extends Opaque{
|
|||||||
|
|
||||||
public function startSound() : void{
|
public function startSound() : void{
|
||||||
if($this->record !== null){
|
if($this->record !== null){
|
||||||
$this->getPosition()->getWorld()->addSound($this->getPosition(), new RecordSound($this->record->getRecordType()));
|
$this->position->getWorld()->addSound($this->position, new RecordSound($this->record->getRecordType()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stopSound() : void{
|
public function stopSound() : void{
|
||||||
$this->getPosition()->getWorld()->addSound($this->getPosition(), new RecordStopSound());
|
$this->position->getWorld()->addSound($this->position, new RecordStopSound());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item, ?Player $player = null, array &$returnedItems = []) : bool{
|
public function onBreak(Item $item, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||||
|
@ -108,8 +108,8 @@ class NetherVines extends Flowable{
|
|||||||
|
|
||||||
private function grow(?Player $player, int $growthAmount = 1) : bool{
|
private function grow(?Player $player, int $growthAmount = 1) : bool{
|
||||||
$top = $this->seekToTip();
|
$top = $this->seekToTip();
|
||||||
$age = $top->getAge();
|
$age = $top->age;
|
||||||
$pos = $top->getPosition();
|
$pos = $top->position;
|
||||||
$world = $pos->getWorld();
|
$world = $pos->getWorld();
|
||||||
$changedBlocks = 0;
|
$changedBlocks = 0;
|
||||||
|
|
||||||
|
@ -70,13 +70,13 @@ class PinkPetals extends Flowable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock) : bool{
|
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock) : bool{
|
||||||
return ($blockReplace instanceof PinkPetals && $blockReplace->getCount() < self::MAX_COUNT) || $this->supportedWhenPlacedAt($blockReplace, $clickVector, $face, $isClickedBlock);
|
return ($blockReplace instanceof PinkPetals && $blockReplace->count < self::MAX_COUNT) || $this->supportedWhenPlacedAt($blockReplace, $clickVector, $face, $isClickedBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||||
if($blockReplace instanceof PinkPetals && $blockReplace->getCount() < self::MAX_COUNT){
|
if($blockReplace instanceof PinkPetals && $blockReplace->count < self::MAX_COUNT){
|
||||||
$this->count = $blockReplace->getCount() + 1;
|
$this->count = $blockReplace->count + 1;
|
||||||
$this->facing = $blockReplace->getFacing();
|
$this->facing = $blockReplace->facing;
|
||||||
}elseif($player !== null){
|
}elseif($player !== null){
|
||||||
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class RedMushroom extends Flowable{
|
|||||||
|
|
||||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||||
$down = $this->getSide(Facing::DOWN);
|
$down = $this->getSide(Facing::DOWN);
|
||||||
$position = $this->getPosition();
|
$position = $this->position;
|
||||||
$lightLevel = $position->getWorld()->getFullLightAt($position->x, $position->y, $position->z);
|
$lightLevel = $position->getWorld()->getFullLightAt($position->x, $position->y, $position->z);
|
||||||
$downId = $down->getTypeId();
|
$downId = $down->getTypeId();
|
||||||
//TODO: nylium support
|
//TODO: nylium support
|
||||||
|
@ -83,7 +83,7 @@ class SmallDripleaf extends Transparent{
|
|||||||
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
$tx->addBlock($block->getPosition(), VanillaBlocks::SMALL_DRIPLEAF()
|
$tx->addBlock($block->position, VanillaBlocks::SMALL_DRIPLEAF()
|
||||||
->setFacing($this->facing)
|
->setFacing($this->facing)
|
||||||
->setTop(true)
|
->setTop(true)
|
||||||
);
|
);
|
||||||
@ -117,7 +117,7 @@ class SmallDripleaf extends Transparent{
|
|||||||
$height = mt_rand(2, 5);
|
$height = mt_rand(2, 5);
|
||||||
$grown = 0;
|
$grown = 0;
|
||||||
for($i = 0; $i < $height; $i++){
|
for($i = 0; $i < $height; $i++){
|
||||||
$pos = $bottomBlock->getSide(Facing::UP, $i)->getPosition();
|
$pos = $bottomBlock->getSide(Facing::UP, $i)->position;
|
||||||
if(!$this->canGrowTo($pos)){
|
if(!$this->canGrowTo($pos)){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,8 @@ class Stair extends Transparent{
|
|||||||
|
|
||||||
public function getSupportType(int $facing) : SupportType{
|
public function getSupportType(int $facing) : SupportType{
|
||||||
if(
|
if(
|
||||||
$facing === Facing::UP && $this->isUpsideDown() ||
|
$facing === Facing::UP && $this->upsideDown ||
|
||||||
$facing === Facing::DOWN && !$this->isUpsideDown() ||
|
$facing === Facing::DOWN && !$this->upsideDown ||
|
||||||
($facing === $this->facing && $this->shape !== StairShape::OUTER_LEFT && $this->shape !== StairShape::OUTER_RIGHT) ||
|
($facing === $this->facing && $this->shape !== StairShape::OUTER_LEFT && $this->shape !== StairShape::OUTER_RIGHT) ||
|
||||||
($facing === Facing::rotate($this->facing, Axis::Y, false) && $this->shape === StairShape::INNER_LEFT) ||
|
($facing === Facing::rotate($this->facing, Axis::Y, false) && $this->shape === StairShape::INNER_LEFT) ||
|
||||||
($facing === Facing::rotate($this->facing, Axis::Y, true) && $this->shape === StairShape::INNER_RIGHT)
|
($facing === Facing::rotate($this->facing, Axis::Y, true) && $this->shape === StairShape::INNER_RIGHT)
|
||||||
|
@ -47,20 +47,20 @@ trait AnimatedBlockInventoryTrait{
|
|||||||
public function onOpen(Player $who) : void{
|
public function onOpen(Player $who) : void{
|
||||||
parent::onOpen($who);
|
parent::onOpen($who);
|
||||||
|
|
||||||
if($this->getHolder()->isValid() && $this->getViewerCount() === 1){
|
if($this->holder->isValid() && $this->getViewerCount() === 1){
|
||||||
//TODO: this crap really shouldn't be managed by the inventory
|
//TODO: this crap really shouldn't be managed by the inventory
|
||||||
$this->animateBlock(true);
|
$this->animateBlock(true);
|
||||||
$this->getHolder()->getWorld()->addSound($this->getHolder()->add(0.5, 0.5, 0.5), $this->getOpenSound());
|
$this->holder->getWorld()->addSound($this->holder->add(0.5, 0.5, 0.5), $this->getOpenSound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function animateBlock(bool $isOpen) : void;
|
abstract protected function animateBlock(bool $isOpen) : void;
|
||||||
|
|
||||||
public function onClose(Player $who) : void{
|
public function onClose(Player $who) : void{
|
||||||
if($this->getHolder()->isValid() && $this->getViewerCount() === 1){
|
if($this->holder->isValid() && $this->getViewerCount() === 1){
|
||||||
//TODO: this crap really shouldn't be managed by the inventory
|
//TODO: this crap really shouldn't be managed by the inventory
|
||||||
$this->animateBlock(false);
|
$this->animateBlock(false);
|
||||||
$this->getHolder()->getWorld()->addSound($this->getHolder()->add(0.5, 0.5, 0.5), $this->getCloseSound());
|
$this->holder->getWorld()->addSound($this->holder->add(0.5, 0.5, 0.5), $this->getCloseSound());
|
||||||
}
|
}
|
||||||
parent::onClose($who);
|
parent::onClose($who);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ class Chest extends Spawnable implements Container, Nameable{
|
|||||||
if($pair->doubleInventory !== null){
|
if($pair->doubleInventory !== null){
|
||||||
$this->doubleInventory = $pair->doubleInventory;
|
$this->doubleInventory = $pair->doubleInventory;
|
||||||
}else{
|
}else{
|
||||||
if(($pair->getPosition()->x + ($pair->getPosition()->z << 15)) > ($this->position->x + ($this->position->z << 15))){ //Order them correctly
|
if(($pair->position->x + ($pair->position->z << 15)) > ($this->position->x + ($this->position->z << 15))){ //Order them correctly
|
||||||
$this->doubleInventory = $pair->doubleInventory = new DoubleChestInventory($pair->inventory, $this->inventory);
|
$this->doubleInventory = $pair->doubleInventory = new DoubleChestInventory($pair->inventory, $this->inventory);
|
||||||
}else{
|
}else{
|
||||||
$this->doubleInventory = $pair->doubleInventory = new DoubleChestInventory($this->inventory, $pair->inventory);
|
$this->doubleInventory = $pair->doubleInventory = new DoubleChestInventory($this->inventory, $pair->inventory);
|
||||||
|
@ -70,7 +70,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
|
|||||||
|
|
||||||
$this->configFile = Path::join($this->dataFolder, "config.yml");
|
$this->configFile = Path::join($this->dataFolder, "config.yml");
|
||||||
|
|
||||||
$prefix = $this->getDescription()->getPrefix();
|
$prefix = $this->description->getPrefix();
|
||||||
$this->logger = new PluginLogger($server->getLogger(), $prefix !== "" ? $prefix : $this->getName());
|
$this->logger = new PluginLogger($server->getLogger(), $prefix !== "" ? $prefix : $this->getName());
|
||||||
$this->scheduler = new TaskScheduler($this->getFullName());
|
$this->scheduler = new TaskScheduler($this->getFullName());
|
||||||
|
|
||||||
@ -145,9 +145,9 @@ abstract class PluginBase implements Plugin, CommandExecutor{
|
|||||||
private function registerYamlCommands() : void{
|
private function registerYamlCommands() : void{
|
||||||
$pluginCmds = [];
|
$pluginCmds = [];
|
||||||
|
|
||||||
foreach(Utils::stringifyKeys($this->getDescription()->getCommands()) as $key => $data){
|
foreach(Utils::stringifyKeys($this->description->getCommands()) as $key => $data){
|
||||||
if(str_contains($key, ":")){
|
if(str_contains($key, ":")){
|
||||||
$this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_commandError($key, $this->getDescription()->getFullName(), ":")));
|
$this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_commandError($key, $this->description->getFullName(), ":")));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
|
|||||||
$aliasList = [];
|
$aliasList = [];
|
||||||
foreach($data->getAliases() as $alias){
|
foreach($data->getAliases() as $alias){
|
||||||
if(str_contains($alias, ":")){
|
if(str_contains($alias, ":")){
|
||||||
$this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_aliasError($alias, $this->getDescription()->getFullName(), ":")));
|
$this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_aliasError($alias, $this->description->getFullName(), ":")));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$aliasList[] = $alias;
|
$aliasList[] = $alias;
|
||||||
@ -181,7 +181,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(count($pluginCmds) > 0){
|
if(count($pluginCmds) > 0){
|
||||||
$this->server->getCommandMap()->registerAll($this->getDescription()->getName(), $pluginCmds);
|
$this->server->getCommandMap()->registerAll($this->description->getName(), $pluginCmds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,9 +190,9 @@ abstract class PluginBase implements Plugin, CommandExecutor{
|
|||||||
* @phpstan-return (Command&PluginOwned)|null
|
* @phpstan-return (Command&PluginOwned)|null
|
||||||
*/
|
*/
|
||||||
public function getCommand(string $name){
|
public function getCommand(string $name){
|
||||||
$command = $this->getServer()->getPluginCommand($name);
|
$command = $this->server->getPluginCommand($name);
|
||||||
if($command === null || $command->getOwningPlugin() !== $this){
|
if($command === null || $command->getOwningPlugin() !== $this){
|
||||||
$command = $this->getServer()->getPluginCommand(strtolower($this->description->getName()) . ":" . $name);
|
$command = $this->server->getPluginCommand(strtolower($this->description->getName()) . ":" . $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($command instanceof PluginOwned && $command->getOwningPlugin() === $this){
|
if($command instanceof PluginOwned && $command->getOwningPlugin() === $this){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user