From 05a6b71775a6305e257d5e7fd7e2f397ac394537 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Fri, 7 Sep 2018 16:07:15 +0200 Subject: [PATCH] Now if execute the browse cmd in console not send the raw msg - Now /jobs quest when execute in console not send the message - Fix brewing stand id - Now you can set in config the amount of players to be shown in one page for /jobs top command --- .../gamingmesh/jobs/CMILib/CMIItemStack.java | 5 +- .../gamingmesh/jobs/CMILib/ItemManager.java | 2 +- src/main/java/com/gamingmesh/jobs/Jobs.java | 14 +- .../gamingmesh/jobs/commands/list/browse.java | 200 +++++++++++------- .../gamingmesh/jobs/commands/list/quests.java | 91 ++++---- .../gamingmesh/jobs/commands/list/top.java | 7 +- .../jobs/config/GeneralConfigManager.java | 5 + .../jobs/config/NameTranslatorManager.java | 8 +- .../java/com/gamingmesh/jobs/dao/JobsDAO.java | 8 +- .../jobs/listeners/JobsListener.java | 9 +- 10 files changed, 192 insertions(+), 157 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java index ae57e495..7881dc49 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java @@ -14,11 +14,8 @@ import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.PotionMeta; -import org.bukkit.potion.Potion; -import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.potion.PotionType; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial; @@ -271,7 +268,7 @@ public class CMIItemStack { if (item.getType() == Material.POTION || item.getType().name().contains("SPLASH_POTION") || item.getType().name().contains("TIPPED_ARROW")) { PotionMeta meta = (PotionMeta) item.getItemMeta(); - if (item.getItemMeta() instanceof PotionMeta) { + if (meta instanceof PotionMeta) { PotionMeta potionMeta = (PotionMeta) meta; try { if (potionMeta != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData().getType().getEffectType() != null) { diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java index 39ba34e7..19231ead 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java @@ -697,7 +697,7 @@ public class ItemManager { BRAIN_CORAL_FAN(-1, -1, 13849, "Brain Coral Fan", ""), BRAIN_CORAL_WALL_FAN(-1, -1, 22685, "Brain Coral Wall Fan", ""), BREAD(297, 0, 32049, "Bread", "BREAD"), - BREWING_STAND(379, 0, 14539, "Brewing Stand", "BREWING_STAND_ITEM"), + BREWING_STAND(117, 0, 14539, "Brewing Stand", ""), BRICK(336, 0, 6820, "Brick", "claybrick"), BRICKS(45, 0, 14165, "Bricks", ""), BRICK_SLAB(44, 4, 26333, "Brick Slab", "STEP"), diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 32ae0f17..1ca7cb81 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -551,11 +551,11 @@ public class Jobs extends JavaPlugin { long time = System.currentTimeMillis(); // Cloning to avoid issues HashMap temp = new HashMap<>(Jobs.getPlayerManager().getPlayersInfoUUIDMap()); - HashMap> playersJobs = Jobs.getJobsDAO().getAllJobs(); - HashMap playersPoints = Jobs.getJobsDAO().getAllPoints(); - HashMap> playersLogs = Jobs.getJobsDAO().getAllLogs(); - HashMap playersArchives = Jobs.getJobsDAO().getAllArchivedJobs(); - HashMap playersLimits = Jobs.getJobsDAO().loadPlayerLimits(); + HashMap> playersJobs = dao.getAllJobs(); + HashMap playersPoints = dao.getAllPoints(); + HashMap> playersLogs = dao.getAllLogs(); + HashMap playersArchives = dao.getAllArchivedJobs(); + HashMap playersLimits = dao.loadPlayerLimits(); Iterator> it = temp.entrySet().iterator(); while (it.hasNext()) { Entry one = it.next(); @@ -607,7 +607,7 @@ public class Jobs extends JavaPlugin { Jobs.getConfigManager().reload(); usedSlots.clear(); for (Job job : jobs) { - usedSlots.put(job, getJobsDAO().getSlotsTaken(job)); + usedSlots.put(job, dao.getSlotsTaken(job)); } pManager.reload(); permissionHandler.registerPermissions(); @@ -622,7 +622,7 @@ public class Jobs extends JavaPlugin { paymentThread = new BufferedPaymentThread(GconfigManager.getEconomyBatchDelay()); paymentThread.start(); - Jobs.getJobsDAO().loadPlayerData(); + dao.loadPlayerData(); // Schedule Jobs.getScheduleManager().load(); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java index f6d7eae8..dd7f2a0c 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java @@ -45,108 +45,144 @@ public class browse implements Cmd { return true; } - int page = 1; Job j = null; + int page = 1; + if (sender instanceof Player) { + for (String one : args) { + if (one.startsWith("-p:")) { + try { + page = Integer.parseInt(one.substring("-p:".length())); + continue; + } catch (Exception e) { + } + } + } + } for (String one : args) { - if (one.startsWith("-p:")) { - try { - page = Integer.parseInt(one.substring("-p:".length())); - continue; - } catch (Exception e) { - } - } - if (one.startsWith("-j:")) { - try { - j = Jobs.getJob(one.substring("-j:".length())); - continue; - } catch (Exception e) { - } - } + if (one.startsWith("-j:")) { + try { + j = Jobs.getJob(one.substring("-j:".length())); + continue; + } catch (Exception e) { + } + } } - if (j == null) { - PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page); - sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size())); - for (Job one : jobList) { - if (!pi.isEntryOk()) - continue; - if (pi.isBreak()) - break; + if (sender instanceof Player) { + if (j == null) { + PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page); + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size())); + for (Job one : jobList) { + if (!pi.isEntryOk()) + continue; + if (pi.isBreak()) + break; - RawMessage rm = new RawMessage(); + RawMessage rm = new RawMessage(); - String hoverMsg = ""; + String hoverMsg = ""; - if (!one.getDescription().isEmpty()) { - hoverMsg += one.getDescription().replace("/n", ""); - } - if (one.getMaxLevel(sender) > 0) { - if (!hoverMsg.isEmpty()) - hoverMsg += " \n"; - hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender)); - } + if (!one.getDescription().isEmpty()) { + hoverMsg += one.getDescription().replace("/n", ""); + } + if (one.getMaxLevel(sender) > 0) { + if (!hoverMsg.isEmpty()) + hoverMsg += " \n"; + hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender)); + } - if (Jobs.getGCManager().ShowTotalWorkers) { - if (!hoverMsg.isEmpty()) - hoverMsg += " \n"; - hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers()); + if (Jobs.getGCManager().ShowTotalWorkers) { + if (!hoverMsg.isEmpty()) + hoverMsg += " \n"; + hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers()); - } + } - if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { - if (!hoverMsg.isEmpty()) - hoverMsg += " \n"; - if ((int) (one.getBonus() * 100) < 0) - hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1); - else - hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100)); - } + if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { + if (!hoverMsg.isEmpty()) + hoverMsg += " \n"; + if ((int) (one.getBonus() * 100) < 0) + hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1); + else + hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100)); + } - if (!hoverMsg.isEmpty()) - hoverMsg += " \n"; - hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click"); + if (!hoverMsg.isEmpty()) + hoverMsg += " \n"; + hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click"); - rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()), - hoverMsg, "jobs browse -j:" + one.getName()); + rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()), + hoverMsg, "jobs browse -j:" + one.getName()); - rm.show(sender); - } - plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs browse", "-p:"); + rm.show(sender); + } + plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs browse", "-p:"); + } else { + + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName())); + + if (j.getMaxLevel(sender) > 0) { + sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender))); + } + + if (Jobs.getGCManager().ShowTotalWorkers) { + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); + + } + + if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { + if ((int) (j.getBonus() * 100) < 0) + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1)); + else + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100))); + } + + if (!j.getFullDescription().isEmpty()) { + for (String one : j.getFullDescription()) { + sender.sendMessage(one); + } + } + + RawMessage rm = new RawMessage(); + rm.add(Jobs.getLanguage().getMessage("command.browse.output.detailed"), + Jobs.getLanguage().getMessage("command.browse.output.detailed"), + "jobs info " + j.getName()); + rm.show(sender); + rm.clear(); + rm.add(Jobs.getLanguage().getMessage("command.browse.output.chooseJob"), + Jobs.getLanguage().getMessage("command.browse.output.chooseJobHover"), + "jobs join " + j.getName() + " -needConfirmation"); + rm.show(sender); + } } else { + if (j == null) { + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size())); + } else { - sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName())); - if (j.getMaxLevel(sender) > 0) { - sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender))); - } + if (j.getMaxLevel(sender) > 0) { + sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender))); + } - if (Jobs.getGCManager().ShowTotalWorkers) { - sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); + if (Jobs.getGCManager().ShowTotalWorkers) { + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); - } + } - if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { - if ((int) (j.getBonus() * 100) < 0) - sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1)); - else - sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100))); - } + if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { + if ((int) (j.getBonus() * 100) < 0) + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1)); + else + sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100))); + } - if (!j.getFullDescription().isEmpty()) - for (String one : j.getFullDescription()) { - sender.sendMessage(one); - } - - RawMessage rm = new RawMessage(); - rm.add(Jobs.getLanguage().getMessage("command.browse.output.detailed"), - Jobs.getLanguage().getMessage("command.browse.output.detailed"), - "jobs info " + j.getName()); - rm.show(sender); - rm.clear(); - rm.add(Jobs.getLanguage().getMessage("command.browse.output.chooseJob"), - Jobs.getLanguage().getMessage("command.browse.output.chooseJobHover"), - "jobs join " + j.getName() + " -needConfirmation"); - rm.show(sender); + if (!j.getFullDescription().isEmpty()) { + for (String one : j.getFullDescription()) { + sender.sendMessage(one); + } + } + } } } else { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index b3d65e91..5b470c75 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -51,55 +51,58 @@ public class quests implements Cmd { } sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getUserName(), "[questsDone]", jPlayer.getDoneQuests())); - for (JobProgression jobProg : jPlayer.getJobProgression()) { - List list = jPlayer.getQuestProgressions(jobProg.getJob()); - for (QuestProgression q : list) { - String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getQuest().getAmount(), q.getAmountDone()); - if (q.isComplited()) - progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed"); - RawMessage rm = new RawMessage(); - String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine", - "[progress]", progressLine, - "[questName]", q.getQuest().getQuestName(), - "[done]", q.getAmountDone(), - "[required]", q.getQuest().getAmount()); + if (sender instanceof Player) { + for (JobProgression jobProg : jPlayer.getJobProgression()) { + List list = jPlayer.getQuestProgressions(jobProg.getJob()); + for (QuestProgression q : list) { + String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getQuest().getAmount(), q.getAmountDone()); + if (q.isComplited()) + progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed"); + RawMessage rm = new RawMessage(); + String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine", + "[progress]", progressLine, + "[questName]", q.getQuest().getQuestName(), + "[done]", q.getAmountDone(), + "[required]", q.getQuest().getAmount()); - List hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover"); - List hoverList = new ArrayList<>(); + List hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover"); + List hoverList = new ArrayList<>(); - for (int i = 0; i < hoverMsgs.size(); i++) { - String current = hoverMsgs.get(i); - current = current.replace("[jobName]", jobProg.getJob().getName()); - current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis())); - if (current.contains("[desc]")) { - for (String one : q.getQuest().getDescription()) { - hoverList.add(one); + for (int i = 0; i < hoverMsgs.size(); i++) { + String current = hoverMsgs.get(i); + current = current.replace("[jobName]", jobProg.getJob().getName()); + current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis())); + if (current.contains("[desc]")) { + for (String one : q.getQuest().getDescription()) { + hoverList.add(one); + } + } else + hoverList.add(current); } - } else - hoverList.add(current); + + String hover = ""; + + for (String one : hoverList) { + if (!hover.isEmpty()) + hover += "\n"; + hover += one; + } + +// hover += "&f" + jobProg.getJob().getName(); +// if (!q.getQuest().getDescription().isEmpty()) { + // +// for (String one : q.getQuest().getDescription()) { +// hover += "\n&7"; +// hover += one; +// } +// } +// hover += "\n&7New quest in: &8" + TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis()); + rm.add(msg, hover); + rm.show(sender); + } } + } else return true; - String hover = ""; - - for (String one : hoverList) { - if (!hover.isEmpty()) - hover += "\n"; - hover += one; - } - -// hover += "&f" + jobProg.getJob().getName(); -// if (!q.getQuest().getDescription().isEmpty()) { -// -// for (String one : q.getQuest().getDescription()) { -// hover += "\n&7"; -// hover += one; -// } -// } -// hover += "\n&7New quest in: &8" + TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis()); - rm.add(msg, hover); - rm.show(sender); - } - } sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/top.java b/src/main/java/com/gamingmesh/jobs/commands/list/top.java index 4598b11f..3ee4ec8e 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/top.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/top.java @@ -52,7 +52,8 @@ public class top implements Cmd { player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.top.error.nojob")); return false; } - int st = (page * 15) - 15; + int showPageNum = Jobs.getGCManager().JobsTopAmount; + int st = (page * showPageNum) - showPageNum; List FullList = Jobs.getJobsDAO().toplist(args[0], st); if (FullList.size() <= 0) { @@ -95,9 +96,9 @@ public class top implements Cmd { RawMessage rm = new RawMessage(); rm.add(Jobs.getLanguage().getMessage("command.gtop.output.prev"), - Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", prev * 15 - 15, "[until]", (prev * 15)), "jobs top " + jobName + " " + prev); + Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", prev * showPageNum - showPageNum, "[until]", (prev * showPageNum)), "jobs top " + jobName + " " + prev); rm.add(Jobs.getLanguage().getMessage("command.gtop.output.next"), - Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", (next * 15), "[until]", (next * 15 + 15)), "jobs top " + jobName + " " + next); + Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", (next * showPageNum), "[until]", (next * showPageNum + showPageNum)), "jobs top " + jobName + " " + next); rm.show(player); } return true; diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 3f11917b..268390cb 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -114,6 +114,8 @@ public class GeneralConfigManager { public ItemStack guiBackButton; public ItemStack guiFiller; + public int JobsTopAmount; + public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume, SoundTitleChangePitch, ToplistInScoreboardInterval; public double MinimumOveralPaymentLimit; @@ -925,6 +927,9 @@ public class GeneralConfigManager { c.getW().addComment("JobsGUI.SkipAmount", "Defines By how many slot we need to skip after group"); JobsGUISkipAmount = c.get("JobsGUI.SkipAmount", 2); + c.getW().addComment("JobsTop.AmountToShow", "Defines amount of players to be shown in one page for /jobs top"); + JobsTopAmount = c.get("JobsTop.AmountToShow", 15); + Material tmat = Material.getMaterial(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN")); guiBackButton = new ItemStack(tmat == null ? Material.JACK_O_LANTERN : tmat, 1, (byte) c.get("JobsGUI.BackButton.Data", 0)); tmat = Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE")); diff --git a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java index 50fe2b45..2da2fdfd 100644 --- a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java @@ -149,7 +149,7 @@ public class NameTranslatorManager { if (ItemFile.getConfig().isConfigurationSection("EntityList")) { ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EntityList"); - Setkeys = section.getKeys(false); + Set keys = section.getKeys(false); ListOfEntities.clear(); for (String one : keys) { String id = one.contains(":") ? one.split(":")[0] : one; @@ -165,7 +165,7 @@ public class NameTranslatorManager { if (ItemFile.getConfig().isConfigurationSection("EnchantList")) { ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EnchantList"); - Setkeys = section.getKeys(false); + Set keys = section.getKeys(false); ListOfEnchants.clear(); for (String one : keys) { String id = one.contains(":") ? one.split(":")[0] : one; @@ -181,7 +181,7 @@ public class NameTranslatorManager { if (ItemFile.getConfig().isConfigurationSection("ColorList")) { ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("ColorList"); - Setkeys = section.getKeys(false); + Set keys = section.getKeys(false); ListOfColors.clear(); for (String one : keys) { String id = one.contains(":") ? one.split(":")[0] : one; @@ -197,7 +197,7 @@ public class NameTranslatorManager { if (ItemFile.getConfig().isConfigurationSection("PotionNamesList")) { ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("PotionNamesList"); - Setkeys = section.getKeys(false); + Set keys = section.getKeys(false); ListOfPotionNames.clear(); for (String one : keys) { String id = one.contains(":") ? one.split(":")[0] : one; diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index 03d994c8..ce75eb34 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -1808,9 +1808,7 @@ public abstract class JobsDAO { conn.setAutoCommit(true); if (i > 0) { - String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Saved " + i + " new explorer entries."); - ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); - console.sendMessage(message); + Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Saved " + i + " new explorer entries.")); } } catch (SQLException e) { e.printStackTrace(); @@ -1857,9 +1855,7 @@ public abstract class JobsDAO { conn.setAutoCommit(true); if (i > 0) { - String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Updated " + i + " explorer entries."); - ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); - console.sendMessage(message); + Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Updated " + i + " explorer entries.")); } } catch (SQLException e) { e.printStackTrace(); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 3fa5b9ea..75c47cfa 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -913,20 +913,17 @@ public class JobsListener implements Listener { @EventHandler public void JobsArmorChangeEvent(JobsArmorChangeEvent event) { - Player player = event.getPlayer(); - Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId()); + Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId()); } @EventHandler public void PlayerItemHeldEvent(PlayerItemHeldEvent event) { - Player player = event.getPlayer(); - Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId()); + Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId()); } @EventHandler public void PlayerItemBreakEvent(PlayerItemBreakEvent event) { - Player player = event.getPlayer(); - Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId()); + Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId()); } @EventHandler