Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Bukkit/AmbiguousPluginNameProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->firstPluginPath = $this->correctPluginPath($matches[2]);
$this->secondPluginPath = $this->correctPluginPath($matches[3]);

$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getFirstPluginPath()));
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getSecondPluginPath()));
$this->addSolution(new FileDeleteSolution($this->getFirstPluginPath()));
$this->addSolution(new FileDeleteSolution($this->getSecondPluginPath()));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Analysis/Problem/Bukkit/ChunkLoadExceptionProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public static function getPatterns(): array
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->addSolution((new WorldRepairSolution())->setWorldName("world"));
$this->addSolution((new FileDeleteSolution())->setRelativePath("world"));
$this->addSolution((new ChunkRemoveSolution()));
$this->addSolution(new WorldRepairSolution("world"));
$this->addSolution(new FileDeleteSolution("world"));
$this->addSolution(new ChunkRemoveSolution());
}
}
8 changes: 4 additions & 4 deletions src/Analysis/Problem/Bukkit/Plugin/AuthMeShutdownProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public static function getPatterns(): array
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->addSolution((new AuthMeShutdownSolution()));
$this->addSolution((new PluginConfigureSolution())->setPluginName("AuthMe")->setSuggestedFile("plugins/AuthMe/config.yml"));
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName("AuthMe"));
$this->addSolution((new PluginRemoveSolution())->setPluginName("AuthMe"));
$this->addSolution(new AuthMeShutdownSolution());
$this->addSolution(new PluginConfigureSolution("AuthMe", "plugins/AuthMe/config.yml"));
$this->addSolution(new PluginInstallDifferentVersionSolution("AuthMe"));
$this->addSolution(new PluginRemoveSolution("AuthMe"));
}
}
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Bukkit/Plugin/MultiverseLoadProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function setMatches(array $matches, mixed $patternKey): void
{
$this->worldName = $matches[1];

$this->addSolution((new WorldRepairSolution())->setWorldName($this->getWorldName()));
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getWorldName()));
$this->addSolution(new WorldRepairSolution($this->getWorldName()));
$this->addSolution(new FileDeleteSolution($this->getWorldName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function getPatterns(): array
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->addSolution((new PluginConfigureSolution())->setPluginName("PermissionsEx")->setSuggestedFile("plugins/PermissionsEx/permissions.yml"));
$this->addSolution((new PluginRemoveSolution())->setPluginName("PermissionsEx"));
$this->addSolution(new PluginConfigureSolution("PermissionsEx", "plugins/PermissionsEx/permissions.yml"));
$this->addSolution(new PluginRemoveSolution("PermissionsEx"));
}
}
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Bukkit/PluginCommandExceptionProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->command = $matches[1];
$this->pluginName = $matches[2];

$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
$this->addSolution((new PluginRemoveSolution())->setPluginName($this->getPluginName()));
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
$this->addSolution(new PluginRemoveSolution($this->getPluginName()));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Analysis/Problem/Bukkit/PluginDependenciesProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ public function setMatches(array $matches, mixed $patternKey): void
if ($matches[4]) {
$this->pluginName = $matches[4];
$this->pluginFilePath = $this->correctPluginPath($matches[1]);
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginFilePath()));
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
$this->addSolution(new FileDeleteSolution($this->getPluginFilePath()));
} else {
parent::setMatches($matches, $patternKey);
}

