From 3425a3ba1ab5966a456ed32cad32d23604cbf563 Mon Sep 17 00:00:00 2001 From: smuddgge <68658429+smuddgge@users.noreply.github.com> Date: Sat, 19 Nov 2022 13:26:34 +0000 Subject: [PATCH 1/5] Reverted fishing exploiting --- .../java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 4f88b98b..559b888e 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -543,7 +543,7 @@ public final class JobsPaymentListener implements Listener { // check is the fishing being exploited. If yes, prevent payment. if (mcMMOPlayer != null && ExperienceConfig.getInstance().isFishingExploitingPrevented() - && mcMMOPlayer.getFishingManager().isFishingTooOften()) { + && mcMMOPlayer.getFishingManager().isExploitingFishing(event.getHook().getLocation().toVector())) { return; } } From 8343995c8f510806006af9fe861f5fca0312c107 Mon Sep 17 00:00:00 2001 From: Teyir Date: Mon, 28 Nov 2022 14:09:56 +0100 Subject: [PATCH 2/5] [FIX] Fix CMILib name --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ffd6dc80..1826a065 100644 --- a/pom.xml +++ b/pom.xml @@ -197,7 +197,7 @@ CMILib latest system - ${basedir}/libs/CMILib1.1.2.3.jar + ${basedir}/libs/CMILib1.2.3.3.jar From 5a5b82e6304fb04eaffb4927fb898c9fe316236e Mon Sep 17 00:00:00 2001 From: Teyir Date: Mon, 28 Nov 2022 14:56:29 +0100 Subject: [PATCH 3/5] [IMPROVE] Add -s argument for /exp command --- .../gamingmesh/jobs/commands/list/exp.java | 145 ++++++++++-------- 1 file changed, 79 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java index 457f8928..8b16d703 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java @@ -12,83 +12,96 @@ import com.gamingmesh.jobs.container.JobsPlayer; public class exp implements Cmd { private enum Action { - Set, Add, Take + Set, Add, Take } @Override public boolean perform(Jobs plugin, CommandSender sender, String[] args) { - if (args.length < 4) { - Jobs.getCommandManager().sendUsage(sender, "exp"); - return true; - } + if (args.length < 4) { + Jobs.getCommandManager().sendUsage(sender, "exp"); + return true; + } - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); - if (jPlayer == null) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); - return true; - } + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); + if (jPlayer == null) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); + return true; + } - Job job = Jobs.getJob(args[1]); - if (job == null) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); - return true; - } + Job job = Jobs.getJob(args[1]); + if (job == null) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); + return true; + } - Action action = Action.Add; + Action action = Action.Add; - switch (args[2].toLowerCase()) { - case "add": - action = Action.Add; - break; - case "set": - action = Action.Set; - break; - case "take": - action = Action.Take; - break; - default: - break; - } + switch (args[2].toLowerCase()) { + case "add": + action = Action.Add; + break; + case "set": + action = Action.Set; + break; + case "take": + action = Action.Take; + break; + default: + break; + } - double amount = 0.0; - try { - amount = Double.parseDouble(args[3]); - } catch (NumberFormatException e) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); - return true; - } + double amount = 0.0; + try { + amount = Double.parseDouble(args[3]); + } catch (NumberFormatException e) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); + return true; + } - try { - // check if player already has the job - if (jPlayer.isInJob(job)) { - JobProgression prog = jPlayer.getJobProgression(job); + try { + // check if player already has the job + if (jPlayer.isInJob(job)) { + JobProgression prog = jPlayer.getJobProgression(job); - switch (action) { - case Add: - int oldLevel = prog.getLevel(); - if (prog.addExperience(amount)) - Jobs.getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel); - break; - case Set: - prog.setExperience(amount); - break; - case Take: - prog.takeExperience(amount); - break; - default: - break; - } + switch (action) { + case Add: + int oldLevel = prog.getLevel(); + if (prog.addExperience(amount)) + Jobs.getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel); + break; + case Set: + prog.setExperience(amount); + break; + case Take: + prog.takeExperience(amount); + break; + default: + break; + } - Player player = jPlayer.getPlayer(); - if (player != null) - player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog - .getExperience())); - sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); - } else - sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob")); - } catch (Exception e) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); - } - return true; + Player player = jPlayer.getPlayer(); + boolean isSilent = false; + if (player != null) { + for (String one : args) { + if (one.equalsIgnoreCase("-s")) { + isSilent = true; + break; + } + } + if (!isSilent) { + player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog + .getExperience())); + } + sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); + } else { + sender.sendMessage(Jobs.getLanguage().getMessage("general.give.output.notonline")); + } + } else { + sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob")); + } + } catch (Exception e) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); + } + return true; } } From 3fc3da0659de1a2cbf2aabf68c54b01e320e4c1c Mon Sep 17 00:00:00 2001 From: Teyir Date: Mon, 28 Nov 2022 16:26:43 +0100 Subject: [PATCH 4/5] [IMPROVE] Add random argument for /exp command ex: rand_5-10 --- .../gamingmesh/jobs/commands/list/exp.java | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java index 8b16d703..169c7c73 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java @@ -9,6 +9,8 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; +import java.util.Random; + public class exp implements Cmd { private enum Action { @@ -51,11 +53,28 @@ public class exp implements Cmd { } double amount = 0.0; - try { - amount = Double.parseDouble(args[3]); - } catch (NumberFormatException e) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); - return true; + + /* Add random argument, ex: rand_5-10 */ + if(args[3].startsWith("rand_")){ + String data= args[3].split("(?i)rand_")[1]; + String[] arr = data.split("-"); + + int amountMin = Integer.parseInt(arr[0]); + int amountMax = Integer.parseInt(arr[1]); + + if(amountMin <= amountMax){ + amount = amountMin + new Random().nextDouble() * (amountMax - amountMin); + } else { + amount = amountMax; + } + + } else { + try { + amount = Double.parseDouble(args[3]); + } catch (NumberFormatException e) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); + return true; + } } try { From bdc2f847cb525a4e355747d80fcf5b4689ae2a00 Mon Sep 17 00:00:00 2001 From: Teyir Date: Tue, 29 Nov 2022 22:41:58 +0100 Subject: [PATCH 5/5] [IMPROVE] Add -sa argument for skip admin success message --- .../com/gamingmesh/jobs/commands/list/exp.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java index 169c7c73..312b7b5f 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java @@ -55,14 +55,14 @@ public class exp implements Cmd { double amount = 0.0; /* Add random argument, ex: rand_5-10 */ - if(args[3].startsWith("rand_")){ - String data= args[3].split("(?i)rand_")[1]; + if (args[3].startsWith("rand_")) { + String data = args[3].split("(?i)rand_")[1]; String[] arr = data.split("-"); int amountMin = Integer.parseInt(arr[0]); int amountMax = Integer.parseInt(arr[1]); - if(amountMin <= amountMax){ + if (amountMin <= amountMax) { amount = amountMin + new Random().nextDouble() * (amountMax - amountMin); } else { amount = amountMax; @@ -100,6 +100,7 @@ public class exp implements Cmd { Player player = jPlayer.getPlayer(); boolean isSilent = false; + boolean isSilentAdmin = false; if (player != null) { for (String one : args) { if (one.equalsIgnoreCase("-s")) { @@ -111,7 +112,15 @@ public class exp implements Cmd { player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog .getExperience())); } - sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); + for (String one : args) { + if (one.equalsIgnoreCase("-sa")) { + isSilentAdmin = true; + break; + } + } + if (!isSilentAdmin) { + sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); + } } else { sender.sendMessage(Jobs.getLanguage().getMessage("general.give.output.notonline")); }