From 2a941c76cb97bd838b5155c45d9b8154aebd8fd9 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Sat, 20 Feb 2021 15:16:36 +0100 Subject: [PATCH] Change ":" to "-" in material actions for better match --- .../gamingmesh/jobs/actions/BlockCollectInfo.java | 2 +- .../jobs/actions/MaterialActionInfo.java | 2 +- .../com/gamingmesh/jobs/config/ConfigManager.java | 14 +++++--------- .../com/gamingmesh/jobs/container/JobInfo.java | 8 +------- src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java | 1 + 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/actions/BlockCollectInfo.java b/src/main/java/com/gamingmesh/jobs/actions/BlockCollectInfo.java index 9fcfe49c..06b8a2e9 100644 --- a/src/main/java/com/gamingmesh/jobs/actions/BlockCollectInfo.java +++ b/src/main/java/com/gamingmesh/jobs/actions/BlockCollectInfo.java @@ -23,6 +23,6 @@ public class BlockCollectInfo extends BaseActionInfo { @Override public String getNameWithSub() { - return getName() + ":" + ageOrLevel; + return getName() + "-" + ageOrLevel; } } diff --git a/src/main/java/com/gamingmesh/jobs/actions/MaterialActionInfo.java b/src/main/java/com/gamingmesh/jobs/actions/MaterialActionInfo.java index 0b7072b6..a7d995f1 100644 --- a/src/main/java/com/gamingmesh/jobs/actions/MaterialActionInfo.java +++ b/src/main/java/com/gamingmesh/jobs/actions/MaterialActionInfo.java @@ -39,7 +39,7 @@ public abstract class MaterialActionInfo extends BaseActionInfo { @Override public String getNameWithSub() { - return getName() + ":" + data; + return getName() + "-" + data; } } diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index 0e1204f6..5b494eb0 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -1083,10 +1083,6 @@ public class ConfigManager { continue; } - int id = itemSection.getInt("id"); - - String name = itemSection.getString("name"); - List lore = new ArrayList<>(); if (itemSection.isList("lore")) itemSection.getStringList("lore").stream().map(CMIChatColor::translate).forEach(lore::add); @@ -1109,9 +1105,9 @@ public class ConfigManager { enchants.put(ench, level); } - int level = itemSection.getInt("level"); String node = itemKey.toLowerCase(); - jobLimitedItems.put(node, new JobLimitedItems(node, id, 0, 1, name, lore, enchants, level)); + jobLimitedItems.put(node, new JobLimitedItems(node, itemSection.getInt("id"), 0, 1, itemSection.getString("name"), + lore, enchants, itemSection.getInt("level"))); } } @@ -1233,9 +1229,9 @@ public class ConfigManager { for (ActionType actionType : ActionType.values()) { ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName()); - ArrayList jobInfo = new ArrayList<>(); + List jobInfo = new ArrayList<>(); if (typeSection != null) { - if (typeSection.isList("materials")) { + if (!typeSection.getStringList("materials").isEmpty()) { for (String mat : typeSection.getStringList("materials")) { if (!mat.contains(";")) { continue; @@ -1327,7 +1323,7 @@ public class ConfigManager { Integer itemSoftPointsLimit = softPointsLimit; if (section.isInt("softPointsLimit")) itemSoftPointsLimit = section.getInt("softPointsLimit"); - + jobInfo.add(new JobInfo(actionType, id, meta, type + subType, income, incomeEquation, experience, expEquation, pointsEquation, points, fromlevel, untilLevel, section.getCurrentPath(), itemSoftIncomeLimit, itemSoftExpLimit, itemSoftPointsLimit)); } diff --git a/src/main/java/com/gamingmesh/jobs/container/JobInfo.java b/src/main/java/com/gamingmesh/jobs/container/JobInfo.java index 031704f7..5e7076dd 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobInfo.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobInfo.java @@ -33,9 +33,7 @@ public class JobInfo { private int untilLevel = Integer.MAX_VALUE; private String configPath = ""; - private Integer softIncomeLevelLimit; - private Integer softExpLevelLimit; - private Integer softPointsLevelLimit; + private Integer softIncomeLevelLimit, softExpLevelLimit, softPointsLevelLimit; public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation, Parser pointsEquation, double basePoints, int fromLevel, int untilLevel, String configPath) { @@ -150,10 +148,6 @@ public class JobInfo { return configPath; } - public void setConfigPath(String configPath) { - this.configPath = configPath; - } - public void setBaseIncome(double baseIncome) { this.baseIncome = baseIncome; } diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index 6122f3a2..a1093ba6 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -1222,6 +1222,7 @@ public abstract class JobsDAO { prestt.setInt(2, job.getId()); prestt.execute(); } catch (SQLException e) { + e.printStackTrace(); } finally { close(prestt); close(res);