mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-24 18:17:53 +01:00
Added DYE protection flag
https://github.com/BentoBoxWorld/BentoBox/issues/653 (cherry picked from commit e94000528791e1abb30d19305e36529d825287b9)
This commit is contained in:
parent
df8a93e9f1
commit
9e15907f93
@ -0,0 +1,43 @@
|
||||
package world.bentobox.bentobox.listeners.flags.protection;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import world.bentobox.bentobox.api.flags.FlagListener;
|
||||
import world.bentobox.bentobox.lists.Flags;
|
||||
|
||||
/**
|
||||
* Protects against dying
|
||||
* @author tastybento
|
||||
*/
|
||||
public class DyeListener extends FlagListener {
|
||||
|
||||
/**
|
||||
* Prevent dying
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerInteract(final PlayerInteractEvent e) {
|
||||
|
||||
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().name().contains("SIGN")) {
|
||||
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.DYE);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerInteract(final PlayerInteractEntityEvent e) {
|
||||
|
||||
if (e.getRightClicked().getType().equals(EntityType.SHEEP)) {
|
||||
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.DYE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -16,6 +16,7 @@ import world.bentobox.bentobox.listeners.flags.protection.BlockInteractionListen
|
||||
import world.bentobox.bentobox.listeners.flags.protection.BreakBlocksListener;
|
||||
import world.bentobox.bentobox.listeners.flags.protection.BreedingListener;
|
||||
import world.bentobox.bentobox.listeners.flags.protection.BucketListener;
|
||||
import world.bentobox.bentobox.listeners.flags.protection.DyeListener;
|
||||
import world.bentobox.bentobox.listeners.flags.protection.EggListener;
|
||||
import world.bentobox.bentobox.listeners.flags.protection.EntityInteractListener;
|
||||
import world.bentobox.bentobox.listeners.flags.protection.ExperiencePickupListener;
|
||||
@ -391,6 +392,14 @@ public final class Flags {
|
||||
*/
|
||||
public static final Flag NATURAL_SPAWNING_OUTSIDE_RANGE = new Flag.Builder("NATURAL_SPAWNING_OUTSIDE_RANGE", Material.ZOMBIE_SPAWN_EGG).type(Type.WORLD_SETTING).listener(new NaturalSpawningOutsideRangeListener()).defaultSetting(true).build();
|
||||
|
||||
/**
|
||||
* Protects against visitors dying stuff, like sheep or signs
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @see DyeListener
|
||||
*/
|
||||
public static final Flag DYE = new Flag.Builder("DYE", Material.LIGHT_BLUE_DYE).type(Type.PROTECTION).listener(new DyeListener()).build();
|
||||
|
||||
/**
|
||||
* Provides a list of all the Flag instances contained in this class using reflection.
|
||||
* @return List of all the flags in this class
|
||||
|
@ -594,6 +594,10 @@ protection:
|
||||
&cThis does not protect it from being
|
||||
&cplaced or broken.
|
||||
hint: "No Dragon Egg interaction"
|
||||
DYE:
|
||||
description: "Prevent dye use"
|
||||
name: "Dye use"
|
||||
hint: "No dying allowed"
|
||||
EGGS:
|
||||
description: "Toggle egg throwing"
|
||||
name: "Egg throwing"
|
||||
|
Loading…
Reference in New Issue
Block a user