From 3eed42cfaaf4a78f9c840223b45101a64c2428e0 Mon Sep 17 00:00:00 2001 From: Zrips Date: Thu, 17 Dec 2020 12:50:56 +0200 Subject: [PATCH] Extra adjustments for job migration --- .../com/gamingmesh/jobs/config/ConfigManager.java | 15 ++++++--------- .../java/com/gamingmesh/jobs/dao/JobsDAO.java | 2 +- .../resources/jobs/{example.yml => _EXAMPLE.yml} | 4 ++++ 3 files changed, 11 insertions(+), 10 deletions(-) rename src/main/resources/jobs/{example.yml => _EXAMPLE.yml} (99%) diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index 423b807d..3c955dd6 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -70,7 +70,7 @@ public class ConfigManager { private final Set jobFiles = new HashSet<>(); - public static final String exampleJobName = "exampleJob"; + public static final String exampleJobName = "_EXAMPLE"; public ConfigManager() { this.jobFile = new File(Jobs.getFolder(), "jobConfig.yml"); @@ -627,22 +627,19 @@ public class ConfigManager { } private boolean migrateJobs() { + YamlConfiguration oldConf = getJobConfig(); if (oldConf == null) { - if (jobsPathFolder.exists()) { - return false; + if (!jobsPathFolder.exists()) { + jobsPathFolder.mkdirs(); } - - jobsPathFolder.mkdirs(); - if (jobsPathFolder.isDirectory() && jobsPathFolder.listFiles().length == 0) try { - for (String f : Util.getFilesFromPackage("Jobs", "", "yml")) { - Jobs.getInstance().saveResource("Jobs" + File.separator + f + ".yml", false); + for (String f : Util.getFilesFromPackage("jobs", "", "yml")) { + Jobs.getInstance().saveResource("jobs" + File.separator + f + ".yml", false); } } catch (Exception c) { } - return false; } diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index d91369ea..8a885749 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -1123,7 +1123,7 @@ public abstract class JobsDAO { conn.commit(); } catch (SQLException e) { - e.printStackTrace(); +// e.printStackTrace(); } finally { close(prestt); close(res2); diff --git a/src/main/resources/jobs/example.yml b/src/main/resources/jobs/_EXAMPLE.yml similarity index 99% rename from src/main/resources/jobs/example.yml rename to src/main/resources/jobs/_EXAMPLE.yml index 2a70f346..4ba7645d 100644 --- a/src/main/resources/jobs/example.yml +++ b/src/main/resources/jobs/_EXAMPLE.yml @@ -3,6 +3,10 @@ # 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. + +# 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: # 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.