From b19cfb515228311167305a07a72a7a143a9f349a Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Fri, 2 Feb 2018 07:46:53 +0100 Subject: [PATCH 1/4] Removed IDEA junk files and added a .gitignore --- .gitignore | 6 ++++++ .idea/misc.xml | 13 ------------- .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ 4 files changed, 6 insertions(+), 27 deletions(-) create mode 100644 .gitignore delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..9adaadaa0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/bin/ +.classpath +.project +/.settings/ +*.iml +/target diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index e8942bd65..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index b7d631524..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfb..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From f930504dabca6c670bbc5361b6b004355230c783 Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Fri, 2 Feb 2018 07:50:17 +0100 Subject: [PATCH 2/4] And remove another IDEA junk file --- bskyblock.iml | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 bskyblock.iml diff --git a/bskyblock.iml b/bskyblock.iml deleted file mode 100644 index 686b4846a..000000000 --- a/bskyblock.iml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 5293d647c0454fb1c244e9e57c69e5fe9891bcb4 Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Fri, 2 Feb 2018 15:22:37 +0100 Subject: [PATCH 3/4] Removed duplicate listeners in Flags --- .../java/us/tastybento/bskyblock/lists/Flags.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/us/tastybento/bskyblock/lists/Flags.java b/src/main/java/us/tastybento/bskyblock/lists/Flags.java index 62ec5cb48..110d76c6d 100644 --- a/src/main/java/us/tastybento/bskyblock/lists/Flags.java +++ b/src/main/java/us/tastybento/bskyblock/lists/Flags.java @@ -44,8 +44,8 @@ public class Flags { 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).listener(new PlaceBlocksListener()).build(); - public static final Flag SPAWN_EGGS = new FlagBuilder().id("SPAWN_EGGS").icon(Material.MONSTER_EGG).listener(new PlaceBlocksListener()).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(); // Entity interactions public static final Flag ARMOR_STAND = new FlagBuilder().id("ARMOR_STAND").icon(Material.ARMOR_STAND).listener(new EntityInteractListener()).build(); @@ -108,14 +108,14 @@ public class Flags { 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).listener(new PlaceBlocksListener()).build(); - public static final Flag VISITOR_ITEM_PICKUP = new FlagBuilder().id("VISITOR_ITEM_PICKUP").icon(Material.DIRT).listener(new PlaceBlocksListener()).build(); + 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(); /* * Non-protection flags */ - public static final Flag ENTER_EXIT_MESSAGES = new FlagBuilder().id("ENTER_EXIT_MESSAGES").icon(Material.DIRT).allowedByDefault(true).listener(new PlaceBlocksListener()).build(); - public static final Flag MOB_SPAWN = new FlagBuilder().id("MOB_SPAWN").icon(Material.APPLE).allowedByDefault(true).listener(new PlaceBlocksListener()).build(); - public static final Flag MONSTER_SPAWN = new FlagBuilder().id("MONSTER_SPAWN").icon(Material.MOB_SPAWNER).allowedByDefault(true).listener(new PlaceBlocksListener()).build(); + 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(); } From 3d7b1bc6479bda2866c0a5c1d82534356aeafd63 Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Fri, 2 Feb 2018 15:29:24 +0100 Subject: [PATCH 4/4] Renamed PVP and Item Drop/pickup related flags Also assigned the ItemDropPickUpListener() to the related events --- .../flags/ItemDropPickUpListener.java | 4 +-- .../listeners/flags/PVPListener.java | 24 +++++++-------- .../us/tastybento/bskyblock/lists/Flags.java | 30 +++++-------------- 3 files changed, 22 insertions(+), 36 deletions(-) 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();