mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Merge pull request #1583 from FireML/bucket-entity-action
Bucketing Entities Action
This commit is contained in:
commit
5667544626
@ -97,6 +97,7 @@ import com.gamingmesh.jobs.listeners.JobsListener;
|
|||||||
import com.gamingmesh.jobs.listeners.JobsPayment14Listener;
|
import com.gamingmesh.jobs.listeners.JobsPayment14Listener;
|
||||||
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
||||||
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
||||||
|
import com.gamingmesh.jobs.listeners.JobsPayment16Listener;
|
||||||
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
|
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
|
||||||
import com.gamingmesh.jobs.selection.SelectionManager;
|
import com.gamingmesh.jobs.selection.SelectionManager;
|
||||||
import com.gamingmesh.jobs.stuff.Loging;
|
import com.gamingmesh.jobs.stuff.Loging;
|
||||||
@ -795,6 +796,9 @@ public final class Jobs extends JavaPlugin {
|
|||||||
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) {
|
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) {
|
||||||
pm.registerEvents(new JobsPayment14Listener(), getInstance());
|
pm.registerEvents(new JobsPayment14Listener(), getInstance());
|
||||||
}
|
}
|
||||||
|
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3)) {
|
||||||
|
pm.registerEvents(new JobsPayment16Listener(), getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {
|
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {
|
||||||
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
|
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
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.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerBucketEntityEvent;
|
||||||
|
|
||||||
|
public class JobsPayment16Listener implements Listener {
|
||||||
|
@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 (!JobsPaymentListener.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));
|
||||||
|
}
|
||||||
|
}
|
@ -77,6 +77,7 @@ import org.bukkit.event.player.PlayerFishEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerBucketEntityEvent;
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user