mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-04 13:54:35 +01:00
Clear cache if plugin doesn't load correctly
This commit is contained in:
parent
5abc9b8fc1
commit
c7f5201e00
@ -174,6 +174,8 @@ public class LibsDisguises extends JavaPlugin {
|
||||
commandConfig.load();
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
ClassMappings.deleteMappingsCache(getDataFolder());
|
||||
|
||||
try {
|
||||
if (isJenkins() && DisguiseConfig.isAutoUpdate()) {
|
||||
getUpdateChecker().doUpdate();
|
||||
@ -237,6 +239,8 @@ public class LibsDisguises extends JavaPlugin {
|
||||
|
||||
new MetricsInitalizer();
|
||||
} catch (Throwable throwable) {
|
||||
ClassMappings.deleteMappingsCache(getDataFolder());
|
||||
|
||||
try {
|
||||
if (isJenkins() && DisguiseConfig.isAutoUpdate()) {
|
||||
getUpdateChecker().doUpdate();
|
||||
|
@ -94,6 +94,14 @@ public class ClassMappings {
|
||||
return "Built for: " + Bukkit.getVersion() + "\t" + LibsDisguises.getInstance().getDescription().getVersion();
|
||||
}
|
||||
|
||||
private static File getFile(File dataFolder) {
|
||||
return new File(dataFolder, "mappings_cache");
|
||||
}
|
||||
|
||||
public static void deleteMappingsCache(File folder) {
|
||||
getFile(folder).delete();
|
||||
}
|
||||
|
||||
public static void saveMappingsCache(File dataFolder) {
|
||||
synchronized (classLocations) {
|
||||
if (!updatingCache) {
|
||||
@ -103,7 +111,7 @@ public class ClassMappings {
|
||||
updatingCache = false;
|
||||
}
|
||||
|
||||
File mappingsCache = new File(dataFolder, "mappings_cache");
|
||||
File mappingsCache = getFile(dataFolder);
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(mappingsCache))) {
|
||||
writer.write(getVersion() + "\n");
|
||||
|
||||
@ -116,7 +124,8 @@ public class ClassMappings {
|
||||
}
|
||||
|
||||
public static void loadMappingsCache(File dataFolder) {
|
||||
File mappingsCache = new File(dataFolder, "mappings_cache");
|
||||
File mappingsCache = getFile(dataFolder);
|
||||
|
||||
if (!mappingsCache.exists()) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user