1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-07 00:38:42 +01:00

Extra adjustments for job migration

This commit is contained in:
Zrips 2020-12-17 12:50:56 +02:00
parent 3f16abdc80
commit 3eed42cfaa
3 changed files with 11 additions and 10 deletions

View File

@ -70,7 +70,7 @@ public class ConfigManager {
private final Set<YmlMaker> jobFiles = new HashSet<>(); private final Set<YmlMaker> jobFiles = new HashSet<>();
public static final String exampleJobName = "exampleJob"; public static final String exampleJobName = "_EXAMPLE";
public ConfigManager() { public ConfigManager() {
this.jobFile = new File(Jobs.getFolder(), "jobConfig.yml"); this.jobFile = new File(Jobs.getFolder(), "jobConfig.yml");
@ -627,22 +627,19 @@ public class ConfigManager {
} }
private boolean migrateJobs() { private boolean migrateJobs() {
YamlConfiguration oldConf = getJobConfig(); YamlConfiguration oldConf = getJobConfig();
if (oldConf == null) { if (oldConf == null) {
if (jobsPathFolder.exists()) { if (!jobsPathFolder.exists()) {
return false; jobsPathFolder.mkdirs();
} }
jobsPathFolder.mkdirs();
if (jobsPathFolder.isDirectory() && jobsPathFolder.listFiles().length == 0) if (jobsPathFolder.isDirectory() && jobsPathFolder.listFiles().length == 0)
try { try {
for (String f : Util.getFilesFromPackage("Jobs", "", "yml")) { for (String f : Util.getFilesFromPackage("jobs", "", "yml")) {
Jobs.getInstance().saveResource("Jobs" + File.separator + f + ".yml", false); Jobs.getInstance().saveResource("jobs" + File.separator + f + ".yml", false);
} }
} catch (Exception c) { } catch (Exception c) {
} }
return false; return false;
} }

View File

@ -1123,7 +1123,7 @@ public abstract class JobsDAO {
conn.commit(); conn.commit();
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); // e.printStackTrace();
} finally { } finally {
close(prestt); close(prestt);
close(res2); close(res2);

View File

@ -3,6 +3,10 @@
# Edited by roracle to include 1.13 items and item names, preparing for 1.14 as well. # Edited by roracle to include 1.13 items and item names, preparing for 1.14 as well.
# Must be one word. This job will be ignored as this is just example of all possible actions. # Must be one word. This job will be ignored as this is just example of all possible actions.
# ATTENTION!
# This is just an example job and will not be included into job list. Recomended to keep it around just for reference. Can be removed if needed.
exampleJob: exampleJob:
# full name of the job (displayed when browsing a job, used when joining and leaving) # full name of the job (displayed when browsing a job, used when joining and leaving)
# also can be used as a prefix for the user's name if the option is enabled. # also can be used as a prefix for the user's name if the option is enabled.