updated how the server side renamer worked to disable the mod

This commit is contained in:
2023-07-15 14:26:03 +02:00
parent 8e2dcc2801
commit 1e4165047e

View File

@@ -13,25 +13,30 @@ public class Speedometer
{
public static final String MOD_ID = "speedometer";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
public static final String VERSION = "3.2";
public static final String VERSION = Platform.getMod(MOD_ID).getVersion();
public static void init() {
LOGGER.info("Loading speedometer by Allen");
if(Platform.getEnvironment() != Env.CLIENT) {
LOGGER.error("You're running speedometer on somthing other then a client, this is not supported");
try {
for (File f : Objects.requireNonNull(Platform.getModsFolder().toFile().listFiles())) {
if (f.getName().startsWith("speedometer")) {
if(f.renameTo(new File(f.getParent(), "speedometer-" + VERSION + ".jar.dis"))){
LOGGER.warn("Unsuccesful in renaming mod jar");
String fileName = "speedometer-" + VERSION + ".jar.disable";
if(f.renameTo(new File(f.getParent(), fileName))){
LOGGER.warn("Successfully in renaming the mod jar file to "+fileName);
LOGGER.warn("You should remove the file from "+Platform.getModsFolder().toString());
}else{
LOGGER.warn("Unsuccessful in renaming mod jar");
LOGGER.warn("You should remove the mod from "+Platform.getModsFolder().toString()+" to no longer receive this message");
}
}
}
}catch (NullPointerException e){
LOGGER.warn("Can't disable the mod");
}
LOGGER.warn("You should remove the mod from "+Platform.getModsFolder().toString()+" to no longer receive this message");
return;
}