diff --git a/pom.xml b/pom.xml index 4f5740e7..900bd8eb 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ org.spigotmc spigot-api - 1.16.3-R0.1-SNAPSHOT + 1.16.4-R0.1-SNAPSHOT provided @@ -153,6 +153,7 @@ com.github.Nathat23 StackMob-5 master-SNAPSHOT + provided @@ -220,7 +221,7 @@ maven-compiler-plugin - 2.4 + 3.8.1 1.8 1.8 diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 5a75c693..24a02a63 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -258,9 +258,7 @@ public class PlayerManager { * Save all the information of all of the players */ public void convertChacheOfPlayers(boolean resetID) { - int y = 0; - int i = 0; - int total = playersUUIDCache.size(); + int y = 0, i = 0, total = playersUUIDCache.size(); for (JobsPlayer jPlayer : playersUUIDCache.values()) { if (resetID) @@ -917,11 +915,8 @@ public class PlayerManager { if (itemName == null) return null; } - JobItems b = ItemBoostManager.getItemByKey(itemName.toString()); - if (b == null) - return null; - return b; + return ItemBoostManager.getItemByKey(itemName.toString()); } // public BoostMultiplier getJobsBoostByNbt(ItemStack item) { @@ -960,34 +955,34 @@ public class PlayerManager { if (HookManager.getMcMMOManager().mcMMOPresent || HookManager.getMcMMOManager().mcMMOOverHaul) boost.add(BoostOf.McMMO, new BoostMultiplier().add(HookManager.getMcMMOManager().getMultiplier(player.getPlayer()))); - Double petPay = null; + double petPay = 0D; if (ent instanceof Tameable) { Tameable t = (Tameable) ent; if (t.isTamed() && t.getOwner() instanceof Player) { petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", false, false, true); - if (petPay != null) + if (petPay != 0D) boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay)); } } if (ent != null && HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(ent, player.getPlayer())) { - if (petPay == null) + if (petPay == 0D) petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", false, false, true); - if (petPay != null) + if (petPay != 0D) boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay)); } if (victim != null && victim.hasMetadata(getMobSpawnerMetadata())) { - Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner"); - if (amount != null) + Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", false, false, true); + if (amount != 0D) boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(amount)); } if (getall) { - if (petPay == null) + if (petPay == 0D) petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", force, false, true); - if (petPay != null) + if (petPay != 0D) boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay)); Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force); if (amount != null) diff --git a/src/main/java/com/gamingmesh/jobs/container/ExploreChunk.java b/src/main/java/com/gamingmesh/jobs/container/ExploreChunk.java index 60102235..f9b091e0 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ExploreChunk.java +++ b/src/main/java/com/gamingmesh/jobs/container/ExploreChunk.java @@ -51,7 +51,7 @@ public class ExploreChunk { StringBuilder s = new StringBuilder(); for (Integer one : playerIds) { if (!s.toString().isEmpty()) - s.append(";"); + s.append(';'); s.append(one); } return s.toString(); diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 5da57412..aee4f7d4 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -153,16 +153,14 @@ public class JobsPlayer { public boolean isUnderLimit(CurrencyType type, Double amount) { Player player = getPlayer(); - if (player == null) - return true; - if (amount == 0) + if (player == null || amount == 0) return true; CurrencyLimit limit = Jobs.getGCManager().getLimit(type); if (!limit.isEnabled()) return true; PaymentData data = getPaymentLimit(); - Integer value = limits.get(type); - if (data.isReachedLimit(type, value == null ? 0 : value)) { + Integer value = limits.getOrDefault(type, 0); + if (data.isReachedLimit(type, value)) { String name = type.getName().toLowerCase(); if (player.isOnline() && !data.isInformed() && !data.isReseted(type)) { diff --git a/src/main/java/com/gamingmesh/jobs/container/ShopItem.java b/src/main/java/com/gamingmesh/jobs/container/ShopItem.java index c48a0468..198a8c2f 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ShopItem.java +++ b/src/main/java/com/gamingmesh/jobs/container/ShopItem.java @@ -6,34 +6,27 @@ import java.util.List; public class ShopItem { - private String NodeName = null; - private double price = 0D; - private int slot = -1; - private int page = -1; + private int slot = -1, page = -1, iconAmount = 1; - private String IconMaterial = null; - private int IconAmount = 1; - private String IconName = null; - private final List IconLore = new ArrayList<>(); + private String nodeName = null, iconMaterial = null, iconName = null; - private boolean HideWithoutPerm = false; + private boolean hideWithoutPerm = false; private boolean hideNoEnoughPoint = false; - private int RequiredTotalLevels = -1; + private int requiredTotalLevels = -1; - private HashMap RequiredJobs = new HashMap<>(); + private HashMap requiredJobs = new HashMap<>(); - private final List RequiredPerm = new ArrayList<>(); - private final List Commands = new ArrayList<>(); + private final List iconLore = new ArrayList<>(), requiredPerm = new ArrayList<>(), commands = new ArrayList<>(); private final List items = new ArrayList<>(); - private String PlayerName; + private String playerName; private boolean useCurrentPlayer = false; - public ShopItem(String NodeName, double price) { - this.NodeName = NodeName; + public ShopItem(String nodeName, double price) { + this.nodeName = nodeName; this.price = price; } @@ -62,30 +55,30 @@ public class ShopItem { return items; } - public void setCommands(List Commands) { - this.Commands.clear(); - this.Commands.addAll(Commands == null ? new ArrayList<>() : Commands); + public void setCommands(List commands) { + this.commands.clear(); + this.commands.addAll(commands == null ? new ArrayList<>() : commands); } public List getCommands() { - return Commands; + return commands; } - public void setRequiredJobs(HashMap RequiredJobs) { - this.RequiredJobs = RequiredJobs; + public void setRequiredJobs(HashMap requiredJobs) { + this.requiredJobs = requiredJobs; } public HashMap getRequiredJobs() { - return RequiredJobs; + return requiredJobs; } - public void setRequiredPerm(List RequiredPerm) { - this.RequiredPerm.clear(); - this.RequiredPerm.addAll(RequiredPerm == null ? new ArrayList<>() : RequiredPerm); + public void setRequiredPerm(List requiredPerm) { + this.requiredPerm.clear(); + this.requiredPerm.addAll(requiredPerm == null ? new ArrayList<>() : requiredPerm); } public List getRequiredPerm() { - return RequiredPerm; + return requiredPerm; } public void setHideIfThereIsNoEnoughPoints(boolean hideNoEnoughPoint) { @@ -96,69 +89,69 @@ public class ShopItem { return hideNoEnoughPoint; } - public void setHideWithoutPerm(boolean HideWithoutPerm) { - this.HideWithoutPerm = HideWithoutPerm; + public void setHideWithoutPerm(boolean hideWithoutPerm) { + this.hideWithoutPerm = hideWithoutPerm; } public boolean isHideWithoutPerm() { - return HideWithoutPerm; + return hideWithoutPerm; } - public void setIconLore(List IconLore) { - this.IconLore.clear(); - this.IconLore.addAll(IconLore == null ? new ArrayList<>() : IconLore); + public void setIconLore(List iconLore) { + this.iconLore.clear(); + this.iconLore.addAll(iconLore == null ? new ArrayList<>() : iconLore); } public List getIconLore() { - return IconLore; + return iconLore; } public String getNodeName() { - return NodeName; + return nodeName; } public String getIconMaterial() { - return IconMaterial; + return iconMaterial; } - public void setIconMaterial(String IconMaterial) { - this.IconMaterial = IconMaterial; + public void setIconMaterial(String iconMaterial) { + this.iconMaterial = iconMaterial; } public double getPrice() { return price; } - public void setIconAmount(int IconAmount) { - this.IconAmount = IconAmount; + public void setIconAmount(int iconAmount) { + this.iconAmount = iconAmount; } public int getIconAmount() { - return IconAmount; + return iconAmount; } - public void setIconName(String IconName) { - this.IconName = IconName; + public void setIconName(String iconName) { + this.iconName = iconName; } public String getIconName() { - return IconName; + return iconName; } public int getRequiredTotalLevels() { - return RequiredTotalLevels; + return requiredTotalLevels; } - public void setRequiredTotalLevels(int RequiredTotalLevels) { - this.RequiredTotalLevels = RequiredTotalLevels; + public void setRequiredTotalLevels(int requiredTotalLevels) { + this.requiredTotalLevels = requiredTotalLevels; } public String getCustomHead() { - return PlayerName; + return playerName; } - public void setCustomHead(String PlayerName) { - this.PlayerName = PlayerName; + public void setCustomHead(String playerName) { + this.playerName = playerName; } public boolean isHeadOwner() {