Added dependency injection (DI) for flag listeners for plugin.

This is required for automated testing (can't use static getInstance). I
really need automated testing of the protection classes, so even though
this adds a parameter to the classes, it's important to have it right
now.
This commit is contained in:
Tastybento 2018-02-03 11:54:33 -08:00
parent 1427f16bec
commit df0ecca217
24 changed files with 178 additions and 60 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/.settings/
*.iml
/target
/.DS_Store

View File

@ -100,7 +100,7 @@ public class BSkyBlock extends JavaPlugin {
// Load Flags
flagsManager = new FlagsManager(plugin);
new Flags();
new Flags(plugin);
// Load addons
addonsManager = new AddonsManager(plugin);

View File

@ -14,11 +14,11 @@ public class Flag {
private Listener listener;
private boolean defaultSetting;
public Flag(String id, PanelItem icon, Listener listener, boolean defaultSetting) {
public Flag(BSkyBlock plugin, String id, PanelItem icon, Listener listener, boolean defaultSetting) {
this.id = id;
this.icon = icon;
this.listener = listener;
BSkyBlock.getInstance().getFlagsManager().registerFlag(this);
plugin.getFlagsManager().registerFlag(this);
}
public String getID() {

View File

@ -4,6 +4,7 @@ import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
@ -37,8 +38,8 @@ public class FlagBuilder {
return this;
}
public Flag build() {
return new Flag(id, icon, listener, defaultSetting);
public Flag build(BSkyBlock plugin) {
return new Flag(plugin, id, icon, listener, defaultSetting);
}
/**

View File

@ -27,9 +27,9 @@ public abstract class AbstractFlagListener implements Listener {
public BSkyBlock plugin;
private User user = null;
public AbstractFlagListener() {
public AbstractFlagListener(BSkyBlock plugin) {
super();
this.plugin = BSkyBlock.getInstance();
this.plugin = plugin;
}
/**
@ -116,6 +116,7 @@ public abstract class AbstractFlagListener implements Listener {
* Generic place blocks checker
* @param e
* @param loc
* @param flag
* @return true if the check is okay, false if it was disallowed
*/
public boolean checkIsland(Event e, Location loc, Flag flag) {

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -16,6 +17,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class BlockInteractionListener extends AbstractFlagListener {
public BlockInteractionListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Handle interaction with blocks
* @param e

View File

@ -17,11 +17,16 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.util.BlockIterator;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.lists.Flags;
public class BreakBlocksListener extends AbstractFlagListener {
public BreakBlocksListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Prevents blocks from being broken
*

View File

@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -24,6 +25,11 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class BreedingListener extends AbstractFlagListener {
public BreedingListener(BSkyBlock plugin) {
super(plugin);
}
/**
* A list of items that cause breeding if a player has them in their hand and they click an animal
* This list may need to be extended with future versions of Minecraft.

View File

@ -10,6 +10,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -20,6 +21,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class BucketListener extends AbstractFlagListener {
public BucketListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Prevents emptying of buckets
* @param e

View File

@ -7,6 +7,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerEggThrowEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -16,6 +17,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class EggListener extends AbstractFlagListener {
public EggListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Handle visitor chicken egg throwing
* @param e

View File

@ -12,6 +12,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -22,6 +23,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class EntityInteractListener extends AbstractFlagListener {
public EntityInteractListener(BSkyBlock plugin) {
super(plugin);
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPlayerInteract(final PlayerInteractAtEntityEvent e) {
if (e.getRightClicked() instanceof ArmorStand) {

View File

@ -19,6 +19,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.BlockIterator;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.lists.Flags;
@ -30,6 +31,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class FireListener extends AbstractFlagListener {
public FireListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Prevents fire spread
* @param e

View File

@ -30,6 +30,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.potion.PotionEffect;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.lists.Flags;
@ -41,6 +42,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class HurtingListener extends AbstractFlagListener {
public HurtingListener(BSkyBlock plugin) {
super(plugin);
}
private HashMap<Integer, UUID> thrownPotions = new HashMap<>();

View File

@ -16,6 +16,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.inventory.InventoryClickEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -25,6 +26,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class InventoryListener extends AbstractFlagListener {
public InventoryListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Prevents visitors picking items from inventories
* @param event

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.lists.Flags;
@ -18,6 +19,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class ItemDropPickUpListener extends AbstractFlagListener {
public ItemDropPickUpListener(BSkyBlock plugin) {
super(plugin);
}
/*
* Handle item drop by visitors
*/
@ -33,7 +38,8 @@ public class ItemDropPickUpListener extends AbstractFlagListener {
public void onVisitorDrop(EntityPickupItemEvent e) {
if (e.getEntity() instanceof Player) {
setUser(User.getInstance(e.getEntity()));
checkIsland(e, e.getItem().getLocation(), Flags.ITEM_PICKUP);
// Disallow, but don't tell the player an error
checkIsland(e, e.getItem().getLocation(), Flags.ITEM_PICKUP, false);
}
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.event.entity.PlayerLeashEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerUnleashEntityEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -18,6 +19,11 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class LeashListener extends AbstractFlagListener {
public LeashListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Prevents leashing
*

View File

@ -13,6 +13,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.lists.Flags;
@ -23,6 +24,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class MobSpawnListener extends AbstractFlagListener {
public MobSpawnListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Prevents mobs spawning naturally
*

View File

@ -20,6 +20,7 @@ import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.potion.PotionEffect;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.lists.Flags;
@ -31,6 +32,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class PVPListener extends AbstractFlagListener {
public PVPListener(BSkyBlock plugin) {
super(plugin);
}
private HashMap<Integer, UUID> thrownPotions = new HashMap<>();

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -16,6 +17,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class PhysicalInteractionListener extends AbstractFlagListener {
public PhysicalInteractionListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Handle physical interaction with blocks
* Crop trample, pressure plates, triggering redstone, tripwires

View File

@ -10,10 +10,15 @@ import org.bukkit.event.block.EntityBlockFormEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
public class PlaceBlocksListener extends AbstractFlagListener {
public PlaceBlocksListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Check blocks being placed in general
*

View File

@ -7,6 +7,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerPortalEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -16,6 +17,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class PortalListener extends AbstractFlagListener {
public PortalListener(BSkyBlock plugin) {
super(plugin);
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerPortal(PlayerPortalEvent e) {
checkIsland(e, e.getFrom(), Flags.PORTAL);

View File

@ -7,6 +7,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerShearEntityEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
@ -16,6 +17,10 @@ import us.tastybento.bskyblock.lists.Flags;
*/
public class ShearingListener extends AbstractFlagListener {
public ShearingListener(BSkyBlock plugin) {
super(plugin);
}
// Protect sheep
@EventHandler(priority = EventPriority.LOW)
public void onShear(final PlayerShearEntityEvent e) {

View File

@ -8,16 +8,20 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.lists.Flags;
/**
* Handles interaction with entities like armor stands
* Note - armor stand protection from breaking or placing is done elsewhere.
* Handles teleporting due to enderpearl or chorus fruit.
* @author tastybento
*
*/
public class TeleportationListener extends AbstractFlagListener {
public TeleportationListener(BSkyBlock plugin) {
super(plugin);
}
/**
* Ender pearl and chorus fruit teleport checks
*

View File

@ -2,59 +2,82 @@ package us.tastybento.bskyblock.lists;
import org.bukkit.Material;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.api.flags.FlagBuilder;
import us.tastybento.bskyblock.listeners.flags.*;
import us.tastybento.bskyblock.listeners.flags.BlockInteractionListener;
import us.tastybento.bskyblock.listeners.flags.BreakBlocksListener;
import us.tastybento.bskyblock.listeners.flags.BreedingListener;
import us.tastybento.bskyblock.listeners.flags.BucketListener;
import us.tastybento.bskyblock.listeners.flags.EggListener;
import us.tastybento.bskyblock.listeners.flags.EntityInteractListener;
import us.tastybento.bskyblock.listeners.flags.FireListener;
import us.tastybento.bskyblock.listeners.flags.HurtingListener;
import us.tastybento.bskyblock.listeners.flags.InventoryListener;
import us.tastybento.bskyblock.listeners.flags.ItemDropPickUpListener;
import us.tastybento.bskyblock.listeners.flags.LeashListener;
import us.tastybento.bskyblock.listeners.flags.PVPListener;
import us.tastybento.bskyblock.listeners.flags.PhysicalInteractionListener;
import us.tastybento.bskyblock.listeners.flags.PlaceBlocksListener;
import us.tastybento.bskyblock.listeners.flags.PortalListener;
import us.tastybento.bskyblock.listeners.flags.ShearingListener;
import us.tastybento.bskyblock.listeners.flags.TeleportationListener;
/**
* Protection flags
* @author tastybento
*
*/
public class Flags {
/*
* Protection Flags
*/
private static BSkyBlock p;
public Flags(BSkyBlock plugin) {
p = plugin;
}
// Break and place blocks
public static final Flag BREAK_BLOCKS = new FlagBuilder().id("BREAK_BLOCKS").icon(Material.STONE).listener(new BreakBlocksListener()).build();
public static final Flag PLACE_BLOCKS = new FlagBuilder().id("PLACE_BLOCKS").icon(Material.DIRT).listener(new PlaceBlocksListener()).build();
public static final Flag BREAK_BLOCKS = new FlagBuilder().id("BREAK_BLOCKS").icon(Material.STONE).listener(new BreakBlocksListener(p)).build(p);
public static final Flag PLACE_BLOCKS = new FlagBuilder().id("PLACE_BLOCKS").icon(Material.DIRT).listener(new PlaceBlocksListener(p)).build(p);
// Block interactions - all use BlockInteractionListener()
public static final Flag ANVIL = new FlagBuilder().id("ANVIL").icon(Material.ANVIL).listener(new BlockInteractionListener()).build();
public static final Flag BEACON = new FlagBuilder().id("BEACON").icon(Material.BEACON).build();
public static final Flag BED = new FlagBuilder().id("BED").icon(Material.BED).build();
public static final Flag BREWING = new FlagBuilder().id("BREWING").icon(Material.BREWING_STAND_ITEM).build();
public static final Flag CHEST = new FlagBuilder().id("CHEST").icon(Material.CHEST).build();
public static final Flag DOOR = new FlagBuilder().id("DOOR").allowedByDefault(true).icon(Material.WOODEN_DOOR).build();
public static final Flag CRAFTING = new FlagBuilder().id("CRAFTING").allowedByDefault(true).icon(Material.WORKBENCH).build();
public static final Flag ENCHANTING = new FlagBuilder().id("ENCHANTING").allowedByDefault(true).icon(Material.ENCHANTMENT_TABLE).build();
public static final Flag FURNACE = new FlagBuilder().id("FURNACE").icon(Material.FURNACE).build();
public static final Flag GATE = new FlagBuilder().id("GATE").allowedByDefault(true).icon(Material.FENCE_GATE).build();
public static final Flag MUSIC = new FlagBuilder().id("MUSIC").icon(Material.JUKEBOX).build();
public static final Flag LEVER_BUTTON = new FlagBuilder().id("LEVER_BUTTON").icon(Material.LEVER).build();
public static final Flag REDSTONE = new FlagBuilder().id("REDSTONE").icon(Material.REDSTONE).build();
public static final Flag SPAWN_EGGS = new FlagBuilder().id("SPAWN_EGGS").icon(Material.MONSTER_EGG).build();
public static final Flag ANVIL = new FlagBuilder().id("ANVIL").icon(Material.ANVIL).listener(new BlockInteractionListener(p)).build(p);
public static final Flag BEACON = new FlagBuilder().id("BEACON").icon(Material.BEACON).build(p);
public static final Flag BED = new FlagBuilder().id("BED").icon(Material.BED).build(p);
public static final Flag BREWING = new FlagBuilder().id("BREWING").icon(Material.BREWING_STAND_ITEM).build(p);
public static final Flag CHEST = new FlagBuilder().id("CHEST").icon(Material.CHEST).build(p);
public static final Flag DOOR = new FlagBuilder().id("DOOR").allowedByDefault(true).icon(Material.WOODEN_DOOR).build(p);
public static final Flag CRAFTING = new FlagBuilder().id("CRAFTING").allowedByDefault(true).icon(Material.WORKBENCH).build(p);
public static final Flag ENCHANTING = new FlagBuilder().id("ENCHANTING").allowedByDefault(true).icon(Material.ENCHANTMENT_TABLE).build(p);
public static final Flag FURNACE = new FlagBuilder().id("FURNACE").icon(Material.FURNACE).build(p);
public static final Flag GATE = new FlagBuilder().id("GATE").allowedByDefault(true).icon(Material.FENCE_GATE).build(p);
public static final Flag MUSIC = new FlagBuilder().id("MUSIC").icon(Material.JUKEBOX).build(p);
public static final Flag LEVER_BUTTON = new FlagBuilder().id("LEVER_BUTTON").icon(Material.LEVER).build(p);
public static final Flag REDSTONE = new FlagBuilder().id("REDSTONE").icon(Material.REDSTONE).build(p);
public static final Flag SPAWN_EGGS = new FlagBuilder().id("SPAWN_EGGS").icon(Material.MONSTER_EGG).build(p);
// Entity interactions
public static final Flag ARMOR_STAND = new FlagBuilder().id("ARMOR_STAND").icon(Material.ARMOR_STAND).listener(new EntityInteractListener()).build();
public static final Flag RIDING = new FlagBuilder().id("RIDING").icon(Material.GOLD_BARDING).build();
public static final Flag TRADING = new FlagBuilder().id("TRADING").allowedByDefault(true).icon(Material.EMERALD).build();
public static final Flag ARMOR_STAND = new FlagBuilder().id("ARMOR_STAND").icon(Material.ARMOR_STAND).listener(new EntityInteractListener(p)).build(p);
public static final Flag RIDING = new FlagBuilder().id("RIDING").icon(Material.GOLD_BARDING).build(p);
public static final Flag TRADING = new FlagBuilder().id("TRADING").allowedByDefault(true).icon(Material.EMERALD).build(p);
// Breeding
public static final Flag BREEDING = new FlagBuilder().id("BREEDING").icon(Material.CARROT).listener(new BreedingListener()).build();
public static final Flag BREEDING = new FlagBuilder().id("BREEDING").icon(Material.CARROT).listener(new BreedingListener(p)).build(p);
// Buckets. All bucket use is covered by one listener
public static final Flag BUCKET = new FlagBuilder().id("BUCKET").icon(Material.BUCKET).listener(new BucketListener()).build();
public static final Flag COLLECT_LAVA = new FlagBuilder().id("COLLECT_LAVA").icon(Material.LAVA_BUCKET).build();
public static final Flag COLLECT_WATER = new FlagBuilder().id("COLLECT_WATER").icon(Material.WATER_BUCKET).build();
public static final Flag MILKING = new FlagBuilder().id("MILKING").icon(Material.MILK_BUCKET).build();
public static final Flag BUCKET = new FlagBuilder().id("BUCKET").icon(Material.BUCKET).listener(new BucketListener(p)).build(p);
public static final Flag COLLECT_LAVA = new FlagBuilder().id("COLLECT_LAVA").icon(Material.LAVA_BUCKET).build(p);
public static final Flag COLLECT_WATER = new FlagBuilder().id("COLLECT_WATER").icon(Material.WATER_BUCKET).build(p);
public static final Flag MILKING = new FlagBuilder().id("MILKING").icon(Material.MILK_BUCKET).build(p);
// Chorus Fruit and Enderpearls
public static final Flag CHORUS_FRUIT = new FlagBuilder().id("CHORUS_FRUIT").icon(Material.CHORUS_FRUIT).listener(new TeleportationListener()).build();
public static final Flag ENDER_PEARL = new FlagBuilder().id("ENDER_PEARL").icon(Material.ENDER_PEARL).build();
public static final Flag CHORUS_FRUIT = new FlagBuilder().id("CHORUS_FRUIT").icon(Material.CHORUS_FRUIT).listener(new TeleportationListener(p)).build(p);
public static final Flag ENDER_PEARL = new FlagBuilder().id("ENDER_PEARL").icon(Material.ENDER_PEARL).build(p);
// Physical interactions
public static final Flag CROP_TRAMPLE = new FlagBuilder().id("CROP_TRAMPLE").icon(Material.WHEAT).listener(new PhysicalInteractionListener()).build();
public static final Flag PRESSURE_PLATE = new FlagBuilder().id("PRESSURE_PLATE").icon(Material.GOLD_PLATE).build();
public static final Flag CROP_TRAMPLE = new FlagBuilder().id("CROP_TRAMPLE").icon(Material.WHEAT).listener(new PhysicalInteractionListener(p)).build(p);
public static final Flag PRESSURE_PLATE = new FlagBuilder().id("PRESSURE_PLATE").icon(Material.GOLD_PLATE).build(p);
// Egg throwing
public static final Flag EGGS = new FlagBuilder().id("EGGS").icon(Material.EGG).listener(new EggListener()).build();
public static final Flag EGGS = new FlagBuilder().id("EGGS").icon(Material.EGG).listener(new EggListener(p)).build(p);
/*
* Fire
@ -66,41 +89,41 @@ public class Flags {
* I'll take you to burn
* - The Crazy World of Arthur Brown
*/
public static final Flag FIRE = new FlagBuilder().id("FIRE").icon(Material.FLINT_AND_STEEL).listener(new FireListener()).build();
public static final Flag FIRE_EXTINGUISH = new FlagBuilder().id("FIRE_EXTINGUISH").icon(Material.POTION).build();
public static final Flag FIRE_SPREAD = new FlagBuilder().id("FIRE_SPREAD").icon(Material.FIREWORK_CHARGE).build();
public static final Flag FIRE = new FlagBuilder().id("FIRE").icon(Material.FLINT_AND_STEEL).listener(new FireListener(p)).build(p);
public static final Flag FIRE_EXTINGUISH = new FlagBuilder().id("FIRE_EXTINGUISH").icon(Material.POTION).build(p);
public static final Flag FIRE_SPREAD = new FlagBuilder().id("FIRE_SPREAD").icon(Material.FIREWORK_CHARGE).build(p);
// Inventories
public static final Flag MOUNT_INVENTORY = new FlagBuilder().id("MOUNT_INVENTORY").icon(Material.IRON_BARDING).listener(new InventoryListener()).build();
public static final Flag MOUNT_INVENTORY = new FlagBuilder().id("MOUNT_INVENTORY").icon(Material.IRON_BARDING).listener(new InventoryListener(p)).build(p);
// Hurting things
public static final Flag HURT_MOBS = new FlagBuilder().id("HURT_MOBS").icon(Material.STONE_SWORD).listener(new HurtingListener()).build();
public static final Flag HURT_MONSTERS = new FlagBuilder().id("HURT_MONSTERS").icon(Material.WOOD_SWORD).build();
public static final Flag HURT_MOBS = new FlagBuilder().id("HURT_MOBS").icon(Material.STONE_SWORD).listener(new HurtingListener(p)).build(p);
public static final Flag HURT_MONSTERS = new FlagBuilder().id("HURT_MONSTERS").icon(Material.WOOD_SWORD).build(p);
// Leashes
public static final Flag LEASH = new FlagBuilder().id("LEASH").icon(Material.LEASH).listener(new LeashListener()).build();
public static final Flag LEASH = new FlagBuilder().id("LEASH").icon(Material.LEASH).listener(new LeashListener(p)).build(p);
// Portal use protection
public static final Flag PORTAL = new FlagBuilder().id("PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener()).build();
public static final Flag PORTAL = new FlagBuilder().id("PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener(p)).build(p);
// PVP
public static final Flag PVP_OVERWORLD = new FlagBuilder().id("PVP_OVERWORLD").icon(Material.ARROW).listener(new PVPListener()).build();
public static final Flag PVP_NETHER = new FlagBuilder().id("PVP_NETHER").icon(Material.IRON_AXE).build();
public static final Flag PVP_END = new FlagBuilder().id("PVP_END").icon(Material.END_CRYSTAL).build();
public static final Flag PVP_OVERWORLD = new FlagBuilder().id("PVP_OVERWORLD").icon(Material.ARROW).listener(new PVPListener(p)).build(p);
public static final Flag PVP_NETHER = new FlagBuilder().id("PVP_NETHER").icon(Material.IRON_AXE).build(p);
public static final Flag PVP_END = new FlagBuilder().id("PVP_END").icon(Material.END_CRYSTAL).build(p);
// Shearing
public static final Flag SHEARING = new FlagBuilder().id("SHEARING").icon(Material.SHEARS).listener(new ShearingListener()).build();
public static final Flag SHEARING = new FlagBuilder().id("SHEARING").icon(Material.SHEARS).listener(new ShearingListener(p)).build(p);
// Item pickup or drop
public static final Flag ITEM_DROP = new FlagBuilder().id("ITEM_DROP").icon(Material.DIRT).listener(new ItemDropPickUpListener()).build();
public static final Flag ITEM_PICKUP = new FlagBuilder().id("ITEM_PICKUP").icon(Material.DIRT).build();
public static final Flag ITEM_DROP = new FlagBuilder().id("ITEM_DROP").icon(Material.DIRT).allowedByDefault(true).listener(new ItemDropPickUpListener(p)).build(p);
public static final Flag ITEM_PICKUP = new FlagBuilder().id("ITEM_PICKUP").icon(Material.DIRT).build(p);
/*
* Non-protection flags
*/
public static final Flag ENTER_EXIT_MESSAGES = new FlagBuilder().id("ENTER_EXIT_MESSAGES").icon(Material.DIRT).allowedByDefault(true).build();
public static final Flag MOB_SPAWN = new FlagBuilder().id("MOB_SPAWN").icon(Material.APPLE).allowedByDefault(true).build();
public static final Flag MONSTER_SPAWN = new FlagBuilder().id("MONSTER_SPAWN").icon(Material.MOB_SPAWNER).allowedByDefault(true).build();
public static final Flag ENTER_EXIT_MESSAGES = new FlagBuilder().id("ENTER_EXIT_MESSAGES").icon(Material.DIRT).allowedByDefault(true).build(p);
public static final Flag MOB_SPAWN = new FlagBuilder().id("MOB_SPAWN").icon(Material.APPLE).allowedByDefault(true).build(p);
public static final Flag MONSTER_SPAWN = new FlagBuilder().id("MONSTER_SPAWN").icon(Material.MOB_SPAWNER).allowedByDefault(true).build(p);
}