mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Bucketing Entities Action
This commit is contained in:
parent
0ca90fbcb5
commit
642b4643e1
@ -617,6 +617,7 @@ public class ConfigManager {
|
|||||||
case BREW:
|
case BREW:
|
||||||
case BREAK:
|
case BREAK:
|
||||||
case STRIPLOGS:
|
case STRIPLOGS:
|
||||||
|
case BUCKET:
|
||||||
case COLLECT:
|
case COLLECT:
|
||||||
material = CMIMaterial.get(myKey + (subType));
|
material = CMIMaterial.get(myKey + (subType));
|
||||||
|
|
||||||
@ -723,7 +724,7 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
id = material.getId();
|
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
|
// check entities
|
||||||
CMIEntityType entity = CMIEntityType.getByName(myKey);
|
CMIEntityType entity = CMIEntityType.getByName(myKey);
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ public enum ActionType {
|
|||||||
EAT("Eat"),
|
EAT("Eat"),
|
||||||
CUSTOMKILL("custom-kill"),
|
CUSTOMKILL("custom-kill"),
|
||||||
COLLECT("Collect"),
|
COLLECT("Collect"),
|
||||||
BAKE("Bake");
|
BAKE("Bake"),
|
||||||
|
BUCKET("Bucket");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -74,10 +74,7 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.inventory.PrepareAnvilEvent;
|
import org.bukkit.event.inventory.PrepareAnvilEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
import org.bukkit.inventory.AnvilInventory;
|
import org.bukkit.inventory.AnvilInventory;
|
||||||
import org.bukkit.inventory.EnchantingInventory;
|
import org.bukkit.inventory.EnchantingInventory;
|
||||||
@ -1979,4 +1976,24 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
fp.setTime(System.currentTimeMillis() + 45);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user