$this->dependencyPluginNames = preg_split("/, ?/", $matches[3]);
foreach ($this->dependencyPluginNames as $name) {
$this->addSolution((new PluginInstallSolution())->setPluginName($name));
$this->addSolution(new PluginInstallSolution($name));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Problem/Bukkit/PluginDependencyProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function setMatches(array $matches, mixed $patternKey): void
parent::setMatches($matches, $patternKey);

$this->dependencyPluginName = $matches[3] ?: $matches[4];
$this->addSolution((new PluginInstallSolution())->setPluginName($this->getDependencyPluginName()));
$this->addSolution(new PluginInstallSolution($this->getDependencyPluginName()));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Bukkit/PluginFileProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->pluginFilePath = $folderPath . '/' . $pluginFileName;
$this->pluginName = $this->extractPluginName($matches[1]);

$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginFilePath()));
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
$this->addSolution(new FileDeleteSolution($this->getPluginFilePath()));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Bukkit/PluginProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function setMatches(array $matches, mixed $patternKey): void
{
$this->pluginName = $this->extractPluginName($matches[1]);

$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
$this->addSolution((new PluginRemoveSolution())->setPluginName($this->getPluginName()));
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
$this->addSolution(new PluginRemoveSolution($this->getPluginName()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function setMatches(array $matches, mixed $patternKey): void
parent::setMatches($matches, $patternKey);

$this->apiVersion = $matches[3];
$this->addSolution((new ServerInstallDifferentVersionSolution())->setSoftwareVersion($this->getApiVersion()));
$this->addSolution(new ServerInstallDifferentVersionSolution($this->getApiVersion()));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->classFileVersion = intval($matches[3]);
}

$this->addSolution((new UpdateJavaSolution())->setVersion($this->getJavaVersion()));
$this->addSolution(new UpdateJavaSolution($this->getJavaVersion()));
}


Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Bukkit/WorldDuplicateProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function setMatches(array $matches, mixed $patternKey): void
{
$this->worldName = $matches[1];

$this->addSolution((new FileDeleteSolution())->setRelativePath($this->worldName . "/uid.dat"));
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->worldName));
$this->addSolution(new FileDeleteSolution($this->worldName . "/uid.dat"));
$this->addSolution(new FileDeleteSolution($this->worldName));
}
}
2 changes: 1 addition & 1 deletion src/Analysis/Problem/CrashReport/TickingEntityProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function getMessage(): string
{
return Translator::getInstance()->getTranslation("ticking-entity-problem", [
"name" => $this->getName(),
"location" => $this->getLocationX() . ", " . $this->getLocationY() . ", " . $this->getLocationZ()
"location" => sprintf("%s, %s, %s", $this->getLocationX(), $this->getLocationY(), $this->getLocationZ())
]);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution;
use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog;
use Aternos\Codex\Minecraft\Translator\Translator;

Expand Down Expand Up @@ -42,6 +43,6 @@ public static function getPatterns(): array
public function setMatches(array $matches, mixed $patternKey): void
{
$this->setModName($matches[3]);
$this->addSolution((new FileDeleteSolution())->setAbsolutePath($matches[4]));
$this->addSolution(new FileDeleteSolution($matches[4], FilePathType::ABSOLUTE));
}
}
2 changes: 1 addition & 1 deletion src/Analysis/Problem/Fabric/FabricEntryStageProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public static function getPatterns(): array
public function setMatches(array $matches, mixed $patternKey): void
{
$this->setModName($matches[1]);
$this->addSolution((new ModRemoveSolution())->setModName($this->getModName()));
$this->addSolution(new ModRemoveSolution($this->getModName()));
}
}
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Fabric/FabricIncompatibleModsProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function setMatches(array $matches, mixed $patternKey): void
{
$this->setModName($matches[1]);
$this->setSecondModName($matches[3]);
$this->addSolution((new ModRemoveSolution())->setModName($this->getModName()));
$this->addSolution((new ModRemoveSolution())->setModName($this->getSecondModName()));
$this->addSolution(new ModRemoveSolution($this->getModName()));
$this->addSolution(new ModRemoveSolution($this->getSecondModName()));
}
}
2 changes: 1 addition & 1 deletion src/Analysis/Problem/Fabric/FabricMixinProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public static function getPatterns(): array
public function setMatches(array $matches, mixed $patternKey): void
{
$this->setModName($matches[1]);
$this->addSolution((new ModRemoveSolution())->setModName($this->getModName()));
$this->addSolution(new ModRemoveSolution($this->getModName()));
}
}
12 changes: 6 additions & 6 deletions src/Analysis/Problem/Fabric/FabricModDependencyProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function setMatches(array $matches, mixed $patternKey): void
case 'short-error':
$this->setModName($matches[2]);
$this->setDependency($matches[empty($matches[3]) ? 4 : 3]);
$solution = (new ModInstallSolution())->setModName($this->getDependency());
$solution = (new ModInstallSolution($this->getDependency()));
if ($matches[5] != '*') {
$solution->setModVersion($matches[5]);
}
Expand All @@ -70,7 +70,7 @@ public function setMatches(array $matches, mixed $patternKey): void
case 'any':
$this->setModName($matches[1]);
$this->setDependency($matches[empty($matches[3]) ? 4 : 3]);
$this->addSolution((new ModInstallSolution())->setModName($this->getDependency()));
$this->addSolution(new ModInstallSolution($this->getDependency()));
return;

