diff --git a/src/main/java/com/gamingmesh/jobs/Placeholders/ChatFilterRule.java b/src/main/java/com/gamingmesh/jobs/Placeholders/ChatFilterRule.java index b7d2ae78..2ca47792 100644 --- a/src/main/java/com/gamingmesh/jobs/Placeholders/ChatFilterRule.java +++ b/src/main/java/com/gamingmesh/jobs/Placeholders/ChatFilterRule.java @@ -87,8 +87,10 @@ public class ChatFilterRule { public Matcher getMatcher(String msg) { for (Pattern one : pattern) { - if (one.matcher(msg).find()) { - return one.matcher(msg); + Matcher matcher = one.matcher(msg); + + if (matcher.find()) { + return matcher; } } return null; diff --git a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java index 57292733..13e78ca6 100644 --- a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java +++ b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java @@ -197,7 +197,8 @@ public class Placeholder { if (isComplex()) { String name = getName(); int i = 0; - for (String one : getName().split("_")) { + + for (String one : name.split("_")) { if (!one.startsWith("$")) continue; @@ -409,7 +410,8 @@ public class Placeholder { JobsPlayer user = uuid == null ? null : Jobs.getPlayerManager().getJobsPlayer(uuid); // Placeholders by JobsPlayer object if (user != null) { - NumberFormat format; + NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH); + switch (placeHolder) { case user_dailyquests_pending: Integer pendingQuests = (int) user.getQuestProgressions().stream().filter(q -> !q.isCompleted()).count(); @@ -451,7 +453,6 @@ public class Placeholder { case user_points_fixed: return Integer.toString((int) user.getPointsData().getCurrentPoints()); case user_total_points: - format = NumberFormat.getInstance(Locale.ENGLISH); return format.format(user.getPointsData().getTotalPoints()); case user_issaved: return convert(user.isSaved()); @@ -511,10 +512,8 @@ public class Placeholder { case user_jlevel_$1: return j == null ? "0" : Integer.toString(j.getLevel()); case user_jexp_$1: - format = NumberFormat.getInstance(Locale.ENGLISH); return j == null ? "0" : format.format(j.getExperience()); case user_jmaxexp_$1: - format = NumberFormat.getInstance(Locale.ENGLISH); return j == null ? "0" : format.format(j.getMaxExperience()); case user_jexpunf_$1: return j == null ? "0" : Double.toString(j.getExperience()); diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignInfo.java b/src/main/java/com/gamingmesh/jobs/Signs/SignInfo.java index 982725b0..ef7659e1 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/SignInfo.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/SignInfo.java @@ -7,9 +7,11 @@ public class SignInfo { private final List allSigns = new ArrayList<>(); - public void setAllSigns(List AllSigns) { + public void setAllSigns(List allSigns) { this.allSigns.clear(); - this.allSigns.addAll(AllSigns == null ? new ArrayList<>() : AllSigns); + + if (allSigns != null) + this.allSigns.addAll(allSigns); } public List getAllSigns() { diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java index 1208759e..08615e0c 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java @@ -81,19 +81,21 @@ public class SignUtil { signsByLocation.clear(); File file = new File(Jobs.getFolder(), "Signs.yml"); - YamlConfiguration f = YamlConfiguration.loadConfiguration(file); - - if (!f.isConfigurationSection("Signs")) + ConfigurationSection confCategory = YamlConfiguration.loadConfiguration(file).getConfigurationSection("Signs"); + if (confCategory == null) return; - ConfigurationSection confCategory = f.getConfigurationSection("Signs"); List categoriesList = new ArrayList<>(confCategory.getKeys(false)); if (categoriesList.isEmpty()) return; for (String category : categoriesList) { ConfigurationSection nameSection = confCategory.getConfigurationSection(category); + if (nameSection == null) + continue; + jobsSign newTemp = new jobsSign(); + if (nameSection.isString("World")) { newTemp.setWorldName(nameSection.getString("World")); newTemp.setX((int) nameSection.getDouble("X")); @@ -177,9 +179,9 @@ public class SignUtil { if (type == null) type = SignTopType.toplist; - String jobNameOrType = jobsSign.getIdentifier(job, type); + String jobNameOrType = jobsSign.getIdentifier(job, type).toLowerCase(); - Map signs = signsByType.get(jobNameOrType.toLowerCase()); + Map signs = signsByType.get(jobNameOrType); if (signs == null || signs.isEmpty()) return false; @@ -209,7 +211,7 @@ public class SignUtil { Block block = loc.getBlock(); if (!(block.getState() instanceof Sign)) { if (!jobNameOrType.isEmpty()) { - Map tt = signsByType.get(jobNameOrType.toLowerCase()); + Map tt = signsByType.get(jobNameOrType); if (tt != null) { tt.remove(jSign.locToBlockString()); } @@ -243,7 +245,7 @@ public class SignUtil { String playerName = pl.getPlayerInfo().getName(); if (playerName.length() > 15) { // We need to split 10 char of name, because of sign rows - playerName = playerName.split("(?<=\\G.{10})")[0] + "~"; + playerName = playerName.split("(?<=\\G.{10})", 2)[0] + "~"; } String line = ""; @@ -273,7 +275,7 @@ public class SignUtil { TopList pl = playerList.get(jSign.getNumber() - 1); String playerName = pl.getPlayerInfo().getName(); if (playerName.length() > 15) { - playerName = playerName.split("(?<=\\G.{10})")[0] + "~"; + playerName = playerName.split("(?<=\\G.{10})", 2)[0] + "~"; } int no = jSign.getNumber() + number + 1; @@ -283,7 +285,7 @@ public class SignUtil { switch (type) { case toplist: case gtoplist: - plugin.getComplement().setLine(sign, 2, Jobs.getLanguage().getMessage("signs.SpecialList.level", "[number]", no, "[player]", playerName, "[level]", pl.getLevel(), "[job]", signJobName)); + plugin.getComplement().setLine(sign, 2, translateSignLine("signs.SpecialList.level", no, playerName, pl.getLevel(), signJobName)); break; case questtoplist: plugin.getComplement().setLine(sign, 2, Jobs.getLanguage().getMessage("signs.SpecialList.quests", "[number]", no, "[player]", playerName, "[quests]", pl.getLevel(), "[job]", signJobName)); diff --git a/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java b/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java index 9c40b50b..f1d50190 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java @@ -97,7 +97,7 @@ public class jobsSign { if (!string.contains(";")) return; - String[] split = string.replace(',', '.').split(";"); + String[] split = string.replace(',', '.').split(";", 4); int x = 0, y = 0, z = 0; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/leave.java b/src/main/java/com/gamingmesh/jobs/commands/list/leave.java index 7e28c207..903bf3f9 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/leave.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/leave.java @@ -22,14 +22,13 @@ public class leave implements Cmd { } Player pSender = (Player) sender; - String jobName = args[0]; - Job job = Jobs.getJob(jobName); + Job job = Jobs.getJob(args[0]); if (job == null) { pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); return true; } - if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + jobName.toLowerCase())) { + if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + args[0].toLowerCase())) { pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); return true; } 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 0625b124..18031b4b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -21,17 +21,18 @@ public class quests implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, String[] args) { JobsPlayer jPlayer = null; + boolean isPlayer = sender instanceof Player; - if (args.length >= 1 && args[0].equals("next") && (!(args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("start")))) { + if (args.length >= 1 && isPlayer && args[0].equalsIgnoreCase("next")) { jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); jPlayer.resetQuests(); } else { - if (args.length >= 1 && (!(args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("start")))) { + if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) { if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true)) return true; jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); - } else if (sender instanceof Player) + } else if (isPlayer) jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); } @@ -51,6 +52,7 @@ public class quests implements Cmd { if (args.length >= 1) { Boolean stopped = null; String cmd = args[args.length == 1 ? 0 : 1]; + if (cmd.equalsIgnoreCase("stop") && Jobs.hasPermission(sender, "jobs.command.admin.quests.stop", false)) { stopped = true; } else if (cmd.equalsIgnoreCase("start") && Jobs.hasPermission(sender, "jobs.command.admin.quests.start", false)) { @@ -58,10 +60,8 @@ public class quests implements Cmd { } if (stopped != null) { - for (JobProgression jobProg : jPlayer.getJobProgression()) { - for (QuestProgression q : jPlayer.getQuestProgressions(jobProg.getJob())) { - q.getQuest().setStopped(stopped); - } + for (QuestProgression q : jPlayer.getQuestProgressions()) { + q.getQuest().setStopped(stopped); } sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%", @@ -72,7 +72,8 @@ public class quests implements Cmd { } sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests())); - if (!(sender instanceof Player)) { + + if (!isPlayer) { return true; } @@ -128,6 +129,7 @@ public class quests implements Cmd { rm.addText(msg).addHover(hover).addCommand("jobs skipquest " + jobProg.getJob().getName() + " " + q.getQuest().getConfigName() + " " + jPlayer.getName()); } else rm.addText(msg).addHover(hover); + rm.show(sender); } } diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 66cdc97d..3e2e4436 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -926,7 +926,6 @@ public class JobsPlayer { * @return true if yes */ public boolean canGetPaid(ActionInfo info) { - List progression = getJobProgression(); int numjobs = progression.size(); if (numjobs == 0) { @@ -1013,7 +1012,9 @@ public class JobsPlayer { } public void resetQuests() { - getJobProgression().forEach(one -> resetQuests(one.getJob())); + for (JobProgression prog : progression) { + resetQuests(prog.getJob()); + } } public void getNewQuests() { @@ -1029,7 +1030,7 @@ public class JobsPlayer { Quest q = quest.getJob().getNextQuest(getQuestNameList(quest.getJob(), null), getJobProgression(quest.getJob()).getLevel()); if (q == null) { - for (JobProgression one : this.getJobProgression()) { + for (JobProgression one : progression) { if (one.getJob().isSame(quest.getJob())) continue; q = one.getJob().getNextQuest(getQuestNameList(one.getJob(), null), getJobProgression(one.getJob()).getLevel()); @@ -1066,7 +1067,7 @@ public class JobsPlayer { public List getQuestProgressions() { List g = new ArrayList<>(); - for (JobProgression one : getJobProgression()) { + for (JobProgression one : progression) { g.addAll(getQuestProgressions(one.getJob())); } return g; diff --git a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java index 0e9272ff..1e884cd0 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java +++ b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java @@ -238,8 +238,8 @@ public class BufferedEconomy { * @param payment {@link BufferedPayment} */ public void showPayment(BufferedPayment payment) { - if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline() || !payment.containsPayment() - || Jobs.getGCManager().aBarSilentMode) + if (Jobs.getGCManager().aBarSilentMode || payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline() + || !payment.containsPayment()) return; UUID playerUUID = payment.getOfflinePlayer().getUniqueId(); diff --git a/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java b/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java index c27f987b..55d7e25c 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java +++ b/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java @@ -45,8 +45,12 @@ public class PaymentData { return payments.get(type).isReseted(); } - public Double getAmount(CurrencyType type) { - return !payments.containsKey(type) ? 0D : (int) (payments.get(type).getAmount() * 100) / 100D; + public double getAmount(CurrencyType type) { + if (type == null) + return 0D; + + LimitsData data = payments.get(type); + return data == null ? 0D : (int) (data.getAmount() * 100) / 100D; } public Double getAmountBylimit(CurrencyType type, int limit) { diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 26f4c0cd..3bbcceee 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -94,11 +94,13 @@ public class JobsListener implements Listener { } private boolean isInteractOk(Player player) { - if (!interactDelay.containsKey(player.getUniqueId())) { + Long delay = interactDelay.get(player.getUniqueId()); + if (delay == null) { interactDelay.put(player.getUniqueId(), System.currentTimeMillis()); return true; } - long time = System.currentTimeMillis() - interactDelay.get(player.getUniqueId()); + + long time = System.currentTimeMillis() - delay; interactDelay.put(player.getUniqueId(), System.currentTimeMillis()); return time > 100; } @@ -124,8 +126,8 @@ public class JobsListener implements Listener { if (player.getGameMode() == GameMode.CREATIVE) event.setCancelled(true); - Block block = event.getClickedBlock(); - Location loc = block.getLocation(); + Location loc = event.getClickedBlock().getLocation(); + if (event.getAction() == Action.LEFT_CLICK_BLOCK) { Jobs.getSelectionManager().placeLoc1(player, loc); player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected1", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ())); @@ -424,7 +426,9 @@ public class JobsListener implements Listener { } for (Entry oneE : enchants.entrySet()) { - if (oneItem.getEnchants().containsKey(oneE.getKey()) && oneItem.getEnchants().get(oneE.getKey()) <= oneE.getValue()) { + Integer value = oneItem.getEnchants().get(oneE.getKey()); + + if (value != null && value <= oneE.getValue()) { return true; } } @@ -565,7 +569,7 @@ public class JobsListener implements Listener { ItemStack item = event.getItem(); ArmorTypes type = ArmorTypes.matchType(item); - if (ArmorTypes.matchType(item) == null) + if (type == null) return; Location loc = event.getBlock().getLocation(); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 6b25f3bf..0ed2e7e1 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -360,10 +360,8 @@ public class JobsPaymentListener implements Listener { return; ItemStack contents = event.getContents().getIngredient(); - if (contents == null) - return; - - Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW)); + if (contents != null) + Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -619,10 +617,10 @@ public class JobsPaymentListener implements Listener { if (s == null) continue; - if (CMIMaterial.isDye(s.getType())) + CMIMaterial mat = CMIMaterial.get(s); + if (mat.isDye()) dyeStack.add(s); - CMIMaterial mat = CMIMaterial.get(s); if (mat != CMIMaterial.NONE && mat != CMIMaterial.AIR) { y++; @@ -965,13 +963,15 @@ public class JobsPaymentListener implements Listener { Enchantment enchant = oneEnchant.getKey(); if (enchant == null) continue; + String enchantName = null; try { enchantName = enchant.getKey().getKey().toLowerCase().replace("_", "").replace("minecraft:", ""); } catch (Throwable e) { CMIEnchantment ench = CMIEnchantment.get(enchant); - enchantName = ench == null ? null : ench.toString(); + if (ench != null) + enchantName = ench.toString(); } if (enchantName != null) @@ -986,13 +986,10 @@ public class JobsPaymentListener implements Listener { if (!Jobs.getGCManager().PreventHopperFillUps) return; - String type = event.getDestination().getType().toString(); - if (!type.equalsIgnoreCase("FURNACE") && !type.equalsIgnoreCase("SMOKER") && !type.equalsIgnoreCase("BLAST_FURNACE")) - return; - if (event.getItem().getType() == Material.AIR) return; + String type = event.getDestination().getType().toString(); Block block = null; switch (type.toLowerCase()) { @@ -1008,7 +1005,7 @@ public class JobsPaymentListener implements Listener { block = ((org.bukkit.block.BlastFurnace) event.getDestination().getHolder()).getBlock(); break; default: - break; + return; } if (block == null || !Jobs.getGCManager().canPerformActionInWorld(block.getWorld())) @@ -1020,10 +1017,10 @@ public class JobsPaymentListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onInventoryMoveItemEventToBrewingStand(InventoryMoveItemEvent event) { - if (event.getDestination().getType() != InventoryType.BREWING) + if (!Jobs.getGCManager().PreventBrewingStandFillUps || event.getDestination().getType() != InventoryType.BREWING) return; - if (!Jobs.getGCManager().PreventBrewingStandFillUps || event.getItem().getType() == Material.AIR) + if (event.getItem().getType() == Material.AIR) return; final BrewingStand stand = (BrewingStand) event.getDestination().getHolder(); @@ -1227,11 +1224,10 @@ public class JobsPaymentListener implements Listener { if (jDamager == null) return; - if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) { - Player VPlayer = (Player) lVictim; - if (jDamager.getName().equalsIgnoreCase(VPlayer.getName())) - return; - } + boolean notNpc = lVictim instanceof Player && !lVictim.hasMetadata("NPC"); + + if (notNpc && jDamager.getName().equalsIgnoreCase(((Player) lVictim).getName())) + return; if (Jobs.getGCManager().payForStackedEntities) { if (JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(lVictim)) { @@ -1252,7 +1248,7 @@ public class JobsPaymentListener implements Listener { 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")) { + if (notNpc) { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) lVictim); if (jPlayer == null) return; @@ -1368,13 +1364,14 @@ public class JobsPaymentListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onArmorstandBreak(EntityDeathEvent event) { Entity ent = event.getEntity(); + if (!ent.getType().toString().equalsIgnoreCase("ARMOR_STAND")) return; - if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent)) + if (!(ent.getLastDamageCause() instanceof EntityDamageByEntityEvent)) return; - EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause(); + EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) ent.getLastDamageCause(); //extra check for Citizens 2 sentry kills if (!(e.getDamager() instanceof Player)) @@ -1480,11 +1477,7 @@ public class JobsPaymentListener implements Listener { if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle()) return; - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - if (jPlayer == null) - return; - - Jobs.action(jPlayer, new ItemActionInfo(Jobs.getNms().getItemInMainHand(player), ActionType.EAT)); + Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(Jobs.getNms().getItemInMainHand(player), ActionType.EAT)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) diff --git a/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java b/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java index c053818d..abdb9955 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java @@ -32,10 +32,10 @@ public class TabComplete implements TabCompleter { for (int i = 1; i <= args.length; i++) { if (args.length == i + 1) { - if (!Jobs.getGCManager().getCommandArgs().containsKey(first)) + List argsList = Jobs.getGCManager().getCommandArgs().get(first); + if (argsList == null) break; - List argsList = Jobs.getGCManager().getCommandArgs().get(first); if (argsList.size() < i) continue; diff --git a/src/main/java/com/gamingmesh/jobs/stuff/Util.java b/src/main/java/com/gamingmesh/jobs/stuff/Util.java index c54b1059..3c80cbfb 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/Util.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/Util.java @@ -64,8 +64,7 @@ public class Util { name = name.replaceAll("[_|.|-]", ""); for (World one : Bukkit.getWorlds()) { - String n = one.getName().replaceAll("[_|.|-]", ""); - if (n.equalsIgnoreCase(name)) + if (one.getName().replaceAll("[_|.|-]", "").equalsIgnoreCase(name)) return one; } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java b/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java index 4d7dfaed..c15750b9 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java @@ -52,7 +52,8 @@ public class blockLoc { public boolean fromString(String loc) { if (!loc.contains(":")) return false; - String[] split = loc.split(":"); + + String[] split = loc.split(":", 4); if (split.length == 0) { return false; } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java b/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java index 2d67be47..022beb04 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java @@ -32,7 +32,7 @@ public class Complement2 implements Complement { } catch (NoSuchMethodError e) { } - return dName == null ? null : serialize(dName); + return dName == null ? "" : serialize(dName); } @Override