1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Bucketing Entities Action

This commit is contained in:
FireML 2023-04-01 05:57:05 +01:00
parent 0ca90fbcb5
commit 642b4643e1
3 changed files with 25 additions and 6 deletions

View File

@ -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);

View File

@ -41,7 +41,8 @@ public enum ActionType {
EAT("Eat"),
CUSTOMKILL("custom-kill"),
COLLECT("Collect"),
BAKE("Bake");
BAKE("Bake"),
BUCKET("Bucket");
private String name;

View File

@ -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));
}
}