1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

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
This commit is contained in:
montlikadani 2018-09-07 16:07:15 +02:00
parent 1e8940124f
commit 05a6b71775
10 changed files with 192 additions and 157 deletions

View File

@ -14,11 +14,8 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta; 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.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial; 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")) { if (item.getType() == Material.POTION || item.getType().name().contains("SPLASH_POTION") || item.getType().name().contains("TIPPED_ARROW")) {
PotionMeta meta = (PotionMeta) item.getItemMeta(); PotionMeta meta = (PotionMeta) item.getItemMeta();
if (item.getItemMeta() instanceof PotionMeta) { if (meta instanceof PotionMeta) {
PotionMeta potionMeta = (PotionMeta) meta; PotionMeta potionMeta = (PotionMeta) meta;
try { try {
if (potionMeta != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData().getType().getEffectType() != null) { if (potionMeta != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData().getType().getEffectType() != null) {

View File

@ -697,7 +697,7 @@ public class ItemManager {
BRAIN_CORAL_FAN(-1, -1, 13849, "Brain Coral Fan", ""), BRAIN_CORAL_FAN(-1, -1, 13849, "Brain Coral Fan", ""),
BRAIN_CORAL_WALL_FAN(-1, -1, 22685, "Brain Coral Wall Fan", ""), BRAIN_CORAL_WALL_FAN(-1, -1, 22685, "Brain Coral Wall Fan", ""),
BREAD(297, 0, 32049, "Bread", "BREAD"), 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"), BRICK(336, 0, 6820, "Brick", "claybrick"),
BRICKS(45, 0, 14165, "Bricks", ""), BRICKS(45, 0, 14165, "Bricks", ""),
BRICK_SLAB(44, 4, 26333, "Brick Slab", "STEP"), BRICK_SLAB(44, 4, 26333, "Brick Slab", "STEP"),

View File

@ -551,11 +551,11 @@ public class Jobs extends JavaPlugin {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
// Cloning to avoid issues // Cloning to avoid issues
HashMap<UUID, PlayerInfo> temp = new HashMap<>(Jobs.getPlayerManager().getPlayersInfoUUIDMap()); HashMap<UUID, PlayerInfo> temp = new HashMap<>(Jobs.getPlayerManager().getPlayersInfoUUIDMap());
HashMap<Integer, List<JobsDAOData>> playersJobs = Jobs.getJobsDAO().getAllJobs(); HashMap<Integer, List<JobsDAOData>> playersJobs = dao.getAllJobs();
HashMap<Integer, PlayerPoints> playersPoints = Jobs.getJobsDAO().getAllPoints(); HashMap<Integer, PlayerPoints> playersPoints = dao.getAllPoints();
HashMap<Integer, HashMap<String, Log>> playersLogs = Jobs.getJobsDAO().getAllLogs(); HashMap<Integer, HashMap<String, Log>> playersLogs = dao.getAllLogs();
HashMap<Integer, ArchivedJobs> playersArchives = Jobs.getJobsDAO().getAllArchivedJobs(); HashMap<Integer, ArchivedJobs> playersArchives = dao.getAllArchivedJobs();
HashMap<Integer, PaymentData> playersLimits = Jobs.getJobsDAO().loadPlayerLimits(); HashMap<Integer, PaymentData> playersLimits = dao.loadPlayerLimits();
Iterator<Entry<UUID, PlayerInfo>> it = temp.entrySet().iterator(); Iterator<Entry<UUID, PlayerInfo>> it = temp.entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Entry<UUID, PlayerInfo> one = it.next(); Entry<UUID, PlayerInfo> one = it.next();
@ -607,7 +607,7 @@ public class Jobs extends JavaPlugin {
Jobs.getConfigManager().reload(); Jobs.getConfigManager().reload();
usedSlots.clear(); usedSlots.clear();
for (Job job : jobs) { for (Job job : jobs) {
usedSlots.put(job, getJobsDAO().getSlotsTaken(job)); usedSlots.put(job, dao.getSlotsTaken(job));
} }
pManager.reload(); pManager.reload();
permissionHandler.registerPermissions(); permissionHandler.registerPermissions();
@ -622,7 +622,7 @@ public class Jobs extends JavaPlugin {
paymentThread = new BufferedPaymentThread(GconfigManager.getEconomyBatchDelay()); paymentThread = new BufferedPaymentThread(GconfigManager.getEconomyBatchDelay());
paymentThread.start(); paymentThread.start();
Jobs.getJobsDAO().loadPlayerData(); dao.loadPlayerData();
// Schedule // Schedule
Jobs.getScheduleManager().load(); Jobs.getScheduleManager().load();

View File

@ -45,108 +45,144 @@ public class browse implements Cmd {
return true; return true;
} }
int page = 1;
Job j = null; 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) { for (String one : args) {
if (one.startsWith("-p:")) { if (one.startsWith("-j:")) {
try { try {
page = Integer.parseInt(one.substring("-p:".length())); j = Jobs.getJob(one.substring("-j:".length()));
continue; continue;
} catch (Exception e) { } catch (Exception e) {
} }
} }
if (one.startsWith("-j:")) {
try {
j = Jobs.getJob(one.substring("-j:".length()));
continue;
} catch (Exception e) {
}
}
} }
if (j == null) { if (sender instanceof Player) {
PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page); if (j == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size())); PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page);
for (Job one : jobList) { sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size()));
if (!pi.isEntryOk()) for (Job one : jobList) {
continue; if (!pi.isEntryOk())
if (pi.isBreak()) continue;
break; if (pi.isBreak())
break;
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
String hoverMsg = ""; String hoverMsg = "";
if (!one.getDescription().isEmpty()) { if (!one.getDescription().isEmpty()) {
hoverMsg += one.getDescription().replace("/n", ""); hoverMsg += one.getDescription().replace("/n", "");
} }
if (one.getMaxLevel(sender) > 0) { if (one.getMaxLevel(sender) > 0) {
if (!hoverMsg.isEmpty()) if (!hoverMsg.isEmpty())
hoverMsg += " \n"; hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender)); hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender));
} }
if (Jobs.getGCManager().ShowTotalWorkers) { if (Jobs.getGCManager().ShowTotalWorkers) {
if (!hoverMsg.isEmpty()) if (!hoverMsg.isEmpty())
hoverMsg += " \n"; hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers()); hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers());
} }
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if (!hoverMsg.isEmpty()) if (!hoverMsg.isEmpty())
hoverMsg += " \n"; hoverMsg += " \n";
if ((int) (one.getBonus() * 100) < 0) if ((int) (one.getBonus() * 100) < 0)
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1); hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1);
else else
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100)); hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100));
} }
if (!hoverMsg.isEmpty()) if (!hoverMsg.isEmpty())
hoverMsg += " \n"; hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click"); hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click");
rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()), rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()),
hoverMsg, "jobs browse -j:" + one.getName()); hoverMsg, "jobs browse -j:" + one.getName());
rm.show(sender); rm.show(sender);
} }
plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs browse", "-p:"); 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 { } 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) { if (j.getMaxLevel(sender) > 0) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender))); sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
} }
if (Jobs.getGCManager().ShowTotalWorkers) { if (Jobs.getGCManager().ShowTotalWorkers) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
} }
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0) if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1)); sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100))); sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
} }
if (!j.getFullDescription().isEmpty()) if (!j.getFullDescription().isEmpty()) {
for (String one : j.getFullDescription()) { for (String one : j.getFullDescription()) {
sender.sendMessage(one); 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 { } else {

View File

@ -51,55 +51,58 @@ public class quests implements Cmd {
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getUserName(), "[questsDone]", jPlayer.getDoneQuests())); sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getUserName(), "[questsDone]", jPlayer.getDoneQuests()));
for (JobProgression jobProg : jPlayer.getJobProgression()) { if (sender instanceof Player) {
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob()); for (JobProgression jobProg : jPlayer.getJobProgression()) {
for (QuestProgression q : list) { List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getQuest().getAmount(), q.getAmountDone()); for (QuestProgression q : list) {
if (q.isComplited()) String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getQuest().getAmount(), q.getAmountDone());
progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed"); if (q.isComplited())
RawMessage rm = new RawMessage(); progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed");
String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine", RawMessage rm = new RawMessage();
"[progress]", progressLine, String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine",
"[questName]", q.getQuest().getQuestName(), "[progress]", progressLine,
"[done]", q.getAmountDone(), "[questName]", q.getQuest().getQuestName(),
"[required]", q.getQuest().getAmount()); "[done]", q.getAmountDone(),
"[required]", q.getQuest().getAmount());
List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover"); List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover");
List<String> hoverList = new ArrayList<>(); List<String> hoverList = new ArrayList<>();
for (int i = 0; i < hoverMsgs.size(); i++) { for (int i = 0; i < hoverMsgs.size(); i++) {
String current = hoverMsgs.get(i); String current = hoverMsgs.get(i);
current = current.replace("[jobName]", jobProg.getJob().getName()); current = current.replace("[jobName]", jobProg.getJob().getName());
current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis())); current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis()));
if (current.contains("[desc]")) { if (current.contains("[desc]")) {
for (String one : q.getQuest().getDescription()) { for (String one : q.getQuest().getDescription()) {
hoverList.add(one); 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")); sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
return true; return true;
} }

View File

@ -52,7 +52,8 @@ public class top implements Cmd {
player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.top.error.nojob")); player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.top.error.nojob"));
return false; return false;
} }
int st = (page * 15) - 15; int showPageNum = Jobs.getGCManager().JobsTopAmount;
int st = (page * showPageNum) - showPageNum;
List<TopList> FullList = Jobs.getJobsDAO().toplist(args[0], st); List<TopList> FullList = Jobs.getJobsDAO().toplist(args[0], st);
if (FullList.size() <= 0) { if (FullList.size() <= 0) {
@ -95,9 +96,9 @@ public class top implements Cmd {
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.gtop.output.prev"), 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"), 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); rm.show(player);
} }
return true; return true;

