From 147a52368d2253eb7711f8ad311420e95547a6f9 Mon Sep 17 00:00:00 2001 From: yuko fuyutsuki Date: Sat, 27 Mar 2021 00:22:53 +0900 Subject: [PATCH] Fixed #106 * Now required Mineflow >= 2.0 --- plugin.yml | 2 +- src/jp/mcbe/fuyutsuki/Texter/Main.php | 12 +++++++----- src/jp/mcbe/fuyutsuki/Texter/i18n/MineflowLang.php | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/plugin.yml b/plugin.yml index 99103dc..53c2597 100644 --- a/plugin.yml +++ b/plugin.yml @@ -10,7 +10,7 @@ mcpe-protocol: - 428 # 1.16.210 softdepend: # aieuo/Mineflow - - Mineflow # >= 1.3 + - Mineflow # >= 2.0 virions: # jojoe77777/libFormAPI - libFormAPI # >= 1.3 diff --git a/src/jp/mcbe/fuyutsuki/Texter/Main.php b/src/jp/mcbe/fuyutsuki/Texter/Main.php index bcc16b3..ce112f2 100644 --- a/src/jp/mcbe/fuyutsuki/Texter/Main.php +++ b/src/jp/mcbe/fuyutsuki/Texter/Main.php @@ -152,11 +152,12 @@ private function loadFloatingTexts() { $worldsPath = $this->findWorldsPath(); foreach ($worldsPath as $worldPath) { $folderName = $this->getFileName($worldPath); - if (FloatingTextData::getInstance($folderName) !== null) { + $floatingTextData = FloatingTextData::getInstance($folderName); + if ($floatingTextData === null) { $floatingTextData = new FloatingTextData($this, $folderName); - $floatingTextData->generateFloatingTexts($this); } - $this->getLogger()->debug("Loaded FloatingTextCluster file: {$folderName}.json"); + $floatingTextData->generateFloatingTexts($this); + $this->getLogger()->debug("Loaded FloatingText file: {$folderName}.json"); } } @@ -213,9 +214,10 @@ private function mineflowLinkage() { if ($mineflow !== null) { /** @var MineflowMain $mineflow */ Mineflow::setAvailable(); + $variableHelper = $mineflow::getVariableHelper(); - foreach (DefaultVariables::getServerVariables() as $defaultVariable) { - $variableHelper->add($defaultVariable); + foreach (DefaultVariables::getServerVariables() as $varName => $defaultVariable) { + $variableHelper->add($varName, $defaultVariable); } Mineflow::setVariableHelper($variableHelper); } diff --git a/src/jp/mcbe/fuyutsuki/Texter/i18n/MineflowLang.php b/src/jp/mcbe/fuyutsuki/Texter/i18n/MineflowLang.php index bb6df46..d1f0f33 100644 --- a/src/jp/mcbe/fuyutsuki/Texter/i18n/MineflowLang.php +++ b/src/jp/mcbe/fuyutsuki/Texter/i18n/MineflowLang.php @@ -30,6 +30,9 @@ public function getAll(): array { return $this->lang; } + /** + * @return self[] + */ public static function all(): array { return self::$instances; }