case 'minimum':
Expand All @@ -91,10 +91,9 @@ public function setMatches(array $matches, mixed $patternKey): void

$firstSymbol = $matches[4] === "exclusive" ? ">" : ">=";
$secondSymbol = $matches[6] === "exclusive" ? "<" : "<=";
$modVersion = $firstSymbol . $matches[3] . ", " . $secondSymbol . $matches[5];

$this->addSolution((new ModInstallSolution())
->setModName($this->getDependency())
->setModVersion($firstSymbol . $matches[3] . ", " . $secondSymbol . $matches[5]));
$this->addSolution(new ModInstallSolution($this->getDependency(), $modVersion));
return;

default:
Expand All @@ -104,7 +103,8 @@ public function setMatches(array $matches, mixed $patternKey): void

$this->setModName($matches[1]);
$this->setDependency($matches[empty($matches[4]) ? 5 : 4]);
$this->addSolution((new ModInstallSolution())->setModName($this->getDependency())->setModVersion($symbol . $matches[3]));
$modVersion = $symbol . $matches[3];
$this->addSolution(new ModInstallSolution($this->getDependency(), $modVersion));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Folia/PluginRegionalTickingProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->pluginFilePath = $folderPath . '/' . $pluginFileName;
$this->pluginName = $matches[3];

$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginFilePath()));
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
$this->addSolution(new FileDeleteSolution($this->getPluginFilePath()));
$this->addSolution(new InstallNonRegionalTickingSoftwareSolution());
}

Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Problem/Forge/FmlConfirmProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public static function getPatterns(): array
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->addSolution((new CommandRunSolution())->setCommand('/fml confirm'));
$this->addSolution(new CommandRunSolution('/fml confirm'));
}
}
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Forge/LanguageProviderVersionProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->requiredVersion = $matches[3];
$this->foundVersion = $matches[4];

