Uses matcher.find instead of matcher.matches

Also removes some code smells
This commit is contained in:
2024-02-20 19:45:41 +01:00
parent 9abf6db27a
commit cde20e35d5
4 changed files with 42 additions and 20 deletions

View File

@@ -434,12 +434,15 @@ public final class StargateConfig {
} else {
portalFolder = replacePluginFolderPath(portalFolder);
}
Stargate.debug("StargateConfig::loadConfig", "Portal folder is " + portalFolder);
gateFolder = (String) configOptions.get(ConfigOption.GATE_FOLDER);
if (gateFolder.isEmpty()) {
gateFolder = dataFolderPath + "/gates/";
} else {
gateFolder = replacePluginFolderPath(gateFolder);
}
Stargate.debug("StargateConfig::loadConfig", "Gate folder is " + gateFolder);
//If users have an outdated config, assume they also need to update their default gates
if (isMigrating) {
@@ -466,7 +469,7 @@ public final class StargateConfig {
private String replacePluginFolderPath(@NotNull String input) {
Pattern pattern = Pattern.compile("(?i)^plugins[\\\\\\/]Stargate");
Matcher matcher = pattern.matcher(input);
if (matcher.matches()) {
if (matcher.find()) {
return dataFolderPath + matcher.replaceAll("");
} else {
return input;