From 1b4d3581007f666bf2bf59325c9729645e162b45 Mon Sep 17 00:00:00 2001 From: Zrips Date: Wed, 30 Aug 2023 12:17:20 +0300 Subject: [PATCH] Not paying for bucketing spawned in animals --- .../gamingmesh/jobs/config/LanguageManager.java | 2 ++ .../jobs/listeners/JobsPayment1_16Listener.java | 14 +++++++++++--- .../jobs/listeners/JobsPaymentListener.java | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 44c546ef..bb1b89f0 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -406,6 +406,8 @@ public class LanguageManager { c.get("command.info.output.collect.none", "%jobname% does not get money for collecting blocks."); c.get("command.info.output.bake.info", "&eBake"); c.get("command.info.output.bake.none", "%jobname% does not get money for cooking foods."); + c.get("command.info.output.bucket.info", "&eBucket"); + c.get("command.info.output.bucket.none", "%jobname% does not get money for bucketing."); c.get("command.playerinfo.help.info", "Show how much each job is getting paid and for what on another player."); c.get("command.playerinfo.help.args", "[playername] [jobname] [action]"); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment1_16Listener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment1_16Listener.java index a05cbf57..7d1d5259 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment1_16Listener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment1_16Listener.java @@ -1,8 +1,6 @@ package com.gamingmesh.jobs.listeners; -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.actions.EntityActionInfo; -import com.gamingmesh.jobs.container.ActionType; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -10,6 +8,10 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerBucketEntityEvent; +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.actions.EntityActionInfo; +import com.gamingmesh.jobs.container.ActionType; + public class JobsPayment1_16Listener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onEntityBucketed(PlayerBucketEntityEvent event) { @@ -33,6 +35,12 @@ public class JobsPayment1_16Listener implements Listener { return; } + Entity ent = event.getEntity(); + // mob spawner, no payment or experience + if (!Jobs.getGCManager().payNearSpawner() && ent.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) { + return; + } + Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new EntityActionInfo(event.getEntity(), ActionType.BUCKET)); } } diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index aeca72d0..772f2b04 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -1604,7 +1604,7 @@ public final class JobsPaymentListener implements Listener { if (event.getEntity().getType().equals(EntityType.TURTLE)) CMIDebug.d(event.getSpawnReason()); - + if (!event.getSpawnReason().toString().equalsIgnoreCase("BREEDING") && !event.getSpawnReason().toString().equalsIgnoreCase("EGG")) return;