$this->addSolution((new ModRemoveSolution())->setModName($this->getModName()));
$this->addSolution((new ForgeInstallDifferentVersionSolution()));
$this->addSolution(new ModRemoveSolution($this->getModName()));
$this->addSolution(new ForgeInstallDifferentVersionSolution());
}
}
2 changes: 1 addition & 1 deletion src/Analysis/Problem/Forge/MissingDatapackModProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function getPatterns(): array
public function setMatches(array $matches, mixed $patternKey): void
{
$this->modName = $matches[1];
$this->addSolution((new ModInstallSolution())->setModName($this->modName));
$this->addSolution(new ModInstallSolution($this->modName));
$this->addSolution(new DoNothingSolution());
}
}
8 changes: 4 additions & 4 deletions src/Analysis/Problem/Forge/ModDependencyProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ public function setMatches(array $matches, mixed $patternKey): void
switch ($patternKey) {
case 0:
$this->dependencyMods[] = $matches[2];
$this->addSolution((new ModInstallSolution())->setModName($matches[2]));
$this->addSolution(new ModInstallSolution($matches[2]));
break;
case 1:
$count = preg_match_all('/(\w+)(?:@\[?([0-9\.]+))?[,\]]/', $matches[2], $dependencyMatches);
if (!$count) {
if (preg_match('/\[(\S+)\]/', $matches[2], $dependencyMatches)) {
$this->dependencyMods[] = $dependencyMatches[1];
$this->addSolution((new ModInstallSolution())->setModName($dependencyMatches[1]));
$this->addSolution(new ModInstallSolution($dependencyMatches[1]));
}
return;
}
Expand All @@ -82,7 +82,7 @@ public function setMatches(array $matches, mixed $patternKey): void
$version = $dependencyMatches[2][$i];
$this->dependencyMods[] = $name;

$solution = (new ModInstallSolution())->setModName($name);
$solution = new ModInstallSolution($name);
if ($version) {
$solution->setModVersion($version);
}
Expand All @@ -92,7 +92,7 @@ public function setMatches(array $matches, mixed $patternKey): void
case 2:
case 3:
$this->dependencyMods[] = $matches[2];
$this->addSolution((new ModInstallSolution())->setModName($matches[2])->setModVersion($matches[3]));
$this->addSolution(new ModInstallSolution($matches[2], $matches[3]));
break;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/Analysis/Problem/Forge/ModDuplicateProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Aternos\Codex\Analysis\InsightInterface;
use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution;
use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType;
use Aternos\Codex\Minecraft\Translator\Translator;

/**
Expand Down Expand Up @@ -61,8 +62,8 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->firstModPath = $matches[2];
$this->secondModPath = $matches[3];

$this->addSolution((new FileDeleteSolution())->setAbsolutePath($this->getFirstModPath()));
$this->addSolution((new FileDeleteSolution())->setAbsolutePath($this->getSecondModPath()));
$this->addSolution(new FileDeleteSolution($this->getFirstModPath(), FilePathType::ABSOLUTE));
$this->addSolution(new FileDeleteSolution($this->getSecondModPath(), FilePathType::ABSOLUTE));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Forge/ModExceptionProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function setMatches(array $matches, mixed $patternKey): void
{
$this->modName = trim($matches[1]);

$this->addSolution((new ModInstallDifferentVersionSolution())->setModName($this->getModName()));
$this->addSolution((new ModRemoveSolution())->setModName($this->getModName()));
$this->addSolution(new ModInstallDifferentVersionSolution($this->getModName()));
$this->addSolution(new ModRemoveSolution($this->getModName()));
}
}
6 changes: 3 additions & 3 deletions src/Analysis/Problem/Forge/ModFatalProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->modVersion = $matches[2];
$this->modName = $matches[3];
$this->modFileName = $matches[4];
$this->addSolution((new FileDeleteSolution())->setRelativePath("mods/" . $this->getModFileName()));
$this->addSolution(new FileDeleteSolution("mods/" . $this->getModFileName()));
break;
case 1:
$this->modId = $matches[2];
$this->modName = $matches[1];
$this->addSolution((new ModRemoveSolution())->setModName($this->getModName()));
$this->addSolution(new ModRemoveSolution($this->getModName()));
break;
}

$this->addSolution((new ModInstallDifferentVersionSolution())->setModName($this->getModName()));
$this->addSolution(new ModInstallDifferentVersionSolution($this->getModName()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->modName = $matches[1];
$this->minecraftVersion = $matches[2];

$this->addSolution((new ModRemoveSolution())->setModName($this->getModName()));
$this->addSolution((new ForgeInstallDifferentVersionSolution()));
$this->addSolution(new ModRemoveSolution($this->getModName()));
$this->addSolution(new ForgeInstallDifferentVersionSolution());
}
}
4 changes: 2 additions & 2 deletions src/Analysis/Problem/Forge/MultipleModulesExportProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public static function getPatterns(): array
public function setMatches(array $matches, mixed $patternKey): void
{
$this->modName = $matches[1];
$this->addSolution((new ModRemoveSolution())->setModName($this->modName));
$this->addSolution(new ModRemoveSolution($this->modName));

$this->secondModName = $matches[2];
$this->addSolution((new ModRemoveSolution())->setModName($this->secondModName));
$this->addSolution(new ModRemoveSolution($this->secondModName));
}
}
Loading