diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index 1d043e16..43e6deeb 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -617,6 +617,7 @@ public class ConfigManager { case BREW: case BREAK: case STRIPLOGS: + case BUCKET: case COLLECT: material = CMIMaterial.get(myKey + (subType)); @@ -723,7 +724,7 @@ public class ConfigManager { } id = material.getId(); - } else if (actionType == ActionType.KILL || actionType == ActionType.TAME || actionType == ActionType.BREED || actionType == ActionType.MILK) { + } else if (actionType == ActionType.KILL || actionType == ActionType.TAME || actionType == ActionType.BREED || actionType == ActionType.MILK || actionType == ActionType.BUCKET) { // check entities CMIEntityType entity = CMIEntityType.getByName(myKey); diff --git a/src/main/java/com/gamingmesh/jobs/container/ActionType.java b/src/main/java/com/gamingmesh/jobs/container/ActionType.java index 0b9a1a9d..08019512 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ActionType.java +++ b/src/main/java/com/gamingmesh/jobs/container/ActionType.java @@ -41,7 +41,8 @@ public enum ActionType { EAT("Eat"), CUSTOMKILL("custom-kill"), COLLECT("Collect"), - BAKE("Bake"); + BAKE("Bake"), + BUCKET("Bucket"); private String name; diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 8eb06e19..37e16113 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -74,10 +74,7 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.PrepareAnvilEvent; import org.bukkit.event.inventory.InventoryType.SlotType; -import org.bukkit.event.player.PlayerFishEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerShearEntityEvent; +import org.bukkit.event.player.*; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.inventory.AnvilInventory; import org.bukkit.inventory.EnchantingInventory; @@ -1979,4 +1976,24 @@ public final class JobsPaymentListener implements Listener { fp.setTime(System.currentTimeMillis() + 45); } } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onEntityBucketed(PlayerBucketEntityEvent event) { + Player player = event.getPlayer(); + + if (!Jobs.getGCManager().canPerformActionInWorld(player.getWorld())) + return; + + // check if in creative + if (!payIfCreative(player)) + return; + + if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName())) + return; + + // check if player is riding + if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle() && !player.getVehicle().getType().equals(EntityType.BOAT)) + return; + + Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new EntityActionInfo(event.getEntity(), ActionType.BUCKET)); + } }