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 String MOD_ID = "speedometer";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID); 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() { public static void init() {
LOGGER.info("Loading speedometer by Allen"); LOGGER.info("Loading speedometer by Allen");
if(Platform.getEnvironment() != Env.CLIENT) { if(Platform.getEnvironment() != Env.CLIENT) {
LOGGER.error("You're running speedometer on somthing other then a client, this is not supported"); LOGGER.error("You're running speedometer on somthing other then a client, this is not supported");
try { try {
for (File f : Objects.requireNonNull(Platform.getModsFolder().toFile().listFiles())) { for (File f : Objects.requireNonNull(Platform.getModsFolder().toFile().listFiles())) {
if (f.getName().startsWith("speedometer")) { if (f.getName().startsWith("speedometer")) {
if(f.renameTo(new File(f.getParent(), "speedometer-" + VERSION + ".jar.dis"))){ String fileName = "speedometer-" + VERSION + ".jar.disable";
LOGGER.warn("Unsuccesful in renaming mod jar"); 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){ }catch (NullPointerException e){
LOGGER.warn("Can't disable the mod"); 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; return;
} }