diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java index 34e9f0cc..6fba429e 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java @@ -623,6 +623,7 @@ public class ItemManager { ACACIA_STAIRS(163, 0, 17453, "Acacia Stairs"), ACACIA_TRAPDOOR(-1, -1, 18343, "Acacia Trapdoor"), ACACIA_WOOD(-1, -1, 21861, "Acacia Wood"), + ACACIA_WOOD_BARK(-1, -1, 156, "Acacia Wood With Bark"), ACTIVATOR_RAIL(157, 0, 5834, "Activator Rail"), AIR(0, 0, 9648, "Air"), ALLIUM(38, 2, 6871, "Allium", "RED_ROSE"), @@ -658,6 +659,7 @@ public class ItemManager { BIRCH_STAIRS(135, 0, 7657, "Birch Wood Stairs", "Birch Stairs"), BIRCH_TRAPDOOR(-1, -1, 32585, "Birch Trapdoor"), BIRCH_WOOD(-1, -1, 20913, "Birch Wood"), + BIRCH_WOOD_BARK(-1, -1, 18354, "Birch Wood With Bark"), BLACK_BANNER(425, 0, 9365, "Banner", "Black Banner"), BLACK_BED(355, 15, 20490, "Black Bed"), BLACK_CARPET(171, 15, 6056, "Black Carpet"), @@ -823,6 +825,7 @@ public class ItemManager { DARK_OAK_STAIRS(164, 0, 22921, "Dark Oak Stairs"), DARK_OAK_TRAPDOOR(-1, -1, 10355, "Dark Oak Trapdoor"), DARK_OAK_WOOD(-1, -1, 16995, "Dark Oak Wood"), + DARK_OAK_WOOD_BARK(-1, -1, 7354, "Dark Oak Wood With Bark"), DARK_PRISMARINE(168, 2, 19940, "Dark Prismarine"), DARK_PRISMARINE_SLAB(-1, -1, 7577, "Dark Prismarine Slab"), DARK_PRISMARINE_STAIRS(-1, -1, 26511, "Dark Prismarine Stairs"), @@ -1029,6 +1032,7 @@ public class ItemManager { JUNGLE_STAIRS(136, 0, 20636, "Jungle Wood Stairs", "Jungle Stairs"), JUNGLE_TRAPDOOR(-1, -1, 8626, "Jungle Trapdoor"), JUNGLE_WOOD(-1, -1, 10341, "Jungle Wood"), + JUNGLE_WOOD_BARK(-1, -1, 458, "Jungle Wood With Bark"), KELP(-1, -1, 21916, "Kelp"), KELP_PLANT(-1, -1, 29697, "Kelp Plant"), KNOWLEDGE_BOOK(453, 0, 12646, "Knowledge Book"), @@ -1163,6 +1167,7 @@ public class ItemManager { OAK_STAIRS(53, 0, 5449, "Oak Stairs", "WOOD_STAIRS"), OAK_TRAPDOOR(96, 0, 16927, "Oak Trapdoor", "Trapdoor"), OAK_WOOD(-1, -1, 7378, "Oak Wood"), + OAK_WOOD_BARK(-1, -1, 2894, "Oak Wood With Bark"), OBSERVER(218, 0, 10726, "Observer"), OBSIDIAN(49, 0, 32723, "Obsidian"), OCELOT_SPAWN_EGG(383, 98, 30080, "Spawn Ocelot", "Ocelot Spawn Egg"), @@ -1418,6 +1423,7 @@ public class ItemManager { SPRUCE_STAIRS(134, 0, 11192, "Spruce Wood Stairs", "Spruce Stairs"), SPRUCE_TRAPDOOR(-1, -1, 10289, "Spruce Trapdoor"), SPRUCE_WOOD(-1, -1, 32328, "Spruce Wood"), + SPRUCE_WOOD_BARK(-1, -1, 22156, "Spruce Wood With Bark"), SQUID_SPAWN_EGG(383, 94, 10682, "Spawn Squid", "Squid Spawn Egg"), STICK(280, 0, 9773, "Stick"), STICKY_PISTON(29, 0, 18127, "Sticky Piston", "PISTON_STICKY_BASE"), @@ -2085,6 +2091,9 @@ public class ItemManager { public boolean isPotion() { switch (this) { + case LINGERING_POTION: + case SPLASH_POTION: + case POTION: case POTION_AWKWARD: case POTION_FIRE_RESISTANCE_1: diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 0dc1cd5f..047078ba 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -979,14 +979,13 @@ public class Jobs extends JavaPlugin { } } if (!jPlayer.isUnderLimit(CurrencyType.MONEY, income)) { - if(GconfigManager.useMaxPaymentCurve ){ - double percentOver =jPlayer.percentOverLimit(CurrencyType.MONEY); - float factor = GconfigManager.maxPaymentCurveFactor; - double percentLoss = 100/((1/factor*percentOver*percentOver)+1); - income = income - (income*percentLoss/100); - }else { - income = 0D; - } + if (GconfigManager.useMaxPaymentCurve) { + double percentOver = jPlayer.percentOverLimit(CurrencyType.MONEY); + float factor = GconfigManager.maxPaymentCurveFactor; + double percentLoss = 100 / ((1 / factor * percentOver * percentOver) + 1); + income = income - (income * percentLoss / 100); + } else + income = 0D; if (GconfigManager.getLimit(CurrencyType.MONEY).getStopWith().contains(CurrencyType.POINTS)) pointAmount = 0D; } diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 0975f5bb..449cd1ee 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -568,7 +568,7 @@ public class PlayerManager { for (String line : message.split("\n")) { if (Jobs.getGCManager().isBroadcastingLevelups()) { if (Jobs.getGCManager().BroadcastingLevelUpLevels.contains(oldLevel + 1) || Jobs.getGCManager().BroadcastingLevelUpLevels.contains(0)) - Jobs.consoleMsg(line); + Bukkit.getServer().broadcastMessage(line); } else if (player != null) { if (Jobs.getGCManager().LevelChangeActionBar) Jobs.getActionBar().send(player, line); @@ -607,7 +607,7 @@ public class PlayerManager { message = message.replace("%jobname%", job.getChatColor() + job.getName()); for (String line : message.split("\n")) { if (Jobs.getGCManager().isBroadcastingSkillups()) - Jobs.consoleMsg(line); + Bukkit.getServer().broadcastMessage(line); else if (player != null) { if (Jobs.getGCManager().TitleChangeActionBar) Jobs.getActionBar().send(player, line); diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index e1e20764..a2f45ed4 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -299,10 +299,6 @@ public class JobsCommands implements CommandExecutor { /** * 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; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java b/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java index 206a0a40..bfd91b9b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java @@ -28,6 +28,9 @@ public class itembonus implements Cmd { return false; } + if (!Jobs.hasPermission(sender, "jobs.commands.itembonus", true)) + return true; + Player player = (Player) sender; JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/log.java b/src/main/java/com/gamingmesh/jobs/commands/list/log.java index dc3c6215..2b4533c9 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/log.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/log.java @@ -27,6 +27,9 @@ public class log implements Cmd { return false; } + if (!Jobs.hasPermission(sender, "jobs.commands.log", true)) + return true; + if (args.length != 1 && args.length != 0) { Jobs.getCommandManager().sendUsage(sender, "log"); return true; @@ -35,9 +38,9 @@ public class log implements Cmd { if (args.length == 0) JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); else if (args.length == 1) { - if (!Jobs.hasPermission(sender, "jobs.commands.log.others", true)) { + if (!Jobs.hasPermission(sender, "jobs.commands.log.others", true)) return true; - } + JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index 22ad56d5..4acc23db 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -20,6 +20,9 @@ public class quests implements Cmd { @Override @JobCommand(400) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { + if (!Jobs.hasPermission(sender, "jobs.commands.quests", true)) + return true; + JobsPlayer jPlayer = null; if (args.length >= 1 && args[0].equals("next")) { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/shop.java b/src/main/java/com/gamingmesh/jobs/commands/list/shop.java index 6a90f50d..6d1d2956 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/shop.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/shop.java @@ -17,6 +17,9 @@ public class shop implements Cmd { return true; } + if (!Jobs.hasPermission(sender, "jobs.commands.shop", true)) + return true; + if (args.length != 0 && args.length != 1) { Jobs.getCommandManager().sendUsage(sender, "shop"); return true; diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index ecbaa84b..5c01603b 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -26,7 +26,6 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; -import com.gamingmesh.jobs.economy.Economy; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.configuration.file.YamlConfiguration; @@ -126,9 +125,9 @@ public class GeneralConfigManager { public double MonsterDamagePercentage; public double DynamicPaymentMaxPenalty; public double DynamicPaymentMaxBonus; - public boolean useMaxPaymentCurve; - public float maxPaymentCurveFactor; - public double TaxesAmount; + public boolean useMaxPaymentCurve; + public float maxPaymentCurveFactor; + public double TaxesAmount; public String SoundLevelupSound, SoundTitleChangeSound, ServerAcountName, ServertaxesAcountName; public ArrayList keys; public boolean hideJobsInfoWithoutPermission; @@ -619,9 +618,9 @@ public class GeneralConfigManager { DynamicPaymentMaxBonus = c.get("Economy.DynamicPayment.MaxBonus", 100.0); c.getW().addComment("Economy.MaxPayment.curve.use", "Enabling this feature will mean players will still earn once they reach cap but " + "will loose a percentage the higher over cap they go. Controlled by a factor. math is ```100/((1/factor*percentOver^2)+1)```"); - useMaxPaymentCurve = c.get("Economy.MaxPayment.curve.use",false); - int temp = c.get("Economy.MaxPayment.curve.factor",10); - maxPaymentCurveFactor = ((float)temp)/1000; + useMaxPaymentCurve = c.get("Economy.MaxPayment.curve.use", false); + int temp = c.get("Economy.MaxPayment.curve.factor", 10); + maxPaymentCurveFactor = ((float) temp) / 1000; c.getW().addComment("Economy.UseServerAcount", "Server economy account", "With this enabled, players will get money from defined user (server account)", "If this account don't have enough money to pay for players for, player will get message"); UseServerAccount = c.get("Economy.UseServerAcount", false); diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 9bfe0e3a..a98c9726 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -240,8 +240,8 @@ public class LanguageManager { c.get("command.limit.output.pointsLimit", "&ePoint limit: &2%current%&e/&2%total%"); c.get("command.limit.output.reachedmoneylimit", "&4You have reached money limit in given time!"); c.get("command.limit.output.reachedmoneylimit2", "&eYou can check your limit with &2/jobs limit &ecommand"); - c.get("command.limit.output.reachedmoneylimit3", "&eMoney earned is now reduced exponentially...but you still earn a little!!"); - c.get("command.limit.output.reachedexplimit", "&4You have reached exp limit in given time!"); + c.get("command.limit.output.reachedmoneylimit3", "&eMoney earned is now reduced exponentially... But you still earn a little!!"); + c.get("command.limit.output.reachedexplimit", "&4You have reached exp limit in given time!"); c.get("command.limit.output.reachedexplimit2", "&eYou can check your limit with &2/jobs limit &ecommand"); c.get("command.limit.output.reachedpointslimit", "&4You have reached exp limit in given time!"); c.get("command.limit.output.reachedpointslimit2", "&eYou can check your limit with &2/jobs limit &ecommand"); @@ -304,7 +304,6 @@ public class LanguageManager { c.get("command.iteminfo.output.data", " &eItem data: &6%itemdata%"); c.get("command.iteminfo.output.usage", " &eUsage: &6%first% &eor &6%second%"); - c.get("command.placeholders.help.info", "List out all placeholders"); c.get("command.placeholders.help.args", "(parse) (placeholder)"); c.get("command.placeholders.output.list", "&e[place]. &7[placeholder]"); diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 6ba16814..10cf42c7 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; -import com.gamingmesh.jobs.commands.list.info; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -147,11 +146,12 @@ public class JobsPlayer { data.AddAmount(type, amount); return true; } - public double percentOverLimit(CurrencyType type){ - Integer value = this.limits.get(type); - PaymentData data = getPaymentLimit(); - return data.percentOverLimit(type,value == null ? 0 : value); - } + + public double percentOverLimit(CurrencyType type) { + Integer value = limits.get(type); + PaymentData data = getPaymentLimit(); + return data.percentOverLimit(type, value == null ? 0 : value); + } public void loadLogFromDao() { Jobs.getJobsDAO().loadLog(this); @@ -170,7 +170,7 @@ public class JobsPlayer { } public synchronized void hideBossBars() { - for (BossBarInfo one : this.barMap) { + for (BossBarInfo one : barMap) { one.getBar().setVisible(false); } } diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java b/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java index f2781fae..ed272f02 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java @@ -14,7 +14,7 @@ public class JobsMySQL extends JobsDAO { private Jobs plugin; JobsMySQL(Jobs plugin, String hostname, String database, String username, String password, String prefix, boolean certificate, boolean ssl) { - super(plugin, "com.mysql.jdbc.Driver", "jdbc:mysql://" + hostname + "/" + database + "?autoReconnect=true&useSSL=" + ssl + "&verifyServerCertificate=" + certificate, username, password, prefix); + super(plugin, "com.mysql.jdbc.Driver", "jdbc:mysql://" + hostname + "/" + database + "?useUnicode=true&characterEncoding=UTF-8&autoReConnect=true&useSSL=" + ssl + "&verifyServerCertificate=" + certificate, username, password, prefix); this.plugin = plugin; this.database = database; this.setDbType(DataBaseType.MySQL); diff --git a/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java b/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java index f5783437..c22e61d1 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java +++ b/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java @@ -107,9 +107,10 @@ public class PaymentData { return false; return true; } - public double percentOverLimit(CurrencyType type,int limit){ - return ((this.payments.get(type) / limit)-1)*100; - } + + public double percentOverLimit(CurrencyType type, int limit) { + return ((this.payments.get(type) / limit) - 1) * 100; + } public boolean IsOverTimeLimit(CurrencyType type) { if (this.GetTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis()) diff --git a/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java b/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java index 4aa55675..3d1e08e2 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java @@ -221,19 +221,4 @@ public class CMIScoreboardManager { Object con = conField.get(nmsPlayer); return con; } - - private String getMaxLengthofDName(String s) { - return s.length() > 16 ? s.substring(0, 16) : s; - } - - private String getSecondMaxLengthofList(String s) { - if (s.length() > 32) { - s = s.substring(0, 32); - } - return s.length() > 16 ? s.substring(16, s.length()) : ""; - } - - private String getSlotColor(int slot) { - return ChatColor.values()[slot].toString(); - } } diff --git a/src/main/resources/locale/messages_hu.yml b/src/main/resources/locale/messages_hu.yml index 545de7cf..4eb2db00 100644 --- a/src/main/resources/locale/messages_hu.yml +++ b/src/main/resources/locale/messages_hu.yml @@ -118,6 +118,7 @@ command: pointsLimit: '&ePont limit: &2%current%&e/&2%total%' reachedmoneylimit: '&4Elérted a pénzkorlátot az adott időben!' reachedmoneylimit2: '&eA korlátot ellenőrizheted a &2/jobs limit &eparanccsal.' + reachedmoneylimit3: '&eA szerzett pénz most már exponenciálisan csökkentve... De még mindig egy kicsit keres!!' reachedexplimit: '&4Elérted a határidőt a meghatározott időben!' reachedexplimit2: '&eA korlátot ellenőrizheted a &2/jobs limit &eparanccsal.' reachedpointslimit: '&4Elérted a határidőt a meghatározott időben!' diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f3f2107a..412a27a0 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -41,6 +41,7 @@ permissions: jobs.command.join: true jobs.command.leave: true jobs.command.leaveall: true + jobs.command.log: true jobs.command.info: true jobs.command.playerinfo: true jobs.command.fire: true @@ -50,6 +51,7 @@ permissions: jobs.command.edititembonus: true jobs.command.promote: true jobs.command.points: true + jobs.command.quests: true jobs.command.demote: true jobs.command.grantxp: true jobs.command.removexp: true @@ -62,6 +64,7 @@ permissions: jobs.command.limit: true jobs.command.give: true jobs.command.signs: true + jobs.command.shop: true jobs.command.stats: true jobs.command.fixnames: true jobs.command.signupdate: true @@ -71,6 +74,7 @@ permissions: jobs.command.clearownership: true jobs.command.expboost: true jobs.command.iteminfo: true + jobs.command.itembonus: true jobs.command.blockinfo: true jobs.command.browse: description: Grants access to the browse command