1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Fix fisherman getting paid for fish even if mcMMO fishing protection kicks in (#1081)

* Disable Fisherman pay if mcMMO fishing protections are enabled

- replace mcMMO dependency with the latest one (contains necessary classes)
- copy exploit protection check to fishing payment event
This commit is contained in:
Ivan Carapovic 2021-02-15 16:58:27 +01:00 committed by GitHub
parent 95169f00ab
commit ff87470088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -25,9 +25,9 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.2</version>
<version>2.1.175-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/libs/mcMMO2.1.2.jar</systemPath>
<systemPath>${basedir}/libs/mcMMO-2.1.175-SNAPSHOT.jar</systemPath>
</dependency>
<!-- Vault -->
<dependency>

View File

@ -28,6 +28,10 @@ import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip;
import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip.ownershipFeedback;
import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.hooks.JobsHook;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.base.Objects;
import org.bukkit.Bukkit;
@ -490,6 +494,17 @@ public class JobsPaymentListener implements Listener {
return;
if (event.getState() == PlayerFishEvent.State.CAUGHT_FISH && event.getCaught() instanceof Item) {
// check is mcMMO enabled
if (JobsHook.mcMMO.isEnabled()) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
// check is the fishing being exploited. If yes, prevent payment.
if (mcMMOPlayer != null && ExperienceConfig.getInstance().isFishingExploitingPrevented()
&& mcMMOPlayer.getFishingManager().isExploitingFishing(event.getHook().getLocation().toVector())) {
return;
}
}
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player),
new ItemActionInfo(((Item) event.getCaught()).getItemStack(), ActionType.FISH));
}