diff --git a/com/gamingmesh/jobs/.gitignore b/com/gamingmesh/jobs/.gitignore index 5bc5d680..95030747 100644 --- a/com/gamingmesh/jobs/.gitignore +++ b/com/gamingmesh/jobs/.gitignore @@ -7,3 +7,4 @@ /PlayerManager$1.class /NMS.class /JobsPlugin.class +/PlayerManager$BoostOf.class diff --git a/com/gamingmesh/jobs/Gui/GuiManager.java b/com/gamingmesh/jobs/Gui/GuiManager.java index 771dbda9..af19cd8c 100644 --- a/com/gamingmesh/jobs/Gui/GuiManager.java +++ b/com/gamingmesh/jobs/Gui/GuiManager.java @@ -1,277 +1,277 @@ -package com.gamingmesh.jobs.Gui; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.container.ActionType; -import com.gamingmesh.jobs.container.BoostType; -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.container.JobInfo; -import com.gamingmesh.jobs.container.JobProgression; -import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.stuff.Perm; - -public class GuiManager { - - public HashMap GuiList = new HashMap(); - - public void CloseInventories() { - for (Entry one : GuiList.entrySet()) { - Player player = Bukkit.getPlayer(one.getKey()); - if (player != null) { - player.closeInventory(); - } - } - } - - public Inventory CreateJobsGUI(Player player) { - - ArrayList JobsList = new ArrayList(); - for (Job job : Jobs.getJobs()) { - if (Jobs.getGCManager().getHideJobsWithoutPermission()) - if (!Jobs.getCommandManager().hasJobPermission(player, job)) - continue; - JobsList.add(job); - } - - GuiInfoList guiInfo = new GuiInfoList(player.getName()); - guiInfo.setJobList(JobsList); - - Inventory topinv = player.getOpenInventory().getTopInventory(); - if (topinv != null) - player.closeInventory(); - - GuiList.put(player.getName(), guiInfo); - - int GuiSize = 9; - - if (JobsList.size() > 9) - GuiSize = 18; - - if (JobsList.size() > 18) - GuiSize = 27; - - if (JobsList.size() > 27) - GuiSize = 36; - - if (JobsList.size() > 36) - GuiSize = 45; - - if (JobsList.size() > 45) - GuiSize = 54; - - JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - - List pJobs = JPlayer.getJobProgression(); - - String title = Jobs.getLanguage().getMessage("command.info.gui.pickjob"); - if (title.length() > 32) - title = title.substring(0, 30) + ".."; - - Inventory GuiInv = Bukkit.createInventory(null, GuiSize, title); - - for (int i = 0; i < JobsList.size(); i++) { - - Job job = JobsList.get(i); - - ArrayList Lore = new ArrayList(); - - for (JobProgression onePJob : pJobs) { - if (onePJob.getJob().getName().equalsIgnoreCase(job.getName())) - Lore.add(Jobs.getLanguage().getMessage("command.info.gui.working")); - } - - int maxlevel = 0; - if (Perm.hasPermission(player, "jobs." + job.getName() + ".vipmaxlevel") && job.getVipMaxLevel() != 0) - maxlevel = job.getVipMaxLevel(); - else - maxlevel = job.getMaxLevel(); - - if (maxlevel > 0) - Lore.add(Jobs.getLanguage().getMessage("command.info.gui.max") + maxlevel); - - if (Jobs.getGCManager().ShowTotalWorkers) - Lore.add(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", job.getTotalPlayers())); - - if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) - if (job.getBonus() < 0) - Lore.add(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (job.getBonus() * 100) / 100.0 * -1)); - else - Lore.add(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100) / 100.0)); - - Lore.addAll(Arrays.asList(job.getDescription().split("/n"))); - - if (job.getMaxSlots() != null) - Lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftSlots") + ((job.getMaxSlots() - Jobs.getUsedSlots(job)) > 0 ? (job.getMaxSlots() - Jobs - .getUsedSlots( - job)) : 0)); - - Lore.add(Jobs.getLanguage().getMessage("command.info.gui.actions")); - for (ActionType actionType : ActionType.values()) { - List info = job.getJobInfo(actionType); - if (info != null && !info.isEmpty()) { - Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() - + ".info"))); - } - } - - Lore.add(""); - Lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftClick")); - Lore.add(Jobs.getLanguage().getMessage("command.info.gui.rightClick")); - - ItemStack GuiItem = job.getGuiItem(); - - ItemMeta meta = GuiItem.getItemMeta(); - meta.setDisplayName(job.getName()); - meta.setLore(Lore); - GuiItem.setItemMeta(meta); - - GuiInv.setItem(i, GuiItem); - } - return GuiInv; - } - - public Inventory CreateJobsSubGUI(Player player, Job job) { - - Inventory tempInv = Bukkit.createInventory(null, 54, ""); - - ItemStack GuiItem = job.getGuiItem(); - JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - - // money exp boost - Double MoneyBoost = JPlayer.getBoost(job.getName(), BoostType.MONEY); - Double ExpBoost = JPlayer.getBoost(job.getName(), BoostType.EXP); - - int level = 1; - JobProgression prog = JPlayer.getJobProgression(job); - if (prog != null) - level = prog.getLevel(); - - int numjobs = JPlayer.getJobProgression().size(); - - List items = new ArrayList(); - int i = 0; - for (ActionType actionType : ActionType.values()) { - List info = job.getJobInfo(actionType); - - if (info == null || info.isEmpty()) - continue; - - ArrayList Lore = new ArrayList(); - Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() - + ".info"))); - int y = 1; - for (int z = 0; z < info.size(); z++) { - String itemName = Jobs.getNameTranslatorManager().Translate(info.get(z).getName(), info.get(z)); - - double income = info.get(z).getIncome(level, numjobs); - income = income + ((income * MoneyBoost) - income) + ((income * job.getMoneyBoost()) - income); - ChatColor incomeColor = income >= 0 ? ChatColor.GREEN : ChatColor.DARK_RED; - - double xp = info.get(z).getExperience(level, numjobs); - xp = xp + ((xp * ExpBoost) - xp) + ((xp * job.getExpBoost()) - xp); - ChatColor xpColor = xp >= 0 ? ChatColor.YELLOW : ChatColor.GRAY; - - String xpString = String.format("%.2fxp", xp); - - Lore.add(ChatColor.translateAlternateColorCodes('&', "&7" + itemName + " " + xpColor + xpString + " " + incomeColor + Jobs.getEconomy().format(income))); - - if (y >= 10) { - y = 1; - - if (z == info.size() - 1) - continue; - ItemMeta meta = GuiItem.getItemMeta(); - meta.setDisplayName(job.getName()); - meta.setLore(Lore); - GuiItem.setItemMeta(meta); - //GuiInv.setItem(i, GuiItem); - tempInv.setItem(i, GuiItem); - - GuiItem = job.getGuiItem(); - Lore = new ArrayList(); - Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() - + ".info"))); - i++; - } - y++; - } - ItemMeta meta = GuiItem.getItemMeta(); - meta.setDisplayName(job.getName()); - meta.setLore(Lore); - GuiItem.setItemMeta(meta); - //GuiInv.setItem(i, GuiItem); - tempInv.setItem(i, GuiItem); - i++; - } - - for (ItemStack one : tempInv.getContents()) { - if (one != null) - items.add(one); - } - - int GuiSize = 18; - int backButton = 9; - - if (items.size() > 9) { - GuiSize = 27; - backButton = 18; - } - - if (items.size() > 18) { - GuiSize = 36; - backButton = 27; - } - - if (items.size() > 27) { - GuiSize = 45; - backButton = 36; - } - - if (items.size() > 36) { - GuiSize = 54; - backButton = 45; - } - -// if (items.size() > 45) { -// GuiSize = 54; -// backButton = 53; -// } - - String title = Jobs.getLanguage().getMessage("command.info.gui.jobinfo", "[jobname]", job.getName()); - if (title.length() > 32) - title = title.substring(0, 30) + ".."; - Inventory GuiInv = Bukkit.createInventory(null, GuiSize, title); - - for (int i1 = 0; i1 < items.size(); i1++) { - GuiInv.setItem(i1, items.get(i1)); - } - - ItemStack skull = new ItemStack(Material.JACK_O_LANTERN, 1, (byte) 0); - - ItemMeta skullMeta = skull.getItemMeta(); - skullMeta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back")); - - skull.setItemMeta(skullMeta); - - GuiInv.setItem(backButton, skull); - - GuiInfoList guiInfo = new GuiInfoList(player.getName()); - guiInfo.setJobInfo(true); - guiInfo.setbackButton(backButton); - GuiList.put(player.getName(), guiInfo); - - return GuiInv; - } -} +package com.gamingmesh.jobs.Gui; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.Boost; +import com.gamingmesh.jobs.container.BoostType; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobInfo; +import com.gamingmesh.jobs.container.JobProgression; +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.stuff.Perm; + +public class GuiManager { + + public HashMap GuiList = new HashMap(); + + public void CloseInventories() { + for (Entry one : GuiList.entrySet()) { + Player player = Bukkit.getPlayer(one.getKey()); + if (player != null) { + player.closeInventory(); + } + } + } + + public Inventory CreateJobsGUI(Player player) { + + ArrayList JobsList = new ArrayList(); + for (Job job : Jobs.getJobs()) { + if (Jobs.getGCManager().getHideJobsWithoutPermission()) + if (!Jobs.getCommandManager().hasJobPermission(player, job)) + continue; + JobsList.add(job); + } + + GuiInfoList guiInfo = new GuiInfoList(player.getName()); + guiInfo.setJobList(JobsList); + + Inventory topinv = player.getOpenInventory().getTopInventory(); + if (topinv != null) + player.closeInventory(); + + GuiList.put(player.getName(), guiInfo); + + int GuiSize = 9; + + if (JobsList.size() > 9) + GuiSize = 18; + + if (JobsList.size() > 18) + GuiSize = 27; + + if (JobsList.size() > 27) + GuiSize = 36; + + if (JobsList.size() > 36) + GuiSize = 45; + + if (JobsList.size() > 45) + GuiSize = 54; + + JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player); + + List pJobs = JPlayer.getJobProgression(); + + String title = Jobs.getLanguage().getMessage("command.info.gui.pickjob"); + if (title.length() > 32) + title = title.substring(0, 30) + ".."; + + Inventory GuiInv = Bukkit.createInventory(null, GuiSize, title); + + for (int i = 0; i < JobsList.size(); i++) { + + Job job = JobsList.get(i); + + ArrayList Lore = new ArrayList(); + + for (JobProgression onePJob : pJobs) { + if (onePJob.getJob().getName().equalsIgnoreCase(job.getName())) + Lore.add(Jobs.getLanguage().getMessage("command.info.gui.working")); + } + + int maxlevel = 0; + if (Perm.hasPermission(player, "jobs." + job.getName() + ".vipmaxlevel") && job.getVipMaxLevel() != 0) + maxlevel = job.getVipMaxLevel(); + else + maxlevel = job.getMaxLevel(); + + if (maxlevel > 0) + Lore.add(Jobs.getLanguage().getMessage("command.info.gui.max") + maxlevel); + + if (Jobs.getGCManager().ShowTotalWorkers) + Lore.add(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", job.getTotalPlayers())); + + if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) + if (job.getBonus() < 0) + Lore.add(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (job.getBonus() * 100) / 100.0 * -1)); + else + Lore.add(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100) / 100.0)); + + Lore.addAll(Arrays.asList(job.getDescription().split("/n"))); + + if (job.getMaxSlots() != null) + Lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftSlots") + ((job.getMaxSlots() - Jobs.getUsedSlots(job)) > 0 ? (job.getMaxSlots() - Jobs + .getUsedSlots( + job)) : 0)); + + Lore.add(Jobs.getLanguage().getMessage("command.info.gui.actions")); + for (ActionType actionType : ActionType.values()) { + List info = job.getJobInfo(actionType); + if (info != null && !info.isEmpty()) { + Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() + + ".info"))); + } + } + + Lore.add(""); + Lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftClick")); + Lore.add(Jobs.getLanguage().getMessage("command.info.gui.rightClick")); + + ItemStack GuiItem = job.getGuiItem(); + + ItemMeta meta = GuiItem.getItemMeta(); + meta.setDisplayName(job.getName()); + meta.setLore(Lore); + GuiItem.setItemMeta(meta); + + GuiInv.setItem(i, GuiItem); + } + return GuiInv; + } + + public Inventory CreateJobsSubGUI(Player player, Job job) { + + Inventory tempInv = Bukkit.createInventory(null, 54, ""); + + ItemStack GuiItem = job.getGuiItem(); + JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player); + + + Boost boost = Jobs.getPlayerManager().getFinalBonus(JPlayer, job); + + int level = 1; + JobProgression prog = JPlayer.getJobProgression(job); + if (prog != null) + level = prog.getLevel(); + + int numjobs = JPlayer.getJobProgression().size(); + + List items = new ArrayList(); + int i = 0; + for (ActionType actionType : ActionType.values()) { + List info = job.getJobInfo(actionType); + + if (info == null || info.isEmpty()) + continue; + + ArrayList Lore = new ArrayList(); + Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() + + ".info"))); + int y = 1; + for (int z = 0; z < info.size(); z++) { + String itemName = Jobs.getNameTranslatorManager().Translate(info.get(z).getName(), info.get(z)); + + double income = info.get(z).getIncome(level, numjobs); + income = income + (income * boost.getFinal(BoostType.MONEY)); + ChatColor incomeColor = income >= 0 ? ChatColor.GREEN : ChatColor.DARK_RED; + + double xp = info.get(z).getExperience(level, numjobs); + xp = xp + (xp * boost.getFinal(BoostType.EXP)); + ChatColor xpColor = xp >= 0 ? ChatColor.YELLOW : ChatColor.GRAY; + + String xpString = String.format("%.2fxp", xp); + + Lore.add(ChatColor.translateAlternateColorCodes('&', "&7" + itemName + " " + xpColor + xpString + " " + incomeColor + Jobs.getEconomy().format(income))); + + if (y >= 10) { + y = 1; + + if (z == info.size() - 1) + continue; + ItemMeta meta = GuiItem.getItemMeta(); + meta.setDisplayName(job.getName()); + meta.setLore(Lore); + GuiItem.setItemMeta(meta); + //GuiInv.setItem(i, GuiItem); + tempInv.setItem(i, GuiItem); + + GuiItem = job.getGuiItem(); + Lore = new ArrayList(); + Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() + + ".info"))); + i++; + } + y++; + } + ItemMeta meta = GuiItem.getItemMeta(); + meta.setDisplayName(job.getName()); + meta.setLore(Lore); + GuiItem.setItemMeta(meta); + //GuiInv.setItem(i, GuiItem); + tempInv.setItem(i, GuiItem); + i++; + } + + for (ItemStack one : tempInv.getContents()) { + if (one != null) + items.add(one); + } + + int GuiSize = 18; + int backButton = 9; + + if (items.size() > 9) { + GuiSize = 27; + backButton = 18; + } + + if (items.size() > 18) { + GuiSize = 36; + backButton = 27; + } + + if (items.size() > 27) { + GuiSize = 45; + backButton = 36; + } + + if (items.size() > 36) { + GuiSize = 54; + backButton = 45; + } + +// if (items.size() > 45) { +// GuiSize = 54; +// backButton = 53; +// } + + String title = Jobs.getLanguage().getMessage("command.info.gui.jobinfo", "[jobname]", job.getName()); + if (title.length() > 32) + title = title.substring(0, 30) + ".."; + Inventory GuiInv = Bukkit.createInventory(null, GuiSize, title); + + for (int i1 = 0; i1 < items.size(); i1++) { + GuiInv.setItem(i1, items.get(i1)); + } + + ItemStack skull = new ItemStack(Material.JACK_O_LANTERN, 1, (byte) 0); + + ItemMeta skullMeta = skull.getItemMeta(); + skullMeta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back")); + + skull.setItemMeta(skullMeta); + + GuiInv.setItem(backButton, skull); + + GuiInfoList guiInfo = new GuiInfoList(player.getName()); + guiInfo.setJobInfo(true); + guiInfo.setbackButton(backButton); + GuiList.put(player.getName(), guiInfo); + + return GuiInv; + } +} diff --git a/com/gamingmesh/jobs/Jobs.java b/com/gamingmesh/jobs/Jobs.java index 0d22ba4d..301a42dd 100644 --- a/com/gamingmesh/jobs/Jobs.java +++ b/com/gamingmesh/jobs/Jobs.java @@ -32,6 +32,8 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.block.Block; import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -56,7 +58,8 @@ import com.gamingmesh.jobs.config.YmlMaker; import com.gamingmesh.jobs.container.ActionInfo; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.BlockProtection; -import com.gamingmesh.jobs.container.BoostMultiplier; +import com.gamingmesh.jobs.container.Boost; +import com.gamingmesh.jobs.container.BoostType; import com.gamingmesh.jobs.container.DBAction; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobInfo; @@ -127,11 +130,11 @@ public class Jobs extends JavaPlugin { public static BufferedPaymentThread paymentThread = null; private static DatabaseSaveThread saveTask = null; - public final static HashMap paymentLimit = new HashMap(); - public final static HashMap ExpLimit = new HashMap(); - public final static HashMap PointLimit = new HashMap(); + public static HashMap paymentLimit = new HashMap(); + public static HashMap ExpLimit = new HashMap(); + public static HashMap PointLimit = new HashMap(); - public final static HashMap FastPayment = new HashMap(); + public static HashMap FastPayment = new HashMap(); private static NMS nms; @@ -759,11 +762,24 @@ public class Jobs extends JavaPlugin { * @param action - the action * @param multiplier - the payment/xp multiplier */ - public static void action(JobsPlayer jPlayer, ActionInfo info, double multiplier) { - action(jPlayer, info, multiplier, null); + + public static void action(JobsPlayer jPlayer, ActionInfo info) { + action(jPlayer, info, null, null, null); } - public static void action(JobsPlayer jPlayer, ActionInfo info, double multiplier, Block block) { + public static void action(JobsPlayer jPlayer, ActionInfo info, Block block) { + action(jPlayer, info, block, null, null); + } + + public static void action(JobsPlayer jPlayer, ActionInfo info, Entity ent) { + action(jPlayer, info, null, ent, null); + } + + public static void action(JobsPlayer jPlayer, ActionInfo info, Entity ent, LivingEntity victim) { + action(jPlayer, info, null, ent, victim); + } + + public static void action(JobsPlayer jPlayer, ActionInfo info, Block block, Entity ent, LivingEntity victim) { if (jPlayer == null) return; @@ -774,76 +790,75 @@ public class Jobs extends JavaPlugin { if (numjobs == 0) { - if (noneJob != null) { - JobInfo jobinfo = noneJob.getJobInfo(info, 1); + if (noneJob == null) + return; + JobInfo jobinfo = noneJob.getJobInfo(info, 1); - if (jobinfo == null) - return; + if (jobinfo == null) + return; - Double income = jobinfo.getIncome(1, numjobs); - Double points = jobinfo.getPoints(1, numjobs); + Double income = jobinfo.getIncome(1, numjobs); + Double pointAmount = jobinfo.getPoints(1, numjobs); - if (income != 0D || points != 0D) { + if (income != 0D || pointAmount != 0D) { // jPlayer - BoostMultiplier FinalBoost = pManager.getFinalBonus(jPlayer, Jobs.getNoneJob()); + Boost boost = pManager.getFinalBonus(jPlayer, Jobs.getNoneJob()); - // Calculate income + // Calculate income - Double amount = 0D; - if (income != 0D) { - amount = income + (income * FinalBoost.getMoneyBoost() / 100); - if (GconfigManager.useMinimumOveralPayment && income > 0) { - double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit; - if (amount < maxLimit) { - amount = maxLimit; - } + if (income != 0D) { + income = income + (income * boost.getFinal(BoostType.MONEY)); + if (GconfigManager.useMinimumOveralPayment && income > 0) { + double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit; + if (income < maxLimit) { + income = maxLimit; } } - - // Calculate points - - Double pointAmount = 0D; - if (points != 0D) { - pointAmount = points + (points * FinalBoost.getPointsBoost() / 100); - if (GconfigManager.useMinimumOveralPoints && points > 0) { - double maxLimit = points * GconfigManager.MinimumOveralPaymentLimit; - if (pointAmount < maxLimit) { - pointAmount = maxLimit; - } - } - } - - if (!isUnderMoneyLimit(jPlayer, amount)) { - amount = 0D; - if (GconfigManager.MoneyStopPoint) - pointAmount = 0D; - } - - if (!isUnderPointLimit(jPlayer, pointAmount)) { - pointAmount = 0D; - if (GconfigManager.PointStopMoney) - amount = 0D; - } - - if (!isBpOk(jPlayer, info, block)) - return; - - if (amount == 0D && pointAmount == 0D) - return; - - if (info.getType() == ActionType.BREAK && block != null) - Jobs.getBpManager().remove(block); - - if (pointAmount != 0D) - jPlayer.setSaved(false); - - Jobs.getEconomy().pay(jPlayer, amount, pointAmount, 0.0); - - if (GconfigManager.LoggingUse) - loging.recordToLog(jPlayer, info, amount, 0); } + + // Calculate points + + if (pointAmount != 0D) { + pointAmount = pointAmount + (pointAmount * boost.getFinal(BoostType.POINTS)); + if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) { + double maxLimit = pointAmount * GconfigManager.MinimumOveralPaymentLimit; + if (pointAmount < maxLimit) { + pointAmount = maxLimit; + } + } + } + + if (!isUnderMoneyLimit(jPlayer, income)) { + income = 0D; + if (GconfigManager.MoneyStopPoint) + pointAmount = 0D; + } + + if (!isUnderPointLimit(jPlayer, pointAmount)) { + pointAmount = 0D; + if (GconfigManager.PointStopMoney) + income = 0D; + } + + if (!isBpOk(jPlayer, info, block)) + return; + + if (income == 0D && pointAmount == 0D) + return; + + if (info.getType() == ActionType.BREAK && block != null) + Jobs.getBpManager().remove(block); + + if (pointAmount != 0D) + jPlayer.setSaved(false); + + Jobs.getEconomy().pay(jPlayer, income, pointAmount, 0.0); + + if (GconfigManager.LoggingUse) + loging.recordToLog(jPlayer, info, income, 0); } + } else { for (JobProgression prog : progression) { int level = prog.getLevel(); @@ -853,10 +868,10 @@ public class Jobs extends JavaPlugin { continue; Double income = jobinfo.getIncome(level, numjobs); - Double points = jobinfo.getPoints(level, numjobs); - Double exp = jobinfo.getExperience(level, numjobs); + Double pointAmount = jobinfo.getPoints(level, numjobs); + Double expAmount = jobinfo.getExperience(level, numjobs); - if (income == 0D && points == 0D && exp == 0D) + if (income == 0D && pointAmount == 0D && expAmount == 0D) continue; if (GconfigManager.addXpPlayer()) { @@ -868,10 +883,10 @@ public class Jobs extends JavaPlugin { * That way jobs that give fractions of experience points will slowly give * experience in the aggregate */ - int expInt = exp.intValue(); - double remainder = exp.doubleValue() - expInt; + int expInt = expAmount.intValue(); + double remainder = expAmount.doubleValue() - expInt; if (Math.abs(remainder) > Math.random()) { - if (exp.doubleValue() < 0) { + if (expAmount.doubleValue() < 0) { expInt--; } else { expInt++; @@ -887,35 +902,26 @@ public class Jobs extends JavaPlugin { } } - BoostMultiplier FinalBoost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob()); + Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim); - if (multiplier != 0.0) - FinalBoost = new BoostMultiplier(FinalBoost.getMoneyBoost() + multiplier, - FinalBoost.getPointsBoost() + multiplier, - FinalBoost.getExpBoost() + multiplier); - -// OfflinePlayer dude = jPlayer.getPlayer(); +// Debug.D(FinalBoost.getMoneyBoost() + " : " + FinalBoost.getPointsBoost() + " : " + FinalBoost.getExpBoost()); // Calculate income - - Double amount = 0D; if (income != 0D) { - amount = income + (income * FinalBoost.getMoneyBoost() / 100); + income = income + (income * boost.getFinal(BoostType.MONEY)); if (GconfigManager.useMinimumOveralPayment && income > 0) { double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit; - if (amount < maxLimit) { - amount = maxLimit; + if (income < maxLimit) { + income = maxLimit; } } } // Calculate points - - Double pointAmount = 0D; - if (points != 0D) { - pointAmount = points + (points * FinalBoost.getPointsBoost() / 100); - if (GconfigManager.useMinimumOveralPoints && points > 0) { - double maxLimit = points * GconfigManager.MinimumOveralPaymentLimit; + if (pointAmount != 0D) { + pointAmount = pointAmount + (pointAmount * boost.getFinal(BoostType.POINTS)); + if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) { + double maxLimit = pointAmount * GconfigManager.MinimumOveralPaymentLimit; if (pointAmount < maxLimit) { pointAmount = maxLimit; } @@ -923,17 +929,17 @@ public class Jobs extends JavaPlugin { } // Calculate exp - double expAmount = exp + (exp * FinalBoost.getExpBoost() / 100); + expAmount = expAmount + (expAmount * boost.getFinal(BoostType.EXP)); - if (GconfigManager.useMinimumOveralPayment && exp > 0) { - double maxLimit = exp * GconfigManager.MinimumOveralPaymentLimit; - if (exp < maxLimit) { - exp = maxLimit; + if (GconfigManager.useMinimumOveralPayment && expAmount > 0) { + double maxLimit = expAmount * GconfigManager.MinimumOveralPaymentLimit; + if (expAmount < maxLimit) { + expAmount = maxLimit; } } - if (!isUnderMoneyLimit(jPlayer, amount)) { - amount = 0D; + if (!isUnderMoneyLimit(jPlayer, income)) { + income = 0D; if (GconfigManager.MoneyStopExp) expAmount = 0D; if (GconfigManager.MoneyStopPoint) @@ -943,7 +949,7 @@ public class Jobs extends JavaPlugin { if (!isUnderExpLimit(jPlayer, expAmount)) { expAmount = 0D; if (GconfigManager.ExpStopMoney) - amount = 0D; + income = 0D; if (GconfigManager.ExpStopPoint) pointAmount = 0D; } @@ -951,7 +957,7 @@ public class Jobs extends JavaPlugin { if (!isUnderPointLimit(jPlayer, pointAmount)) { pointAmount = 0D; if (GconfigManager.PointStopMoney) - amount = 0D; + income = 0D; if (GconfigManager.PointStopExp) expAmount = 0D; } @@ -959,7 +965,7 @@ public class Jobs extends JavaPlugin { if (!isBpOk(jPlayer, info, block)) return; - if (amount == 0D && pointAmount == 0D && expAmount == 0D) + if (income == 0D && pointAmount == 0D && expAmount == 0D) continue; try { @@ -981,17 +987,19 @@ public class Jobs extends JavaPlugin { else expAmount = JobsExpGainEvent.getExp(); - economy.pay(jPlayer, amount, pointAmount, expAmount); + FastPayment.clear(); + FastPayment.put(jPlayer.getUserName(), new FastPayment(jPlayer, info, new BufferedPayment(jPlayer.getPlayer(), income, pointAmount, expAmount), prog + .getJob())); + + economy.pay(jPlayer, income, pointAmount, expAmount); int oldLevel = prog.getLevel(); if (GconfigManager.LoggingUse) - loging.recordToLog(jPlayer, info, amount, expAmount); + loging.recordToLog(jPlayer, info, income, expAmount); if (prog.addExperience(expAmount)) pManager.performLevelUp(jPlayer, prog.getJob(), oldLevel); - FastPayment.clear(); - FastPayment.put(jPlayer.getUserName(), new FastPayment(jPlayer, info, new BufferedPayment(jPlayer.getPlayer(), amount, points, exp), prog.getJob())); } } } diff --git a/com/gamingmesh/jobs/PlayerManager.java b/com/gamingmesh/jobs/PlayerManager.java index bb1a225e..6f47f903 100644 --- a/com/gamingmesh/jobs/PlayerManager.java +++ b/com/gamingmesh/jobs/PlayerManager.java @@ -30,12 +30,16 @@ import java.util.concurrent.ConcurrentHashMap; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Tameable; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import com.gamingmesh.jobs.api.JobsJoinEvent; import com.gamingmesh.jobs.api.JobsLeaveEvent; import com.gamingmesh.jobs.api.JobsLevelUpEvent; +import com.gamingmesh.jobs.container.Boost; import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.BoostType; import com.gamingmesh.jobs.container.Job; @@ -48,6 +52,7 @@ import com.gamingmesh.jobs.dao.JobsDAO; import com.gamingmesh.jobs.dao.JobsDAOData; import com.gamingmesh.jobs.economy.PointsData; import com.gamingmesh.jobs.stuff.ChatColor; +import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.PerformCommands; import com.gamingmesh.jobs.stuff.Perm; @@ -56,6 +61,7 @@ public class PlayerManager { private ConcurrentHashMap playersCache = new ConcurrentHashMap(); private ConcurrentHashMap players = new ConcurrentHashMap(); private PointsData PointsDatabase = new PointsData(); + private final String mobSpawnerMetadata = "jobsMobSpawner"; private HashMap PlayerMap = new HashMap(); Jobs plugin; @@ -428,7 +434,7 @@ public class PlayerManager { Jobs.getGCManager().SoundLevelupVolume, Jobs.getGCManager().SoundLevelupPitch, Jobs.getGCManager().SoundTitleChangeSound.toUpperCase(), - Jobs.getGCManager().SoundTitleChangeVolume, + Jobs.getGCManager().SoundTitleChangeVolume, Jobs.getGCManager().SoundTitleChangePitch); Bukkit.getServer().getPluginManager().callEvent(levelUpEvent); // If event is canceled, dont do anything @@ -560,13 +566,20 @@ public class PlayerManager { return false; } - public double GetBoostInPerc(JobsPlayer player, Job job, BoostType type) { - return GetBoostInPerc(player, job, type, false); + public BoostMultiplier getBoost(JobsPlayer player, Job job) { + BoostMultiplier b = new BoostMultiplier(); + for (BoostType one : BoostType.values()) { + b.add(one, getBoost(player, job, one, false)); + } + return b; } - public double GetBoostInPerc(JobsPlayer player, Job job, BoostType type, boolean force) { - double Boost = player.getBoost(job.getName(), type, force) * 100.0 - 100.0; - return Boost; + public double getBoost(JobsPlayer player, Job job, BoostType type) { + return getBoost(player, job, type, false); + } + + public double getBoost(JobsPlayer player, Job job, BoostType type, boolean force) { + return player.getBoost(job.getName(), type, force); } /** @@ -590,35 +603,25 @@ public class PlayerManager { } public BoostMultiplier getItemBoost(Player player, Job prog) { - BoostMultiplier data = new BoostMultiplier(1D, 1D, 1D); + BoostMultiplier data = new BoostMultiplier(); if (player == null) return data; - ItemStack iih = Jobs.getNms().getItemInMainHand(player); - if (iih == null || prog == null) return data; - - BoostMultiplier itemboost = Jobs.getPlayerManager().getItemBoost(prog, iih); - - data = new BoostMultiplier(data.getMoneyBoost() + itemboost.getMoneyBoost(), - data.getPointsBoost() + itemboost.getPointsBoost(), - data.getExpBoost() + itemboost.getExpBoost()); - + data = Jobs.getPlayerManager().getItemBoost(prog, iih); for (ItemStack OneArmor : player.getInventory().getArmorContents()) { - BoostMultiplier armorboost = Jobs.getPlayerManager().getItemBoost(prog, OneArmor); - data = new BoostMultiplier(data.getMoneyBoost() + armorboost.getMoneyBoost(), - data.getPointsBoost() + armorboost.getPointsBoost(), - data.getExpBoost() + armorboost.getExpBoost()); + BoostMultiplier armorboost = Jobs.getPlayerManager().getItemBoost(prog, OneArmor); + data.add(armorboost); } - return data; } @SuppressWarnings("deprecation") public BoostMultiplier getItemBoost(Job prog, ItemStack item) { + BoostMultiplier bonus = new BoostMultiplier(); if (item == null) - return new BoostMultiplier(0D, 0D, 0D); + return bonus; ItemMeta meta = item.getItemMeta(); String name = null; @@ -655,52 +658,53 @@ public class PlayerManager { continue main; } - return new BoostMultiplier(oneItem.getMoneyBoost() - 1D, oneItem.getPointBoost() - 1D, oneItem.getExpBoost() - 1D); + return oneItem.getBoost(); } - return new BoostMultiplier(0D, 0D, 0D); + return bonus; } - public BoostMultiplier getFinalBonus(JobsPlayer player, Job prog) { - BoostMultiplier multiplier = new BoostMultiplier(0D, 0D, 0D); + public enum BoostOf { + McMMO, PetPay, NearSpawner, Permission, Global, Dynamic, Item, Area + } + + public Boost getFinalBonus(JobsPlayer player, Job prog) { + return getFinalBonus(player, prog, null, null); + } + + public Boost getFinalBonus(JobsPlayer player, Job prog, Entity ent, LivingEntity victim) { + Boost boost = new Boost(); + if (player == null || prog == null) - return multiplier; + return boost; - double PMoneyBoost = Jobs.getPlayerManager().GetBoostInPerc(player, prog, BoostType.MONEY); - PMoneyBoost = (int) (PMoneyBoost * 100D) / 100D; - double PPointBoost = Jobs.getPlayerManager().GetBoostInPerc(player, prog, BoostType.POINTS); - PPointBoost = (int) (PPointBoost * 100D) / 100D; - double PExpBoost = Jobs.getPlayerManager().GetBoostInPerc(player, prog, BoostType.EXP); - PExpBoost = (int) (PExpBoost * 100D) / 100D; + if (Jobs.getMcMMOlistener().mcMMOPresent) + boost.add(BoostOf.McMMO, new BoostMultiplier().add(Jobs.getMcMMOlistener().getMultiplier(player.getPlayer()))); - double GMoneyBoost = prog.getMoneyBoost() * 100.0 - 100.0; - GMoneyBoost = (int) (GMoneyBoost * 100D) / 100D; - double GPointBoost = prog.getPointBoost() * 100.0 - 100.0; - GPointBoost = (int) (GPointBoost * 100D) / 100D; - double GExpBoost = prog.getExpBoost() * 100.0 - 100.0; - GExpBoost = (int) (GExpBoost * 100D) / 100D; + if (ent != null && ent instanceof Tameable) { + Tameable t = (Tameable) ent; + if (t.isTamed() && t.getOwner() instanceof Player) { + Player pDamager = (Player) t.getOwner(); + double PetPayMultiplier = 0D; + if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay")) + PetPayMultiplier = Jobs.getGCManager().VipPetPay; + else + PetPayMultiplier = Jobs.getGCManager().PetPay; + boost.add(BoostOf.PetPay, new BoostMultiplier().add(PetPayMultiplier)); + } + } - double DBoost = (int) (prog.getBonus() * 100D) / 100D; - if (!Jobs.getGCManager().useDynamicPayment) - DBoost = 0.0; + if (victim != null && victim.hasMetadata(this.getMobSpawnerMetadata())) + boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(player.getVipSpawnerMultiplier())); + boost.add(BoostOf.Permission, Jobs.getPlayerManager().getBoost(player, prog)); + boost.add(BoostOf.Global, prog.getBoost()); + if (Jobs.getGCManager().useDynamicPayment) + boost.add(BoostOf.Dynamic, new BoostMultiplier().add(prog.getBonus())); + boost.add(BoostOf.Item, Jobs.getPlayerManager().getItemBoost(player.getPlayer(), prog)); + boost.add(BoostOf.Item, Jobs.getPlayerManager().getItemBoost(player.getPlayer(), prog)); + boost.add(BoostOf.Area, new BoostMultiplier().add(Jobs.getRestrictedAreaManager().getRestrictedMultiplier(player.getPlayer()))); - BoostMultiplier itemboost = Jobs.getPlayerManager().getItemBoost(player.getPlayer(), prog); - - double IMoneyBoost = itemboost.getMoneyBoost() * 100.0 - 100.0; - IMoneyBoost = (int) (IMoneyBoost * 100D) / 100D; - double IPointBoost = itemboost.getPointsBoost() * 100.0 - 100.0; - IPointBoost = (int) (IPointBoost * 100D) / 100D; - double IExpBoost = itemboost.getExpBoost() * 100.0 - 100.0; - IExpBoost = (int) (IExpBoost * 100D) / 100D; - - double RBoost = Jobs.getRestrictedAreaManager().getRestrictedMultiplier(player.getPlayer()) * 100.0 - 100.0; - RBoost = (int) (RBoost * 100D) / 100D; - - double Fmoney = (int) ((IMoneyBoost + DBoost + GMoneyBoost + PMoneyBoost + RBoost) * 100) / 100D; - double Fpoints = (int) ((IPointBoost + DBoost + GPointBoost + PPointBoost + RBoost) * 100) / 100D; - double Fexp = (int) ((IExpBoost + DBoost + GExpBoost + PExpBoost + RBoost) * 100) / 100D; - - return new BoostMultiplier(Fmoney, Fpoints, Fexp); + return boost; } public void AutoJoinJobs(final Player player) { @@ -736,4 +740,8 @@ public class PlayerManager { } }, Jobs.getGCManager().AutoJobJoinDelay * 20L); } + + public String getMobSpawnerMetadata() { + return mobSpawnerMetadata; + } } diff --git a/com/gamingmesh/jobs/commands/JobsCommands.java b/com/gamingmesh/jobs/commands/JobsCommands.java index 63fbcae0..d2de6376 100644 --- a/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/com/gamingmesh/jobs/commands/JobsCommands.java @@ -1,611 +1,612 @@ -package com.gamingmesh.jobs.commands; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.container.ActionType; -import com.gamingmesh.jobs.container.BoostMultiplier; -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.container.JobInfo; -import com.gamingmesh.jobs.container.JobProgression; -import com.gamingmesh.jobs.container.JobsPlayer; - -public class JobsCommands implements CommandExecutor { - private static final String label = "jobs"; - private static final String packagePath = "com.gamingmesh.jobs.commands.list"; - private static final List hidenCommands = new ArrayList(); - Map CommandList = new HashMap(); - - protected Jobs plugin; - - public JobsCommands(Jobs plugin) { - this.plugin = plugin; - } - - public Map getCommands() { - return CommandList; - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - - if (sender instanceof Player) { - if (!Jobs.getGCManager().canPerformActionInWorld(((Player) sender).getWorld()) && !sender.hasPermission("jobs.disabledworld.commands")) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.worldisdisabled")); - return true; - } - } - - if (args.length == 0) - return help(sender, 1); - - if ((args.length == 1 || args.length == 2) && (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help"))) { - int page = 1; - if (args.length == 2) - try { - page = Integer.parseInt(args[1]); - } catch (NumberFormatException e) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); - return true; - } - return help(sender, page); - } - - String cmd = args[0].toLowerCase(); - - if (!hasCommandPermission(sender, cmd)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); - return true; - } - String[] myArgs = reduceArgs(args); - if (myArgs.length > 0) { - if (myArgs[myArgs.length - 1].equals("?")) { - sendUsage(sender, cmd); - return true; - } - } - - Cmd cmdClass = getCmdClass(cmd); - if (cmdClass == null) { - return help(sender, 1); - } - boolean back = cmdClass.perform(plugin, sender, myArgs); - if (back) - return true; - - if (!(sender instanceof Player)) - return help(sender, 1); - - return help(sender, 1); - } - - private static String[] reduceArgs(String[] args) { - return args.length <= 1 ? new String[0] : Arrays.copyOfRange(args, 1, args.length); - } - - private static boolean hasCommandPermission(CommandSender sender, String cmd) { - return sender.hasPermission("jobs.command." + cmd); - } - - private static String getUsage(String cmd) { - StringBuilder builder = new StringBuilder(); - builder.append(ChatColor.GREEN.toString()); - builder.append('/').append(label).append(' '); - builder.append(cmd); - builder.append(ChatColor.YELLOW); - String key = "command." + cmd + ".help.args"; - if (Jobs.getLanguage().containsKey(key)) { - builder.append(' '); - builder.append(Jobs.getLanguage().getMessage(key)); - } - return builder.toString(); - } - - public static String getUsageNoCmd(String cmd) { - StringBuilder builder = new StringBuilder(); - builder.append(ChatColor.GREEN.toString()); - builder.append('/').append(label).append(' '); - builder.append(ChatColor.YELLOW); - String key = "command." + cmd + ".help.args"; - if (Jobs.getLanguage().containsKey(key)) { - builder.append(' '); - builder.append(Jobs.getLanguage().getMessage(key)); - } - return builder.toString(); - } - - public void sendUsage(CommandSender sender, String cmd) { - String message = ChatColor.YELLOW + Jobs.getLanguage().getMessage("command.help.output.usage"); - message = message.replace("%usage%", getUsage(cmd)); - sender.sendMessage(message); - sender.sendMessage(ChatColor.YELLOW + "* " + Jobs.getLanguage().getMessage("command." + cmd + ".help.info")); - } - - protected boolean help(CommandSender sender, int page) { - - Map commands = GetCommands(sender); - - if (commands.size() == 0) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); - return true; - } - commands = sort(commands); - int amountToShow = 7; - int start = page * amountToShow - amountToShow; - int end = page * amountToShow; - int TotalPages = commands.size() / amountToShow; - if (((commands.size() * 1.0) / (amountToShow * 1.0)) - TotalPages > 0) - TotalPages++; - if (start >= commands.size()) { - start = page * amountToShow; - end = start + amountToShow; - } - - if (page > TotalPages || page < 1) { - Jobs.getActionBar().send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage")); - return true; - } - - sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title")); - sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.page", "[1]", page, "[2]", TotalPages)); - - int i = -1; - for (Entry one : commands.entrySet()) { - i++; - if (i < start) - continue; - if (i >= end) - break; - sender.sendMessage(getUsage(one.getKey()) + " - " + Jobs.getLanguage().getMessage("command." + one.getKey() + ".help.info")); - } - - String prevCmd = "/" + label + " ? " + (page - 1); - String prev = "[\"\",{\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.prev") + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" - + prevCmd - + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + "<<<" + "\"}]}}}"; - String nextCmd = "/" + label + " ? " + (page + 1); - String next = " {\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.next") + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + nextCmd - + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + ">>>" + "\"}]}}}]"; - - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + prev + "," + next); - - return true; - } - - private static List getClassesFromPackage(String pckgname) throws ClassNotFoundException { - List result = new ArrayList(); - try { - for (URL jarURL : ((URLClassLoader) Jobs.class.getClassLoader()).getURLs()) { - try { - result.addAll(getClassesInSamePackageFromJar(pckgname, jarURL.toURI().getPath())); - } catch (URISyntaxException e) { - } - } - } catch (NullPointerException x) { - throw new ClassNotFoundException(pckgname + " does not appear to be a valid package (Null pointer exception)"); - } - - return result; - } - - private static List getClassesInSamePackageFromJar(String packageName, String jarPath) { - JarFile jarFile = null; - List listOfCommands = new ArrayList(); - try { - jarFile = new JarFile(jarPath); - Enumeration en = jarFile.entries(); - while (en.hasMoreElements()) { - JarEntry entry = en.nextElement(); - String entryName = entry.getName(); - packageName = packageName.replace(".", "/"); - if (entryName != null && entryName.endsWith(".class") && entryName.startsWith(packageName)) { - String name = entryName.replace(packageName, "").replace(".class", "").replace("/", ""); - if (name.contains("$")) - name = name.split("\\$")[0]; - listOfCommands.add(name); - } - } - } catch (Exception e) { - } finally { - if (jarFile != null) - try { - jarFile.close(); - } catch (Exception e) { - } - } - return listOfCommands; - } - - public Map GetCommands(CommandSender sender) { - Map temp = new HashMap(); - for (Entry cmd : CommandList.entrySet()) { - if (!hasCommandPermission(sender, cmd.getKey())) - continue; - temp.put(cmd.getKey(), cmd.getValue()); - } - return temp; - } - - public void fillCommands() { - List lm = new ArrayList(); - HashMap> classes = new HashMap>(); - try { - lm = getClassesFromPackage(packagePath); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - - for (String one : lm) { - Class newclass = getClass(one); - if (newclass != null) - classes.put(one, newclass); - } - - for (Entry> OneClass : classes.entrySet()) { - for (Method met : OneClass.getValue().getMethods()) { - if (!met.isAnnotationPresent(JobCommand.class)) - continue; - String cmd = OneClass.getKey(); - if (hidenCommands.contains(met.getName().toLowerCase())) - continue; - CommandList.put(cmd, met.getAnnotation(JobCommand.class).value()); - break; - } - } - } - - private static Class getClass(String cmd) { - Class nmsClass = null; - try { - nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase()); - } catch (ClassNotFoundException | IllegalArgumentException | SecurityException e) { - } - return nmsClass; - } - - private static Cmd getCmdClass(String cmd) { - Cmd cmdClass = null; - try { - Class nmsClass; - nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase()); - if (Cmd.class.isAssignableFrom(nmsClass)) { - cmdClass = (Cmd) nmsClass.getConstructor().newInstance(); - } - } catch (ClassNotFoundException | InstantiationException | IllegalArgumentException | IllegalAccessException | NoSuchMethodException | InvocationTargetException - | SecurityException e) { - } - return cmdClass; - } - - private static Map sort(Map unsortMap) { - List> list = new LinkedList>(unsortMap.entrySet()); - Collections.sort(list, new Comparator>() { - @Override - public int compare(Map.Entry o1, Map.Entry o2) { - return (o1.getValue()).compareTo(o2.getValue()); - } - }); - Map sortedMap = new LinkedHashMap(); - for (Iterator> it = list.iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - sortedMap.put(entry.getKey(), entry.getValue()); - } - return sortedMap; - } - - /** - * Check Job joining permission - */ - public boolean hasJobPermission(Player sender, Job job) { - return hasJobPermission((CommandSender) sender, job); - } - - public boolean hasJobPermission(CommandSender sender, Job job) { - if (!sender.hasPermission("jobs.use")) { - return false; - } - return sender.hasPermission("jobs.join." + job.getName().toLowerCase()); - } - - public void sendValidActions(CommandSender sender) { - StringBuilder builder = new StringBuilder(); - boolean first = true; - for (ActionType action : ActionType.values()) { - if (!first) - builder.append(','); - builder.append(action.getName()); - first = false; - - } - sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.actions", "%actions%", builder.toString())); - } - - /** - * Displays info about a job - * @param player - the player of the job - * @param job - the job we are displaying info about - * @param type - type of info - * @return the message - */ - public void jobInfoMessage(CommandSender sender, JobsPlayer player, Job job, String type, int page) { - if (job == null) { - // job doesn't exist - sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job")); - return; - } - - if (type == null) { - type = ""; - } else { - type = type.toLowerCase(); - } - - StringBuilder message = new StringBuilder(); - - int showAllTypes = 1; - for (ActionType actionType : ActionType.values()) { - if (type.startsWith(actionType.getName().toLowerCase())) { - showAllTypes = 0; - break; - } - } - - if (job.getExpBoost() != 1.0) - message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", job.getExpBoost()) + "\n"); - - if (job.getMoneyBoost() != 1.0) - message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", job.getMoneyBoost()) + "\n"); - - if (job.getPointBoost() != 1.0) - message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", job.getPointBoost()) + "\n"); - - if (Jobs.getGCManager().useDynamicPayment) - if (job.getBonus() < 0) - message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.info.help.penalty", "[penalty]", (int) (job.getBonus() * 100) / 100.0 * -1) - + "\n"); - else - message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.info.help.bonus", "[bonus]", (int) (job.getBonus() * 100) / 100.0) + "\n"); - - for (ActionType actionType : ActionType.values()) { - if (showAllTypes == 1 || type.startsWith(actionType.getName().toLowerCase())) { - List info = job.getJobInfo(actionType); - if (info != null && !info.isEmpty()) { - message.append(jobInfoMessage(player, job, actionType)); - } else if (showAllTypes == 0) { - String myMessage = Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() + ".none"); - myMessage = myMessage.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE); - message.append(myMessage); - } - } - } - - StringBuilder message2 = new StringBuilder(); - int perPage = 20; - int start = (page - 1) * perPage; - int end = start + perPage; - int pagecount = (int) Math.ceil((double) message.toString().split("\n").length / (double) perPage); - if (pagecount == 0) - pagecount = 1; - if (page > pagecount) { - player.getPlayer().sendMessage("Invalid page"); - return; - } - - if (message.toString().split("\n").length > perPage && sender instanceof Player) { - int i = 0; - for (String one : message.toString().split("\n")) { - i++; - if (i <= start) - continue; - if (i > end) - break; - - message2.append(one); - message2.append("\n"); - } - message = message2; - } - - sender.sendMessage(message.toString().split("\n")); - - String t = type == "" ? "" : " " + type; - - if (sender instanceof Player) - if (sender.getName().equalsIgnoreCase(player.getUserName())) - ShowPagination(sender.getName(), pagecount, page, "jobs info " + job.getName() + t); - else - ShowPagination(sender.getName(), pagecount, page, "jobs playerinfo " + player.getUserName() + " " + job.getName() + t); - } - - public static void ShowPagination(String target, int pageCount, int CurrentPage, String cmd) { - if (target.equalsIgnoreCase("console")) - return; -// String separator = ChatColor.GOLD + ""; -// String simbol = "\u25AC"; -// for (int i = 0; i < 10; i++) { -// separator += simbol; -// } - - if (pageCount == 1) - return; - - int NextPage = CurrentPage + 1; - NextPage = CurrentPage < pageCount ? NextPage : CurrentPage; - int Prevpage = CurrentPage - 1; - Prevpage = CurrentPage > 1 ? Prevpage : CurrentPage; - - String prevCmd = "/" + cmd + " " + Prevpage; - String prev = "\"\",{\"text\":\" " + Jobs.getLanguage().getMessage("command.help.output.prev") - + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + prevCmd - + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + "<<<" + "\"}]}}}"; - String nextCmd = "/" + cmd + " " + NextPage; - String next = " {\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.next") + " " - + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" - + nextCmd + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + ">>>" + "\"}]}}}"; - - if (CurrentPage >= pageCount) - next = "{\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.next") + " \"}"; - - if (CurrentPage <= 1) - prev = "{\"text\":\" " + Jobs.getLanguage().getMessage("command.help.output.prev") + "\"}"; - - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + target + " [" + prev + "," + next + "]"); - } - - /** - * Displays info about a particular action - * @param player - the player of the job - * @param prog - the job we are displaying info about - * @param type - the type of action - * @return the message - */ - public static String jobInfoMessage(JobsPlayer player, Job job, ActionType type) { - - // money exp boost - BoostMultiplier finalBoost = Jobs.getPlayerManager().getFinalBonus(player, job); - - StringBuilder message = new StringBuilder(); - - message.append(Jobs.getLanguage().getMessage("command.info.output." + type.getName().toLowerCase() + ".info")); - message.append(":\n"); - - int level = 1; - - JobProgression prog = player.getJobProgression(job); - if (prog != null) - level = prog.getLevel(); - int numjobs = player.getJobProgression().size(); - List jobInfo = job.getJobInfo(type); - for (JobInfo info : jobInfo) { - - String materialName = info.getName().toLowerCase().replace('_', ' '); - materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1); - materialName = Jobs.getNameTranslatorManager().Translate(materialName, info); - materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName); - - double income = info.getIncome(level, numjobs); - -// Jobs.getPlayerManager().getFinalBonus(player, prog) - - income = income + (income * finalBoost.getMoneyBoost() / 100); - String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString(); - - double xp = info.getExperience(level, numjobs); - xp = xp + (xp * finalBoost.getExpBoost() / 100); - String xpColor = xp >= 0 ? "" : ChatColor.GRAY.toString(); - - double points = info.getPoints(level, numjobs); - points = points + (points * finalBoost.getPointsBoost() / 100); - String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString(); - - if (income == 0D && points == 0D && xp == 0D) - continue; - - message.append(" "); - - message.append(Jobs.getLanguage().getMessage("command.info.help.material", "%material%", materialName)); - if (prog != null && !info.isInLevelRange(prog.getLevel())) - message.append(org.bukkit.ChatColor.RED + " -> "); - else - message.append(" -> "); - - if (income != 0.0) - message.append(Jobs.getLanguage().getMessage("command.info.help.money", "%money%", incomeColor + String.format("%.2f", income))); - - if (points != 0.0) - message.append(Jobs.getLanguage().getMessage("command.info.help.points", "%points%", pointsColor + String.format("%.2f", points))); - - if (xp != 0.0) - message.append(Jobs.getLanguage().getMessage("command.info.help.exp", "%exp%", xpColor + String.format("%.2f", xp))); - - if (info.getFromLevel() > 1 && info.getUntilLevel() != -1) - message.append(Jobs.getLanguage().getMessage("command.info.help.levelRange", "%levelFrom%", info.getFromLevel(), "%levelUntil%", info.getUntilLevel())); - - if (info.getFromLevel() > 1 && info.getUntilLevel() == -1) - message.append(Jobs.getLanguage().getMessage("command.info.help.levelFrom", "%levelFrom%", info.getFromLevel())); - - if (info.getFromLevel() == 1 && info.getUntilLevel() != -1) - message.append(Jobs.getLanguage().getMessage("command.info.help.levelUntil", "%levelUntil%", info.getUntilLevel())); - - message.append('\n'); - } - return message.toString(); - } - - /** - * Displays job stats about a particular player's job - * @param jobProg - the job progress of the players job - * @return the message - */ - public String jobStatsMessage(JobProgression jobProg) { - String message = Jobs.getLanguage().getMessage("command.stats.output", - "%joblevel%", Integer.valueOf(jobProg.getLevel()).toString(), - "%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName() + ChatColor.WHITE, - "%jobxp%", Double.toString(Math.round(jobProg.getExperience() * 100.0) / 100.0), - "%jobmaxxp%", Integer.toString(jobProg.getMaxExperience())); - return " " + jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) + " " + message; - } - - public String jobProgressMessage(double max, double current) { - String message = ""; - String pos = ChatColor.DARK_GREEN + "\u258F"; - String pros = ChatColor.YELLOW + "\u258F"; - if (current < 0) - current = 0; - if (max < current) - max = current; - int percentage = (int) ((current * 50.0) / max); - for (int i = 0; i < percentage; i++) { - message += pos; - } - - if (50 - percentage < 0) - percentage = 50; - - for (int i = 0; i < 50 - percentage; i++) { - message += pros; - } - return message; - } - - /** - * Displays job stats about a particular player's job from archive - * @param jobInfo - jobinfo string line - * @return the message - */ - public String jobStatsMessage(String jobInfo) { - String[] splited = jobInfo.split(":"); - if (Jobs.getJob(splited[0]) == null) - return ""; - String message = Jobs.getLanguage().getMessage("command.archive.output", - "%joblevel%", Integer.valueOf(splited[1]).toString(), - "%getbackjoblevel%", Integer.valueOf(splited[2]).toString(), - "%jobname%", Jobs.getJob(splited[0]).getChatColor() + splited[0] + ChatColor.WHITE, - "%jobxp%", Double.toString(Math.round(Double.valueOf(splited[3]) * 100.0) / 100.0)); - return message; - } -} +package com.gamingmesh.jobs.commands; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.Boost; +import com.gamingmesh.jobs.container.BoostType; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobInfo; +import com.gamingmesh.jobs.container.JobProgression; +import com.gamingmesh.jobs.container.JobsPlayer; + +public class JobsCommands implements CommandExecutor { + private static final String label = "jobs"; + private static final String packagePath = "com.gamingmesh.jobs.commands.list"; + private static final List hidenCommands = new ArrayList(); + Map CommandList = new HashMap(); + + protected Jobs plugin; + + public JobsCommands(Jobs plugin) { + this.plugin = plugin; + } + + public Map getCommands() { + return CommandList; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + + if (sender instanceof Player) { + if (!Jobs.getGCManager().canPerformActionInWorld(((Player) sender).getWorld()) && !sender.hasPermission("jobs.disabledworld.commands")) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.worldisdisabled")); + return true; + } + } + + if (args.length == 0) + return help(sender, 1); + + if ((args.length == 1 || args.length == 2) && (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help"))) { + int page = 1; + if (args.length == 2) + try { + page = Integer.parseInt(args[1]); + } catch (NumberFormatException e) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); + return true; + } + return help(sender, page); + } + + String cmd = args[0].toLowerCase(); + + if (!hasCommandPermission(sender, cmd)) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + return true; + } + String[] myArgs = reduceArgs(args); + if (myArgs.length > 0) { + if (myArgs[myArgs.length - 1].equals("?")) { + sendUsage(sender, cmd); + return true; + } + } + + Cmd cmdClass = getCmdClass(cmd); + if (cmdClass == null) { + return help(sender, 1); + } + boolean back = cmdClass.perform(plugin, sender, myArgs); + if (back) + return true; + + if (!(sender instanceof Player)) + return help(sender, 1); + + return help(sender, 1); + } + + private static String[] reduceArgs(String[] args) { + return args.length <= 1 ? new String[0] : Arrays.copyOfRange(args, 1, args.length); + } + + private static boolean hasCommandPermission(CommandSender sender, String cmd) { + return sender.hasPermission("jobs.command." + cmd); + } + + private static String getUsage(String cmd) { + StringBuilder builder = new StringBuilder(); + builder.append(ChatColor.GREEN.toString()); + builder.append('/').append(label).append(' '); + builder.append(cmd); + builder.append(ChatColor.YELLOW); + String key = "command." + cmd + ".help.args"; + if (Jobs.getLanguage().containsKey(key)) { + builder.append(' '); + builder.append(Jobs.getLanguage().getMessage(key)); + } + return builder.toString(); + } + + public static String getUsageNoCmd(String cmd) { + StringBuilder builder = new StringBuilder(); + builder.append(ChatColor.GREEN.toString()); + builder.append('/').append(label).append(' '); + builder.append(ChatColor.YELLOW); + String key = "command." + cmd + ".help.args"; + if (Jobs.getLanguage().containsKey(key)) { + builder.append(' '); + builder.append(Jobs.getLanguage().getMessage(key)); + } + return builder.toString(); + } + + public void sendUsage(CommandSender sender, String cmd) { + String message = ChatColor.YELLOW + Jobs.getLanguage().getMessage("command.help.output.usage"); + message = message.replace("%usage%", getUsage(cmd)); + sender.sendMessage(message); + sender.sendMessage(ChatColor.YELLOW + "* " + Jobs.getLanguage().getMessage("command." + cmd + ".help.info")); + } + + protected boolean help(CommandSender sender, int page) { + + Map commands = GetCommands(sender); + + if (commands.size() == 0) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + return true; + } + commands = sort(commands); + int amountToShow = 7; + int start = page * amountToShow - amountToShow; + int end = page * amountToShow; + int TotalPages = commands.size() / amountToShow; + if (((commands.size() * 1.0) / (amountToShow * 1.0)) - TotalPages > 0) + TotalPages++; + if (start >= commands.size()) { + start = page * amountToShow; + end = start + amountToShow; + } + + if (page > TotalPages || page < 1) { + Jobs.getActionBar().send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage")); + return true; + } + + sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title")); + sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.page", "[1]", page, "[2]", TotalPages)); + + int i = -1; + for (Entry one : commands.entrySet()) { + i++; + if (i < start) + continue; + if (i >= end) + break; + sender.sendMessage(getUsage(one.getKey()) + " - " + Jobs.getLanguage().getMessage("command." + one.getKey() + ".help.info")); + } + + String prevCmd = "/" + label + " ? " + (page - 1); + String prev = "[\"\",{\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.prev") + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + + prevCmd + + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + "<<<" + "\"}]}}}"; + String nextCmd = "/" + label + " ? " + (page + 1); + String next = " {\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.next") + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + nextCmd + + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + ">>>" + "\"}]}}}]"; + + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + prev + "," + next); + + return true; + } + + private static List getClassesFromPackage(String pckgname) throws ClassNotFoundException { + List result = new ArrayList(); + try { + for (URL jarURL : ((URLClassLoader) Jobs.class.getClassLoader()).getURLs()) { + try { + result.addAll(getClassesInSamePackageFromJar(pckgname, jarURL.toURI().getPath())); + } catch (URISyntaxException e) { + } + } + } catch (NullPointerException x) { + throw new ClassNotFoundException(pckgname + " does not appear to be a valid package (Null pointer exception)"); + } + + return result; + } + + private static List getClassesInSamePackageFromJar(String packageName, String jarPath) { + JarFile jarFile = null; + List listOfCommands = new ArrayList(); + try { + jarFile = new JarFile(jarPath); + Enumeration en = jarFile.entries(); + while (en.hasMoreElements()) { + JarEntry entry = en.nextElement(); + String entryName = entry.getName(); + packageName = packageName.replace(".", "/"); + if (entryName != null && entryName.endsWith(".class") && entryName.startsWith(packageName)) { + String name = entryName.replace(packageName, "").replace(".class", "").replace("/", ""); + if (name.contains("$")) + name = name.split("\\$")[0]; + listOfCommands.add(name); + } + } + } catch (Exception e) { + } finally { + if (jarFile != null) + try { + jarFile.close(); + } catch (Exception e) { + } + } + return listOfCommands; + } + + public Map GetCommands(CommandSender sender) { + Map temp = new HashMap(); + for (Entry cmd : CommandList.entrySet()) { + if (!hasCommandPermission(sender, cmd.getKey())) + continue; + temp.put(cmd.getKey(), cmd.getValue()); + } + return temp; + } + + public void fillCommands() { + List lm = new ArrayList(); + HashMap> classes = new HashMap>(); + try { + lm = getClassesFromPackage(packagePath); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + + for (String one : lm) { + Class newclass = getClass(one); + if (newclass != null) + classes.put(one, newclass); + } + + for (Entry> OneClass : classes.entrySet()) { + for (Method met : OneClass.getValue().getMethods()) { + if (!met.isAnnotationPresent(JobCommand.class)) + continue; + String cmd = OneClass.getKey(); + if (hidenCommands.contains(met.getName().toLowerCase())) + continue; + CommandList.put(cmd, met.getAnnotation(JobCommand.class).value()); + break; + } + } + } + + private static Class getClass(String cmd) { + Class nmsClass = null; + try { + nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase()); + } catch (ClassNotFoundException | IllegalArgumentException | SecurityException e) { + } + return nmsClass; + } + + private static Cmd getCmdClass(String cmd) { + Cmd cmdClass = null; + try { + Class nmsClass; + nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase()); + if (Cmd.class.isAssignableFrom(nmsClass)) { + cmdClass = (Cmd) nmsClass.getConstructor().newInstance(); + } + } catch (ClassNotFoundException | InstantiationException | IllegalArgumentException | IllegalAccessException | NoSuchMethodException | InvocationTargetException + | SecurityException e) { + } + return cmdClass; + } + + private static Map sort(Map unsortMap) { + List> list = new LinkedList>(unsortMap.entrySet()); + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map.Entry o1, Map.Entry o2) { + return (o1.getValue()).compareTo(o2.getValue()); + } + }); + Map sortedMap = new LinkedHashMap(); + for (Iterator> it = list.iterator(); it.hasNext();) { + Map.Entry entry = it.next(); + sortedMap.put(entry.getKey(), entry.getValue()); + } + return sortedMap; + } + + /** + * Check Job joining permission + */ + public boolean hasJobPermission(Player sender, Job job) { + return hasJobPermission((CommandSender) sender, job); + } + + public boolean hasJobPermission(CommandSender sender, Job job) { + if (!sender.hasPermission("jobs.use")) { + return false; + } + return sender.hasPermission("jobs.join." + job.getName().toLowerCase()); + } + + public void sendValidActions(CommandSender sender) { + StringBuilder builder = new StringBuilder(); + boolean first = true; + for (ActionType action : ActionType.values()) { + if (!first) + builder.append(','); + builder.append(action.getName()); + first = false; + + } + sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.actions", "%actions%", builder.toString())); + } + + /** + * Displays info about a job + * @param player - the player of the job + * @param job - the job we are displaying info about + * @param type - type of info + * @return the message + */ + public void jobInfoMessage(CommandSender sender, JobsPlayer player, Job job, String type, int page) { + if (job == null) { + // job doesn't exist + sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job")); + return; + } + + if (type == null) { + type = ""; + } else { + type = type.toLowerCase(); + } + + StringBuilder message = new StringBuilder(); + + int showAllTypes = 1; + for (ActionType actionType : ActionType.values()) { + if (type.startsWith(actionType.getName().toLowerCase())) { + showAllTypes = 0; + break; + } + } + + if (job.getBoost().get(BoostType.EXP) != 1.0) + message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", job.getBoost().get(BoostType.EXP)) + "\n"); + + if (job.getBoost().get(BoostType.MONEY) != 1.0) + message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", job.getBoost().get(BoostType.MONEY)) + "\n"); + + if (job.getBoost().get(BoostType.POINTS) != 1.0) + message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", job.getBoost().get(BoostType.POINTS)) + "\n"); + + if (Jobs.getGCManager().useDynamicPayment) + if (job.getBonus() < 0) + message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.info.help.penalty", "[penalty]", (int) (job.getBonus() * 100) / 100.0 * -1) + + "\n"); + else + message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.info.help.bonus", "[bonus]", (int) (job.getBonus() * 100) / 100.0) + "\n"); + + for (ActionType actionType : ActionType.values()) { + if (showAllTypes == 1 || type.startsWith(actionType.getName().toLowerCase())) { + List info = job.getJobInfo(actionType); + if (info != null && !info.isEmpty()) { + message.append(jobInfoMessage(player, job, actionType)); + } else if (showAllTypes == 0) { + String myMessage = Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() + ".none"); + myMessage = myMessage.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE); + message.append(myMessage); + } + } + } + + StringBuilder message2 = new StringBuilder(); + int perPage = 20; + int start = (page - 1) * perPage; + int end = start + perPage; + int pagecount = (int) Math.ceil((double) message.toString().split("\n").length / (double) perPage); + if (pagecount == 0) + pagecount = 1; + if (page > pagecount) { + player.getPlayer().sendMessage("Invalid page"); + return; + } + + if (message.toString().split("\n").length > perPage && sender instanceof Player) { + int i = 0; + for (String one : message.toString().split("\n")) { + i++; + if (i <= start) + continue; + if (i > end) + break; + + message2.append(one); + message2.append("\n"); + } + message = message2; + } + + sender.sendMessage(message.toString().split("\n")); + + String t = type == "" ? "" : " " + type; + + if (sender instanceof Player) + if (sender.getName().equalsIgnoreCase(player.getUserName())) + ShowPagination(sender.getName(), pagecount, page, "jobs info " + job.getName() + t); + else + ShowPagination(sender.getName(), pagecount, page, "jobs playerinfo " + player.getUserName() + " " + job.getName() + t); + } + + public static void ShowPagination(String target, int pageCount, int CurrentPage, String cmd) { + if (target.equalsIgnoreCase("console")) + return; +// String separator = ChatColor.GOLD + ""; +// String simbol = "\u25AC"; +// for (int i = 0; i < 10; i++) { +// separator += simbol; +// } + + if (pageCount == 1) + return; + + int NextPage = CurrentPage + 1; + NextPage = CurrentPage < pageCount ? NextPage : CurrentPage; + int Prevpage = CurrentPage - 1; + Prevpage = CurrentPage > 1 ? Prevpage : CurrentPage; + + String prevCmd = "/" + cmd + " " + Prevpage; + String prev = "\"\",{\"text\":\" " + Jobs.getLanguage().getMessage("command.help.output.prev") + + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + prevCmd + + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + "<<<" + "\"}]}}}"; + String nextCmd = "/" + cmd + " " + NextPage; + String next = " {\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.next") + " " + + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + + nextCmd + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + ">>>" + "\"}]}}}"; + + if (CurrentPage >= pageCount) + next = "{\"text\":\"" + Jobs.getLanguage().getMessage("command.help.output.next") + " \"}"; + + if (CurrentPage <= 1) + prev = "{\"text\":\" " + Jobs.getLanguage().getMessage("command.help.output.prev") + "\"}"; + + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + target + " [" + prev + "," + next + "]"); + } + + /** + * Displays info about a particular action + * @param player - the player of the job + * @param prog - the job we are displaying info about + * @param type - the type of action + * @return the message + */ + public static String jobInfoMessage(JobsPlayer player, Job job, ActionType type) { + + // money exp boost + Boost boost = Jobs.getPlayerManager().getFinalBonus(player, job); + + StringBuilder message = new StringBuilder(); + + message.append(Jobs.getLanguage().getMessage("command.info.output." + type.getName().toLowerCase() + ".info")); + message.append(":\n"); + + int level = 1; + + JobProgression prog = player.getJobProgression(job); + if (prog != null) + level = prog.getLevel(); + int numjobs = player.getJobProgression().size(); + List jobInfo = job.getJobInfo(type); + for (JobInfo info : jobInfo) { + + String materialName = info.getName().toLowerCase().replace('_', ' '); + materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1); + materialName = Jobs.getNameTranslatorManager().Translate(materialName, info); + materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName); + + double income = info.getIncome(level, numjobs); + +// Jobs.getPlayerManager().getFinalBonus(player, prog) + + income = income + (income * boost.getFinal(BoostType.MONEY)); + String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString(); + + double xp = info.getExperience(level, numjobs); + xp = xp + (xp * boost.getFinal(BoostType.EXP)); + String xpColor = xp >= 0 ? "" : ChatColor.GRAY.toString(); + + double points = info.getPoints(level, numjobs); + points = points + (points * boost.getFinal(BoostType.POINTS)); + String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString(); + + if (income == 0D && points == 0D && xp == 0D) + continue; + + message.append(" "); + + message.append(Jobs.getLanguage().getMessage("command.info.help.material", "%material%", materialName)); + if (prog != null && !info.isInLevelRange(prog.getLevel())) + message.append(org.bukkit.ChatColor.RED + " -> "); + else + message.append(" -> "); + + if (income != 0.0) + message.append(Jobs.getLanguage().getMessage("command.info.help.money", "%money%", incomeColor + String.format("%.2f", income))); + + if (points != 0.0) + message.append(Jobs.getLanguage().getMessage("command.info.help.points", "%points%", pointsColor + String.format("%.2f", points))); + + if (xp != 0.0) + message.append(Jobs.getLanguage().getMessage("command.info.help.exp", "%exp%", xpColor + String.format("%.2f", xp))); + + if (info.getFromLevel() > 1 && info.getUntilLevel() != -1) + message.append(Jobs.getLanguage().getMessage("command.info.help.levelRange", "%levelFrom%", info.getFromLevel(), "%levelUntil%", info.getUntilLevel())); + + if (info.getFromLevel() > 1 && info.getUntilLevel() == -1) + message.append(Jobs.getLanguage().getMessage("command.info.help.levelFrom", "%levelFrom%", info.getFromLevel())); + + if (info.getFromLevel() == 1 && info.getUntilLevel() != -1) + message.append(Jobs.getLanguage().getMessage("command.info.help.levelUntil", "%levelUntil%", info.getUntilLevel())); + + message.append('\n'); + } + return message.toString(); + } + + /** + * Displays job stats about a particular player's job + * @param jobProg - the job progress of the players job + * @return the message + */ + public String jobStatsMessage(JobProgression jobProg) { + String message = Jobs.getLanguage().getMessage("command.stats.output", + "%joblevel%", Integer.valueOf(jobProg.getLevel()).toString(), + "%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName() + ChatColor.WHITE, + "%jobxp%", Double.toString(Math.round(jobProg.getExperience() * 100.0) / 100.0), + "%jobmaxxp%", Integer.toString(jobProg.getMaxExperience())); + return " " + jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) + " " + message; + } + + public String jobProgressMessage(double max, double current) { + String message = ""; + String pos = ChatColor.DARK_GREEN + "\u258F"; + String pros = ChatColor.YELLOW + "\u258F"; + if (current < 0) + current = 0; + if (max < current) + max = current; + int percentage = (int) ((current * 50.0) / max); + for (int i = 0; i < percentage; i++) { + message += pos; + } + + if (50 - percentage < 0) + percentage = 50; + + for (int i = 0; i < 50 - percentage; i++) { + message += pros; + } + return message; + } + + /** + * Displays job stats about a particular player's job from archive + * @param jobInfo - jobinfo string line + * @return the message + */ + public String jobStatsMessage(String jobInfo) { + String[] splited = jobInfo.split(":"); + if (Jobs.getJob(splited[0]) == null) + return ""; + String message = Jobs.getLanguage().getMessage("command.archive.output", + "%joblevel%", Integer.valueOf(splited[1]).toString(), + "%getbackjoblevel%", Integer.valueOf(splited[2]).toString(), + "%jobname%", Jobs.getJob(splited[0]).getChatColor() + splited[0] + ChatColor.WHITE, + "%jobxp%", Double.toString(Math.round(Double.valueOf(splited[3]) * 100.0) / 100.0)); + return message; + } +} diff --git a/com/gamingmesh/jobs/commands/list/bonus.java b/com/gamingmesh/jobs/commands/list/bonus.java index 58908aee..919c4c7f 100644 --- a/com/gamingmesh/jobs/commands/list/bonus.java +++ b/com/gamingmesh/jobs/commands/list/bonus.java @@ -1,116 +1,93 @@ -package com.gamingmesh.jobs.commands.list; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; -import com.gamingmesh.jobs.container.BoostMultiplier; -import com.gamingmesh.jobs.container.BoostType; -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.stuff.ChatColor; - -public class bonus implements Cmd { - - @Override - @JobCommand(300) - public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { - if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); - return false; - } - - if (args.length != 1) { - Jobs.getCommandManager().sendUsage(sender, "bonus"); - return true; - } - - Player player = (Player) sender; - - Job job = Jobs.getJob(args[0]); - - if (job == null) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); - return true; - } - - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - - if (jPlayer == null) - return false; - -// sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", job.getChatColor() + job.getName())); - double PMoneyBoost = Jobs.getPlayerManager().GetBoostInPerc(jPlayer, job, BoostType.MONEY, true); - PMoneyBoost = (int) (PMoneyBoost * 100D) / 100D; - double PPointBoost = Jobs.getPlayerManager().GetBoostInPerc(jPlayer, job, BoostType.POINTS, true); - PPointBoost = (int) (PPointBoost * 100D) / 100D; - double PExpBoost = Jobs.getPlayerManager().GetBoostInPerc(jPlayer, job, BoostType.EXP, true); - PExpBoost = (int) (PExpBoost * 100D) / 100D; - - double GMoneyBoost = job.getMoneyBoost() * 100.0 - 100.0; - GMoneyBoost = (int) (GMoneyBoost * 100D) / 100D; - double GPointBoost = job.getPointBoost() * 100.0 - 100.0; - GPointBoost = (int) (GPointBoost * 100D) / 100D; - double GExpBoost = job.getExpBoost() * 100.0 - 100.0; - GExpBoost = (int) (GExpBoost * 100D) / 100D; - - double DBoost = (int) (job.getBonus() * 100D) / 100D; - - BoostMultiplier itemboost = Jobs.getPlayerManager().getItemBoost(player, job); - - double IMoneyBoost = itemboost.getMoneyBoost() * 100.0 - 100.0; - IMoneyBoost = (int) (IMoneyBoost * 100D) / 100D; - double IPointBoost = itemboost.getPointsBoost() * 100.0 - 100.0; - IPointBoost = (int) (IPointBoost * 100D) / 100D; - double IExpBoost = itemboost.getExpBoost() * 100.0 - 100.0; - IExpBoost = (int) (IExpBoost * 100D) / 100D; - - double RBoost = Jobs.getRestrictedAreaManager().getRestrictedMultiplier(player) * 100.0 - 100.0; - RBoost = (int) (RBoost * 100D) / 100D; - - sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline")); - - sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.permission", - "%money%", ChatColor.DARK_GREEN.toString() + formatText(PMoneyBoost), - "%points%", ChatColor.GOLD.toString() + formatText(PPointBoost), - "%exp%", ChatColor.YELLOW.toString() + formatText(PExpBoost))); - - sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.item", - "%money%", ChatColor.DARK_GREEN.toString() + formatText(IMoneyBoost), - "%points%", ChatColor.GOLD.toString() + formatText(IPointBoost), - "%exp%", ChatColor.YELLOW.toString() + formatText(IExpBoost))); - - sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.global", - "%money%", ChatColor.DARK_GREEN.toString() + formatText(GMoneyBoost), - "%points%", ChatColor.GOLD.toString() + formatText(GPointBoost), - "%exp%", ChatColor.YELLOW.toString() + formatText(GExpBoost))); - - sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.dynamic", - "%money%", ChatColor.DARK_GREEN.toString() + formatText(DBoost), - "%points%", ChatColor.GOLD.toString() + formatText(DBoost), - "%exp%", ChatColor.YELLOW.toString() + formatText(DBoost))); - - sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.area", - "%money%", ChatColor.DARK_GREEN.toString() + formatText(RBoost), - "%points%", ChatColor.GOLD.toString() + formatText(RBoost), - "%exp%", ChatColor.YELLOW.toString() + formatText(RBoost))); - - double Fmoney = Math.rint((IMoneyBoost + DBoost + GMoneyBoost + PMoneyBoost + RBoost) * 100) / 100; - double Fpoints = Math.rint((IPointBoost + DBoost + GPointBoost + PPointBoost + RBoost) * 100) / 100; - double Fexp = Math.rint((IExpBoost + DBoost + GExpBoost + PExpBoost + RBoost) * 100) / 100; - - sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); - sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.final", - "%money%", ChatColor.DARK_GREEN.toString() + formatText(Fmoney), - "%points%", ChatColor.GOLD.toString() + formatText(Fpoints), - "%exp%", ChatColor.YELLOW.toString() + formatText(Fexp))); - - return true; - } - - private static String formatText(double amount) { - return ((amount > 0 ? "+" : "") + amount + "%"); - } - -} +package com.gamingmesh.jobs.commands.list; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.PlayerManager.BoostOf; +import com.gamingmesh.jobs.commands.Cmd; +import com.gamingmesh.jobs.commands.JobCommand; +import com.gamingmesh.jobs.container.Boost; +import com.gamingmesh.jobs.container.BoostMultiplier; +import com.gamingmesh.jobs.container.BoostType; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.stuff.ChatColor; + +public class bonus implements Cmd { + + @Override + @JobCommand(300) + public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + return false; + } + + if (args.length != 1) { + Jobs.getCommandManager().sendUsage(sender, "bonus"); + return true; + } + + Player player = (Player) sender; + + Job job = Jobs.getJob(args[0]); + + if (job == null) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); + return true; + } + + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); + + if (jPlayer == null) + return false; + + Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job); + + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline")); + + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.permission", + "%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Permission, BoostType.MONEY, true)), + "%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Permission, BoostType.POINTS, true)), + "%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Permission, BoostType.EXP, true)))); + + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.item", + "%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Item, BoostType.MONEY, true)), + "%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Item, BoostType.POINTS, true)), + "%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Item, BoostType.EXP, true)))); + + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.global", + "%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Global, BoostType.MONEY, true)), + "%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Global, BoostType.POINTS, true)), + "%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Global, BoostType.EXP, true)))); + + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.dynamic", + "%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Dynamic, BoostType.MONEY, true)), + "%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Dynamic, BoostType.POINTS, true)), + "%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Dynamic, BoostType.EXP, true)))); + + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.area", + "%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Area, BoostType.MONEY, true)), + "%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Area, BoostType.POINTS, true)), + "%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Area, BoostType.EXP, true)))); + + if (Jobs.getMcMMOlistener().mcMMOPresent && boost.get(BoostOf.McMMO, BoostType.EXP) != 0D) + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.mcmmo", + "%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.McMMO, BoostType.MONEY, true)), + "%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.McMMO, BoostType.POINTS, true)), + "%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.McMMO, BoostType.EXP, true)))); + + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); + sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.final", + "%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.getFinal(BoostType.MONEY, true)), + "%points%", ChatColor.GOLD.toString() + formatText(boost.getFinal(BoostType.POINTS, true)), + "%exp%", ChatColor.YELLOW.toString() + formatText(boost.getFinal(BoostType.EXP, true)))); + + return true; + } + + private static String formatText(double amount) { + return ((amount > 0 ? "+" : "") + amount + "%"); + } + +} diff --git a/com/gamingmesh/jobs/commands/list/expboost.java b/com/gamingmesh/jobs/commands/list/expboost.java index 6dab38e0..893bfd5d 100644 --- a/com/gamingmesh/jobs/commands/list/expboost.java +++ b/com/gamingmesh/jobs/commands/list/expboost.java @@ -1,78 +1,79 @@ -package com.gamingmesh.jobs.commands.list; - -import org.bukkit.command.CommandSender; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.stuff.ChatColor; - -public class expboost implements Cmd { - - @Override - @JobCommand(2300) - public boolean perform(Jobs plugin, CommandSender sender, String[] args) { - if (args.length > 2 || args.length <= 1) { - Jobs.getCommandManager().sendUsage(sender, "expboost"); - return true; - } - - double rate = 1.0; - if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) - try { - rate = Double.parseDouble(args[1]); - } catch (NumberFormatException e) { - Jobs.getCommandManager().sendUsage(sender, "expboost"); - return true; - } - - String PlayerName = sender.getName(); - String jobName = args[0]; - Job job = Jobs.getJob(jobName); - - if (PlayerName == null) { - Jobs.getCommandManager().sendUsage(sender, "expboost"); - return true; - } - - if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) { - for (Job one : Jobs.getJobs()) { - one.setExpBoost(1.0); - } - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.allreset")); - return true; - } else if (args[0].equalsIgnoreCase("reset")) { - boolean found = false; - for (Job one : Jobs.getJobs()) { - if (one.getName().equalsIgnoreCase(args[1])) { - one.setExpBoost(1.0); - found = true; - break; - } - } - - if (found) { - sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%", job.getName())); - return true; - } - } - - if (args[0].equalsIgnoreCase("all")) { - - for (Job one : Jobs.getJobs()) { - one.setExpBoost(rate); - } - - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate)); - return true; - } - if (job == null) { - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job")); - return true; - } - job.setExpBoost(rate); - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName())); - return true; - } -} +package com.gamingmesh.jobs.commands.list; + +import org.bukkit.command.CommandSender; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.commands.Cmd; +import com.gamingmesh.jobs.commands.JobCommand; +import com.gamingmesh.jobs.container.BoostType; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.stuff.ChatColor; + +public class expboost implements Cmd { + + @Override + @JobCommand(2300) + public boolean perform(Jobs plugin, CommandSender sender, String[] args) { + if (args.length > 2 || args.length <= 1) { + Jobs.getCommandManager().sendUsage(sender, "expboost"); + return true; + } + + double rate = 1.0; + if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) + try { + rate = Double.parseDouble(args[1]); + } catch (NumberFormatException e) { + Jobs.getCommandManager().sendUsage(sender, "expboost"); + return true; + } + + String PlayerName = sender.getName(); + String jobName = args[0]; + Job job = Jobs.getJob(jobName); + + if (PlayerName == null) { + Jobs.getCommandManager().sendUsage(sender, "expboost"); + return true; + } + + if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) { + for (Job one : Jobs.getJobs()) { + one.addBoost(BoostType.EXP, 1.0); + } + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.allreset")); + return true; + } else if (args[0].equalsIgnoreCase("reset")) { + boolean found = false; + for (Job one : Jobs.getJobs()) { + if (one.getName().equalsIgnoreCase(args[1])) { + one.addBoost(BoostType.EXP, 1.0); + found = true; + break; + } + } + + if (found) { + sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%", job.getName())); + return true; + } + } + + if (args[0].equalsIgnoreCase("all")) { + + for (Job one : Jobs.getJobs()) { + one.addBoost(BoostType.EXP, rate); + } + + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate)); + return true; + } + if (job == null) { + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job")); + return true; + } + job.addBoost(BoostType.EXP, rate); + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName())); + return true; + } +} diff --git a/com/gamingmesh/jobs/commands/list/moneyboost.java b/com/gamingmesh/jobs/commands/list/moneyboost.java index a4fab6db..391e5a76 100644 --- a/com/gamingmesh/jobs/commands/list/moneyboost.java +++ b/com/gamingmesh/jobs/commands/list/moneyboost.java @@ -1,79 +1,80 @@ -package com.gamingmesh.jobs.commands.list; - -import org.bukkit.command.CommandSender; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.stuff.ChatColor; - -public class moneyboost implements Cmd { - - @Override - @JobCommand(2400) - public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { - - if (args.length > 2 || args.length <= 1) { - Jobs.getCommandManager().sendUsage(sender, "moneyboost"); - return true; - } - - double rate = 1.0; - if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) - try { - rate = Double.parseDouble(args[1]); - } catch (NumberFormatException e) { - Jobs.getCommandManager().sendUsage(sender, "moneyboost"); - return true; - } - - String PlayerName = sender.getName(); - String jobName = args[0]; - Job job = Jobs.getJob(jobName); - - if (PlayerName == null) { - Jobs.getCommandManager().sendUsage(sender, "moneyboost"); - return true; - } - - if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) { - for (Job one : Jobs.getJobs()) { - one.setMoneyBoost(1.0); - } - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.allreset")); - return true; - } else if (args[0].equalsIgnoreCase("reset")) { - boolean found = false; - for (Job one : Jobs.getJobs()) { - if (one.getName().equalsIgnoreCase(args[1])) { - one.setMoneyBoost(1.0); - found = true; - break; - } - } - - if (found) { - sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%", job.getName())); - return true; - } - } - - if (args[0].equalsIgnoreCase("all")) { - - for (Job one : Jobs.getJobs()) { - one.setMoneyBoost(rate); - } - - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate)); - return true; - } - if (job == null) { - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job")); - return true; - } - job.setMoneyBoost(rate); - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName())); - return true; - } -} +package com.gamingmesh.jobs.commands.list; + +import org.bukkit.command.CommandSender; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.commands.Cmd; +import com.gamingmesh.jobs.commands.JobCommand; +import com.gamingmesh.jobs.container.BoostType; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.stuff.ChatColor; + +public class moneyboost implements Cmd { + + @Override + @JobCommand(2400) + public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { + + if (args.length > 2 || args.length <= 1) { + Jobs.getCommandManager().sendUsage(sender, "moneyboost"); + return true; + } + + double rate = 1.0; + if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) + try { + rate = Double.parseDouble(args[1]); + } catch (NumberFormatException e) { + Jobs.getCommandManager().sendUsage(sender, "moneyboost"); + return true; + } + + String PlayerName = sender.getName(); + String jobName = args[0]; + Job job = Jobs.getJob(jobName); + + if (PlayerName == null) { + Jobs.getCommandManager().sendUsage(sender, "moneyboost"); + return true; + } + + if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) { + for (Job one : Jobs.getJobs()) { + one.addBoost(BoostType.MONEY, 1.0); + } + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.allreset")); + return true; + } else if (args[0].equalsIgnoreCase("reset")) { + boolean found = false; + for (Job one : Jobs.getJobs()) { + if (one.getName().equalsIgnoreCase(args[1])) { + one.addBoost(BoostType.MONEY, 1.0); + found = true; + break; + } + } + + if (found) { + sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%", job.getName())); + return true; + } + } + + if (args[0].equalsIgnoreCase("all")) { + + for (Job one : Jobs.getJobs()) { + one.addBoost(BoostType.MONEY, rate); + } + + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate)); + return true; + } + if (job == null) { + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job")); + return true; + } + job.addBoost(BoostType.MONEY, rate); + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName())); + return true; + } +} diff --git a/com/gamingmesh/jobs/commands/list/pointboost.java b/com/gamingmesh/jobs/commands/list/pointboost.java index 2c0f6930..a69e3fab 100644 --- a/com/gamingmesh/jobs/commands/list/pointboost.java +++ b/com/gamingmesh/jobs/commands/list/pointboost.java @@ -1,79 +1,80 @@ -package com.gamingmesh.jobs.commands.list; - -import org.bukkit.command.CommandSender; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.stuff.ChatColor; - -public class pointboost implements Cmd { - - @Override - @JobCommand(2400) - public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { - - if (args.length > 2 || args.length <= 1) { - Jobs.getCommandManager().sendUsage(sender, "pointboost"); - return true; - } - - double rate = 1.0; - if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) - try { - rate = Double.parseDouble(args[1]); - } catch (NumberFormatException e) { - Jobs.getCommandManager().sendUsage(sender, "pointboost"); - return true; - } - - String PlayerName = sender.getName(); - String jobName = args[0]; - Job job = Jobs.getJob(jobName); - - if (PlayerName == null) { - Jobs.getCommandManager().sendUsage(sender, "pointboost"); - return true; - } - - if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) { - for (Job one : Jobs.getJobs()) { - one.setPointBoost(1.0); - } - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.allreset")); - return true; - } else if (args[0].equalsIgnoreCase("reset")) { - boolean found = false; - for (Job one : Jobs.getJobs()) { - if (one.getName().equalsIgnoreCase(args[1])) { - one.setPointBoost(1.0); - found = true; - break; - } - } - - if (found) { - sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", "%jobname%", job.getName())); - return true; - } - } - - if (args[0].equalsIgnoreCase("all")) { - - for (Job one : Jobs.getJobs()) { - one.setPointBoost(rate); - } - - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate)); - return true; - } - if (job == null) { - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job")); - return true; - } - job.setPointBoost(rate); - sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName())); - return true; - } -} +package com.gamingmesh.jobs.commands.list; + +import org.bukkit.command.CommandSender; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.commands.Cmd; +import com.gamingmesh.jobs.commands.JobCommand; +import com.gamingmesh.jobs.container.BoostType; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.stuff.ChatColor; + +public class pointboost implements Cmd { + + @Override + @JobCommand(2400) + public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { + + if (args.length > 2 || args.length <= 1) { + Jobs.getCommandManager().sendUsage(sender, "pointboost"); + return true; + } + + double rate = 1.0; + if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) + try { + rate = Double.parseDouble(args[1]); + } catch (NumberFormatException e) { + Jobs.getCommandManager().sendUsage(sender, "pointboost"); + return true; + } + + String PlayerName = sender.getName(); + String jobName = args[0]; + Job job = Jobs.getJob(jobName); + + if (PlayerName == null) { + Jobs.getCommandManager().sendUsage(sender, "pointboost"); + return true; + } + + if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) { + for (Job one : Jobs.getJobs()) { + one.addBoost(BoostType.POINTS, 1.0); + } + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.allreset")); + return true; + } else if (args[0].equalsIgnoreCase("reset")) { + boolean found = false; + for (Job one : Jobs.getJobs()) { + if (one.getName().equalsIgnoreCase(args[1])) { + one.addBoost(BoostType.POINTS, 1.0); + found = true; + break; + } + } + + if (found) { + sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", "%jobname%", job.getName())); + return true; + } + } + + if (args[0].equalsIgnoreCase("all")) { + + for (Job one : Jobs.getJobs()) { + one.addBoost(BoostType.POINTS, rate); + } + + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate)); + return true; + } + if (job == null) { + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job")); + return true; + } + job.addBoost(BoostType.POINTS, rate); + sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName())); + return true; + } +} diff --git a/com/gamingmesh/jobs/config/ConfigManager.java b/com/gamingmesh/jobs/config/ConfigManager.java index 681f879d..0733602c 100644 --- a/com/gamingmesh/jobs/config/ConfigManager.java +++ b/com/gamingmesh/jobs/config/ConfigManager.java @@ -37,6 +37,8 @@ import org.bukkit.inventory.ItemStack; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.BoostMultiplier; +import com.gamingmesh.jobs.container.BoostType; import com.gamingmesh.jobs.container.DisplayMethod; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobCommands; @@ -47,6 +49,7 @@ import com.gamingmesh.jobs.container.JobLimitedItems; import com.gamingmesh.jobs.container.JobPermission; import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.stuff.ChatColor; +import com.gamingmesh.jobs.stuff.Debug; public class ConfigManager { private Jobs plugin; @@ -341,19 +344,15 @@ public class ConfigManager { enchants.put(ench, level); } - Double moneyBoost = 1D; + BoostMultiplier b = new BoostMultiplier(); if (itemSection.isDouble("moneyBoost")) - moneyBoost = itemSection.getDouble("moneyBoost"); - - Double pointBoost = 1D; + b.add(BoostType.MONEY, itemSection.getDouble("moneyBoost") - 1); if (itemSection.isDouble("pointBoost")) - pointBoost = itemSection.getDouble("pointBoost"); - - Double expBoost = 1D; + b.add(BoostType.POINTS, itemSection.getDouble("pointBoost") - 1); if (itemSection.isDouble("expBoost")) - expBoost = itemSection.getDouble("expBoost"); - - jobItems.add(new JobItems(node, id, 0, 1, name, lore, enchants, moneyBoost, pointBoost, expBoost)); + b.add(BoostType.EXP, itemSection.getDouble("expBoost") - 1); + + jobItems.add(new JobItems(node, id, 0, 1, name, lore, enchants, b)); } } diff --git a/com/gamingmesh/jobs/config/GeneralConfigManager.java b/com/gamingmesh/jobs/config/GeneralConfigManager.java index 2cf63d39..be7b3f13 100644 --- a/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -709,8 +709,8 @@ public class GeneralConfigManager { c.getW().addComment("ExploitProtections.General.PetPay", "Do you want to pay when players pet kills monster/player", "Can be exploited with mob farms", "0.2 means 20% of original reward", "Optionaly you can give jobs.petpay permission node for specific players/ranks to get paid by VipPetPay multiplier"); - PetPay = c.get("ExploitProtections.General.PetPay", 0.1); - VipPetPay = c.get("ExploitProtections.General.VipPetPay", 1.0); + PetPay = c.get("ExploitProtections.General.PetPay", 0.1) - 1D; + VipPetPay = c.get("ExploitProtections.General.VipPetPay", 1.0) - 1D; c.getW().addComment("ExploitProtections.McMMO", "McMMO abilities"); c.getW().addComment("ExploitProtections.McMMO.TreeFellerMultiplier", "Players will get part of money from cutting trees with treefeller ability enabled.", @@ -741,9 +741,9 @@ public class GeneralConfigManager { "Use: jobs.boost.[jobname].money or jobs.boost.[jobname].exp or jobs.boost.[jobname].points or jobs.boost.[jobname].all for all of them with specific jobs name.", "Use: jobs.boost.all.money or jobs.boost.all.exp or jobs.boost.all.points or jobs.boost.all.all to get boost for all jobs", "1.25 means that player will get 25% more than others, you can set less than 1 to get less from anothers"); - Boost.put(BoostType.EXP, c.get("boost.exp", 1.00)); - Boost.put(BoostType.MONEY, c.get("boost.money", 1.00)); - Boost.put(BoostType.POINTS, c.get("boost.points", 1.00)); + Boost.put(BoostType.EXP, c.get("boost.exp", 1D) - 1D); + Boost.put(BoostType.MONEY, c.get("boost.money", 1D) - 1D); + Boost.put(BoostType.POINTS, c.get("boost.points", 1D) - 1D); c.getW().addComment("old-job", "Old job save", "Players can leave job and return later with some level loss during that", "You can fix players level if hes job level is at max level"); diff --git a/com/gamingmesh/jobs/config/LanguageManager.java b/com/gamingmesh/jobs/config/LanguageManager.java index fc809751..66b12208 100644 --- a/com/gamingmesh/jobs/config/LanguageManager.java +++ b/com/gamingmesh/jobs/config/LanguageManager.java @@ -112,6 +112,7 @@ public class LanguageManager { c.get("command.bonus.output.global", " &eGlobal bonus: %money% %points% %exp%"); c.get("command.bonus.output.dynamic", " &eDynamic payment bonus: %money% %points% %exp%"); c.get("command.bonus.output.area", " &eArea bonus: %money% %points% %exp%"); + c.get("command.bonus.output.mcmmo", " &eMcMMO bonus: %money% %points% %exp%"); c.get("command.bonus.output.final", " &eFinal bonus: %money% %points% %exp%"); c.get("command.convert.help.info", diff --git a/com/gamingmesh/jobs/config/RestrictedAreaManager.java b/com/gamingmesh/jobs/config/RestrictedAreaManager.java index c5d55293..a0b7a26e 100644 --- a/com/gamingmesh/jobs/config/RestrictedAreaManager.java +++ b/com/gamingmesh/jobs/config/RestrictedAreaManager.java @@ -1,112 +1,112 @@ -package com.gamingmesh.jobs.config; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.container.RestrictedArea; -import com.gamingmesh.jobs.stuff.ChatColor; - -public class RestrictedAreaManager { - - protected ArrayList restrictedAreas = new ArrayList(); - - private Jobs plugin; - - public RestrictedAreaManager(Jobs plugin) { - this.plugin = plugin; - } - - /** - * Gets the area multiplier for the player - * @param player - * @return - the multiplier - */ - public synchronized double getRestrictedMultiplier(Player player) { - for (RestrictedArea area : restrictedAreas) { - if (area.inRestrictedArea(player)) - return area.getMultiplier(); - } - return 1.0; - } - - /** - * Method to load the restricted areas configuration - * - * loads from Jobs/restrictedAreas.yml - */ - public synchronized void load() { - this.restrictedAreas.clear(); - File f = new File(plugin.getDataFolder(), "restrictedAreas.yml"); - YamlConfiguration conf = YamlConfiguration.loadConfiguration(f); - conf.options().indent(2); - conf.options().copyDefaults(true); - StringBuilder header = new StringBuilder(); - - header.append("Restricted area configuration"); - header.append(System.getProperty("line.separator")) - .append(System.getProperty("line.separator")) - .append("Configures restricted areas where you cannot get experience or money").append(System.getProperty("line.separator")) - .append("when performing a job.").append(System.getProperty("line.separator")).append(System.getProperty("line.separator")) - .append("The multiplier changes the experience/money gains in an area.").append(System.getProperty("line.separator")) - .append("A multiplier of 0.0 means no money or xp, while 0.5 means you will get half the normal money/exp").append(System.getProperty("line.separator")) - .append(System.getProperty("line.separator")) - .append("restrictedareas:").append(System.getProperty("line.separator")) - .append(" area1:").append(System.getProperty("line.separator")) - .append(" world: 'world'").append(System.getProperty("line.separator")) - .append(" multiplier: 0.0").append(System.getProperty("line.separator")) - .append(" point1:").append(System.getProperty("line.separator")) - .append(" x: 125").append(System.getProperty("line.separator")) - .append(" y: 0").append(System.getProperty("line.separator")) - .append(" z: 125").append(System.getProperty("line.separator")) - .append(" point2:").append(System.getProperty("line.separator")) - .append(" x: 150").append(System.getProperty("line.separator")) - .append(" y: 100").append(System.getProperty("line.separator")) - .append(" z: 150").append(System.getProperty("line.separator")) - .append(" area2:").append(System.getProperty("line.separator")) - .append(" world: 'world_nether'").append(System.getProperty("line.separator")) - .append(" multiplier: 0.0").append(System.getProperty("line.separator")) - .append(" point1:").append(System.getProperty("line.separator")) - .append(" x: -100").append(System.getProperty("line.separator")) - .append(" y: 0").append(System.getProperty("line.separator")) - .append(" z: -100").append(System.getProperty("line.separator")) - .append(" point2:").append(System.getProperty("line.separator")) - .append(" x: -150").append(System.getProperty("line.separator")) - .append(" y: 100").append(System.getProperty("line.separator")) - .append(" z: -150"); - conf.options().header(header.toString()); - ConfigurationSection areaSection = conf.getConfigurationSection("restrictedareas"); - if (areaSection != null) { - for (String areaKey : areaSection.getKeys(false)) { - String worldName = conf.getString("restrictedareas." + areaKey + ".world"); - double multiplier = conf.getDouble("restrictedareas." + areaKey + ".multiplier", 0.0); - World world = Bukkit.getServer().getWorld(worldName); - if (world == null) - continue; - Location point1 = new Location(world, conf.getDouble("restrictedareas." + areaKey + ".point1.x", 0.0), conf.getDouble("restrictedareas." + areaKey - + ".point1.y", 0.0), conf.getDouble("restrictedareas." + areaKey + ".point1.z", 0.0)); - - Location point2 = new Location(world, conf.getDouble("restrictedareas." + areaKey + ".point2.x", 0.0), conf.getDouble("restrictedareas." + areaKey - + ".point2.y", 0.0), conf.getDouble("restrictedareas." + areaKey + ".point2.z", 0.0)); - this.restrictedAreas.add(new RestrictedArea(point1, point2, multiplier)); - } - } - - - Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Loaded " + restrictedAreas.size() + " restricted areas!"); - - try { - conf.save(f); - } catch (IOException e) { - e.printStackTrace(); - } - } -} +package com.gamingmesh.jobs.config; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.container.RestrictedArea; +import com.gamingmesh.jobs.stuff.ChatColor; + +public class RestrictedAreaManager { + + protected ArrayList restrictedAreas = new ArrayList(); + + private Jobs plugin; + + public RestrictedAreaManager(Jobs plugin) { + this.plugin = plugin; + } + + /** + * Gets the area multiplier for the player + * @param player + * @return - the multiplier + */ + public synchronized double getRestrictedMultiplier(Player player) { + for (RestrictedArea area : restrictedAreas) { + if (area.inRestrictedArea(player)) + return area.getMultiplier(); + } + return 0D; + } + + /** + * Method to load the restricted areas configuration + * + * loads from Jobs/restrictedAreas.yml + */ + public synchronized void load() { + this.restrictedAreas.clear(); + File f = new File(plugin.getDataFolder(), "restrictedAreas.yml"); + YamlConfiguration conf = YamlConfiguration.loadConfiguration(f); + conf.options().indent(2); + conf.options().copyDefaults(true); + StringBuilder header = new StringBuilder(); + + header.append("Restricted area configuration"); + header.append(System.getProperty("line.separator")) + .append(System.getProperty("line.separator")) + .append("Configures restricted areas where you cannot get experience or money").append(System.getProperty("line.separator")) + .append("when performing a job.").append(System.getProperty("line.separator")).append(System.getProperty("line.separator")) + .append("The multiplier changes the experience/money gains in an area.").append(System.getProperty("line.separator")) + .append("A multiplier of 0.0 means no money or xp, while 0.5 means you will get half the normal money/exp").append(System.getProperty("line.separator")) + .append(System.getProperty("line.separator")) + .append("restrictedareas:").append(System.getProperty("line.separator")) + .append(" area1:").append(System.getProperty("line.separator")) + .append(" world: 'world'").append(System.getProperty("line.separator")) + .append(" multiplier: 0.0").append(System.getProperty("line.separator")) + .append(" point1:").append(System.getProperty("line.separator")) + .append(" x: 125").append(System.getProperty("line.separator")) + .append(" y: 0").append(System.getProperty("line.separator")) + .append(" z: 125").append(System.getProperty("line.separator")) + .append(" point2:").append(System.getProperty("line.separator")) + .append(" x: 150").append(System.getProperty("line.separator")) + .append(" y: 100").append(System.getProperty("line.separator")) + .append(" z: 150").append(System.getProperty("line.separator")) + .append(" area2:").append(System.getProperty("line.separator")) + .append(" world: 'world_nether'").append(System.getProperty("line.separator")) + .append(" multiplier: 0.0").append(System.getProperty("line.separator")) + .append(" point1:").append(System.getProperty("line.separator")) + .append(" x: -100").append(System.getProperty("line.separator")) + .append(" y: 0").append(System.getProperty("line.separator")) + .append(" z: -100").append(System.getProperty("line.separator")) + .append(" point2:").append(System.getProperty("line.separator")) + .append(" x: -150").append(System.getProperty("line.separator")) + .append(" y: 100").append(System.getProperty("line.separator")) + .append(" z: -150"); + conf.options().header(header.toString()); + ConfigurationSection areaSection = conf.getConfigurationSection("restrictedareas"); + if (areaSection != null) { + for (String areaKey : areaSection.getKeys(false)) { + String worldName = conf.getString("restrictedareas." + areaKey + ".world"); + double multiplier = conf.getDouble("restrictedareas." + areaKey + ".multiplier", 0.0); + World world = Bukkit.getServer().getWorld(worldName); + if (world == null) + continue; + Location point1 = new Location(world, conf.getDouble("restrictedareas." + areaKey + ".point1.x", 0.0), conf.getDouble("restrictedareas." + areaKey + + ".point1.y", 0.0), conf.getDouble("restrictedareas." + areaKey + ".point1.z", 0.0)); + + Location point2 = new Location(world, conf.getDouble("restrictedareas." + areaKey + ".point2.x", 0.0), conf.getDouble("restrictedareas." + areaKey + + ".point2.y", 0.0), conf.getDouble("restrictedareas." + areaKey + ".point2.z", 0.0)); + this.restrictedAreas.add(new RestrictedArea(point1, point2, multiplier)); + } + } + + + Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Loaded " + restrictedAreas.size() + " restricted areas!"); + + try { + conf.save(f); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/com/gamingmesh/jobs/config/ScheduleManager.java b/com/gamingmesh/jobs/config/ScheduleManager.java index 5448a4b9..59dbd3cb 100644 --- a/com/gamingmesh/jobs/config/ScheduleManager.java +++ b/com/gamingmesh/jobs/config/ScheduleManager.java @@ -13,6 +13,8 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.container.BoostMultiplier; +import com.gamingmesh.jobs.container.BoostType; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Schedule; import com.gamingmesh.jobs.stuff.ChatColor; @@ -90,8 +92,7 @@ public class ScheduleManager { } for (Job onejob : one.GetJobs()) { - onejob.setExpBoost(one.GetExpBoost()); - onejob.setMoneyBoost(one.GetMoneyBoost()); + onejob.setBoost(one.getBoost()); } one.setBroadcastInfoOn(System.currentTimeMillis() + one.GetBroadcastInterval() * 60 * 1000); @@ -109,8 +110,7 @@ public class ScheduleManager { Bukkit.broadcastMessage(oneMsg); } for (Job onejob : one.GetJobs()) { - onejob.setExpBoost(1.0); - onejob.setMoneyBoost(1.0); + onejob.setBoost(new BoostMultiplier()); } one.setStoped(true); one.setStarted(false); @@ -191,12 +191,6 @@ public class ScheduleManager { if (!path.contains("Jobs") || !path.isList("Jobs")) continue; - if (!path.contains("Exp") || !path.isDouble("Exp")) - continue; - - if (!path.contains("Money") || !path.isDouble("Money")) - continue; - sched.setDays(path.getStringList("Days")); sched.setJobs(path.getStringList("Jobs")); sched.setFrom(Integer.valueOf(path.getString("From").replace(":", ""))); @@ -220,8 +214,12 @@ public class ScheduleManager { if (path.contains("BroadcastMessage") && path.isList("BroadcastMessage")) sched.setMessageToBroadcast(path.getStringList("BroadcastMessage"), path.getString("From"), path.getString("Until")); - sched.setExpBoost(path.getDouble("Exp")); - sched.setMoneyBoost(path.getDouble("Money")); + if (path.contains("Exp") && path.isDouble("Exp")) + sched.setBoost(BoostType.EXP, path.getDouble("Exp", 0D)); + if (path.contains("Money") && path.isDouble("Money")) + sched.setBoost(BoostType.MONEY, path.getDouble("Money", 0D)); + if (path.contains("Points") && path.isDouble("Points")) + sched.setBoost(BoostType.POINTS, path.getDouble("Points", 0D)); Jobs.getGCManager().BoostSchedule.add(sched); } Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Loaded " + Jobs.getGCManager().BoostSchedule.size() + " schedulers!"); diff --git a/com/gamingmesh/jobs/config/ShopManager.java b/com/gamingmesh/jobs/config/ShopManager.java index a63ad417..b444ca03 100644 --- a/com/gamingmesh/jobs/config/ShopManager.java +++ b/com/gamingmesh/jobs/config/ShopManager.java @@ -1,479 +1,480 @@ -package com.gamingmesh.jobs.config; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.container.JobItems; -import com.gamingmesh.jobs.container.JobProgression; -import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.container.PlayerPoints; -import com.gamingmesh.jobs.container.ShopItem; -import com.gamingmesh.jobs.stuff.Perm; - -public class ShopManager { - private Jobs plugin; - public List list = new ArrayList(); - public HashMap GuiList = new HashMap(); - - public ShopManager(Jobs plugin) { - this.plugin = plugin; - } - - public List getShopItemList() { - return list; - } - - public void openInventory(Player player, int page) { - Inventory inv = Jobs.getShopManager().CreateJobsGUI(player, page); - if (inv == null) { - player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.cantOpen")); - return; - } - Inventory topinv = player.getOpenInventory().getTopInventory(); - if (topinv != null) - player.closeInventory(); - Jobs.getShopManager().GuiList.put(player.getName(), page); - player.openInventory(inv); - } - - public void checkSlot(Player player, int slot, int page) { - - List ls = getItemsByPage(page); - - int GuiSize = getGuiSize(ls, page); - if (slot == getPrevButtonSlot(GuiSize, page)) { - openInventory(player, page - 1); - return; - } - - if (slot == getnextButtonSlot(GuiSize, page)) { - openInventory(player, page + 1); - return; - } - - if (slot > ls.size() - 1) - return; - - ShopItem item = ls.get(slot); - PlayerPoints pointsInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(player.getUniqueId()); - - if (!Perm.hasPermission(player, "jobs.items.bypass")) { - for (String onePerm : item.getRequiredPerm()) { - if (!Perm.hasPermission(player, onePerm)) { - player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoPermForItem")); - return; - } - } - - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - - if (jPlayer == null) - return; - - for (Entry oneJob : item.getRequiredJobs().entrySet()) { - Job tempJob = Jobs.getJob(oneJob.getKey()); - if (tempJob == null) - continue; - JobProgression playerJob = jPlayer.getJobProgression(tempJob); - if (playerJob == null || playerJob.getLevel() < oneJob.getValue()) { - player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoJobReqForitem", - "%jobname%", tempJob.getName(), - "%joblevel%", oneJob.getValue())); - return; - } - } - - if (pointsInfo == null || pointsInfo.getCurrentPoints() < item.getPrice()) { - player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoPoints")); - return; - } - } - - for (String one : item.getCommands()) { - if (one.toLowerCase().startsWith("msg ")) - player.sendMessage(one.substring(4, one.length()).replace("[player]", player.getName())); - else - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[player]", player.getName())); - } - - for (JobItems one : item.getitems()) { - @SuppressWarnings("deprecation") - Material mat = Material.getMaterial(one.getId()); - - if (mat == null) - continue; - - ItemStack itemStack = new ItemStack(mat, one.getAmount(), (byte) one.getData()); - - ItemMeta meta = itemStack.getItemMeta(); - - if (one.getName() != null) - meta.setDisplayName(one.getName()); - - if (one.getLore() != null) - meta.setLore(one.getLore()); - itemStack.setItemMeta(meta); - - if (itemStack.getType() == Material.ENCHANTED_BOOK) { - EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) itemStack.getItemMeta(); - for (Entry oneEnch : one.getEnchants().entrySet()) { - bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true); - } - if (bookMeta != null) - itemStack.setItemMeta(bookMeta); - } else - for (Entry oneEnch : one.getEnchants().entrySet()) { - itemStack.addUnsafeEnchantment(oneEnch.getKey(), oneEnch.getValue()); - } - - player.getInventory().addItem(itemStack); - - } - - if (!Perm.hasPermission(player, "jobs.items.bypass")) { - pointsInfo.takePoints(item.getPrice()); - player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.Paid", "%amount%", item.getPrice())); - } - - player.getOpenInventory().getTopInventory().setContents(CreateJobsGUI(player, page).getContents()); - - } - - private List getItemsByPage(Integer page) { - List ls = new ArrayList(); - for (ShopItem one : list) { - if (one.getPage() == page) - ls.add(one); - } - return ls; - } - - private static int getGuiSize(List ls, int page) { - int GuiSize = 9; - if (ls.size() > 9) - GuiSize = 18; - - if (ls.size() > 18) - GuiSize = 27; - - if (ls.size() > 27) - GuiSize = 36; - - if (ls.size() > 36) - GuiSize = 45; - - if (ls.size() == 45) - GuiSize = 54; - - if (page > 1 && GuiSize < 54) - GuiSize += 9; - - return GuiSize; - } - - private static int getPrevButtonSlot(int GuiSize, int page) { - int prev = -1; - if (page > 1) - prev = GuiSize - 9; - return prev; - } - - private int getnextButtonSlot(int GuiSize, int page) { - int next = -1; - List lsnext = getItemsByPage(page + 1); - if (!lsnext.isEmpty()) - next = GuiSize - 1; - return next; - } - - public Inventory CreateJobsGUI(Player player, Integer page) { - - List ls = getItemsByPage(page); - - if (ls.isEmpty()) - return null; - - int GuiSize = getGuiSize(ls, page); - - String title = Jobs.getLanguage().getMessage("command.shop.info.title"); - if (title.length() > 32) - title = title.substring(0, 30) + ".."; - - PlayerPoints pointsInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(player.getUniqueId()); - double points = 0D; - if (pointsInfo != null) - points = (int) (pointsInfo.getCurrentPoints() * 100.0) / 100.0; - - Inventory GuiInv = Bukkit.createInventory(null, GuiSize, title); - - for (int i = 0; i < ls.size(); i++) { - - ShopItem item = ls.get(i); - - ArrayList Lore = new ArrayList(); - - @SuppressWarnings("deprecation") - Material mat = Material.getMaterial(item.getIconId()); - - if (item.isHideWithoutPerm()) { - for (String onePerm : item.getRequiredPerm()) { - if (!Perm.hasPermission(player, onePerm)) { - mat = Material.STONE_BUTTON; - Lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPermToBuy")); - break; - } - } - } - - if (mat == null) - mat = Material.STONE_BUTTON; - - ItemStack GUIitem = new ItemStack(mat, item.getIconAmount(), (byte) item.getIconData()); - - ItemMeta meta = GUIitem.getItemMeta(); - - if (item.getIconName() != null) - meta.setDisplayName(item.getIconName()); - - Lore.addAll(item.getIconLore()); - - Lore.add(Jobs.getLanguage().getMessage("command.shop.info.currentPoints", "%currentpoints%", points)); - Lore.add(Jobs.getLanguage().getMessage("command.shop.info.price", "%price%", item.getPrice())); - - if (!item.getRequiredJobs().isEmpty()) { - Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobs")); - for (Entry one : item.getRequiredJobs().entrySet()) { - - String jobColor = ""; - String levelColor = ""; - - Job job = Jobs.getJob(one.getKey()); - - JobProgression prog = Jobs.getPlayerManager().getJobsPlayer(player).getJobProgression(job); - if (prog == null) { - jobColor = ChatColor.DARK_RED.toString(); - levelColor = ChatColor.DARK_RED.toString(); - } - - if (prog != null && prog.getLevel() < one.getValue()) - levelColor = ChatColor.DARK_RED.toString(); - - Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobsList", "%jobsname%", jobColor + one.getKey(), "%level%", levelColor + one - .getValue())); - } - } - - meta.setLore(Lore); - GUIitem.setItemMeta(meta); - GuiInv.setItem(i, GUIitem); - } - - ItemStack Item = new ItemStack(Material.ARROW); - - ItemMeta meta = Item.getItemMeta(); - int pervSlot = getPrevButtonSlot(GuiSize, page); - if (pervSlot != -1) { - meta.setDisplayName(Jobs.getLanguage().getMessage("command.help.output.prev")); - Item.setItemMeta(meta); - GuiInv.setItem(pervSlot, Item); - } - - int nextSlot = getnextButtonSlot(GuiSize, page); - if (nextSlot != -1) { - meta.setDisplayName(Jobs.getLanguage().getMessage("command.help.output.next")); - Item.setItemMeta(meta); - GuiInv.setItem(nextSlot, Item); - } - - return GuiInv; - } - - public void load() { - list.clear(); - File file = new File(plugin.getDataFolder(), "shopItems.yml"); - YamlConfiguration f = YamlConfiguration.loadConfiguration(file); - - if (!f.isConfigurationSection("Items")) - return; - - ConfigurationSection ConfCategory = f.getConfigurationSection("Items"); - ArrayList categoriesList = new ArrayList(ConfCategory.getKeys(false)); - if (categoriesList.size() == 0) - return; - int i = 0; - int y = 1; - for (String category : categoriesList) { - ConfigurationSection NameSection = ConfCategory.getConfigurationSection(category); - - if (!NameSection.isDouble("Price")) { - Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid Price property. Skipping!"); - continue; - } - - double price = NameSection.getDouble("Price"); - - if (!NameSection.isInt("Icon.Id")) { - Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid Icon Id property. Skipping!"); - continue; - } - - int IconId = NameSection.getInt("Icon.Id"); - ShopItem Sitem = new ShopItem(category, price, IconId); - - if (NameSection.isInt("Icon.Data")) - Sitem.setIconData(NameSection.getInt("Icon.Data")); - - if (NameSection.isInt("Icon.Amount")) - Sitem.setIconAmount(NameSection.getInt("Icon.Amount")); - - if (NameSection.isString("Icon.Name")) - Sitem.setIconName(ChatColor.translateAlternateColorCodes('&', NameSection.getString("Icon.Name"))); - - if (NameSection.isList("Icon.Lore")) { - List lore = new ArrayList(); - if (NameSection.getStringList("Icon.Lore") != null) - for (String eachLine : NameSection.getStringList("Icon.Lore")) { - lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine)); - } - Sitem.setIconLore(lore); - } - - if (NameSection.isBoolean("Icon.HideWithoutPermission")) { - Sitem.setHideWithoutPerm(NameSection.getBoolean("Icon.HideWithoutPermission")); - } - - if (NameSection.isList("RequiredPermission")) - Sitem.setRequiredPerm(NameSection.getStringList("RequiredPermission")); - - if (NameSection.isList("RequiredJobLevels")) { - HashMap RequiredJobs = new HashMap(); - for (String one : NameSection.getStringList("RequiredJobLevels")) { - if (!one.contains("-")) - continue; - - String job = one.split("-")[0]; - int lvl = -1; - try { - lvl = Integer.parseInt(one.split("-")[1]); - } catch (NumberFormatException e) { - continue; - } - RequiredJobs.put(job, lvl); - } - Sitem.setRequiredJobs(RequiredJobs); - } - - if (NameSection.isList("PerformCommands")) { - List cmd = new ArrayList(); - if (NameSection.getStringList("PerformCommands") != null) - for (String eachLine : NameSection.getStringList("PerformCommands")) { - cmd.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine)); - } - Sitem.setCommands(cmd); - } - - if (NameSection.isConfigurationSection("GiveItems")) { - ConfigurationSection itemsSection = NameSection.getConfigurationSection("GiveItems"); - Set itemKeys = itemsSection.getKeys(false); - - List items = new ArrayList(); - - for (String oneItemName : itemKeys) { - - ConfigurationSection itemSection = itemsSection.getConfigurationSection(oneItemName); - - String node = oneItemName.toLowerCase(); - - int id = itemSection.getInt("Id"); - - int data = 0; - if (itemSection.isInt("Data")) - data = itemSection.getInt("Data"); - - int amount = 1; - if (itemSection.isInt("Amount")) - amount = itemSection.getInt("Amount"); - - String name = null; - if (itemSection.isString("Name")) - name = org.bukkit.ChatColor.translateAlternateColorCodes('&', itemSection.getString("Name")); - - List lore = new ArrayList(); - if (itemSection.getStringList("Lore") != null) - for (String eachLine : itemSection.getStringList("Lore")) { - lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine)); - } - - HashMap enchants = new HashMap(); - if (itemSection.getStringList("Enchants") != null) - for (String eachLine : itemSection.getStringList("Enchants")) { - - if (!eachLine.contains("=")) - continue; - - Enchantment ench = Enchantment.getByName(eachLine.split("=")[0]); - Integer level = -1; - try { - level = Integer.parseInt(eachLine.split("=")[1]); - } catch (NumberFormatException e) { - continue; - } - - if (ench != null && level != -1) - enchants.put(ench, level); - } - - items.add(new JobItems(node, id, data, amount, name, lore, enchants, 0, 0, 0)); - } - Sitem.setitems(items); - } - -// if (list.size() >= 54) { -// Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[Jobs] To many jobs shop items, max allowed is 54! Only first 54 items will be used!"); -// break; -// } - i++; - - if (i > 45) { - i = 1; - y++; - } - - Sitem.setSlot(i); - Sitem.setPage(y); - list.add(Sitem); - } - - if (!list.isEmpty()) - Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] " + list.size() + " shop items loaded!"); - - return; - } - - public void CloseInventories() { - for (Entry one : GuiList.entrySet()) { - Player player = Bukkit.getPlayer(one.getKey()); - if (player != null) { - player.closeInventory(); - } - } - } -} +package com.gamingmesh.jobs.config; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.EnchantmentStorageMeta; +import org.bukkit.inventory.meta.ItemMeta; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.container.BoostMultiplier; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobItems; +import com.gamingmesh.jobs.container.JobProgression; +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.container.PlayerPoints; +import com.gamingmesh.jobs.container.ShopItem; +import com.gamingmesh.jobs.stuff.Perm; + +public class ShopManager { + private Jobs plugin; + public List list = new ArrayList(); + public HashMap GuiList = new HashMap(); + + public ShopManager(Jobs plugin) { + this.plugin = plugin; + } + + public List getShopItemList() { + return list; + } + + public void openInventory(Player player, int page) { + Inventory inv = Jobs.getShopManager().CreateJobsGUI(player, page); + if (inv == null) { + player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.cantOpen")); + return; + } + Inventory topinv = player.getOpenInventory().getTopInventory(); + if (topinv != null) + player.closeInventory(); + Jobs.getShopManager().GuiList.put(player.getName(), page); + player.openInventory(inv); + } + + public void checkSlot(Player player, int slot, int page) { + + List ls = getItemsByPage(page); + + int GuiSize = getGuiSize(ls, page); + if (slot == getPrevButtonSlot(GuiSize, page)) { + openInventory(player, page - 1); + return; + } + + if (slot == getnextButtonSlot(GuiSize, page)) { + openInventory(player, page + 1); + return; + } + + if (slot > ls.size() - 1) + return; + + ShopItem item = ls.get(slot); + PlayerPoints pointsInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(player.getUniqueId()); + + if (!Perm.hasPermission(player, "jobs.items.bypass")) { + for (String onePerm : item.getRequiredPerm()) { + if (!Perm.hasPermission(player, onePerm)) { + player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoPermForItem")); + return; + } + } + + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); + + if (jPlayer == null) + return; + + for (Entry oneJob : item.getRequiredJobs().entrySet()) { + Job tempJob = Jobs.getJob(oneJob.getKey()); + if (tempJob == null) + continue; + JobProgression playerJob = jPlayer.getJobProgression(tempJob); + if (playerJob == null || playerJob.getLevel() < oneJob.getValue()) { + player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoJobReqForitem", + "%jobname%", tempJob.getName(), + "%joblevel%", oneJob.getValue())); + return; + } + } + + if (pointsInfo == null || pointsInfo.getCurrentPoints() < item.getPrice()) { + player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoPoints")); + return; + } + } + + for (String one : item.getCommands()) { + if (one.toLowerCase().startsWith("msg ")) + player.sendMessage(one.substring(4, one.length()).replace("[player]", player.getName())); + else + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[player]", player.getName())); + } + + for (JobItems one : item.getitems()) { + @SuppressWarnings("deprecation") + Material mat = Material.getMaterial(one.getId()); + + if (mat == null) + continue; + + ItemStack itemStack = new ItemStack(mat, one.getAmount(), (byte) one.getData()); + + ItemMeta meta = itemStack.getItemMeta(); + + if (one.getName() != null) + meta.setDisplayName(one.getName()); + + if (one.getLore() != null) + meta.setLore(one.getLore()); + itemStack.setItemMeta(meta); + + if (itemStack.getType() == Material.ENCHANTED_BOOK) { + EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) itemStack.getItemMeta(); + for (Entry oneEnch : one.getEnchants().entrySet()) { + bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true); + } + if (bookMeta != null) + itemStack.setItemMeta(bookMeta); + } else + for (Entry oneEnch : one.getEnchants().entrySet()) { + itemStack.addUnsafeEnchantment(oneEnch.getKey(), oneEnch.getValue()); + } + + player.getInventory().addItem(itemStack); + + } + + if (!Perm.hasPermission(player, "jobs.items.bypass")) { + pointsInfo.takePoints(item.getPrice()); + player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.Paid", "%amount%", item.getPrice())); + } + + player.getOpenInventory().getTopInventory().setContents(CreateJobsGUI(player, page).getContents()); + + } + + private List getItemsByPage(Integer page) { + List ls = new ArrayList(); + for (ShopItem one : list) { + if (one.getPage() == page) + ls.add(one); + } + return ls; + } + + private static int getGuiSize(List ls, int page) { + int GuiSize = 9; + if (ls.size() > 9) + GuiSize = 18; + + if (ls.size() > 18) + GuiSize = 27; + + if (ls.size() > 27) + GuiSize = 36; + + if (ls.size() > 36) + GuiSize = 45; + + if (ls.size() == 45) + GuiSize = 54; + + if (page > 1 && GuiSize < 54) + GuiSize += 9; + + return GuiSize; + } + + private static int getPrevButtonSlot(int GuiSize, int page) { + int prev = -1; + if (page > 1) + prev = GuiSize - 9; + return prev; + } + + private int getnextButtonSlot(int GuiSize, int page) { + int next = -1; + List lsnext = getItemsByPage(page + 1); + if (!lsnext.isEmpty()) + next = GuiSize - 1; + return next; + } + + public Inventory CreateJobsGUI(Player player, Integer page) { + + List ls = getItemsByPage(page); + + if (ls.isEmpty()) + return null; + + int GuiSize = getGuiSize(ls, page); + + String title = Jobs.getLanguage().getMessage("command.shop.info.title"); + if (title.length() > 32) + title = title.substring(0, 30) + ".."; + + PlayerPoints pointsInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(player.getUniqueId()); + double points = 0D; + if (pointsInfo != null) + points = (int) (pointsInfo.getCurrentPoints() * 100.0) / 100.0; + + Inventory GuiInv = Bukkit.createInventory(null, GuiSize, title); + + for (int i = 0; i < ls.size(); i++) { + + ShopItem item = ls.get(i); + + ArrayList Lore = new ArrayList(); + + @SuppressWarnings("deprecation") + Material mat = Material.getMaterial(item.getIconId()); + + if (item.isHideWithoutPerm()) { + for (String onePerm : item.getRequiredPerm()) { + if (!Perm.hasPermission(player, onePerm)) { + mat = Material.STONE_BUTTON; + Lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPermToBuy")); + break; + } + } + } + + if (mat == null) + mat = Material.STONE_BUTTON; + + ItemStack GUIitem = new ItemStack(mat, item.getIconAmount(), (byte) item.getIconData()); + + ItemMeta meta = GUIitem.getItemMeta(); + + if (item.getIconName() != null) + meta.setDisplayName(item.getIconName()); + + Lore.addAll(item.getIconLore()); + + Lore.add(Jobs.getLanguage().getMessage("command.shop.info.currentPoints", "%currentpoints%", points)); + Lore.add(Jobs.getLanguage().getMessage("command.shop.info.price", "%price%", item.getPrice())); + + if (!item.getRequiredJobs().isEmpty()) { + Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobs")); + for (Entry one : item.getRequiredJobs().entrySet()) { + + String jobColor = ""; + String levelColor = ""; + + Job job = Jobs.getJob(one.getKey()); + + JobProgression prog = Jobs.getPlayerManager().getJobsPlayer(player).getJobProgression(job); + if (prog == null) { + jobColor = ChatColor.DARK_RED.toString(); + levelColor = ChatColor.DARK_RED.toString(); + } + + if (prog != null && prog.getLevel() < one.getValue()) + levelColor = ChatColor.DARK_RED.toString(); + + Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobsList", "%jobsname%", jobColor + one.getKey(), "%level%", levelColor + one + .getValue())); + } + } + + meta.setLore(Lore); + GUIitem.setItemMeta(meta); + GuiInv.setItem(i, GUIitem); + } + + ItemStack Item = new ItemStack(Material.ARROW); + + ItemMeta meta = Item.getItemMeta(); + int pervSlot = getPrevButtonSlot(GuiSize, page); + if (pervSlot != -1) { + meta.setDisplayName(Jobs.getLanguage().getMessage("command.help.output.prev")); + Item.setItemMeta(meta); + GuiInv.setItem(pervSlot, Item); + } + + int nextSlot = getnextButtonSlot(GuiSize, page); + if (nextSlot != -1) { + meta.setDisplayName(Jobs.getLanguage().getMessage("command.help.output.next")); + Item.setItemMeta(meta); + GuiInv.setItem(nextSlot, Item); + } + + return GuiInv; + } + + public void load() { + list.clear(); + File file = new File(plugin.getDataFolder(), "shopItems.yml"); + YamlConfiguration f = YamlConfiguration.loadConfiguration(file); + + if (!f.isConfigurationSection("Items")) + return; + + ConfigurationSection ConfCategory = f.getConfigurationSection("Items"); + ArrayList categoriesList = new ArrayList(ConfCategory.getKeys(false)); + if (categoriesList.size() == 0) + return; + int i = 0; + int y = 1; + for (String category : categoriesList) { + ConfigurationSection NameSection = ConfCategory.getConfigurationSection(category); + + if (!NameSection.isDouble("Price")) { + Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid Price property. Skipping!"); + continue; + } + + double price = NameSection.getDouble("Price"); + + if (!NameSection.isInt("Icon.Id")) { + Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid Icon Id property. Skipping!"); + continue; + } + + int IconId = NameSection.getInt("Icon.Id"); + ShopItem Sitem = new ShopItem(category, price, IconId); + + if (NameSection.isInt("Icon.Data")) + Sitem.setIconData(NameSection.getInt("Icon.Data")); + + if (NameSection.isInt("Icon.Amount")) + Sitem.setIconAmount(NameSection.getInt("Icon.Amount")); + + if (NameSection.isString("Icon.Name")) + Sitem.setIconName(ChatColor.translateAlternateColorCodes('&', NameSection.getString("Icon.Name"))); + + if (NameSection.isList("Icon.Lore")) { + List lore = new ArrayList(); + if (NameSection.getStringList("Icon.Lore") != null) + for (String eachLine : NameSection.getStringList("Icon.Lore")) { + lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine)); + } + Sitem.setIconLore(lore); + } + + if (NameSection.isBoolean("Icon.HideWithoutPermission")) { + Sitem.setHideWithoutPerm(NameSection.getBoolean("Icon.HideWithoutPermission")); + } + + if (NameSection.isList("RequiredPermission")) + Sitem.setRequiredPerm(NameSection.getStringList("RequiredPermission")); + + if (NameSection.isList("RequiredJobLevels")) { + HashMap RequiredJobs = new HashMap(); + for (String one : NameSection.getStringList("RequiredJobLevels")) { + if (!one.contains("-")) + continue; + + String job = one.split("-")[0]; + int lvl = -1; + try { + lvl = Integer.parseInt(one.split("-")[1]); + } catch (NumberFormatException e) { + continue; + } + RequiredJobs.put(job, lvl); + } + Sitem.setRequiredJobs(RequiredJobs); + } + + if (NameSection.isList("PerformCommands")) { + List cmd = new ArrayList(); + if (NameSection.getStringList("PerformCommands") != null) + for (String eachLine : NameSection.getStringList("PerformCommands")) { + cmd.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine)); + } + Sitem.setCommands(cmd); + } + + if (NameSection.isConfigurationSection("GiveItems")) { + ConfigurationSection itemsSection = NameSection.getConfigurationSection("GiveItems"); + Set itemKeys = itemsSection.getKeys(false); + + List items = new ArrayList(); + + for (String oneItemName : itemKeys) { + + ConfigurationSection itemSection = itemsSection.getConfigurationSection(oneItemName); + + String node = oneItemName.toLowerCase(); + + int id = itemSection.getInt("Id"); + + int data = 0; + if (itemSection.isInt("Data")) + data = itemSection.getInt("Data"); + + int amount = 1; + if (itemSection.isInt("Amount")) + amount = itemSection.getInt("Amount"); + + String name = null; + if (itemSection.isString("Name")) + name = org.bukkit.ChatColor.translateAlternateColorCodes('&', itemSection.getString("Name")); + + List lore = new ArrayList(); + if (itemSection.getStringList("Lore") != null) + for (String eachLine : itemSection.getStringList("Lore")) { + lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine)); + } + + HashMap enchants = new HashMap(); + if (itemSection.getStringList("Enchants") != null) + for (String eachLine : itemSection.getStringList("Enchants")) { + + if (!eachLine.contains("=")) + continue; + + Enchantment ench = Enchantment.getByName(eachLine.split("=")[0]); + Integer level = -1; + try { + level = Integer.parseInt(eachLine.split("=")[1]); + } catch (NumberFormatException e) { + continue; + } + + if (ench != null && level != -1) + enchants.put(ench, level); + } + + items.add(new JobItems(node, id, data, amount, name, lore, enchants, new BoostMultiplier())); + } + Sitem.setitems(items); + } + +// if (list.size() >= 54) { +// Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[Jobs] To many jobs shop items, max allowed is 54! Only first 54 items will be used!"); +// break; +// } + i++; + + if (i > 45) { + i = 1; + y++; + } + + Sitem.setSlot(i); + Sitem.setPage(y); + list.add(Sitem); + } + + if (!list.isEmpty()) + Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] " + list.size() + " shop items loaded!"); + + return; + } + + public void CloseInventories() { + for (Entry one : GuiList.entrySet()) { + Player player = Bukkit.getPlayer(one.getKey()); + if (player != null) { + player.closeInventory(); + } + } + } +} diff --git a/com/gamingmesh/jobs/container/.gitignore b/com/gamingmesh/jobs/container/.gitignore index 19d175a6..661cb881 100644 --- a/com/gamingmesh/jobs/container/.gitignore +++ b/com/gamingmesh/jobs/container/.gitignore @@ -41,3 +41,4 @@ /BlockProtection.class /BpDBAction.class /DBAction.class +/Boost.class diff --git a/com/gamingmesh/jobs/container/Boost.java b/com/gamingmesh/jobs/container/Boost.java new file mode 100644 index 00000000..3a3233f1 --- /dev/null +++ b/com/gamingmesh/jobs/container/Boost.java @@ -0,0 +1,59 @@ +package com.gamingmesh.jobs.container; + +import java.util.HashMap; + +import com.gamingmesh.jobs.PlayerManager.BoostOf; + +public class Boost { + + HashMap map = new HashMap(); + + public Boost() { + for (BoostOf one : BoostOf.values()) { + map.put(one, new BoostMultiplier()); + } + } + + public void add(BoostOf boostoff, BoostMultiplier BM) { + map.put(boostoff, BM); + } + + public BoostMultiplier get(BoostOf boostoff) { + if (!map.containsKey(boostoff)) + return new BoostMultiplier(); + return map.get(boostoff); + } + + public double get(BoostOf boostoff, BoostType BT) { + return get(boostoff, BT, false); + } + + public double get(BoostOf boostoff, BoostType BT, boolean percent) { + if (!map.containsKey(boostoff)) + return 0D; + double r = map.get(boostoff).get(BT); + if (r < -1) + r = -1; + if (percent) + return (int)(r * 100); + return r; + } + + public double getFinal(BoostType BT) { + return getFinal(BT, false); + } + + public double getFinal(BoostType BT, boolean percent) { + double r = 0D; + for (BoostOf one : BoostOf.values()) { + if (!map.containsKey(one)) + continue; + r += map.get(one).get(BT); + } + if (r < -1) + r = -1; + if (percent) + return (int)(r * 100); + return r; + } +} diff --git a/com/gamingmesh/jobs/container/BoostMultiplier.java b/com/gamingmesh/jobs/container/BoostMultiplier.java index f2553b80..670b0b8d 100644 --- a/com/gamingmesh/jobs/container/BoostMultiplier.java +++ b/com/gamingmesh/jobs/container/BoostMultiplier.java @@ -1,25 +1,39 @@ -package com.gamingmesh.jobs.container; - -public class BoostMultiplier { - double money; - double points; - double exp; - - public BoostMultiplier(double money, double points, double exp) { - this.money = money; - this.points = points; - this.exp = exp; - } - - public double getMoneyBoost() { - return this.money; - } - - public double getPointsBoost() { - return this.points; - } - - public double getExpBoost() { - return this.exp; - } -} +package com.gamingmesh.jobs.container; + +import java.util.HashMap; + +public class BoostMultiplier { + + HashMap map = new HashMap(); + + public BoostMultiplier() { + for (BoostType one : BoostType.values()) { + map.put(one, 0D); + } + } + + public BoostMultiplier add(BoostType type, double amount) { + map.put(type, amount); + return this; + } + + public BoostMultiplier add(double amount) { + for (BoostType one : BoostType.values()) { + map.put(one, amount); + } + return this; + } + + public double get(BoostType type) { + if (!map.containsKey(type)) + return 0D; + return this.map.get(type); + } + + public void add(BoostMultiplier armorboost) { + for (BoostType one : BoostType.values()) { + double r = armorboost.get(one); + map.put(one, get(one) + r); + } + } +} diff --git a/com/gamingmesh/jobs/container/Job.java b/com/gamingmesh/jobs/container/Job.java index 544538e0..f7e599a0 100644 --- a/com/gamingmesh/jobs/container/Job.java +++ b/com/gamingmesh/jobs/container/Job.java @@ -71,11 +71,7 @@ public class Job { private int totalPlayers = -1; private double bonus = 0.0; - private double ExpBoost = 1.0; - - private double MoneyBoost = 1.0; - - private double PointBoost = 1.0; + private BoostMultiplier boost = new BoostMultiplier(); /** * Constructor @@ -117,34 +113,22 @@ public class Job { this.CmdOnLeave = CmdOnLeave; this.GUIitem = GUIitem; } + + public void addBoost(BoostType type, double Point) { + this.boost.add(type, Point - 1D); + } - public void setPointBoost(double Point) { - this.PointBoost = Point; + public void setBoost(BoostMultiplier BM) { + this.boost = BM; + } + + public BoostMultiplier getBoost() { + return this.boost; } public boolean isSame(Job job) { return this.getName().equalsIgnoreCase(job.getName()); } - - public double getPointBoost() { - return this.PointBoost; - } - - public void setMoneyBoost(double amount) { - this.MoneyBoost = amount; - } - - public double getMoneyBoost() { - return this.MoneyBoost; - } - - public void setExpBoost(double amount) { - this.ExpBoost = amount; - } - - public double getExpBoost() { - return this.ExpBoost; - } public int getTotalPlayers() { if (this.totalPlayers == -1) { @@ -220,10 +204,10 @@ public class Job { public EnumMap> getJobInfoList() { return jobInfo; } - + public JobInfo getJobInfo(ActionInfo action, int level) { for (JobInfo info : getJobInfo(action.getType())) { - if (info.getName().equalsIgnoreCase(action.getName()) || info.getName().equalsIgnoreCase(action.getNameWithSub())){ + if (info.getName().equalsIgnoreCase(action.getName()) || info.getName().equalsIgnoreCase(action.getNameWithSub())) { if (!info.isInLevelRange(level)) break; return info; diff --git a/com/gamingmesh/jobs/container/JobItems.java b/com/gamingmesh/jobs/container/JobItems.java index d572fa30..7f571219 100644 --- a/com/gamingmesh/jobs/container/JobItems.java +++ b/com/gamingmesh/jobs/container/JobItems.java @@ -31,12 +31,9 @@ public class JobItems { private String name; private List lore; private HashMap enchants; - private Double moneyBoost = 0D; - private Double pointBoost = 0D; - private Double expBoost = 0D; + private BoostMultiplier boostMultiplier = new BoostMultiplier(); - public JobItems(String node, int id, int data, int amount, String name, List lore, HashMap enchants, double moneyBoost, - double pointBoost, double expBoost) { + public JobItems(String node, int id, int data, int amount, String name, List lore, HashMap enchants, BoostMultiplier boostMultiplier) { this.node = node; this.id = id; this.data = data; @@ -44,9 +41,7 @@ public class JobItems { this.name = name; this.lore = lore; this.enchants = enchants; - this.moneyBoost = moneyBoost; - this.pointBoost = pointBoost; - this.expBoost = expBoost; + this.boostMultiplier = boostMultiplier; } public String getNode() { @@ -77,15 +72,7 @@ public class JobItems { return this.enchants; } - public Double getMoneyBoost() { - return this.moneyBoost; - } - - public Double getPointBoost() { - return this.pointBoost; - } - - public Double getExpBoost() { - return this.expBoost; + public BoostMultiplier getBoost() { + return this.boostMultiplier; } } diff --git a/com/gamingmesh/jobs/container/JobsPlayer.java b/com/gamingmesh/jobs/container/JobsPlayer.java index 5ee0ba95..746e2b55 100644 --- a/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/com/gamingmesh/jobs/container/JobsPlayer.java @@ -53,7 +53,7 @@ public class JobsPlayer { private OfflinePlayer OffPlayer = null; private Player player = null; - private double VipSpawnerMultiplier = -1; + private double VipSpawnerMultiplier = 0D; private int MoneyLimit = 0; private int ExpLimit = 0; @@ -70,7 +70,7 @@ public class JobsPlayer { private List logList = new ArrayList(); private Long seen; - + public JobsPlayer(String userName, OfflinePlayer player) { this.userName = userName; this.OffPlayer = player; @@ -131,7 +131,7 @@ public class JobsPlayer { */ public double getVipSpawnerMultiplier() { if (this.getPlayer() == null || !this.getPlayer().isOnline()) - return 1.0; + return 0D; if (VipSpawnerMultiplier < 0) updateVipSpawnerMultiplier(); return this.VipSpawnerMultiplier; @@ -139,9 +139,9 @@ public class JobsPlayer { public void updateVipSpawnerMultiplier() { if (Perm.hasPermission(this.player, "jobs.vipspawner")) - this.VipSpawnerMultiplier = Jobs.getGCManager().VIPpayNearSpawnerMultiplier; + this.VipSpawnerMultiplier = Jobs.getGCManager().VIPpayNearSpawnerMultiplier - 1; else - this.VipSpawnerMultiplier = Jobs.getGCManager().payNearSpawnerMultiplier; + this.VipSpawnerMultiplier = Jobs.getGCManager().payNearSpawnerMultiplier - 1; } /** diff --git a/com/gamingmesh/jobs/container/RestrictedArea.java b/com/gamingmesh/jobs/container/RestrictedArea.java index 9b1b3e32..1e1ae3f2 100644 --- a/com/gamingmesh/jobs/container/RestrictedArea.java +++ b/com/gamingmesh/jobs/container/RestrictedArea.java @@ -33,20 +33,20 @@ public class RestrictedArea { private Location location1; private Location location2; private double multiplier; - + public RestrictedArea(Location location1, Location location2, double multiplier) { - this.location1 = location1; - this.location2 = location2; - this.multiplier = multiplier; + this.location1 = location1; + this.location2 = location2; + this.multiplier = multiplier; } - + /** * The multipler for the restricted area * @return - the multipler for this restricted area */ - + public double getMultiplier() { - return this.multiplier; + return this.multiplier - 1; } /** @@ -56,16 +56,16 @@ public class RestrictedArea { * @return false - the location is outside the restricted area */ public boolean inRestrictedArea(Player player) { - if(isBetween(player.getLocation().getX(), this.location1.getX(), this.location2.getX()) && - isBetween(player.getLocation().getY(), this.location1.getY(), this.location2.getY()) && - isBetween(player.getLocation().getZ(), this.location1.getZ(), this.location2.getZ()) && - this.location1.getWorld().equals(player.getLocation().getWorld()) && - this.location2.getWorld().equals(player.getLocation().getWorld())) { - return true; - } - return false; + if (isBetween(player.getLocation().getX(), this.location1.getX(), this.location2.getX()) && + isBetween(player.getLocation().getY(), this.location1.getY(), this.location2.getY()) && + isBetween(player.getLocation().getZ(), this.location1.getZ(), this.location2.getZ()) && + this.location1.getWorld().equals(player.getLocation().getWorld()) && + this.location2.getWorld().equals(player.getLocation().getWorld())) { + return true; + } + return false; } - + /** * Function check if number is between bounds * @param number - the number to be checked @@ -75,11 +75,11 @@ public class RestrictedArea { * @return false - number is out of bounds */ private static boolean isBetween(double number, double bound1, double bound2) { - if(bound1 < bound2 && number > bound1 && number < bound2) { - return true; - } else if (bound1 > bound2 && number < bound1 && number > bound2) { - return true; - } - return false; + if (bound1 < bound2 && number > bound1 && number < bound2) { + return true; + } else if (bound1 > bound2 && number < bound1 && number > bound2) { + return true; + } + return false; } } diff --git a/com/gamingmesh/jobs/container/Schedule.java b/com/gamingmesh/jobs/container/Schedule.java index 2f5f11bd..3fc0c96e 100644 --- a/com/gamingmesh/jobs/container/Schedule.java +++ b/com/gamingmesh/jobs/container/Schedule.java @@ -18,8 +18,7 @@ public class Schedule { boolean nextDay = false; - double MoneyBoost = 1.0; - double ExpBoost = 1.0; + BoostMultiplier BM = new BoostMultiplier(); String Name = null; @@ -83,20 +82,16 @@ public class Schedule { return this.stoped; } - public void setMoneyBoost(double MoneyBoost) { - this.MoneyBoost = MoneyBoost; + public void setBoost(BoostType type, double amount) { + this.BM.add(type, amount - 1); } - public double GetMoneyBoost() { - return this.MoneyBoost; + public double getBoost(BoostType type) { + return this.BM.get(type); } - public void setExpBoost(double ExpBoost) { - this.ExpBoost = ExpBoost; - } - - public double GetExpBoost() { - return this.ExpBoost; + public BoostMultiplier getBoost() { + return this.BM; } public void setName(String Name) { diff --git a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 7a7ef639..0cb36b8c 100644 --- a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -83,14 +83,12 @@ import com.gamingmesh.jobs.container.FastPayment; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.ChatColor; -import com.gamingmesh.jobs.stuff.Perm; import com.google.common.base.Objects; public class JobsPaymentListener implements Listener { private Jobs plugin; private final String furnaceOwnerMetadata = "jobsFurnaceOwner"; public final static String brewingOwnerMetadata = "jobsBrewingOwner"; - private final String mobSpawnerMetadata = "jobsMobSpawner"; public static final String BlockMetadata = "BlockOwner"; public static final String PlacedBlockMetadata = "JobsBlockOwner"; public static final String VegyMetadata = "VegyTimer"; @@ -157,7 +155,7 @@ public class JobsPaymentListener implements Listener { if (jPlayer == null) return; - Jobs.action(jPlayer, new EntityActionInfo(cow, ActionType.MILK), 0.0); + Jobs.action(jPlayer, new EntityActionInfo(cow, ActionType.MILK)); Long Timer = System.currentTimeMillis(); @@ -175,8 +173,8 @@ public class JobsPaymentListener implements Listener { Sheep sheep = (Sheep) event.getEntity(); // mob spawner, no payment or experience - if (sheep.hasMetadata(this.mobSpawnerMetadata)) { - sheep.removeMetadata(this.mobSpawnerMetadata, this.plugin); + if (sheep.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) { + sheep.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), this.plugin); return; } @@ -201,7 +199,7 @@ public class JobsPaymentListener implements Listener { if (jDamager == null) return; - Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR), 0.0); + Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -239,7 +237,7 @@ public class JobsPaymentListener implements Listener { if (contents == null) return; - Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW), 0.0); + Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -280,10 +278,6 @@ public class JobsPaymentListener implements Listener { } // restricted area multiplier - double multiplier = 0.0; - - if (Jobs.getMcMMOlistener().mcMMOPresent) - multiplier = Jobs.getMcMMOlistener().getMultiplier(player) * 100 - 100; // Item in hand ItemStack item = Jobs.getNms().getItemInMainHand(player); @@ -299,7 +293,7 @@ public class JobsPaymentListener implements Listener { return; BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK); - Jobs.action(jPlayer, bInfo, multiplier, block); + Jobs.action(jPlayer, bInfo, block); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -342,7 +336,7 @@ public class JobsPaymentListener implements Listener { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); if (jPlayer == null) return; - Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.PLACE), 0.0, block); + Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.PLACE), block); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -368,7 +362,7 @@ public class JobsPaymentListener implements Listener { if (jPlayer == null) return; ItemStack items = ((Item) event.getCaught()).getItemStack(); - Jobs.action(jPlayer, new ItemActionInfo(items, ActionType.FISH), 0.0); + Jobs.action(jPlayer, new ItemActionInfo(items, ActionType.FISH)); } } @@ -382,8 +376,8 @@ public class JobsPaymentListener implements Listener { LivingEntity animal = event.getEntity(); // mob spawner, no payment or experience - if (animal.hasMetadata(this.mobSpawnerMetadata)) { - animal.removeMetadata(this.mobSpawnerMetadata, this.plugin); + if (animal.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) { + animal.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), this.plugin); return; } @@ -406,7 +400,7 @@ public class JobsPaymentListener implements Listener { JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player); if (jDamager == null) return; - Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.TAME), 0.0); + Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.TAME)); } @@ -460,8 +454,6 @@ public class JobsPaymentListener implements Listener { if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative()) return; - double multiplier = 0.0; - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); // Checking if item is been repaired, not crafted. Combining 2 items @@ -497,7 +489,7 @@ public class JobsPaymentListener implements Listener { if (y == 2) { if (first == second && third == second) { - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR), multiplier); + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR)); return; } } @@ -505,9 +497,9 @@ public class JobsPaymentListener implements Listener { // Check Dyes if (y >= 2) { if ((third == 351 || second == 351) && leather) { - Jobs.action(jPlayer, new ItemActionInfo(sourceItems[0], ActionType.DYE), multiplier); + Jobs.action(jPlayer, new ItemActionInfo(sourceItems[0], ActionType.DYE)); for (ItemStack OneDye : DyeStack) { - Jobs.action(jPlayer, new ItemActionInfo(OneDye, ActionType.DYE), multiplier); + Jobs.action(jPlayer, new ItemActionInfo(OneDye, ActionType.DYE)); } return; } @@ -515,7 +507,7 @@ public class JobsPaymentListener implements Listener { // If we need to pay only by each craft action we will skip calculation how much was crafted if (!Jobs.getGCManager().PayForEachCraft) { - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT), multiplier); + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT)); return; } @@ -525,14 +517,14 @@ public class JobsPaymentListener implements Listener { // Make sure we are actually crafting anything if (hasItems(toCraft)) if (event.isShiftClick()) - schedulePostDetection(player, toCraft, jPlayer, resultStack, multiplier); + schedulePostDetection(player, toCraft, jPlayer, resultStack); else { // The items are stored in the cursor. Make sure there's enough space. if (isStackSumLegal(toCraft, toStore)) { int newItemsCount = toCraft.getAmount(); while (newItemsCount >= 0) { newItemsCount--; - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT), multiplier); + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT)); } } } @@ -541,8 +533,7 @@ public class JobsPaymentListener implements Listener { // HACK! The API doesn't allow us to easily determine the resulting number of // crafted items, so we're forced to compare the inventory before and after. - private Integer schedulePostDetection(final HumanEntity player, final ItemStack compareItem, final JobsPlayer jPlayer, final ItemStack resultStack, - final double multiplier) { + private Integer schedulePostDetection(final HumanEntity player, final ItemStack compareItem, final JobsPlayer jPlayer, final ItemStack resultStack) { final ItemStack[] preInv = player.getInventory().getContents(); // Clone the array. The content may (was for me) be mutable. for (int i = 0; i < preInv.length; i++) { @@ -566,7 +557,7 @@ public class JobsPaymentListener implements Listener { if (newItemsCount > 0) { while (newItemsCount >= 0) { newItemsCount--; - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT), multiplier); + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT)); } } return; @@ -668,7 +659,7 @@ public class JobsPaymentListener implements Listener { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); if (jPlayer == null) return; - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR), 0.0); + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -721,9 +712,9 @@ public class JobsPaymentListener implements Listener { if (level == null) continue; - Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT), 0.0); + Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT)); } - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT), 0.0); + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT)); } @@ -757,7 +748,7 @@ public class JobsPaymentListener implements Listener { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); if (jPlayer == null) return; - Jobs.action(jPlayer, new ItemActionInfo(event.getResult(), ActionType.SMELT), 0.0); + Jobs.action(jPlayer, new ItemActionInfo(event.getResult(), ActionType.SMELT)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -788,7 +779,7 @@ public class JobsPaymentListener implements Listener { } // mob spawner, no payment or experience - if (lVictim.hasMetadata(this.mobSpawnerMetadata) && !Jobs.getGCManager().payNearSpawner()) { + if (lVictim.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata()) && !Jobs.getGCManager().payNearSpawner()) { //lVictim.removeMetadata(mobSpawnerMetadata, plugin); return; } @@ -799,20 +790,11 @@ public class JobsPaymentListener implements Listener { Player pDamager = null; - Double PetPayMultiplier = 0.0; // Checking if killer is player if (e.getDamager() instanceof Player) { pDamager = (Player) e.getDamager(); // Checking if killer is tamed animal } else if (e.getDamager() instanceof Tameable) { - Tameable t = (Tameable) (e).getDamager(); - if (t.isTamed() && t.getOwner() instanceof Player) { - pDamager = (Player) t.getOwner(); - if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay")) - PetPayMultiplier = Jobs.getGCManager().VipPetPay * 100 - 100; - else - PetPayMultiplier = Jobs.getGCManager().PetPay * 100 - 100; - } } else if (e.getDamager() instanceof Projectile) { Projectile pr = (Projectile) e.getDamager(); if (pr.getShooter() instanceof Player) @@ -835,20 +817,13 @@ public class JobsPaymentListener implements Listener { if (jDamager == null) return; - Double NearSpawnerMultiplier = 0.0; - if (lVictim.hasMetadata(this.mobSpawnerMetadata)) - NearSpawnerMultiplier = jDamager.getVipSpawnerMultiplier() * 100 - 100; - - // Calulating multiplaier - double multiplier = NearSpawnerMultiplier + PetPayMultiplier; - if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) { Player VPlayer = (Player) lVictim; if (jDamager.getUserName().equalsIgnoreCase(VPlayer.getName())) return; } - Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), multiplier); + Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), e.getDamager(), lVictim); // Payment for killing player with particular job, except NPC's if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) { @@ -860,7 +835,7 @@ public class JobsPaymentListener implements Listener { if (jobs == null) return; for (JobProgression job : jobs) { - Jobs.action(jDamager, new CustomKillInfo(job.getJob().getName(), ActionType.CUSTOMKILL), multiplier); + Jobs.action(jDamager, new CustomKillInfo(job.getJob().getName(), ActionType.CUSTOMKILL), e.getDamager(), lVictim); } } } @@ -872,7 +847,7 @@ public class JobsPaymentListener implements Listener { return; if (event.getSpawnReason() == SpawnReason.SPAWNER) { LivingEntity creature = event.getEntity(); - creature.setMetadata(this.mobSpawnerMetadata, new FixedMetadataValue(this.plugin, true)); + creature.setMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), new FixedMetadataValue(this.plugin, true)); } } @@ -881,7 +856,7 @@ public class JobsPaymentListener implements Listener { //disabling plugin in world if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) return; - if (!event.getEntity().hasMetadata(this.mobSpawnerMetadata)) + if (!event.getEntity().hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) return; EntityType type = event.getEntityType(); @@ -941,7 +916,7 @@ public class JobsPaymentListener implements Listener { JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player); if (jDamager == null) return; - Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.BREED), 0.0); + Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.BREED)); } } @@ -983,7 +958,7 @@ public class JobsPaymentListener implements Listener { if (jPlayer == null) return; - Jobs.action(jPlayer, new ItemActionInfo(item, ActionType.EAT), 0.0); + Jobs.action(jPlayer, new ItemActionInfo(item, ActionType.EAT)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -1045,7 +1020,7 @@ public class JobsPaymentListener implements Listener { return; BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.TNTBREAK); - Jobs.action(jPlayer, bInfo, 0.0); + Jobs.action(jPlayer, bInfo); } } @@ -1112,6 +1087,6 @@ public class JobsPaymentListener implements Listener { if (jPlayer == null) return; - Jobs.action(jPlayer, new ExploreActionInfo(String.valueOf(respond.getCount()), ActionType.EXPLORE), 0.0); + Jobs.action(jPlayer, new ExploreActionInfo(String.valueOf(respond.getCount()), ActionType.EXPLORE)); } } diff --git a/com/gamingmesh/jobs/listeners/McMMOlistener.java b/com/gamingmesh/jobs/listeners/McMMOlistener.java index c5f5074b..cb872ff1 100644 --- a/com/gamingmesh/jobs/listeners/McMMOlistener.java +++ b/com/gamingmesh/jobs/listeners/McMMOlistener.java @@ -16,6 +16,7 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.actions.ItemActionInfo; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.stuff.Debug; import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent; import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent; @@ -56,10 +57,10 @@ public class McMMOlistener implements Listener { return; JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR), 0.0); + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR)); } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) { HashMap InfoMap = new HashMap(); if (map.containsKey(event.getPlayer().getName())) @@ -68,7 +69,7 @@ public class McMMOlistener implements Listener { map.put(event.getPlayer().getName(), InfoMap); } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void OnAbilityOff(McMMOPlayerAbilityDeactivateEvent event) { if (map.containsKey(event.getPlayer().getName())) { HashMap InfoMap = map.get(event.getPlayer().getName()); @@ -81,30 +82,32 @@ public class McMMOlistener implements Listener { public double getMultiplier(Player player) { HashMap InfoMap = map.get(player.getName()); - if (InfoMap == null) - return 1.0; + if (InfoMap == null) { + return 0D; + } Long t = InfoMap.get(AbilityType.TREE_FELLER); if (t != null) { if (t < System.currentTimeMillis()) - return Jobs.getGCManager().TreeFellerMultiplier; + return -(1-Jobs.getGCManager().TreeFellerMultiplier); map.remove(AbilityType.TREE_FELLER); } t = InfoMap.get(AbilityType.GIGA_DRILL_BREAKER); if (t != null) { if (t < System.currentTimeMillis()) - return Jobs.getGCManager().gigaDrillMultiplier; + return -(1-Jobs.getGCManager().gigaDrillMultiplier); map.remove(AbilityType.GIGA_DRILL_BREAKER); } t = InfoMap.get(AbilityType.SUPER_BREAKER); if (t != null) { if (t < System.currentTimeMillis()) - return Jobs.getGCManager().superBreakerMultiplier; + return -(1-Jobs.getGCManager().superBreakerMultiplier); map.remove(AbilityType.SUPER_BREAKER); } - return 1.0; + + return 0D; } public boolean CheckmcMMO() { diff --git a/com/gamingmesh/jobs/listeners/MythicMobsListener.java b/com/gamingmesh/jobs/listeners/MythicMobsListener.java index 9014cfed..3e3a0d37 100644 --- a/com/gamingmesh/jobs/listeners/MythicMobsListener.java +++ b/com/gamingmesh/jobs/listeners/MythicMobsListener.java @@ -1,108 +1,97 @@ -package com.gamingmesh.jobs.listeners; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Tameable; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.plugin.Plugin; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.actions.MMKillInfo; -import com.gamingmesh.jobs.container.ActionType; -import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.stuff.Perm; - -import net.elseland.xikage.MythicMobs.MythicMobs; -import net.elseland.xikage.MythicMobs.API.MythicMobsAPI; -import net.elseland.xikage.MythicMobs.API.Bukkit.Events.MythicMobDeathEvent; -import net.elseland.xikage.MythicMobs.Mobs.MythicMob; - -public class MythicMobsListener implements Listener { - - private Jobs plugin; - public MythicMobsAPI MMAPI = null; - - public MythicMobsListener(Jobs plugin) { - this.plugin = plugin; - } - - @EventHandler - public void OnMythicMobDeath(MythicMobDeathEvent event) { - //disabling plugin in world - if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) - return; - // Entity that died must be living - if (!(event.getEntity() instanceof LivingEntity)) - return; - MythicMob lVictim = event.getMobType(); - - // make sure plugin is enabled - if (!plugin.isEnabled()) - return; - - Player pDamager = null; - - Double PetPayMultiplier = 0.0; - // Checking if killer is player - if (event.getKiller() instanceof Player) - pDamager = (Player) event.getKiller(); - // Checking if killer is tamed animal - else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) { - if (((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager() instanceof Tameable) { - Tameable t = (Tameable) ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager(); - if (t.isTamed() && t.getOwner() instanceof Player) { - pDamager = (Player) t.getOwner(); - if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay")) - PetPayMultiplier = Jobs.getGCManager().VipPetPay; - else - PetPayMultiplier = Jobs.getGCManager().PetPay; - } - } - } else - return; - - if (pDamager == null) - return; - // check if in creative - if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative()) - return; - - if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName())) - return; - - // pay - JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager); - - if (jDamager == null) - return; - - Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), PetPayMultiplier); - } - - public boolean Check() { - Plugin mm = Bukkit.getPluginManager().getPlugin("MythicMobs"); - if (mm == null) - return false; - - try { - Class.forName("net.elseland.xikage.MythicMobs.API.Bukkit.Events.MythicMobDeathEvent"); - Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI"); - Class.forName("net.elseland.xikage.MythicMobs.Mobs.MythicMob"); - } catch (ClassNotFoundException e) { - // Disabling - Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', - "&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support.")); - return false; - } - - MMAPI = ((MythicMobs) mm).getAPI(); - Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &6MythicMobs was found - Enabling capabilities.")); - return true; - - } -} +package com.gamingmesh.jobs.listeners; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.plugin.Plugin; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.actions.MMKillInfo; +import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.JobsPlayer; +import net.elseland.xikage.MythicMobs.MythicMobs; +import net.elseland.xikage.MythicMobs.API.MythicMobsAPI; +import net.elseland.xikage.MythicMobs.API.Bukkit.Events.MythicMobDeathEvent; +import net.elseland.xikage.MythicMobs.Mobs.MythicMob; + +public class MythicMobsListener implements Listener { + + private Jobs plugin; + public MythicMobsAPI MMAPI = null; + + public MythicMobsListener(Jobs plugin) { + this.plugin = plugin; + } + + @EventHandler + public void OnMythicMobDeath(MythicMobDeathEvent event) { + //disabling plugin in world + if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) + return; + // Entity that died must be living + if (!(event.getEntity() instanceof LivingEntity)) + return; + MythicMob lVictim = event.getMobType(); + + // make sure plugin is enabled + if (!plugin.isEnabled()) + return; + + Player pDamager = null; + + // Checking if killer is player + Entity ent = null; + if (event.getKiller() instanceof Player) + pDamager = (Player) event.getKiller(); + // Checking if killer is tamed animal + else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) { + ent = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager(); + } else + return; + + if (pDamager == null) + return; + // check if in creative + if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative()) + return; + + if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName())) + return; + + // pay + JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager); + + if (jDamager == null) + return; + + Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent); + } + + public boolean Check() { + Plugin mm = Bukkit.getPluginManager().getPlugin("MythicMobs"); + if (mm == null) + return false; + + try { + Class.forName("net.elseland.xikage.MythicMobs.API.Bukkit.Events.MythicMobDeathEvent"); + Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI"); + Class.forName("net.elseland.xikage.MythicMobs.Mobs.MythicMob"); + } catch (ClassNotFoundException e) { + // Disabling + Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', + "&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support.")); + return false; + } + + MMAPI = ((MythicMobs) mm).getAPI(); + Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &6MythicMobs was found - Enabling capabilities.")); + return true; + + } +} diff --git a/jobConfig.yml b/jobConfig.yml index 618fbff4..a3b73fd5 100644 --- a/jobConfig.yml +++ b/jobConfig.yml @@ -1,2364 +1,2366 @@ -# Jobs configuration. -# -# Stores information about each job. -# -# NOTE: When having multiple jobs, both jobs will give the income payout to the player -# even if they give the pay for one action (make the configurations with this in mind) -# and each job will get the respective experience. -# -# e.g If player has 2 jobs where job1 gives 10 income and experience for killing a player -# and job2 gives 5 income and experience for killing a player. When the user kills a player -# they will get 15 income and job1 will gain 10 experience and job2 will gain 5 experience. - -Jobs: - # must be one word. This job will be ignored as this is just example of all posible actions - 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. - # Shown as a prefix only when the user has 1 job. - # - # NOTE: Must be 1 word - fullname: Woodcutter - # Shortened version of the name of the job. Used as a prefix when the user has more - # than 1 job - shortname: W - description: Earns money felling and planting trees - # The colour of the name, for a full list of supported colours, go to the message config. - ChatColour: GREEN - # Option to let you choose what kind of prefix this job adds to your name. - # options are: full, title, job, shortfull, shorttitle, shortjob and none - chat-display: full - # [OPTIONAL] - the maximum level of this class - max-level: 10 - # [OPTIONAL] - the maximum level of this class with specific permission - # use jobs.[jobsname].vipmaxlevel, in this case it will be jobs.exampleJob.vipmaxlevel - vip-max-level: 20 - # [OPTIONAL] - the maximum number of users on the server that can have this job at - # any one time (includes offline players). - slots: 1 - # Equation used for calculating how much experience is needed to go to the next level. - # Available parameters: - # numjobs - the number of jobs the player has - # joblevel - the level the player has attained in the job. - # NOTE: Please take care of the brackets when modifying this equation. - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - # Equation used for calculating how much income is given per action for the job level. - # Available parameters: - # numjobs - the number of jobs the player has - # baseincome - the income for the action at level 1 (as set in the configuration). - # joblevel - the level the player has attained in the job. - # NOTE: Please take care of the brackets when modifying this equation. - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - # Equation used for calculating how much points is given per action for the job level. - # Available parameters: - # numjobs - the number of jobs the player has - # basepoints - the points for the action at level 1 (as set in the configuration). - # joblevel - the level the player has attained in the job. - # NOTE: Please take care of the brackets when modifying this equation. - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - # Equation used for calculating how much experience is given per action for the job level. - # Available parameters: - # numjobs - the number of jobs the player has - # baseexperience - the experience for the action at level 1 (as set in the configuration). - # joblevel - the level the player has attained in the job. - # NOTE: Please take care of the brackets when modifying this equation. - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - # GUI icon information when using GUI function - Gui: - # id of block - Id: 17 - # data of block, usualy its 0, but in example Diorite will have id of 1 and data of 3 - Data: 2 - ######################################################################## - # Section used to configure what items the job gets paid for, how much - # they get paid and how much experience they gain. - # - # For break and place, the block name or id is used. - # You can select a sub-type by using a '-' between the id and the bit - # value for the sub-type. e.g LOG-0 = usual log, LOG-2 = birch log - # 17-2 = birch log. - # - # If no sub-type is give, the payout will be for all sub-types. - # - # To get a list of all available block types, check the - # bukkit JavaDocs for a complete list of block types - # https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html - # - # For kill tags (Kill and custom-kill), the name is the name of the - # mob. - # Available mobs: - # Bat - # Blaze - # Cave_spider - # Chicken - # Cow - # Creeper - # Ender_dragon - # Enderman - # Endermite - # Ghast - # Giant - # Guardian - # GuardianElder - # Horse - # HorseZombie - # HorseSkeleton - # Iron_golem - # Magma_cube - # Mushroom_cow - # Ocelot - # Pig - # Player - # Polar_Bear - # Rabbit - # Sheep - # Silverfish - # Skeleton - # SkeletonWither - # SkeletonStray - # Shulker - # Slime - # Snowman - # Spider - # Squid - # Villager - # Witch - # Wither - # Wolf - # Zombie - # ZombieVillager - # ZombieHusk - # - # - # NOTE: mob names are case sensitive. - # - # For custom-kill, it is the name of the job (also case sensitive). - # - # NOTE: If a job has both the pay for killing a player and for killing a - # specific class, they will get both payments. - ######################################################################## - # payment for breaking a block - Break: - # block name/id (with optional sub-type) - LOG: - # base income, can be not used if using point system - income: 5.0 - # base points, can be not used if using income system - points: 5.0 - # base experience - experience: 5.0 - # (OPTIONAL) from which level of this job player can get money for this action - # if not given, then player will always get money for this action - # this can be used for any action - from-level: 1 - # (OPTIONAL) until which level player can get money for this action. - # if not given, then there is no limit - # this can be used for any action - until-level: 30 - # payment for breaking a block with tnt - TNTBreak: - LOG: - income: 5.0 - points: 5.0 - experience: 5.0 - # payment for placing a block - Place: - SAPLING: - income: 1.0 - points: 1.0 - experience: 1.0 - WOOD: - income: 2.0 - points: 2.0 - experience: 2.0 - # killing a mob - Kill: - # mob name - Player: - # base income - income: 7.5 - # base experience - experience: 7.5 - # killing a MythicMob - MMKill: - # mob name - CustomNameHere: - # base income - income: 7.5 - # base experience - experience: 7.5 - # Killing player with certain job - custom-kill: - Woodcutter: - income: 10.0 - experience: 10.0 - # Tamig animals - Tame: - Wolf: - income: 2.0 - experience: 5.0 - # Breeding animals - Breed: - Wolf: - income: 2.0 - experience: 5.0 - # Eating food - Eat: - cooked_rabbit: - income: 5 - experience: 5 - baked_potato: - income: 5 - experience: 5 - # Milking cows, only one option is available - Milk: - Cow: - income: 2.0 - experience: 5.0 - Mushroomcow: - income: 5.0 - experience: 10.0 - # Shear sheeps by its color - Shear: - Black: - income: 2.0 - experience: 5.0 - Blue: - income: 2.0 - experience: 5.0 - Brown: - income: 2.0 - experience: 5.0 - Cyan: - income: 2.0 - experience: 5.0 - Gray: - income: 2.0 - experience: 5.0 - Green: - income: 2.0 - experience: 5.0 - Light_blue: - income: 2.0 - experience: 5.0 - Lime: - income: 2.0 - experience: 5.0 - Magenta: - income: 2.0 - experience: 5.0 - Orange: - income: 2.0 - experience: 5.0 - Pink: - income: 2.0 - experience: 5.0 - Purple: - income: 2.0 - experience: 5.0 - Red: - income: 2.0 - experience: 5.0 - Silver: - income: 2.0 - experience: 5.0 - White: - income: 2.0 - experience: 5.0 - Yellow: - income: 2.0 - experience: 5.0 - # dyeing armor - Dye: - LEATHER_BOOTS: - income: 1.0 - experience: 1.0 - LEATHER_CHESTPLATE: - income: 1.0 - experience: 1.0 - LEATHER_HELMET: - income: 1.0 - experience: 1.0 - LEATHER_LEGGINGS: - income: 1.0 - experience: 1.0 - 351: - income: 1.0 - experience: 1.0 - # Catching fish - Fish: - '349': - income: 20.0 - experience: 25.0 - # Repairing items - Repair: - WOOD_SWORD: - income: 1.0 - experience: 1.0 - IRON_SWORD: - income: 2.0 - experience: 2.0 - # Crafting items - Craft: - WOOD_SWORD: - income: 1.5 - experience: 3.0 - LEATHER_BOOTS: - income: 1.0 - experience: 6.0 - # Smelting ores - Smelt: - IRON_INGOT: - income: 2.0 - experience: 8.0 - GOLD_INGOT: - income: 4.5 - experience: 12 - # Enchanting items - Enchant: - # You can set item for which player will get money - WOOD_SWORD: - income: 1.5 - experience: 3.0 - LEATHER_BOOTS: - income: 1.0 - experience: 6.0 - # Or/and you can give money for each enchantment they got - DIG_SPEED-1: - income: 3.0 - experience: 10.0 - DIG_SPEED-2: - income: 6.0 - experience: 20.0 - # Brewing potions - Brew: - NETHER_STALK: - income: 5.0 - experience: 3.0 - REDSTONE: - income: 5.0 - experience: 3.0 - # Explore options. Each number represents players number in exploring that chunk - # 1 means that player is first in this chunk, 2 is second and so on, so you can give money not only for first player ho discovers that chunk - Explore: - 1: - income: 5.0 - experience: 5.0 - 2: - income: 2.5 - experience: 2.5 - 3: - income: 1.0 - experience: 1.0 - 4: - income: 0.5 - experience: 0.5 - 5: - income: 0.1 - experience: 0.1 - # permissions granted for joining class - permissions: - # example node - aaaaaatest.node: - # true to give, false to revoke - value: true - # minimum level needed to grant permission. Use 0 for all levels - level: 0 - aaaaaatest.node2: - value: true - # Permission granted when reaching level 10 - level: 10 - # Permissions granted when perticular conditions are meet - conditions: - # Condition mane, irelevent, you can write anything in here - first: - requires: - # j marks that player should have particular jobs level and higher - - j:Miner-50 - - j:Digger-50 - # p marks permission requirement - - p:essentials.notnoob - perform: - # p marks permission, player will get if given true value, if used false, permission will be taken - - p:essentials.fly-true - # Commands executed when player reached level - commands: - # command name, just to have better idea what this do - fly: - # Command its self, this will be executed from console, so all commands should work - # Possible variables are: [player] [jobname] [oldlevel] [newlevel] - command: manuaddp [player] essentials.fly - # When to execute this command first time - levelFrom: 100 - # Until when to do this command - # This can be set to same level as levelFrom, so this command will be executed only once - levelUntil: 100 - kit: - command: manuaddp [player] essentials.kits.woodcutter - levelFrom: 150 - levelUntil: 150 - # Getting more money when equiped with specific weapon/tool ar wearing armor - items: - # Just name, dont have any impact - firstOne: - # Tool/Weapon id. Works for block Break, Fish, Animal tame, Breed, Monster/Player kill. - id: 278 - # Items name, should be with color codes - name: '&8Miner Pickaxe' - # Item lore, again should come with color codes - lore: - - '&eBobs pick' - - '&710% bonus XP' - # Item enchantments, all enchantment names can be found https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html - enchants: - - DAMAGE_ALL=1 - - FIRE_ASPECT=1 - # Money boost: 1.1 is equals 10% more income when 0.9 is equals 10% less from base income - moneyBoost: 1.1 - # Exp boost - expBoost: 1.1 - helmet: - # Armor id. This one works with all jobs - id: 310 - name: '&8Armor' - lore: - - '&eBobs armor' - - '&710% bonus XP' - moneyBoost: 1.1 - expBoost: 1.1 - # Limit item use to jobs level - limitedItems: - # Just name, dont have any impact - firstOne: - # Tool/Weapon id. Works for any interact action. - id: 278 - # Level of this job player can start using this item - level: 5 - # (optional) Items name, option to use color codes - name: '&8Miner Pickaxe' - # (optional) Item lore, again can come with color codes - lore: - - '&eBobs pick' - - '&710% bonus XP' - # (optional) Item enchantments, all enchantment names can be found https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html - # enchant level can inrease with jobs level to give best RPG experiance - enchants: - - DAMAGE_ALL=1 - - FIRE_ASPECT=1 - cmd-on-join: - - 'msg [name] Thx for joining this job!' - - 'msg [name] Now start working and get money from [jobname] job!' - cmd-on-leave: - - 'msg [name] You have left this awesome [jobname] job' - - 'msg [name] See you soon!' -# from this point you can edit jobs by your liking, rename, remove or add new ones - Woodcutter: - fullname: Woodcutter - shortname: W - description: Earns money felling and planting trees - ChatColour: GREEN - chat-display: full - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 17 - Data: 2 - Break: - 17-0: - income: 2.5 - points: 2.5 - experience: 2.5 - 17-1: - income: 2.0 - points: 2.5 - experience: 2.0 - 17-2: - income: 2.5 - points: 2.5 - experience: 2.5 - 17-3: - income: 2.5 - points: 2.5 - experience: 2.5 - 18-0: - income: 0.5 - points: 0.5 - experience: 0.5 - 18-1: - income: 0.5 - points: 0.5 - experience: 0.5 - 18-2: - income: 0.5 - points: 0.5 - experience: 0.5 - 18-3: - income: 0.5 - points: 0.5 - experience: 0.5 - 161-0: - income: 0.5 - points: 0.5 - experience: 0.5 - 161-1: - income: 0.5 - points: 0.5 - experience: 0.5 - 162-0: - income: 2.5 - points: 2.5 - experience: 2.5 - 162-1: - income: 2.5 - points: 2.5 - experience: 2.5 - Kill: - Player: - income: 7.5 - points: 7.5 - experience: 7.5 - custom-kill: - Woodcutter: - income: 10.0 - points: 10.0 - experience: 10.0 - max-level: 200 - Miner: - fullname: Miner - shortname: M - description: Earns money mining minerals and ores. - ChatColour: DARK_GRAY - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 270 - Data: 0 - TNTBreak: - STONE: - income: 0.3 - points: 0.3 - experience: 0.3 - STONE-1: - income: 1 - points: 1 - experience: 1 - STONE-3: - income: 1 - points: 1 - experience: 1 - STONE-5: - income: 1 - points: 1 - experience: 1 - Break: - STONE: - income: 0.3 - points: 0.3 - experience: 0.3 - STONE-1: - income: 1 - points: 1 - experience: 1 - STONE-3: - income: 1 - points: 1 - experience: 1 - STONE-5: - income: 1 - points: 1 - experience: 1 - COAL_ORE: - income: 3 - points: 2 - experience: 2 - SANDSTONE: - income: 0.15 - points: 0.15 - experience: 0.2 - SANDSTONE-1: - income: 0.15 - points: 0.15 - experience: 0.2 - SANDSTONE-2: - income: 0.15 - points: 0.15 - experience: 0.2 - GLOWING_REDSTONE_ORE: - income: 2.5 - points: 2 - experience: 2 - IRON_ORE: - income: 3.5 - points: 3 - experience: 2 - GOLD_ORE: - income: 5 - points: 4 - experience: 2 - LAPIS_ORE: - income: 7.5 - points: 6 - experience: 2 - DIAMOND_ORE: - income: 10 - points: 10 - experience: 10 - EMERALD_ORE: - income: 15 - points: 15 - experience: 30 - QUARTZ_ORE: - income: 2.5 - points: 2.5 - experience: 2.5 - OBSIDIAN: - income: 5 - points: 5 - experience: 5 - MOSSY_COBBLESTONE: - income: 2.5 - points: 2.5 - experience: 2.5 - NETHER_BRICK: - income: 1.0 - points: 1 - experience: 1.0 - NETHER_BRICK_STAIRS: - income: 3 - points: 3 - experience: 3 - NETHER_FENCE: - income: 1 - points: 1 - experience: 1 - NETHERRACK: - income: 0.1 - points: 0.1 - experience: 0.1 - PRISMARINE: - income: 2.5 - points: 2.5 - experience: 2.5 - Place: - RAILS: - income: 2.0 - points: 2.0 - experience: 2.0 - IRON_ORE: - income: -5.0 - points: -5 - experience: -5.0 - GOLD_ORE: - income: -6.0 - points: -6 - experience: -6.0 - DIAMOND_ORE: - income: -10.0 - points: -10 - experience: -10.0 - Kill: - Player: - income: 7.5 - points: 7.5 - experience: 7.5 - max-level: 200 - Builder: - fullname: Builder - shortname: B - description: Earns money for building structures. - ChatColour: WHITE - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 108 - Data: 0 - Place: - STONE-2: - income: 1.3 - points: 1.3 - experience: 2 - STONE-4: - income: 1.3 - points: 1.3 - experience: 2 - STONE-6: - income: 1.3 - points: 1.3 - experience: 2 - COBBLESTONE: - income: 0.7 - points: 0.7 - experience: 2 - '5': - income: 1.5 - points: 1.5 - experience: 2 - '35': - income: 1.5 - points: 1.5 - experience: 2 - '41': - income: 1.5 - points: 1.5 - experience: 2 - '42': - income: 1.5 - points: 1.5 - experience: 2 - '44': - income: 0.8 - points: 0.8 - experience: 2 - '45': - income: 1.5 - points: 1.5 - experience: 2 - '47': - income: 1.5 - points: 1.5 - experience: 2 - '48': - income: 1.5 - points: 1.5 - experience: 2 - '49': - income: 1.5 - points: 1.5 - experience: 2 - '53': - income: 1.5 - points: 1.5 - experience: 2 - '54': - income: 1.5 - points: 1.5 - experience: 2 - '57': - income: 1.5 - points: 1.5 - experience: 2 - '58': - income: 1.5 - points: 1.5 - experience: 2 - '61': - income: 1.5 - points: 1.5 - experience: 2 - '65': - income: 1.5 - points: 1.5 - experience: 2 - '67': - income: 1.5 - points: 1.5 - experience: 2 - '79': - income: 1.5 - points: 1.5 - experience: 2 - '80': - income: 1.0 - points: 1.0 - experience: 2 - '84': - income: 1.0 - points: 1.0 - experience: 2 - '85': - income: 1.5 - points: 1.5 - experience: 2 - '89': - income: 1.5 - points: 1.5 - experience: 2 - '95': - income: 1.5 - points: 1.5 - experience: 2 - '96': - income: 1.5 - points: 1.5 - experience: 2 - '98': - income: 1.5 - points: 1.5 - experience: 2 - '101': - income: 1.5 - points: 1.5 - experience: 2 - '102': - income: 1.5 - points: 1.5 - experience: 2 - '107': - income: 1.5 - points: 1.5 - experience: 2 - '108': - income: 1.5 - points: 1.5 - experience: 2 - '109': - income: 1.5 - points: 1.5 - experience: 2 - '112': - income: 1.5 - points: 1.5 - experience: 2 - '113': - income: 1.5 - points: 1.5 - experience: 2 - '114': - income: 1.5 - points: 1.5 - experience: 2 - '116': - income: 1.5 - points: 1.5 - experience: 2 - '120': - income: 1.5 - points: 1.5 - experience: 2 - '123': - income: 1.0 - points: 1.0 - experience: 2 - '126': - income: 0.8 - points: 0.8 - experience: 2 - '128': - income: 1.5 - points: 1.5 - experience: 2 - '130': - income: 1.5 - points: 1.5 - experience: 2 - '133': - income: 1.5 - points: 1.5 - experience: 2 - '134': - income: 1.5 - points: 1.5 - experience: 2 - '139': - income: 1.5 - points: 1.5 - experience: 2 - '146': - income: 1.5 - points: 1.5 - experience: 2 - '152': - income: 1.5 - points: 1.5 - experience: 2 - '154': - income: 1.5 - points: 1.5 - experience: 2 - '155': - income: 1.5 - points: 1.5 - experience: 2 - '156': - income: 1.5 - points: 1.5 - experience: 2 - '159': - income: 1.5 - points: 1.5 - experience: 2 - '160': - income: 1.5 - points: 1.5 - experience: 2 - '161': - income: 1.5 - points: 1.5 - experience: 2 - '163': - income: 1.5 - points: 1.5 - experience: 2 - '164': - income: 1.5 - points: 1.5 - experience: 2 - '167': - income: 1.5 - points: 1.5 - experience: 2 - '168': - income: 1.3 - points: 1.3 - experience: 1.9 - '169': - income: 1.5 - points: 1.5 - experience: 2 - '170': - income: 1.5 - points: 1.5 - experience: 2 - '172': - income: 1.5 - points: 1.5 - experience: 2 - '173': - income: 1.5 - points: 1.5 - experience: 2 - '174': - income: 1.5 - points: 1.5 - experience: 2 - '179': - income: 1.5 - points: 1.5 - experience: 2 - '180': - income: 1.5 - points: 1.5 - experience: 2 - '182': - income: 0.8 - points: 0.8 - experience: 2 - '183': - income: 1.5 - points: 1.5 - experience: 2 - '184': - income: 1.5 - points: 1.5 - experience: 2 - '185': - income: 1.5 - points: 1.5 - experience: 2 - '186': - income: 1.5 - points: 1.5 - experience: 2 - '187': - income: 1.5 - points: 1.5 - experience: 2 - '188': - income: 1.5 - points: 1.5 - experience: 2 - '189': - income: 1.5 - points: 1.5 - experience: 2 - '190': - income: 1.5 - points: 1.5 - experience: 2 - '191': - income: 1.5 - points: 1.5 - experience: 2 - '192': - income: 1.5 - points: 1.5 - experience: 2 - Kill: - Player: - income: 7.5 - points: 7.5 - experience: 7.5 - max-level: 200 - Digger: - fullname: Digger - shortname: D - description: Earns money for terraforming the world. - ChatColour: GOLD - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 269 - Data: 0 - Break: - '179': - income: 1 - points: 1 - experience: 1 - DIRT: - income: 0.25 - points: 0.25 - experience: 0.25 - GRASS: - income: 0.3 - points: 0.3 - experience: 0.3 - GRAVEL: - income: 1 - points: 1 - experience: 1.0 - SAND: - income: 0.4 - points: 0.4 - experience: 0.5 - CLAY: - income: 1 - points: 1 - experience: 1.0 - '159': - income: 1 - points: 1 - experience: 1.0 - Kill: - Player: - income: 7.5 - points: 7.5 - experience: 7.5 - custom-kill: - Digger: - income: 10.0 - points: 10.0 - experience: 10.0 - max-level: 200 - Farmer: - fullname: Farmer - shortname: Fa - description: Earns money farming crops. - ChatColour: BLUE - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 290 - Data: 0 - Tame: - Wolf: - income: 5.0 - points: 5.0 - experience: 5.0 - Horse: - income: 5.0 - points: 5.0 - experience: 5.0 - Breed: - Wolf: - income: 4.0 - points: 4.0 - experience: 5.0 - Ocelot: - income: 4.0 - points: 4.0 - experience: 5.0 - Pig: - income: 4.0 - points: 4.0 - experience: 5.0 - Cow: - income: 4.0 - points: 4.0 - experience: 5.0 - Horse: - income: 4.0 - points: 4.0 - experience: 5.0 - Rabbit: - income: 4.0 - points: 4.0 - experience: 5.0 - Sheep: - income: 4.0 - points: 4.0 - experience: 5.0 - Chicken: - income: 4.0 - points: 4.0 - experience: 5.0 - Shear: - Red: - income: 4.0 - points: 4.0 - experience: 5.0 - Orange: - income: 4.0 - points: 4.0 - experience: 5.0 - Yellow: - income: 4.0 - points: 4.0 - experience: 5.0 - Green: - income: 4.0 - points: 4.0 - experience: 5.0 - Blue: - income: 4.0 - points: 4.0 - experience: 5.0 - 'Light Blue': - income: 4.0 - points: 4.0 - experience: 5.0 - Magenta: - income: 4.0 - points: 4.0 - experience: 5.0 - Pink: - income: 4.0 - points: 4.0 - experience: 5.0 - White: - income: 4.0 - points: 4.0 - experience: 5.0 - 'Light Gray': - income: 4.0 - points: 4.0 - experience: 5.0 - Black: - income: 4.0 - points: 4.0 - experience: 5.0 - Brown: - income: 4.0 - points: 4.0 - experience: 5.0 - Purple: - income: 4.0 - points: 4.0 - experience: 5.0 - Cyan: - income: 4.0 - points: 4.0 - experience: 5.0 - Gray: - income: 4.0 - points: 4.0 - experience: 5.0 - 'Lime Green': - income: 4.0 - points: 4.0 - experience: 5.0 - Milk: - Cow: - income: 5.0 - points: 5.0 - experience: 5.0 - Break: - CHORUS_PLANT: - income: 1.5 - points: 1.5 - experience: 3.0 - CHORUS_FLOWER: - income: 1.5 - points: 1.5 - experience: 3.0 - BEETROOT_BLOCK-3: - income: 1.5 - points: 1.5 - experience: 3.0 - CROPS-7: - income: 1.5 - points: 1.5 - experience: 3.0 - CARROT-7: - income: 1.0 - points: 1.0 - experience: 1.0 - POTATO-7: - income: 1.0 - points: 1.0 - experience: 1.0 - PUMPKIN: - income: 0.5 - points: 0.5 - experience: 1.0 - SUGAR_CANE_BLOCK: - income: 0.2 - points: 0.2 - experience: 0.2 - COCOA-4: - income: 4 - points: 4 - experience: 4.0 - '6': - income: 2 - points: 2 - experience: 2.0 - '111': - income: 2 - points: 2 - experience: 2.0 - '37': - income: 2 - points: 2 - experience: 2.0 - '38': - income: 2 - points: 2 - experience: 2.0 - '39': - income: 1 - points: 1 - experience: 1.0 - '40': - income: 1 - points: 1 - experience: 1.0 - '106': - income: 1 - points: 1 - experience: 1.0 - '81': - income: 1 - points: 1 - experience: 1.0 - '115': - income: 1 - points: 1 - experience: 1.0 - Place: - CROPS-0: - income: 3.0 - points: 3 - experience: 3.0 - SUGAR_CANE_BLOCK: - income: 1.0 - points: 1 - experience: 1.0 - Kill: - Player: - income: 7.5 - points: 7.5 - experience: 7.5 - max-level: 200 - Hunter: - fullname: Hunter - shortname: H - description: Earns money killing animals and monsters. - ChatColour: RED - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 261 - Data: 0 - Tame: - Wolf: - income: 20.0 - points: 20 - experience: 15.0 - Ocelot: - income: 20.0 - points: 20 - experience: 15.0 - Horse: - income: 20.0 - points: 20 - experience: 15.0 - Kill: - Chicken: - income: 5.0 - points: 5 - experience: 5.0 - Cow: - income: 6.0 - points: 5 - experience: 5.0 - Pig: - income: 5.0 - points: 5 - experience: 5.0 - Sheep: - income: 5.0 - points: 5 - experience: 5.0 - Wolf: - income: 10.0 - points: 10 - experience: 5.0 - Creeper: - income: 15.0 - points: 15 - experience: 15.0 - Skeleton: - income: 10.0 - points: 10 - experience: 15.0 - Spider: - income: 10.0 - points: 10 - experience: 15.0 - Zombie: - income: 10.0 - points: 10 - experience: 15.0 - BLAZE: - income: 20.0 - points: 20 - experience: 15.0 - CAVE_SPIDER: - income: 20.0 - points: 20 - experience: 15.0 - ENDERMAN: - income: 2.0 - points: 2 - experience: 2.0 - GHAST: - income: 30.0 - points: 30 - experience: 30.0 - GIANT: - income: 250.0 - points: 250 - experience: 100.0 - IRON_GOLEM: - income: 30.0 - points: 30 - experience: 30.0 - MUSHROOM_COW: - income: 5.0 - points: 5 - experience: 5.0 - PIG_ZOMBIE: - income: 5.0 - points: 5 - experience: 5.0 - SILVERFISH: - income: 3.0 - points: 3 - experience: 5.0 - SNOWMAN: - income: 2.0 - points: 2 - experience: 4.0 - SQUID: - income: 2.0 - points: 2 - experience: 2.0 - RABBIT: - income: 2.0 - points: 2 - experience: 2.0 - GUARDIAN: - income: 2.0 - points: 2 - experience: 2.0 - SHULKER: - income: 5.0 - points: 5 - experience: 5.0 - WITHER: - income: 50.0 - points: 50 - experience: 120.0 - ENDER_DRAGON: - income: 2000.0 - points: 2000 - experience: 2000.0 - Player: - income: 9.0 - points: 9 - experience: 7.5 - max-level: 200 - Explorer: - fullname: Explorer - shortname: Ex - description: Earns money from exploring map. - ChatColour: AQUA - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 301 - Data: 0 - Explore: - 1: - income: 5.0 - points: 5 - experience: 5.0 - 2: - income: 2.5 - points: 2.5 - experience: 2.5 - 3: - income: 1.0 - points: 1.0 - experience: 1.0 - 4: - income: 0.5 - points: 0.5 - experience: 0.5 - 5: - income: 0.1 - points: 0.1 - experience: 0.1 - Kill: - Player: - income: 7.5 - experience: 7.5 - max-level: 200 - Crafter: - fullname: Crafter - shortname: Cr - description: Earns money from crafting items. - ChatColour: RED - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 61 - Data: 0 - Craft: - '280': - income: 0.1 - points: 0.1 - experience: 0.1 - '23': - income: 4.0 - points: 4.0 - experience: 4.0 - '25': - income: 1.5 - points: 1.5 - experience: 3.0 - '27': - income: 5.0 - points: 5 - experience: 5.0 - '28': - income: 5.0 - points: 4.0 - experience: 5.0 - '29': - income: 3.0 - points: 3.0 - experience: 3.0 - 'tnt': - income: 4.0 - points: 4.0 - experience: 4.0 - 'chest': - income: 1.3 - points: 1.3 - experience: 1.3 - '58': - income: 0.7 - points: 0.7 - experience: 1.0 - '61': - income: 1.0 - points: 1.0 - experience: 1.0 - '65': - income: 0.1 - points: 0.1 - experience: 0.1 - '66': - income: 1.1 - points: 1.0 - experience: 1.1 - '84': - income: 10.0 - points: 10.0 - experience: 20.0 - '95': - income: 0.3 - points: 0.3 - experience: 0.3 - '108': - income: 2.5 - points: 2.5 - experience: 3.0 - '109': - income: 0.5 - points: 0.5 - experience: 0.5 - '116': - income: 30.0 - points: 30.0 - experience: 40.0 - '138': - income: 100.0 - points: 100.0 - experience: 300.0 - '145': - income: 20.0 - points: 20.0 - experience: 25.0 - '146': - income: 1.5 - points: 1.5 - experience: 1.5 - '147': - income: 3.0 - points: 3.0 - experience: 3.0 - '148': - income: 2.5 - points: 2.5 - experience: 2.5 - '151': - income: 2.5 - points: 2.5 - experience: 2.5 - 'hopper': - income: 7.0 - points: 7.0 - experience: 7.0 - '157': - income: 4.0 - points: 4.0 - experience: 4.0 - '158': - income: 2.0 - points: 2.0 - experience: 3.0 - '159': - income: 1.5 - points: 1.5 - experience: 1.5 - '160': - income: 0.2 - points: 0.2 - experience: 0.2 - '165': - income: 1.0 - points: 1.0 - experience: 1.0 - '168': - income: 3.0 - points: 3.0 - experience: 3.0 - '169': - income: 10.0 - points: 10.0 - experience: 10.0 - '183': - income: 0.5 - points: 0.5 - experience: 0.5 - '184': - income: 0.5 - points: 0.5 - experience: 0.5 - '185': - income: 0.5 - points: 0.5 - experience: 0.5 - '186': - income: 0.5 - points: 0.5 - experience: 0.5 - '187': - income: 0.5 - points: 0.5 - experience: 0.5 - '188': - income: 0.5 - points: 0.5 - experience: 0.5 - '189': - income: 0.5 - points: 0.5 - experience: 0.5 - '190': - income: 0.5 - points: 0.5 - experience: 0.5 - '191': - income: 0.5 - points: 0.5 - experience: 0.5 - '192': - income: 0.5 - points: 0.5 - experience: 0.5 - '324': - income: 0.5 - points: 0.5 - experience: 0.5 - '330': - income: 8.0 - points: 8.0 - experience: 8.0 - '340': - income: 1.0 - points: 1.0 - experience: 1.0 - '345': - income: 4.0 - points: 4.0 - experience: 7.0 - '347': - income: 7.0 - points: 7.0 - experience: 7.0 - '354': - income: 8.0 - points: 8.0 - experience: 10.0 - '355': - income: 3.0 - points: 3.0 - experience: 3.0 - '379': - income: 2.8 - points: 2.8 - experience: 3.5 - '380': - income: 7.0 - points: 7.0 - experience: 7.0 - '427': - income: 0.15 - points: 0.15 - experience: 0.15 - '428': - income: 0.15 - points: 0.15 - experience: 0.15 - '429': - income: 0.15 - points: 0.15 - experience: 0.15 - '430': - income: 0.15 - points: 0.15 - experience: 0.15 - '431': - income: 0.15 - points: 0.15 - experience: 0.15 - Smelt: - COOKED_CHICKEN: - income: 3.0 - points: 3.0 - experience: 3.0 - Kill: - Player: - income: 7.5 - points: 7.5 - experience: 7.5 - max-level: 200 - Fisherman: - fullname: Fisherman - shortname: Fi - description: Earns money from fishing. - ChatColour: AQUA - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 346 - Data: 0 - Fish: - '349-0': - income: 15.0 - points: 15.0 - experience: 15.0 - '349-1': - income: 20.0 - points: 20.0 - experience: 25.0 - '349-2': - income: 25.0 - points: 25.0 - experience: 25.0 - '349-3': - income: 25.0 - points: 25.0 - experience: 25.0 - Kill: - Player: - income: 7.5 - points: 7.5 - experience: 7.5 - max-level: 200 - Weaponsmith: - fullname: Weaponsmith - shortname: W - description: Earns money from crafting and repairing weapons. - ChatColour: DARK_PURPLE - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 58 - Data: 0 - Craft: - WOOD_SWORD: - income: 1.0 - points: 1.0 - experience: 2.0 - LEATHER_BOOTS: - income: 3.0 - points: 3.0 - experience: 4.0 - LEATHER_CHESTPLATE: - income: 4.0 - points: 4.0 - experience: 8.0 - LEATHER_HELMET: - income: 2.5 - points: 2.5 - experience: 5.0 - LEATHER_LEGGINGS: - income: 3.5 - points: 3.5 - experience: 7.0 - IRON_SWORD: - income: 4.0 - points: 4.0 - experience: 8.0 - IRON_BOOTS: - income: 8.0 - points: 8.0 - experience: 16.0 - IRON_CHESTPLATE: - income: 16.0 - points: 16.0 - experience: 32.0 - IRON_HELMET: - income: 10.0 - points: 10.0 - experience: 20.0 - IRON_LEGGINGS: - income: 14.0 - points: 14.0 - experience: 28.0 - GOLD_SWORD: - income: 6.0 - points: 6.0 - experience: 12.0 - GOLD_BOOTS: - income: 12.0 - points: 12.0 - experience: 24.0 - GOLD_CHESTPLATE: - income: 24.0 - points: 24.0 - experience: 48.0 - GOLD_HELMET: - income: 15.0 - points: 15.0 - experience: 30.0 - GOLD_LEGGINGS: - income: 21.0 - points: 21.0 - experience: 42.0 - DIAMOND_SWORD: - income: 8.0 - points: 8.0 - experience: 16.0 - DIAMOND_PICKAXE: - income: 12.0 - points: 12.0 - experience: 24.0 - DIAMOND_AXE: - income: 12.0 - points: 12.0 - experience: 24.0 - DIAMOND_HELMET: - income: 20.0 - points: 20.0 - experience: 40.0 - DIAMOND_CHESTPLATE: - income: 32.0 - points: 32.0 - experience: 64.0 - DIAMOND_LEGGINGS: - income: 28.0 - points: 28.0 - experience: 40.0 - DIAMOND_BOOTS: - income: 16.0 - points: 16.0 - experience: 32.0 - Repair: - WOOD_SWORD: - income: 1.0 - points: 1.0 - experience: 1.0 - IRON_SWORD: - income: 2.0 - points: 2.0 - experience: 2.0 - GOLD_SWORD: - income: 3.0 - points: 3.0 - experience: 3.0 - DIAMOND_SWORD: - income: 4.0 - points: 4.0 - experience: 4.0 - Smelt: - IRON_INGOT: - income: 1.3 - points: 1.3 - experience: 2.0 - GOLD_INGOT: - income: 5.0 - points: 5.0 - experience: 10 - DIAMOND: - income: 7.0 - points: 7.0 - experience: 20 - max-level: 200 - Brewer: - fullname: Brewer - shortname: Br - description: Earns money brewing potions. - ChatColour: LIGHT_PURPLE - chat-display: full - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 379 - Data: 0 - Brew: - NETHER_STALK: - income: 6.0 - points: 6.0 - experience: 6.0 - REDSTONE: - income: 6.0 - points: 6.0 - experience: 6.0 - GLOWSTONE_DUST: - income: 8.0 - points: 8.0 - experience: 8.0 - SPIDER_EYE: - income: 9.0 - points: 9.0 - experience: 9.0 - FERMENTED_SPIDER_EYE: - income: 12.0 - points: 12.0 - experience: 12.0 - BLAZE_POWDER: - income: 12.0 - points: 12.0 - experience: 12.0 - SUGAR: - income: 7.0 - points: 7.0 - experience: 7.0 - SPECKLED_MELON: - income: 10.0 - points: 10.0 - experience: 10.0 - MAGMA_CREAM: - income: 12.0 - points: 12.0 - experience: 12.0 - GHAST_TEAR: - income: 22.0 - points: 22.0 - experience: 22.0 - GOLDEN_CARROT: - income: 14.0 - points: 14.0 - experience: 14.0 - 349-3: - income: 14.0 - points: 14.0 - experience: 14.0 - RABBIT_FOOT: - income: 18.0 - points: 18.0 - experience: 18.0 - max-level: 200 - Enchanter: - fullname: Enchanter - shortname: E - description: Earns money enchanting weapons. - ChatColour: DARK_BLUE - chat-display: full - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Gui: - Id: 116 - Data: 0 - Enchant: - WOOD_SWORD: - income: 1.5 - points: 1.5 - experience: 3.0 - LEATHER_BOOTS: - income: 1.0 - points: 1.0 - experience: 6.0 - LEATHER_CHESTPLATE: - income: 2.0 - points: 2.0 - experience: 6.0 - LEATHER_HELMET: - income: 1.0 - points: 1.0 - experience: 6.0 - LEATHER_LEGGINGS: - income: 2.0 - points: 2.0 - experience: 6.0 - IRON_SWORD: - income: 3.0 - points: 3.0 - experience: 6.0 - IRON_BOOTS: - income: 2.5 - points: 2.5 - experience: 9.0 - IRON_CHESTPLATE: - income: 4.5 - points: 4.5 - experience: 9.0 - IRON_HELMET: - income: 2.5 - points: 2.5 - experience: 9.0 - IRON_LEGGINGS: - income: 4.5 - points: 4.5 - experience: 9.0 - GOLD_SWORD: - income: 4.5 - points: 4.5 - experience: 15.0 - GOLD_BOOTS: - income: 2.5 - points: 2.5 - experience: 15.0 - GOLD_CHESTPLATE: - income: 5.5 - points: 5.5 - experience: 15.0 - GOLD_HELMET: - income: 2.5 - points: 2.5 - experience: 15.0 - GOLD_LEGGINGS: - income: 5.5 - points: 5.5 - experience: 15.0 - DIAMOND_SWORD: - income: 9.0 - points: 9.0 - experience: 30.0 - DIAMOND_SPADE: - income: 5.0 - points: 5.0 - experience: 30.0 - DIAMOND_PICKAXE: - income: 10.0 - points: 10.0 - experience: 30.0 - DIAMOND_AXE: - income: 10.0 - points: 10.0 - experience: 30.0 - DIAMOND_HELMET: - income: 6.0 - points: 6.0 - experience: 30.0 - DIAMOND_CHESTPLATE: - income: 12.0 - points: 12.0 - experience: 50.0 - DIAMOND_LEGGINGS: - income: 12.0 - points: 12.0 - experience: 50.0 - DIAMOND_BOOTS: - income: 6.0 - points: 6.0 - experience: 30.0 - ARROW_DAMAGE-1: - income: 10.0 - points: 10.0 - experience: 10.0 - ARROW_DAMAGE-2: - income: 20.0 - points: 20.0 - experience: 20.0 - ARROW_DAMAGE-3: - income: 30.0 - points: 30.0 - experience: 30.0 - ARROW_DAMAGE-4: - income: 40.0 - points: 40.0 - experience: 40.0 - ARROW_DAMAGE-5: - income: 50.0 - points: 50.0 - experience: 50.0 - ARROW_FIRE: - income: 10.0 - points: 10.0 - experience: 30.0 - ARROW_INFINITE: - income: 20.0 - points: 20.0 - experience: 50.0 - ARROW_KNOCKBACK-1: - income: 10.0 - points: 10.0 - experience: 10.0 - ARROW_KNOCKBACK-2: - income: 20.0 - points: 20.0 - experience: 20.0 - DAMAGE_ALL-1: - income: 10.0 - points: 10.0 - experience: 10.0 - DAMAGE_ALL-2: - income: 20.0 - points: 20.0 - experience: 20.0 - DAMAGE_ALL-3: - income: 30.0 - points: 30.0 - experience: 30.0 - DAMAGE_ALL-4: - income: 40.0 - points: 40.0 - experience: 40.0 - DAMAGE_ALL-5: - income: 50.0 - points: 50.0 - experience: 50.0 - DAMAGE_ARTHROPODS-1: - income: 10.0 - points: 10.0 - experience: 10.0 - DAMAGE_ARTHROPODS-2: - income: 20.0 - points: 20.0 - experience: 20.0 - DAMAGE_ARTHROPODS-3: - income: 30.0 - points: 30.0 - experience: 30.0 - DAMAGE_ARTHROPODS-4: - income: 40.0 - points: 40.0 - experience: 40.0 - DAMAGE_ARTHROPODS-5: - income: 50.0 - points: 50.0 - experience: 50.0 - DAMAGE_UNDEAD-1: - income: 10.0 - points: 10.0 - experience: 10.0 - DAMAGE_UNDEAD-2: - income: 20.0 - points: 20.0 - experience: 20.0 - DAMAGE_UNDEAD-3: - income: 30.0 - points: 30.0 - experience: 30.0 - DAMAGE_UNDEAD-4: - income: 40.0 - points: 40.0 - experience: 40.0 - DAMAGE_UNDEAD-5: - income: 50.0 - points: 50.0 - experience: 50.0 - DEPTH_STRIDER-1: - income: 10.0 - points: 10.0 - experience: 10.0 - DEPTH_STRIDER-2: - income: 20.0 - points: 20.0 - experience: 20.0 - DEPTH_STRIDER-3: - income: 30.0 - points: 30.0 - experience: 30.0 - DIG_SPEED-1: - income: 10.0 - points: 10.0 - experience: 10.0 - DIG_SPEED-2: - income: 20.0 - points: 20.0 - experience: 20.0 - DIG_SPEED-3: - income: 30.0 - points: 30.0 - experience: 30.0 - DIG_SPEED-4: - income: 40.0 - points: 40.0 - experience: 40.0 - DIG_SPEED-5: - income: 50.0 - points: 50.0 - experience: 50.0 - DURABILITY-1: - income: 10.0 - points: 10.0 - experience: 10.0 - DURABILITY-2: - income: 20.0 - points: 20.0 - experience: 20.0 - DURABILITY-3: - income: 30.0 - points: 30.0 - experience: 30.0 - FIRE_ASPECT-1: - income: 10.0 - points: 10.0 - experience: 10.0 - FIRE_ASPECT-2: - income: 20.0 - points: 20.0 - experience: 20.0 - KNOCKBACK-1: - income: 10.0 - points: 10.0 - experience: 10.0 - KNOCKBACK-2: - income: 20.0 - points: 20.0 - experience: 20.0 - LOOT_BONUS_BLOCKS-1: - income: 20.0 - points: 20.0 - experience: 100.0 - LOOT_BONUS_BLOCKS-2: - income: 40.0 - points: 40.0 - experience: 200.0 - LOOT_BONUS_BLOCKS-3: - income: 80.0 - points: 80.0 - experience: 300.0 - LOOT_BONUS_MOBS-1: - income: 10.0 - points: 10.0 - experience: 20.0 - LOOT_BONUS_MOBS-2: - income: 20.0 - points: 20.0 - experience: 40.0 - LOOT_BONUS_MOBS-3: - income: 30.0 - points: 30.0 - experience: 60.0 - LUCK-1: - income: 15.0 - points: 15.0 - experience: 10.0 - LUCK-2: - income: 25.0 - points: 25.0 - experience: 20.0 - LUCK-3: - income: 35.0 - points: 35.0 - experience: 30.0 - LURE-1: - income: 10.0 - points: 10.0 - experience: 10.0 - LURE-2: - income: 20.0 - points: 20.0 - experience: 20.0 - LURE-3: - income: 30.0 - points: 30.0 - experience: 30.0 - OXYGEN-1: - income: 10.0 - points: 10.0 - experience: 10.0 - OXYGEN-2: - income: 20.0 - points: 20.0 - experience: 20.0 - OXYGEN-3: - income: 30.0 - points: 30.0 - experience: 30.0 - PROTECTION_ENVIRONMENTAL-1: - income: 10.0 - points: 10.0 - experience: 10.0 - PROTECTION_ENVIRONMENTAL-2: - income: 20.0 - points: 20.0 - experience: 20.0 - PROTECTION_ENVIRONMENTAL-3: - income: 30.0 - points: 30.0 - experience: 30.0 - PROTECTION_ENVIRONMENTAL-4: - income: 40.0 - points: 40.0 - experience: 40.0 - PROTECTION_EXPLOSIONS-1: - income: 10.0 - points: 10.0 - experience: 10.0 - PROTECTION_EXPLOSIONS-2: - income: 20.0 - points: 20.0 - experience: 20.0 - PROTECTION_EXPLOSIONS-3: - income: 30.0 - points: 30.0 - experience: 30.0 - PROTECTION_EXPLOSIONS-4: - income: 40.0 - points: 40.0 - experience: 40.0 - PROTECTION_FALL-1: - income: 10.0 - points: 10.0 - experience: 10.0 - PROTECTION_FALL-2: - income: 20.0 - points: 20.0 - experience: 20.0 - PROTECTION_FALL-3: - income: 30.0 - points: 30.0 - experience: 30.0 - PROTECTION_FALL-4: - income: 40.0 - points: 40.0 - experience: 40.0 - PROTECTION_FIRE-1: - income: 5.0 - points: 5.0 - experience: 10.0 - PROTECTION_FIRE-2: - income: 10.0 - points: 10.0 - experience: 20.0 - PROTECTION_FIRE-3: - income: 20.0 - points: 20.0 - experience: 30.0 - PROTECTION_FIRE-4: - income: 30.0 - points: 30.0 - experience: 40.0 - PROTECTION_PROJECTILE-1: - income: 10.0 - points: 10.0 - experience: 10.0 - PROTECTION_PROJECTILE-2: - income: 20.0 - points: 20.0 - experience: 20.0 - PROTECTION_PROJECTILE-3: - income: 30.0 - points: 30.0 - experience: 30.0 - PROTECTION_PROJECTILE-4: - income: 40.0 - points: 40.0 - experience: 40.0 - SILK_TOUCH: - income: 100.0 - points: 100.0 - experience: 300.0 - THORNS-1: - income: 10.0 - points: 10.0 - experience: 10.0 - THORNS-2: - income: 20.0 - points: 20.0 - experience: 20.0 - THORNS-3: - income: 30.0 - points: 30.0 - experience: 30.0 - WATER_WORKER: - income: 30.0 - points: 30.0 - experience: 100.0 - max-level: 200 - None: - fullname: None - shortname: N - ChatColour: WHITE - chat-display: none - #max-level: 10 - #slots: 10 - leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) - income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) - experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) - Kill: - Player: +# Jobs configuration. +# +# Stores information about each job. +# +# NOTE: When having multiple jobs, both jobs will give the income payout to the player +# even if they give the pay for one action (make the configurations with this in mind) +# and each job will get the respective experience. +# +# e.g If player has 2 jobs where job1 gives 10 income and experience for killing a player +# and job2 gives 5 income and experience for killing a player. When the user kills a player +# they will get 15 income and job1 will gain 10 experience and job2 will gain 5 experience. + +Jobs: + # must be one word. This job will be ignored as this is just example of all posible actions + 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. + # Shown as a prefix only when the user has 1 job. + # + # NOTE: Must be 1 word + fullname: Woodcutter + # Shortened version of the name of the job. Used as a prefix when the user has more + # than 1 job + shortname: W + description: Earns money felling and planting trees + # The colour of the name, for a full list of supported colours, go to the message config. + ChatColour: GREEN + # Option to let you choose what kind of prefix this job adds to your name. + # options are: full, title, job, shortfull, shorttitle, shortjob and none + chat-display: full + # [OPTIONAL] - the maximum level of this class + max-level: 10 + # [OPTIONAL] - the maximum level of this class with specific permission + # use jobs.[jobsname].vipmaxlevel, in this case it will be jobs.exampleJob.vipmaxlevel + vip-max-level: 20 + # [OPTIONAL] - the maximum number of users on the server that can have this job at + # any one time (includes offline players). + slots: 1 + # Equation used for calculating how much experience is needed to go to the next level. + # Available parameters: + # numjobs - the number of jobs the player has + # joblevel - the level the player has attained in the job. + # NOTE: Please take care of the brackets when modifying this equation. + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + # Equation used for calculating how much income is given per action for the job level. + # Available parameters: + # numjobs - the number of jobs the player has + # baseincome - the income for the action at level 1 (as set in the configuration). + # joblevel - the level the player has attained in the job. + # NOTE: Please take care of the brackets when modifying this equation. + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + # Equation used for calculating how much points is given per action for the job level. + # Available parameters: + # numjobs - the number of jobs the player has + # basepoints - the points for the action at level 1 (as set in the configuration). + # joblevel - the level the player has attained in the job. + # NOTE: Please take care of the brackets when modifying this equation. + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + # Equation used for calculating how much experience is given per action for the job level. + # Available parameters: + # numjobs - the number of jobs the player has + # baseexperience - the experience for the action at level 1 (as set in the configuration). + # joblevel - the level the player has attained in the job. + # NOTE: Please take care of the brackets when modifying this equation. + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + # GUI icon information when using GUI function + Gui: + # id of block + Id: 17 + # data of block, usualy its 0, but in example Diorite will have id of 1 and data of 3 + Data: 2 + ######################################################################## + # Section used to configure what items the job gets paid for, how much + # they get paid and how much experience they gain. + # + # For break and place, the block name or id is used. + # You can select a sub-type by using a '-' between the id and the bit + # value for the sub-type. e.g LOG-0 = usual log, LOG-2 = birch log + # 17-2 = birch log. + # + # If no sub-type is give, the payout will be for all sub-types. + # + # To get a list of all available block types, check the + # bukkit JavaDocs for a complete list of block types + # https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html + # + # For kill tags (Kill and custom-kill), the name is the name of the + # mob. + # Available mobs: + # Bat + # Blaze + # Cave_spider + # Chicken + # Cow + # Creeper + # Ender_dragon + # Enderman + # Endermite + # Ghast + # Giant + # Guardian + # GuardianElder + # Horse + # HorseZombie + # HorseSkeleton + # Iron_golem + # Magma_cube + # Mushroom_cow + # Ocelot + # Pig + # Player + # Polar_Bear + # Rabbit + # Sheep + # Silverfish + # Skeleton + # SkeletonWither + # SkeletonStray + # Shulker + # Slime + # Snowman + # Spider + # Squid + # Villager + # Witch + # Wither + # Wolf + # Zombie + # ZombieVillager + # ZombieHusk + # + # + # NOTE: mob names are case sensitive. + # + # For custom-kill, it is the name of the job (also case sensitive). + # + # NOTE: If a job has both the pay for killing a player and for killing a + # specific class, they will get both payments. + ######################################################################## + # payment for breaking a block + Break: + # block name/id (with optional sub-type) + LOG: + # base income, can be not used if using point system + income: 5.0 + # base points, can be not used if using income system + points: 5.0 + # base experience + experience: 5.0 + # (OPTIONAL) from which level of this job player can get money for this action + # if not given, then player will always get money for this action + # this can be used for any action + from-level: 1 + # (OPTIONAL) until which level player can get money for this action. + # if not given, then there is no limit + # this can be used for any action + until-level: 30 + # payment for breaking a block with tnt + TNTBreak: + LOG: + income: 5.0 + points: 5.0 + experience: 5.0 + # payment for placing a block + Place: + SAPLING: + income: 1.0 + points: 1.0 + experience: 1.0 + WOOD: + income: 2.0 + points: 2.0 + experience: 2.0 + # killing a mob + Kill: + # mob name + Player: + # base income + income: 7.5 + # base experience + experience: 7.5 + # killing a MythicMob + MMKill: + # mob name + CustomNameHere: + # base income + income: 7.5 + # base experience + experience: 7.5 + # Killing player with certain job + custom-kill: + Woodcutter: + income: 10.0 + experience: 10.0 + # Tamig animals + Tame: + Wolf: + income: 2.0 + experience: 5.0 + # Breeding animals + Breed: + Wolf: + income: 2.0 + experience: 5.0 + # Eating food + Eat: + cooked_rabbit: + income: 5 + experience: 5 + baked_potato: + income: 5 + experience: 5 + # Milking cows, only one option is available + Milk: + Cow: + income: 2.0 + experience: 5.0 + Mushroomcow: + income: 5.0 + experience: 10.0 + # Shear sheeps by its color + Shear: + Black: + income: 2.0 + experience: 5.0 + Blue: + income: 2.0 + experience: 5.0 + Brown: + income: 2.0 + experience: 5.0 + Cyan: + income: 2.0 + experience: 5.0 + Gray: + income: 2.0 + experience: 5.0 + Green: + income: 2.0 + experience: 5.0 + Light_blue: + income: 2.0 + experience: 5.0 + Lime: + income: 2.0 + experience: 5.0 + Magenta: + income: 2.0 + experience: 5.0 + Orange: + income: 2.0 + experience: 5.0 + Pink: + income: 2.0 + experience: 5.0 + Purple: + income: 2.0 + experience: 5.0 + Red: + income: 2.0 + experience: 5.0 + Silver: + income: 2.0 + experience: 5.0 + White: + income: 2.0 + experience: 5.0 + Yellow: + income: 2.0 + experience: 5.0 + # dyeing armor + Dye: + LEATHER_BOOTS: + income: 1.0 + experience: 1.0 + LEATHER_CHESTPLATE: + income: 1.0 + experience: 1.0 + LEATHER_HELMET: + income: 1.0 + experience: 1.0 + LEATHER_LEGGINGS: + income: 1.0 + experience: 1.0 + 351: + income: 1.0 + experience: 1.0 + # Catching fish + Fish: + '349': + income: 20.0 + experience: 25.0 + # Repairing items + Repair: + WOOD_SWORD: + income: 1.0 + experience: 1.0 + IRON_SWORD: + income: 2.0 + experience: 2.0 + # Crafting items + Craft: + WOOD_SWORD: + income: 1.5 + experience: 3.0 + LEATHER_BOOTS: + income: 1.0 + experience: 6.0 + # Smelting ores + Smelt: + IRON_INGOT: + income: 2.0 + experience: 8.0 + GOLD_INGOT: + income: 4.5 + experience: 12 + # Enchanting items + Enchant: + # You can set item for which player will get money + WOOD_SWORD: + income: 1.5 + experience: 3.0 + LEATHER_BOOTS: + income: 1.0 + experience: 6.0 + # Or/and you can give money for each enchantment they got + DIG_SPEED-1: + income: 3.0 + experience: 10.0 + DIG_SPEED-2: + income: 6.0 + experience: 20.0 + # Brewing potions + Brew: + NETHER_STALK: + income: 5.0 + experience: 3.0 + REDSTONE: + income: 5.0 + experience: 3.0 + # Explore options. Each number represents players number in exploring that chunk + # 1 means that player is first in this chunk, 2 is second and so on, so you can give money not only for first player ho discovers that chunk + Explore: + 1: + income: 5.0 + experience: 5.0 + 2: + income: 2.5 + experience: 2.5 + 3: + income: 1.0 + experience: 1.0 + 4: + income: 0.5 + experience: 0.5 + 5: + income: 0.1 + experience: 0.1 + # permissions granted for joining class + permissions: + # example node + aaaaaatest.node: + # true to give, false to revoke + value: true + # minimum level needed to grant permission. Use 0 for all levels + level: 0 + aaaaaatest.node2: + value: true + # Permission granted when reaching level 10 + level: 10 + # Permissions granted when perticular conditions are meet + conditions: + # Condition mane, irelevent, you can write anything in here + first: + requires: + # j marks that player should have particular jobs level and higher + - j:Miner-50 + - j:Digger-50 + # p marks permission requirement + - p:essentials.notnoob + perform: + # p marks permission, player will get if given true value, if used false, permission will be taken + - p:essentials.fly-true + # Commands executed when player reached level + commands: + # command name, just to have better idea what this do + fly: + # Command its self, this will be executed from console, so all commands should work + # Possible variables are: [player] [jobname] [oldlevel] [newlevel] + command: manuaddp [player] essentials.fly + # When to execute this command first time + levelFrom: 100 + # Until when to do this command + # This can be set to same level as levelFrom, so this command will be executed only once + levelUntil: 100 + kit: + command: manuaddp [player] essentials.kits.woodcutter + levelFrom: 150 + levelUntil: 150 + # Getting more money when equiped with specific weapon/tool ar wearing armor + items: + # Just name, dont have any impact + firstOne: + # Tool/Weapon id. Works for block Break, Fish, Animal tame, Breed, Monster/Player kill. + id: 278 + # Items name, should be with color codes + name: '&8Miner Pickaxe' + # Item lore, again should come with color codes + lore: + - '&eBobs pick' + - '&710% bonus XP' + # Item enchantments, all enchantment names can be found https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html + enchants: + - DAMAGE_ALL=1 + - FIRE_ASPECT=1 + # Money boost: 1.1 is equals 10% more income when 0.9 is equals 10% less from base income + moneyBoost: 1.1 + # Exp boost + expBoost: 1.2 + # Point boost + pointBoost: 1.3 + helmet: + # Armor id. This one works with all jobs + id: 310 + name: '&8Armor' + lore: + - '&eBobs armor' + - '&710% bonus XP' + moneyBoost: 1.1 + expBoost: 1.1 + # Limit item use to jobs level + limitedItems: + # Just name, dont have any impact + firstOne: + # Tool/Weapon id. Works for any interact action. + id: 278 + # Level of this job player can start using this item + level: 5 + # (optional) Items name, option to use color codes + name: '&8Miner Pickaxe' + # (optional) Item lore, again can come with color codes + lore: + - '&eBobs pick' + - '&710% bonus XP' + # (optional) Item enchantments, all enchantment names can be found https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html + # enchant level can inrease with jobs level to give best RPG experiance + enchants: + - DAMAGE_ALL=1 + - FIRE_ASPECT=1 + cmd-on-join: + - 'msg [name] Thx for joining this job!' + - 'msg [name] Now start working and get money from [jobname] job!' + cmd-on-leave: + - 'msg [name] You have left this awesome [jobname] job' + - 'msg [name] See you soon!' +# from this point you can edit jobs by your liking, rename, remove or add new ones + Woodcutter: + fullname: Woodcutter + shortname: W + description: Earns money felling and planting trees + ChatColour: GREEN + chat-display: full + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 17 + Data: 2 + Break: + 17-0: + income: 2.5 + points: 2.5 + experience: 2.5 + 17-1: + income: 2.0 + points: 2.5 + experience: 2.0 + 17-2: + income: 2.5 + points: 2.5 + experience: 2.5 + 17-3: + income: 2.5 + points: 2.5 + experience: 2.5 + 18-0: + income: 0.5 + points: 0.5 + experience: 0.5 + 18-1: + income: 0.5 + points: 0.5 + experience: 0.5 + 18-2: + income: 0.5 + points: 0.5 + experience: 0.5 + 18-3: + income: 0.5 + points: 0.5 + experience: 0.5 + 161-0: + income: 0.5 + points: 0.5 + experience: 0.5 + 161-1: + income: 0.5 + points: 0.5 + experience: 0.5 + 162-0: + income: 2.5 + points: 2.5 + experience: 2.5 + 162-1: + income: 2.5 + points: 2.5 + experience: 2.5 + Kill: + Player: + income: 7.5 + points: 7.5 + experience: 7.5 + custom-kill: + Woodcutter: + income: 10.0 + points: 10.0 + experience: 10.0 + max-level: 200 + Miner: + fullname: Miner + shortname: M + description: Earns money mining minerals and ores. + ChatColour: DARK_GRAY + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 270 + Data: 0 + TNTBreak: + STONE: + income: 0.3 + points: 0.3 + experience: 0.3 + STONE-1: + income: 1 + points: 1 + experience: 1 + STONE-3: + income: 1 + points: 1 + experience: 1 + STONE-5: + income: 1 + points: 1 + experience: 1 + Break: + STONE: + income: 0.3 + points: 0.3 + experience: 0.3 + STONE-1: + income: 1 + points: 1 + experience: 1 + STONE-3: + income: 1 + points: 1 + experience: 1 + STONE-5: + income: 1 + points: 1 + experience: 1 + COAL_ORE: + income: 3 + points: 2 + experience: 2 + SANDSTONE: + income: 0.15 + points: 0.15 + experience: 0.2 + SANDSTONE-1: + income: 0.15 + points: 0.15 + experience: 0.2 + SANDSTONE-2: + income: 0.15 + points: 0.15 + experience: 0.2 + GLOWING_REDSTONE_ORE: + income: 2.5 + points: 2 + experience: 2 + IRON_ORE: + income: 3.5 + points: 3 + experience: 2 + GOLD_ORE: + income: 5 + points: 4 + experience: 2 + LAPIS_ORE: + income: 7.5 + points: 6 + experience: 2 + DIAMOND_ORE: + income: 10 + points: 10 + experience: 10 + EMERALD_ORE: + income: 15 + points: 15 + experience: 30 + QUARTZ_ORE: + income: 2.5 + points: 2.5 + experience: 2.5 + OBSIDIAN: + income: 5 + points: 5 + experience: 5 + MOSSY_COBBLESTONE: + income: 2.5 + points: 2.5 + experience: 2.5 + NETHER_BRICK: + income: 1.0 + points: 1 + experience: 1.0 + NETHER_BRICK_STAIRS: + income: 3 + points: 3 + experience: 3 + NETHER_FENCE: + income: 1 + points: 1 + experience: 1 + NETHERRACK: + income: 0.1 + points: 0.1 + experience: 0.1 + PRISMARINE: + income: 2.5 + points: 2.5 + experience: 2.5 + Place: + RAILS: + income: 2.0 + points: 2.0 + experience: 2.0 + IRON_ORE: + income: -5.0 + points: -5 + experience: -5.0 + GOLD_ORE: + income: -6.0 + points: -6 + experience: -6.0 + DIAMOND_ORE: + income: -10.0 + points: -10 + experience: -10.0 + Kill: + Player: + income: 7.5 + points: 7.5 + experience: 7.5 + max-level: 200 + Builder: + fullname: Builder + shortname: B + description: Earns money for building structures. + ChatColour: WHITE + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 108 + Data: 0 + Place: + STONE-2: + income: 1.3 + points: 1.3 + experience: 2 + STONE-4: + income: 1.3 + points: 1.3 + experience: 2 + STONE-6: + income: 1.3 + points: 1.3 + experience: 2 + COBBLESTONE: + income: 0.7 + points: 0.7 + experience: 2 + '5': + income: 1.5 + points: 1.5 + experience: 2 + '35': + income: 1.5 + points: 1.5 + experience: 2 + '41': + income: 1.5 + points: 1.5 + experience: 2 + '42': + income: 1.5 + points: 1.5 + experience: 2 + '44': + income: 0.8 + points: 0.8 + experience: 2 + '45': + income: 1.5 + points: 1.5 + experience: 2 + '47': + income: 1.5 + points: 1.5 + experience: 2 + '48': + income: 1.5 + points: 1.5 + experience: 2 + '49': + income: 1.5 + points: 1.5 + experience: 2 + '53': + income: 1.5 + points: 1.5 + experience: 2 + '54': + income: 1.5 + points: 1.5 + experience: 2 + '57': + income: 1.5 + points: 1.5 + experience: 2 + '58': + income: 1.5 + points: 1.5 + experience: 2 + '61': + income: 1.5 + points: 1.5 + experience: 2 + '65': + income: 1.5 + points: 1.5 + experience: 2 + '67': + income: 1.5 + points: 1.5 + experience: 2 + '79': + income: 1.5 + points: 1.5 + experience: 2 + '80': + income: 1.0 + points: 1.0 + experience: 2 + '84': + income: 1.0 + points: 1.0 + experience: 2 + '85': + income: 1.5 + points: 1.5 + experience: 2 + '89': + income: 1.5 + points: 1.5 + experience: 2 + '95': + income: 1.5 + points: 1.5 + experience: 2 + '96': + income: 1.5 + points: 1.5 + experience: 2 + '98': + income: 1.5 + points: 1.5 + experience: 2 + '101': + income: 1.5 + points: 1.5 + experience: 2 + '102': + income: 1.5 + points: 1.5 + experience: 2 + '107': + income: 1.5 + points: 1.5 + experience: 2 + '108': + income: 1.5 + points: 1.5 + experience: 2 + '109': + income: 1.5 + points: 1.5 + experience: 2 + '112': + income: 1.5 + points: 1.5 + experience: 2 + '113': + income: 1.5 + points: 1.5 + experience: 2 + '114': + income: 1.5 + points: 1.5 + experience: 2 + '116': + income: 1.5 + points: 1.5 + experience: 2 + '120': + income: 1.5 + points: 1.5 + experience: 2 + '123': + income: 1.0 + points: 1.0 + experience: 2 + '126': + income: 0.8 + points: 0.8 + experience: 2 + '128': + income: 1.5 + points: 1.5 + experience: 2 + '130': + income: 1.5 + points: 1.5 + experience: 2 + '133': + income: 1.5 + points: 1.5 + experience: 2 + '134': + income: 1.5 + points: 1.5 + experience: 2 + '139': + income: 1.5 + points: 1.5 + experience: 2 + '146': + income: 1.5 + points: 1.5 + experience: 2 + '152': + income: 1.5 + points: 1.5 + experience: 2 + '154': + income: 1.5 + points: 1.5 + experience: 2 + '155': + income: 1.5 + points: 1.5 + experience: 2 + '156': + income: 1.5 + points: 1.5 + experience: 2 + '159': + income: 1.5 + points: 1.5 + experience: 2 + '160': + income: 1.5 + points: 1.5 + experience: 2 + '161': + income: 1.5 + points: 1.5 + experience: 2 + '163': + income: 1.5 + points: 1.5 + experience: 2 + '164': + income: 1.5 + points: 1.5 + experience: 2 + '167': + income: 1.5 + points: 1.5 + experience: 2 + '168': + income: 1.3 + points: 1.3 + experience: 1.9 + '169': + income: 1.5 + points: 1.5 + experience: 2 + '170': + income: 1.5 + points: 1.5 + experience: 2 + '172': + income: 1.5 + points: 1.5 + experience: 2 + '173': + income: 1.5 + points: 1.5 + experience: 2 + '174': + income: 1.5 + points: 1.5 + experience: 2 + '179': + income: 1.5 + points: 1.5 + experience: 2 + '180': + income: 1.5 + points: 1.5 + experience: 2 + '182': + income: 0.8 + points: 0.8 + experience: 2 + '183': + income: 1.5 + points: 1.5 + experience: 2 + '184': + income: 1.5 + points: 1.5 + experience: 2 + '185': + income: 1.5 + points: 1.5 + experience: 2 + '186': + income: 1.5 + points: 1.5 + experience: 2 + '187': + income: 1.5 + points: 1.5 + experience: 2 + '188': + income: 1.5 + points: 1.5 + experience: 2 + '189': + income: 1.5 + points: 1.5 + experience: 2 + '190': + income: 1.5 + points: 1.5 + experience: 2 + '191': + income: 1.5 + points: 1.5 + experience: 2 + '192': + income: 1.5 + points: 1.5 + experience: 2 + Kill: + Player: + income: 7.5 + points: 7.5 + experience: 7.5 + max-level: 200 + Digger: + fullname: Digger + shortname: D + description: Earns money for terraforming the world. + ChatColour: GOLD + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 269 + Data: 0 + Break: + '179': + income: 1 + points: 1 + experience: 1 + DIRT: + income: 0.25 + points: 0.25 + experience: 0.25 + GRASS: + income: 0.3 + points: 0.3 + experience: 0.3 + GRAVEL: + income: 1 + points: 1 + experience: 1.0 + SAND: + income: 0.4 + points: 0.4 + experience: 0.5 + CLAY: + income: 1 + points: 1 + experience: 1.0 + '159': + income: 1 + points: 1 + experience: 1.0 + Kill: + Player: + income: 7.5 + points: 7.5 + experience: 7.5 + custom-kill: + Digger: + income: 10.0 + points: 10.0 + experience: 10.0 + max-level: 200 + Farmer: + fullname: Farmer + shortname: Fa + description: Earns money farming crops. + ChatColour: BLUE + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 290 + Data: 0 + Tame: + Wolf: + income: 5.0 + points: 5.0 + experience: 5.0 + Horse: + income: 5.0 + points: 5.0 + experience: 5.0 + Breed: + Wolf: + income: 4.0 + points: 4.0 + experience: 5.0 + Ocelot: + income: 4.0 + points: 4.0 + experience: 5.0 + Pig: + income: 4.0 + points: 4.0 + experience: 5.0 + Cow: + income: 4.0 + points: 4.0 + experience: 5.0 + Horse: + income: 4.0 + points: 4.0 + experience: 5.0 + Rabbit: + income: 4.0 + points: 4.0 + experience: 5.0 + Sheep: + income: 4.0 + points: 4.0 + experience: 5.0 + Chicken: + income: 4.0 + points: 4.0 + experience: 5.0 + Shear: + Red: + income: 4.0 + points: 4.0 + experience: 5.0 + Orange: + income: 4.0 + points: 4.0 + experience: 5.0 + Yellow: + income: 4.0 + points: 4.0 + experience: 5.0 + Green: + income: 4.0 + points: 4.0 + experience: 5.0 + Blue: + income: 4.0 + points: 4.0 + experience: 5.0 + 'Light Blue': + income: 4.0 + points: 4.0 + experience: 5.0 + Magenta: + income: 4.0 + points: 4.0 + experience: 5.0 + Pink: + income: 4.0 + points: 4.0 + experience: 5.0 + White: + income: 4.0 + points: 4.0 + experience: 5.0 + 'Light Gray': + income: 4.0 + points: 4.0 + experience: 5.0 + Black: + income: 4.0 + points: 4.0 + experience: 5.0 + Brown: + income: 4.0 + points: 4.0 + experience: 5.0 + Purple: + income: 4.0 + points: 4.0 + experience: 5.0 + Cyan: + income: 4.0 + points: 4.0 + experience: 5.0 + Gray: + income: 4.0 + points: 4.0 + experience: 5.0 + 'Lime Green': + income: 4.0 + points: 4.0 + experience: 5.0 + Milk: + Cow: + income: 5.0 + points: 5.0 + experience: 5.0 + Break: + CHORUS_PLANT: + income: 1.5 + points: 1.5 + experience: 3.0 + CHORUS_FLOWER: + income: 1.5 + points: 1.5 + experience: 3.0 + BEETROOT_BLOCK-3: + income: 1.5 + points: 1.5 + experience: 3.0 + CROPS-7: + income: 1.5 + points: 1.5 + experience: 3.0 + CARROT-7: + income: 1.0 + points: 1.0 + experience: 1.0 + POTATO-7: + income: 1.0 + points: 1.0 + experience: 1.0 + PUMPKIN: + income: 0.5 + points: 0.5 + experience: 1.0 + SUGAR_CANE_BLOCK: + income: 0.2 + points: 0.2 + experience: 0.2 + COCOA-4: + income: 4 + points: 4 + experience: 4.0 + '6': + income: 2 + points: 2 + experience: 2.0 + '111': + income: 2 + points: 2 + experience: 2.0 + '37': + income: 2 + points: 2 + experience: 2.0 + '38': + income: 2 + points: 2 + experience: 2.0 + '39': + income: 1 + points: 1 + experience: 1.0 + '40': + income: 1 + points: 1 + experience: 1.0 + '106': + income: 1 + points: 1 + experience: 1.0 + '81': + income: 1 + points: 1 + experience: 1.0 + '115': + income: 1 + points: 1 + experience: 1.0 + Place: + CROPS-0: + income: 3.0 + points: 3 + experience: 3.0 + SUGAR_CANE_BLOCK: + income: 1.0 + points: 1 + experience: 1.0 + Kill: + Player: + income: 7.5 + points: 7.5 + experience: 7.5 + max-level: 200 + Hunter: + fullname: Hunter + shortname: H + description: Earns money killing animals and monsters. + ChatColour: RED + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 261 + Data: 0 + Tame: + Wolf: + income: 20.0 + points: 20 + experience: 15.0 + Ocelot: + income: 20.0 + points: 20 + experience: 15.0 + Horse: + income: 20.0 + points: 20 + experience: 15.0 + Kill: + Chicken: + income: 5.0 + points: 5 + experience: 5.0 + Cow: + income: 6.0 + points: 5 + experience: 5.0 + Pig: + income: 5.0 + points: 5 + experience: 5.0 + Sheep: + income: 5.0 + points: 5 + experience: 5.0 + Wolf: + income: 10.0 + points: 10 + experience: 5.0 + Creeper: + income: 15.0 + points: 15 + experience: 15.0 + Skeleton: + income: 10.0 + points: 10 + experience: 15.0 + Spider: + income: 10.0 + points: 10 + experience: 15.0 + Zombie: + income: 10.0 + points: 10 + experience: 15.0 + BLAZE: + income: 20.0 + points: 20 + experience: 15.0 + CAVE_SPIDER: + income: 20.0 + points: 20 + experience: 15.0 + ENDERMAN: + income: 2.0 + points: 2 + experience: 2.0 + GHAST: + income: 30.0 + points: 30 + experience: 30.0 + GIANT: + income: 250.0 + points: 250 + experience: 100.0 + IRON_GOLEM: + income: 30.0 + points: 30 + experience: 30.0 + MUSHROOM_COW: + income: 5.0 + points: 5 + experience: 5.0 + PIG_ZOMBIE: + income: 5.0 + points: 5 + experience: 5.0 + SILVERFISH: + income: 3.0 + points: 3 + experience: 5.0 + SNOWMAN: + income: 2.0 + points: 2 + experience: 4.0 + SQUID: + income: 2.0 + points: 2 + experience: 2.0 + RABBIT: + income: 2.0 + points: 2 + experience: 2.0 + GUARDIAN: + income: 2.0 + points: 2 + experience: 2.0 + SHULKER: + income: 5.0 + points: 5 + experience: 5.0 + WITHER: + income: 50.0 + points: 50 + experience: 120.0 + ENDER_DRAGON: + income: 2000.0 + points: 2000 + experience: 2000.0 + Player: + income: 9.0 + points: 9 + experience: 7.5 + max-level: 200 + Explorer: + fullname: Explorer + shortname: Ex + description: Earns money from exploring map. + ChatColour: AQUA + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 301 + Data: 0 + Explore: + 1: + income: 5.0 + points: 5 + experience: 5.0 + 2: + income: 2.5 + points: 2.5 + experience: 2.5 + 3: + income: 1.0 + points: 1.0 + experience: 1.0 + 4: + income: 0.5 + points: 0.5 + experience: 0.5 + 5: + income: 0.1 + points: 0.1 + experience: 0.1 + Kill: + Player: + income: 7.5 + experience: 7.5 + max-level: 200 + Crafter: + fullname: Crafter + shortname: Cr + description: Earns money from crafting items. + ChatColour: RED + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 61 + Data: 0 + Craft: + '280': + income: 0.1 + points: 0.1 + experience: 0.1 + '23': + income: 4.0 + points: 4.0 + experience: 4.0 + '25': + income: 1.5 + points: 1.5 + experience: 3.0 + '27': + income: 5.0 + points: 5 + experience: 5.0 + '28': + income: 5.0 + points: 4.0 + experience: 5.0 + '29': + income: 3.0 + points: 3.0 + experience: 3.0 + 'tnt': + income: 4.0 + points: 4.0 + experience: 4.0 + 'chest': + income: 1.3 + points: 1.3 + experience: 1.3 + '58': + income: 0.7 + points: 0.7 + experience: 1.0 + '61': + income: 1.0 + points: 1.0 + experience: 1.0 + '65': + income: 0.1 + points: 0.1 + experience: 0.1 + '66': + income: 1.1 + points: 1.0 + experience: 1.1 + '84': + income: 10.0 + points: 10.0 + experience: 20.0 + '95': + income: 0.3 + points: 0.3 + experience: 0.3 + '108': + income: 2.5 + points: 2.5 + experience: 3.0 + '109': + income: 0.5 + points: 0.5 + experience: 0.5 + '116': + income: 30.0 + points: 30.0 + experience: 40.0 + '138': + income: 100.0 + points: 100.0 + experience: 300.0 + '145': + income: 20.0 + points: 20.0 + experience: 25.0 + '146': + income: 1.5 + points: 1.5 + experience: 1.5 + '147': + income: 3.0 + points: 3.0 + experience: 3.0 + '148': + income: 2.5 + points: 2.5 + experience: 2.5 + '151': + income: 2.5 + points: 2.5 + experience: 2.5 + 'hopper': + income: 7.0 + points: 7.0 + experience: 7.0 + '157': + income: 4.0 + points: 4.0 + experience: 4.0 + '158': + income: 2.0 + points: 2.0 + experience: 3.0 + '159': + income: 1.5 + points: 1.5 + experience: 1.5 + '160': + income: 0.2 + points: 0.2 + experience: 0.2 + '165': + income: 1.0 + points: 1.0 + experience: 1.0 + '168': + income: 3.0 + points: 3.0 + experience: 3.0 + '169': + income: 10.0 + points: 10.0 + experience: 10.0 + '183': + income: 0.5 + points: 0.5 + experience: 0.5 + '184': + income: 0.5 + points: 0.5 + experience: 0.5 + '185': + income: 0.5 + points: 0.5 + experience: 0.5 + '186': + income: 0.5 + points: 0.5 + experience: 0.5 + '187': + income: 0.5 + points: 0.5 + experience: 0.5 + '188': + income: 0.5 + points: 0.5 + experience: 0.5 + '189': + income: 0.5 + points: 0.5 + experience: 0.5 + '190': + income: 0.5 + points: 0.5 + experience: 0.5 + '191': + income: 0.5 + points: 0.5 + experience: 0.5 + '192': + income: 0.5 + points: 0.5 + experience: 0.5 + '324': + income: 0.5 + points: 0.5 + experience: 0.5 + '330': + income: 8.0 + points: 8.0 + experience: 8.0 + '340': + income: 1.0 + points: 1.0 + experience: 1.0 + '345': + income: 4.0 + points: 4.0 + experience: 7.0 + '347': + income: 7.0 + points: 7.0 + experience: 7.0 + '354': + income: 8.0 + points: 8.0 + experience: 10.0 + '355': + income: 3.0 + points: 3.0 + experience: 3.0 + '379': + income: 2.8 + points: 2.8 + experience: 3.5 + '380': + income: 7.0 + points: 7.0 + experience: 7.0 + '427': + income: 0.15 + points: 0.15 + experience: 0.15 + '428': + income: 0.15 + points: 0.15 + experience: 0.15 + '429': + income: 0.15 + points: 0.15 + experience: 0.15 + '430': + income: 0.15 + points: 0.15 + experience: 0.15 + '431': + income: 0.15 + points: 0.15 + experience: 0.15 + Smelt: + COOKED_CHICKEN: + income: 3.0 + points: 3.0 + experience: 3.0 + Kill: + Player: + income: 7.5 + points: 7.5 + experience: 7.5 + max-level: 200 + Fisherman: + fullname: Fisherman + shortname: Fi + description: Earns money from fishing. + ChatColour: AQUA + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 346 + Data: 0 + Fish: + '349-0': + income: 15.0 + points: 15.0 + experience: 15.0 + '349-1': + income: 20.0 + points: 20.0 + experience: 25.0 + '349-2': + income: 25.0 + points: 25.0 + experience: 25.0 + '349-3': + income: 25.0 + points: 25.0 + experience: 25.0 + Kill: + Player: + income: 7.5 + points: 7.5 + experience: 7.5 + max-level: 200 + Weaponsmith: + fullname: Weaponsmith + shortname: W + description: Earns money from crafting and repairing weapons. + ChatColour: DARK_PURPLE + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 58 + Data: 0 + Craft: + WOOD_SWORD: + income: 1.0 + points: 1.0 + experience: 2.0 + LEATHER_BOOTS: + income: 3.0 + points: 3.0 + experience: 4.0 + LEATHER_CHESTPLATE: + income: 4.0 + points: 4.0 + experience: 8.0 + LEATHER_HELMET: + income: 2.5 + points: 2.5 + experience: 5.0 + LEATHER_LEGGINGS: + income: 3.5 + points: 3.5 + experience: 7.0 + IRON_SWORD: + income: 4.0 + points: 4.0 + experience: 8.0 + IRON_BOOTS: + income: 8.0 + points: 8.0 + experience: 16.0 + IRON_CHESTPLATE: + income: 16.0 + points: 16.0 + experience: 32.0 + IRON_HELMET: + income: 10.0 + points: 10.0 + experience: 20.0 + IRON_LEGGINGS: + income: 14.0 + points: 14.0 + experience: 28.0 + GOLD_SWORD: + income: 6.0 + points: 6.0 + experience: 12.0 + GOLD_BOOTS: + income: 12.0 + points: 12.0 + experience: 24.0 + GOLD_CHESTPLATE: + income: 24.0 + points: 24.0 + experience: 48.0 + GOLD_HELMET: + income: 15.0 + points: 15.0 + experience: 30.0 + GOLD_LEGGINGS: + income: 21.0 + points: 21.0 + experience: 42.0 + DIAMOND_SWORD: + income: 8.0 + points: 8.0 + experience: 16.0 + DIAMOND_PICKAXE: + income: 12.0 + points: 12.0 + experience: 24.0 + DIAMOND_AXE: + income: 12.0 + points: 12.0 + experience: 24.0 + DIAMOND_HELMET: + income: 20.0 + points: 20.0 + experience: 40.0 + DIAMOND_CHESTPLATE: + income: 32.0 + points: 32.0 + experience: 64.0 + DIAMOND_LEGGINGS: + income: 28.0 + points: 28.0 + experience: 40.0 + DIAMOND_BOOTS: + income: 16.0 + points: 16.0 + experience: 32.0 + Repair: + WOOD_SWORD: + income: 1.0 + points: 1.0 + experience: 1.0 + IRON_SWORD: + income: 2.0 + points: 2.0 + experience: 2.0 + GOLD_SWORD: + income: 3.0 + points: 3.0 + experience: 3.0 + DIAMOND_SWORD: + income: 4.0 + points: 4.0 + experience: 4.0 + Smelt: + IRON_INGOT: + income: 1.3 + points: 1.3 + experience: 2.0 + GOLD_INGOT: + income: 5.0 + points: 5.0 + experience: 10 + DIAMOND: + income: 7.0 + points: 7.0 + experience: 20 + max-level: 200 + Brewer: + fullname: Brewer + shortname: Br + description: Earns money brewing potions. + ChatColour: LIGHT_PURPLE + chat-display: full + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 379 + Data: 0 + Brew: + NETHER_STALK: + income: 6.0 + points: 6.0 + experience: 6.0 + REDSTONE: + income: 6.0 + points: 6.0 + experience: 6.0 + GLOWSTONE_DUST: + income: 8.0 + points: 8.0 + experience: 8.0 + SPIDER_EYE: + income: 9.0 + points: 9.0 + experience: 9.0 + FERMENTED_SPIDER_EYE: + income: 12.0 + points: 12.0 + experience: 12.0 + BLAZE_POWDER: + income: 12.0 + points: 12.0 + experience: 12.0 + SUGAR: + income: 7.0 + points: 7.0 + experience: 7.0 + SPECKLED_MELON: + income: 10.0 + points: 10.0 + experience: 10.0 + MAGMA_CREAM: + income: 12.0 + points: 12.0 + experience: 12.0 + GHAST_TEAR: + income: 22.0 + points: 22.0 + experience: 22.0 + GOLDEN_CARROT: + income: 14.0 + points: 14.0 + experience: 14.0 + 349-3: + income: 14.0 + points: 14.0 + experience: 14.0 + RABBIT_FOOT: + income: 18.0 + points: 18.0 + experience: 18.0 + max-level: 200 + Enchanter: + fullname: Enchanter + shortname: E + description: Earns money enchanting weapons. + ChatColour: DARK_BLUE + chat-display: full + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Gui: + Id: 116 + Data: 0 + Enchant: + WOOD_SWORD: + income: 1.5 + points: 1.5 + experience: 3.0 + LEATHER_BOOTS: + income: 1.0 + points: 1.0 + experience: 6.0 + LEATHER_CHESTPLATE: + income: 2.0 + points: 2.0 + experience: 6.0 + LEATHER_HELMET: + income: 1.0 + points: 1.0 + experience: 6.0 + LEATHER_LEGGINGS: + income: 2.0 + points: 2.0 + experience: 6.0 + IRON_SWORD: + income: 3.0 + points: 3.0 + experience: 6.0 + IRON_BOOTS: + income: 2.5 + points: 2.5 + experience: 9.0 + IRON_CHESTPLATE: + income: 4.5 + points: 4.5 + experience: 9.0 + IRON_HELMET: + income: 2.5 + points: 2.5 + experience: 9.0 + IRON_LEGGINGS: + income: 4.5 + points: 4.5 + experience: 9.0 + GOLD_SWORD: + income: 4.5 + points: 4.5 + experience: 15.0 + GOLD_BOOTS: + income: 2.5 + points: 2.5 + experience: 15.0 + GOLD_CHESTPLATE: + income: 5.5 + points: 5.5 + experience: 15.0 + GOLD_HELMET: + income: 2.5 + points: 2.5 + experience: 15.0 + GOLD_LEGGINGS: + income: 5.5 + points: 5.5 + experience: 15.0 + DIAMOND_SWORD: + income: 9.0 + points: 9.0 + experience: 30.0 + DIAMOND_SPADE: + income: 5.0 + points: 5.0 + experience: 30.0 + DIAMOND_PICKAXE: + income: 10.0 + points: 10.0 + experience: 30.0 + DIAMOND_AXE: + income: 10.0 + points: 10.0 + experience: 30.0 + DIAMOND_HELMET: + income: 6.0 + points: 6.0 + experience: 30.0 + DIAMOND_CHESTPLATE: + income: 12.0 + points: 12.0 + experience: 50.0 + DIAMOND_LEGGINGS: + income: 12.0 + points: 12.0 + experience: 50.0 + DIAMOND_BOOTS: + income: 6.0 + points: 6.0 + experience: 30.0 + ARROW_DAMAGE-1: + income: 10.0 + points: 10.0 + experience: 10.0 + ARROW_DAMAGE-2: + income: 20.0 + points: 20.0 + experience: 20.0 + ARROW_DAMAGE-3: + income: 30.0 + points: 30.0 + experience: 30.0 + ARROW_DAMAGE-4: + income: 40.0 + points: 40.0 + experience: 40.0 + ARROW_DAMAGE-5: + income: 50.0 + points: 50.0 + experience: 50.0 + ARROW_FIRE: + income: 10.0 + points: 10.0 + experience: 30.0 + ARROW_INFINITE: + income: 20.0 + points: 20.0 + experience: 50.0 + ARROW_KNOCKBACK-1: + income: 10.0 + points: 10.0 + experience: 10.0 + ARROW_KNOCKBACK-2: + income: 20.0 + points: 20.0 + experience: 20.0 + DAMAGE_ALL-1: + income: 10.0 + points: 10.0 + experience: 10.0 + DAMAGE_ALL-2: + income: 20.0 + points: 20.0 + experience: 20.0 + DAMAGE_ALL-3: + income: 30.0 + points: 30.0 + experience: 30.0 + DAMAGE_ALL-4: + income: 40.0 + points: 40.0 + experience: 40.0 + DAMAGE_ALL-5: + income: 50.0 + points: 50.0 + experience: 50.0 + DAMAGE_ARTHROPODS-1: + income: 10.0 + points: 10.0 + experience: 10.0 + DAMAGE_ARTHROPODS-2: + income: 20.0 + points: 20.0 + experience: 20.0 + DAMAGE_ARTHROPODS-3: + income: 30.0 + points: 30.0 + experience: 30.0 + DAMAGE_ARTHROPODS-4: + income: 40.0 + points: 40.0 + experience: 40.0 + DAMAGE_ARTHROPODS-5: + income: 50.0 + points: 50.0 + experience: 50.0 + DAMAGE_UNDEAD-1: + income: 10.0 + points: 10.0 + experience: 10.0 + DAMAGE_UNDEAD-2: + income: 20.0 + points: 20.0 + experience: 20.0 + DAMAGE_UNDEAD-3: + income: 30.0 + points: 30.0 + experience: 30.0 + DAMAGE_UNDEAD-4: + income: 40.0 + points: 40.0 + experience: 40.0 + DAMAGE_UNDEAD-5: + income: 50.0 + points: 50.0 + experience: 50.0 + DEPTH_STRIDER-1: + income: 10.0 + points: 10.0 + experience: 10.0 + DEPTH_STRIDER-2: + income: 20.0 + points: 20.0 + experience: 20.0 + DEPTH_STRIDER-3: + income: 30.0 + points: 30.0 + experience: 30.0 + DIG_SPEED-1: + income: 10.0 + points: 10.0 + experience: 10.0 + DIG_SPEED-2: + income: 20.0 + points: 20.0 + experience: 20.0 + DIG_SPEED-3: + income: 30.0 + points: 30.0 + experience: 30.0 + DIG_SPEED-4: + income: 40.0 + points: 40.0 + experience: 40.0 + DIG_SPEED-5: + income: 50.0 + points: 50.0 + experience: 50.0 + DURABILITY-1: + income: 10.0 + points: 10.0 + experience: 10.0 + DURABILITY-2: + income: 20.0 + points: 20.0 + experience: 20.0 + DURABILITY-3: + income: 30.0 + points: 30.0 + experience: 30.0 + FIRE_ASPECT-1: + income: 10.0 + points: 10.0 + experience: 10.0 + FIRE_ASPECT-2: + income: 20.0 + points: 20.0 + experience: 20.0 + KNOCKBACK-1: + income: 10.0 + points: 10.0 + experience: 10.0 + KNOCKBACK-2: + income: 20.0 + points: 20.0 + experience: 20.0 + LOOT_BONUS_BLOCKS-1: + income: 20.0 + points: 20.0 + experience: 100.0 + LOOT_BONUS_BLOCKS-2: + income: 40.0 + points: 40.0 + experience: 200.0 + LOOT_BONUS_BLOCKS-3: + income: 80.0 + points: 80.0 + experience: 300.0 + LOOT_BONUS_MOBS-1: + income: 10.0 + points: 10.0 + experience: 20.0 + LOOT_BONUS_MOBS-2: + income: 20.0 + points: 20.0 + experience: 40.0 + LOOT_BONUS_MOBS-3: + income: 30.0 + points: 30.0 + experience: 60.0 + LUCK-1: + income: 15.0 + points: 15.0 + experience: 10.0 + LUCK-2: + income: 25.0 + points: 25.0 + experience: 20.0 + LUCK-3: + income: 35.0 + points: 35.0 + experience: 30.0 + LURE-1: + income: 10.0 + points: 10.0 + experience: 10.0 + LURE-2: + income: 20.0 + points: 20.0 + experience: 20.0 + LURE-3: + income: 30.0 + points: 30.0 + experience: 30.0 + OXYGEN-1: + income: 10.0 + points: 10.0 + experience: 10.0 + OXYGEN-2: + income: 20.0 + points: 20.0 + experience: 20.0 + OXYGEN-3: + income: 30.0 + points: 30.0 + experience: 30.0 + PROTECTION_ENVIRONMENTAL-1: + income: 10.0 + points: 10.0 + experience: 10.0 + PROTECTION_ENVIRONMENTAL-2: + income: 20.0 + points: 20.0 + experience: 20.0 + PROTECTION_ENVIRONMENTAL-3: + income: 30.0 + points: 30.0 + experience: 30.0 + PROTECTION_ENVIRONMENTAL-4: + income: 40.0 + points: 40.0 + experience: 40.0 + PROTECTION_EXPLOSIONS-1: + income: 10.0 + points: 10.0 + experience: 10.0 + PROTECTION_EXPLOSIONS-2: + income: 20.0 + points: 20.0 + experience: 20.0 + PROTECTION_EXPLOSIONS-3: + income: 30.0 + points: 30.0 + experience: 30.0 + PROTECTION_EXPLOSIONS-4: + income: 40.0 + points: 40.0 + experience: 40.0 + PROTECTION_FALL-1: + income: 10.0 + points: 10.0 + experience: 10.0 + PROTECTION_FALL-2: + income: 20.0 + points: 20.0 + experience: 20.0 + PROTECTION_FALL-3: + income: 30.0 + points: 30.0 + experience: 30.0 + PROTECTION_FALL-4: + income: 40.0 + points: 40.0 + experience: 40.0 + PROTECTION_FIRE-1: + income: 5.0 + points: 5.0 + experience: 10.0 + PROTECTION_FIRE-2: + income: 10.0 + points: 10.0 + experience: 20.0 + PROTECTION_FIRE-3: + income: 20.0 + points: 20.0 + experience: 30.0 + PROTECTION_FIRE-4: + income: 30.0 + points: 30.0 + experience: 40.0 + PROTECTION_PROJECTILE-1: + income: 10.0 + points: 10.0 + experience: 10.0 + PROTECTION_PROJECTILE-2: + income: 20.0 + points: 20.0 + experience: 20.0 + PROTECTION_PROJECTILE-3: + income: 30.0 + points: 30.0 + experience: 30.0 + PROTECTION_PROJECTILE-4: + income: 40.0 + points: 40.0 + experience: 40.0 + SILK_TOUCH: + income: 100.0 + points: 100.0 + experience: 300.0 + THORNS-1: + income: 10.0 + points: 10.0 + experience: 10.0 + THORNS-2: + income: 20.0 + points: 20.0 + experience: 20.0 + THORNS-3: + income: 30.0 + points: 30.0 + experience: 30.0 + WATER_WORKER: + income: 30.0 + points: 30.0 + experience: 100.0 + max-level: 200 + None: + fullname: None + shortname: N + ChatColour: WHITE + chat-display: none + #max-level: 10 + #slots: 10 + leveling-progression-equation: 10*(joblevel)+(joblevel*joblevel*4) + income-progression-equation: baseincome+(baseincome*(joblevel-1)*0.01)-((baseincome+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + points-progression-equation: basepoints+(basepoints*(joblevel-1)*0.01)-((basepoints+(joblevel-1)*0.01) * ((numjobs-1)*0.05)) + experience-progression-equation: baseexperience-(baseexperience*((numjobs-1) *0.01)) + Kill: + Player: income: 7.5 \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index 13682b5e..1e16905b 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,7 +1,7 @@ name: Jobs description: Jobs Plugin for the BukkitAPI main: com.gamingmesh.jobs.Jobs -version: 3.6.3 +version: 3.7.0 author: phrstbrn depend: [Vault] softdepend: [MythicMobs, McMMO]