diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemDropPickUpListener.java b/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemDropPickUpListener.java index b73e2f4b3..1a550ffc7 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemDropPickUpListener.java +++ b/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemDropPickUpListener.java @@ -23,7 +23,7 @@ public class ItemDropPickUpListener extends AbstractFlagListener { */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVisitorDrop(PlayerDropItemEvent e) { - checkIsland(e, e.getItemDrop().getLocation(), Flags.VISITOR_ITEM_DROP); + checkIsland(e, e.getItemDrop().getLocation(), Flags.ITEM_DROP); } /* @@ -33,7 +33,7 @@ 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.VISITOR_ITEM_PICKUP); + checkIsland(e, e.getItem().getLocation(), Flags.ITEM_PICKUP); } } } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/PVPListener.java b/src/main/java/us/tastybento/bskyblock/listeners/flags/PVPListener.java index 428b193f5..52932d4db 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/PVPListener.java +++ b/src/main/java/us/tastybento/bskyblock/listeners/flags/PVPListener.java @@ -43,9 +43,9 @@ public class PVPListener extends AbstractFlagListener { @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityDamage(final EntityDamageByEntityEvent e) { if (e.getEntity() instanceof Player) { - Flag flag = Flags.PVP; - if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP; - else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP; + Flag flag = Flags.PVP_OVERWORLD; + if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER; + else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END; respond(e, e.getDamager(), flag); } } @@ -72,9 +72,9 @@ public class PVPListener extends AbstractFlagListener { @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onFishing(PlayerFishEvent e) { if (e.getCaught() != null && e.getCaught() instanceof Player) { - Flag flag = Flags.PVP; - if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP; - else if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP; + Flag flag = Flags.PVP_OVERWORLD; + if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER; + else if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END; if (checkIsland(e, e.getCaught().getLocation(), flag)) { e.getHook().remove(); return; @@ -89,9 +89,9 @@ public class PVPListener extends AbstractFlagListener { @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void onSplashPotionSplash(final PotionSplashEvent e) { // Deduce the world - Flag flag = Flags.PVP; - if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP; - else if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP; + Flag flag = Flags.PVP_OVERWORLD; + if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER; + else if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END; // Try to get the thrower Projectile projectile = (Projectile) e.getEntity(); @@ -138,9 +138,9 @@ public class PVPListener extends AbstractFlagListener { if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) { // Deduce the world - Flag flag = Flags.PVP; - if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP; - else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP; + Flag flag = Flags.PVP_OVERWORLD; + if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER; + else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END; UUID attacker = thrownPotions.get(e.getDamager().getEntityId()); // Self damage diff --git a/src/main/java/us/tastybento/bskyblock/lists/Flags.java b/src/main/java/us/tastybento/bskyblock/lists/Flags.java index 110d76c6d..08e4e297d 100644 --- a/src/main/java/us/tastybento/bskyblock/lists/Flags.java +++ b/src/main/java/us/tastybento/bskyblock/lists/Flags.java @@ -4,22 +4,7 @@ import org.bukkit.Material; import us.tastybento.bskyblock.api.flags.Flag; import us.tastybento.bskyblock.api.flags.FlagBuilder; -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.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; +import us.tastybento.bskyblock.listeners.flags.*; public class Flags { @@ -100,20 +85,21 @@ public class Flags { public static final Flag PORTAL = new FlagBuilder().id("PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener()).build(); // PVP - public static final Flag PVP = new FlagBuilder().id("PVP").icon(Material.ARROW).listener(new PVPListener()).build(); - public static final Flag NETHER_PVP = new FlagBuilder().id("NETHER_PVP").icon(Material.IRON_AXE).build(); - public static final Flag END_PVP = new FlagBuilder().id("END_PVP").icon(Material.END_CRYSTAL).build(); + 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(); // Shearing public static final Flag SHEARING = new FlagBuilder().id("SHEARING").icon(Material.SHEARS).listener(new ShearingListener()).build(); - // Visitor item pickup or drop - public static final Flag VISITOR_ITEM_DROP = new FlagBuilder().id("VISITOR_ITEM_DROP").icon(Material.DIRT).build(); - public static final Flag VISITOR_ITEM_PICKUP = new FlagBuilder().id("VISITOR_ITEM_PICKUP").icon(Material.DIRT).build(); + // 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(); /* * 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();