View File

@ -114,6 +114,8 @@ public class GeneralConfigManager {
public ItemStack guiBackButton; public ItemStack guiBackButton;
public ItemStack guiFiller; public ItemStack guiFiller;
public int JobsTopAmount;
public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume, public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume,
SoundTitleChangePitch, ToplistInScoreboardInterval; SoundTitleChangePitch, ToplistInScoreboardInterval;
public double MinimumOveralPaymentLimit; 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"); c.getW().addComment("JobsGUI.SkipAmount", "Defines By how many slot we need to skip after group");
JobsGUISkipAmount = c.get("JobsGUI.SkipAmount", 2); 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")); 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)); 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")); tmat = Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE"));

View File

@ -149,7 +149,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("EntityList")) { if (ItemFile.getConfig().isConfigurationSection("EntityList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EntityList"); ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EntityList");
Set<String>keys = section.getKeys(false); Set<String> keys = section.getKeys(false);
ListOfEntities.clear(); ListOfEntities.clear();
for (String one : keys) { for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one; String id = one.contains(":") ? one.split(":")[0] : one;
@ -165,7 +165,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("EnchantList")) { if (ItemFile.getConfig().isConfigurationSection("EnchantList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EnchantList"); ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EnchantList");
Set<String>keys = section.getKeys(false); Set<String> keys = section.getKeys(false);
ListOfEnchants.clear(); ListOfEnchants.clear();
for (String one : keys) { for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one; String id = one.contains(":") ? one.split(":")[0] : one;
@ -181,7 +181,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("ColorList")) { if (ItemFile.getConfig().isConfigurationSection("ColorList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("ColorList"); ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("ColorList");
Set<String>keys = section.getKeys(false); Set<String> keys = section.getKeys(false);
ListOfColors.clear(); ListOfColors.clear();
for (String one : keys) { for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one; String id = one.contains(":") ? one.split(":")[0] : one;
@ -197,7 +197,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("PotionNamesList")) { if (ItemFile.getConfig().isConfigurationSection("PotionNamesList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("PotionNamesList"); ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("PotionNamesList");
Set<String>keys = section.getKeys(false); Set<String> keys = section.getKeys(false);
ListOfPotionNames.clear(); ListOfPotionNames.clear();
for (String one : keys) { for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one; String id = one.contains(":") ? one.split(":")[0] : one;

View File

@ -1808,9 +1808,7 @@ public abstract class JobsDAO {
conn.setAutoCommit(true); conn.setAutoCommit(true);
if (i > 0) { if (i > 0) {
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Saved " + i + " new explorer entries."); Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Saved " + i + " new explorer entries."));
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
} }
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
@ -1857,9 +1855,7 @@ public abstract class JobsDAO {
conn.setAutoCommit(true); conn.setAutoCommit(true);
if (i > 0) { if (i > 0) {
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Updated " + i + " explorer entries."); Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Updated " + i + " explorer entries."));
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
} }
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -913,20 +913,17 @@ public class JobsListener implements Listener {
@EventHandler @EventHandler
public void JobsArmorChangeEvent(JobsArmorChangeEvent event) { public void JobsArmorChangeEvent(JobsArmorChangeEvent event) {
Player player = event.getPlayer(); Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId());
Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId());
} }
@EventHandler @EventHandler
public void PlayerItemHeldEvent(PlayerItemHeldEvent event) { public void PlayerItemHeldEvent(PlayerItemHeldEvent event) {
Player player = event.getPlayer(); Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId());
Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId());
} }
@EventHandler @EventHandler
public void PlayerItemBreakEvent(PlayerItemBreakEvent event) { public void PlayerItemBreakEvent(PlayerItemBreakEvent event) {
Player player = event.getPlayer(); Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId());
Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId());
} }
@EventHandler @EventHandler