Skip to content

Commit

Permalink
7.5.7
Browse files Browse the repository at this point in the history
FIX: .ip always failing to retrieve mc version even if provided in config
  • Loading branch information
Osiris-Team committed Dec 29, 2023
1 parent 2dba747 commit 50425f1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.osiris.autoplug.client</groupId>
<artifactId>autoplug-client</artifactId>
<version>7.5.6</version>
<version>7.5.7</version>
<packaging>jar</packaging>

<name>AutoPlug-Client</name>
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/com/osiris/autoplug/client/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
import com.osiris.autoplug.client.managers.FileManager;
import com.osiris.autoplug.client.network.online.connections.ConAutoPlugConsoleSend;
import com.osiris.autoplug.client.tasks.BeforeServerStartupTasks;
import com.osiris.autoplug.client.utils.GD;
import com.osiris.autoplug.client.utils.UtilsJar;
import com.osiris.autoplug.client.utils.UtilsLists;
import com.osiris.autoplug.client.utils.UtilsString;
import com.osiris.autoplug.client.utils.*;
import com.osiris.autoplug.client.utils.io.AsyncInputStream;
import com.osiris.dyml.SmartString;
import com.osiris.dyml.YamlSection;
Expand Down Expand Up @@ -386,6 +383,12 @@ public static void submitCommand(@NotNull String command) throws IOException {
}
}

public static String getMCVersion() throws Exception {
String mcVersion = new GeneralConfig().server_version.asString();
if (mcVersion == null) mcVersion = new UtilsMinecraft().getInstalledVersion();
if (mcVersion == null) throw new NullPointerException(GD.errorMsgFailedToGetMCVersion());
return mcVersion;
}
}


15 changes: 7 additions & 8 deletions src/main/java/com/osiris/autoplug/client/console/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* Listens for input started with .
Expand Down Expand Up @@ -343,14 +341,14 @@ public static boolean installPlugin(String command) throws Exception {
String input = command.replaceFirst("\\.install plugin", "").replaceFirst("\\.ip", "").trim();
SearchResult result = null;
String tempName = "NEW_PLUGIN";
File pluginsDir = FileManager.convertRelativeToAbsolutePath(new UpdaterConfig().plugins_updater_path.asString());
UpdaterConfig updaterConfig = new UpdaterConfig();
File pluginsDir = FileManager.convertRelativeToAbsolutePath(updaterConfig.plugins_updater_path.asString());

MinecraftPlugin plugin = new MinecraftPlugin(new File(pluginsDir + "/" + tempName).getAbsolutePath(),
tempName, "0", "", 0, 0, "");
String mcVersion = new UpdaterConfig().mods_updater_version.asString();

if (mcVersion == null) mcVersion = new UtilsMinecraft().getInstalledVersion();
if (mcVersion == null) throw new NullPointerException("Failed to determine Minecraft version.");
String mcVersion = updaterConfig.plugins_updater_version.asString();
if (mcVersion == null) Server.getMCVersion();

String repo = "spigot";
if(input.startsWith(repo)){
Expand Down Expand Up @@ -451,9 +449,10 @@ public static boolean installMod(String command) throws Exception {
String tempName = "NEW_MOD";
UpdaterConfig updaterConfig = new UpdaterConfig();
File modsDir = FileManager.convertRelativeToAbsolutePath(updaterConfig.mods_updater_path.asString());

String mcVersion = updaterConfig.mods_updater_version.asString();
if (mcVersion == null) mcVersion = new UtilsMinecraft().getInstalledVersion();
if (mcVersion == null) throw new NullPointerException("Failed to determine Minecraft version.");
if (mcVersion == null) Server.getMCVersion();

MinecraftMod mod = new MinecraftMod(new File(modsDir + "/" + tempName).getAbsolutePath(), tempName, "0",
"", "0", "0", "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package com.osiris.autoplug.client.tasks.updater.mods;

import com.osiris.autoplug.client.Server;
import com.osiris.autoplug.client.configs.GeneralConfig;
import com.osiris.autoplug.client.configs.ModsConfig;
import com.osiris.autoplug.client.configs.UpdaterConfig;
import com.osiris.autoplug.client.managers.FileManager;
Expand Down Expand Up @@ -181,9 +180,7 @@ public void runAtStart() throws Exception {


String mcVersion = updaterConfig.mods_updater_version.asString();
if (mcVersion == null) mcVersion = new GeneralConfig().server_version.asString();
if (mcVersion == null) mcVersion = new UtilsMinecraft().getInstalledVersion();
if (mcVersion == null) throw new NullPointerException(GD.errorMsgFailedToGetMCVersion());
if (mcVersion == null) Server.getMCVersion();

ExecutorService executorService;
if (updaterConfig.mods_updater_async.asBoolean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ else if (installedPlugin.getVersion() == null || installedPlugin.getVersion().tr
UpdaterConfig updaterConfig = new UpdaterConfig();

String mcVersion = updaterConfig.plugins_updater_version.asString();
if (mcVersion == null) mcVersion = generalConfig.server_version.asString();
if (mcVersion == null) mcVersion = new UtilsMinecraft().getInstalledVersion();
if (mcVersion == null) throw new NullPointerException(GD.errorMsgFailedToGetMCVersion());
if (mcVersion == null) Server.getMCVersion();

for (MinecraftPlugin pl :
includedPlugins) {
Expand Down

0 comments on commit 50425f1

Please sign in to comment.