diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index fc8b0bd4..cc070f91 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -600,6 +600,7 @@ public class Jobs extends JavaPlugin { GconfigManager.reload(); lManager.reload(); configManager.reload(); + FurnaceBrewingHandling.load(); usedSlots.clear(); for (Job job : jobs) { usedSlots.put(job, dao.getSlotsTaken(job)); @@ -785,7 +786,7 @@ public class Jobs extends JavaPlugin { YmlMaker restrictedBlocks = new YmlMaker(this, "restrictedBlocks.yml"); restrictedBlocks.saveDefaultConfig(); - + setPermissionHandler(new PermissionHandler(this)); setJobsClassloader(); setPlayerManager(); @@ -838,10 +839,7 @@ public class Jobs extends JavaPlugin { dao.loadBlockProtection(); exploreManager.load(); - FurnaceBrewingHandling.load(); - consoleMsg("&e[Jobs] Plugin has been enabled successfully."); - lManager.reload(); cManager.fillCommands(); diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index df035bd4..3fe56f8e 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -90,27 +90,41 @@ public class LanguageManager { String ls = Jobs.getGCManager().localeString; - if (ls == null || ls.equals("")) - return; - - YmlMaker langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + ls + ".yml"); - langFile.saveDefaultConfig(); - languages.clear(); languages.add("en"); - File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + ls + ".yml"); - if (!customLocaleFile.exists() && !ls.equalsIgnoreCase("en")) - languages.add(ls); + YmlMaker langFile = null; + if (ls == null || ls.equals("")) { + langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_en.yml"); + langFile.saveDefaultConfig(); + } else { + langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + ls + ".yml"); + langFile.saveDefaultConfig(); + + File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + ls + ".yml"); + if (!customLocaleFile.exists() && !ls.equalsIgnoreCase("en")) + languages.add(ls); + } for (String lang : languages) { - File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); + File f = null; + if (ls == null || ls.equals("")) { + f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_en.yml"); - // Fail safe if file get corrupted and being created with corrupted data, we need to recreate it - if ((f.length() / 1024) > 1024) { - f.delete(); - f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); - } + // Fail safe if file get corrupted and being created with corrupted data, we need to re-create it + if ((f.length() / 1024) > 1024) { + f.delete(); + f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_en.yml"); + } + } else { + f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); + + // Fail safe if file get corrupted and being created with corrupted data, we need to re-create it + if ((f.length() / 1024) > 1024) { + f.delete(); + f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); + } + } YamlConfiguration config = YamlConfiguration.loadConfiguration(f); CommentedYamlConfiguration writer = new CommentedYamlConfiguration(); @@ -152,11 +166,11 @@ public class LanguageManager { c.get("command.help.output.info", "Type /jobs [cmd] ? for more information about a command."); c.get("command.help.output.cmdUsage", "&2Usage: &7[command]"); c.get("command.help.output.label", "Jobs"); - + c.get("command.help.output.cmdInfoFormat", "[command] &f- &2[description]"); c.get("command.help.output.cmdFormat", "&7/[command]&f[arguments]"); c.get("command.help.output.helpPageDescription", "&2* [description]"); - + c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------"); c.get("command.help.output.page", "&e-----&e ====== Page &6[1] &eof &6[2] &e====== &e-----"); c.get("command.help.output.fliperSimbols", "&e----------"); @@ -461,7 +475,7 @@ public class LanguageManager { c.get("command.clearownership.help.info", "Clear block ownership"); c.get("command.clearownership.help.args", "(playername)"); c.get("command.clearownership.output.cleared", "&2Removed &7[furnaces] &2furnaces and &7[brewing] &2brewing stands"); - + c.get("command.quests.help.info", "List available quests"); c.get("command.quests.help.args", "(playername)"); c.get("command.quests.error.noquests", "&cThere are no quests"); diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsConnectionPool.java b/src/main/java/com/gamingmesh/jobs/dao/JobsConnectionPool.java index fc3f4ecf..a7f5e2b5 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsConnectionPool.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsConnectionPool.java @@ -31,7 +31,6 @@ public class JobsConnectionPool { } if (connection == null) { - @SuppressWarnings("resource") Connection conn = DriverManager.getConnection(url, username, password); connection = new JobsConnection(conn); } diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java b/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java index 24cf738e..f2781fae 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java @@ -113,7 +113,6 @@ public class JobsMySQL extends JobsDAO { return prest; } - @SuppressWarnings("resource") @Override public boolean createTable(String query) { Jobs.consoleMsg(query); @@ -137,7 +136,6 @@ public class JobsMySQL extends JobsDAO { return true; } - @SuppressWarnings("resource") @Override public boolean isTable(String table) { Statement statement; @@ -158,7 +156,6 @@ public class JobsMySQL extends JobsDAO { } } - @SuppressWarnings("resource") @Override public boolean isCollumn(String table, String collumn) { Statement statement; @@ -180,7 +177,6 @@ public class JobsMySQL extends JobsDAO { } } - @SuppressWarnings("resource") @Override public boolean addCollumn(String table, String collumn, String type) { Statement statement; @@ -202,7 +198,6 @@ public class JobsMySQL extends JobsDAO { } } - @SuppressWarnings("resource") @Override public boolean truncate(String table) { Statement statement = null; @@ -226,7 +221,6 @@ public class JobsMySQL extends JobsDAO { } } - @SuppressWarnings("resource") @Override public boolean drop(String table) { Statement statement = null; diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java b/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java index bef91d9a..163f14cc 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java @@ -113,7 +113,6 @@ public class JobsSQLite extends JobsDAO { return prest; } - @SuppressWarnings("resource") @Override public boolean createTable(String query) { Statement statement = null; @@ -170,7 +169,6 @@ public class JobsSQLite extends JobsDAO { } } - @SuppressWarnings("resource") @Override public boolean addCollumn(String table, String collumn, String type) { Statement statement; @@ -190,7 +188,6 @@ public class JobsSQLite extends JobsDAO { } } - @SuppressWarnings("resource") @Override public boolean truncate(String table) { Statement statement = null; diff --git a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java index 7de4e0a2..09a177f7 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java +++ b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java @@ -140,9 +140,8 @@ public class BufferedEconomy { this.ServerTaxesAccount = Bukkit.getOfflinePlayer(ServerTaxesAccountname); if (Jobs.getGCManager().UseTaxes && Jobs.getGCManager().TransferToServerAccount && ServerTaxesAccount != null) { - if(TaxesAmount > 0) { + if (TaxesAmount > 0) economy.depositPlayer(ServerTaxesAccount, TaxesAmount); - } if (ServerTaxesAccount.isOnline()) { if (!Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getGCManager().ActionBarsMessageByDefault) Jobs.getActionbarToggleList().put(ServerTaxesAccountname, true); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index fead33bf..3ac0d87f 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -219,7 +219,7 @@ public class JobsPaymentListener implements Listener { Player player = event.getPlayer(); - if (player == null || !player.isOnline()) + if (!player.isOnline()) return; if (Jobs.getGCManager().CowMilkingTimer > 0) @@ -284,7 +284,7 @@ public class JobsPaymentListener implements Listener { Player player = event.getPlayer(); - if (player == null || !player.isOnline()) + if (!player.isOnline()) return; // check if in creative @@ -1500,7 +1500,7 @@ public class JobsPaymentListener implements Listener { Player p = event.getPlayer(); - if (p == null || !p.isOnline()) + if (!p.isOnline()) return; // check if in creative @@ -1534,7 +1534,7 @@ public class JobsPaymentListener implements Listener { Player player = event.getPlayer(); - if (player == null || !player.isOnline()) + if (!player.isOnline()) return; if (!Jobs.getGCManager().payExploringWhenFlying() && player.isFlying())