From d20ef372fa8d31089c10de434251b926f6bd4855 Mon Sep 17 00:00:00 2001 From: Naman Date: Wed, 30 May 2018 19:52:16 -0500 Subject: [PATCH] Revert "Bug fix: item frame/armor stand protection" --- .../java/com/massivecraft/factions/Conf.java | 2 -- .../listeners/FactionsEntityListener.java | 35 ------------------- .../listeners/FactionsPlayerListener.java | 30 ---------------- 3 files changed, 67 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index cc466758..79b408e0 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -411,7 +411,6 @@ public class Conf { territoryDenyUseageMaterials.add(Material.BUCKET); territoryDenyUseageMaterials.add(Material.WATER_BUCKET); territoryDenyUseageMaterials.add(Material.LAVA_BUCKET); - territoryDenyUseageMaterials.add(Material.ARMOR_STAND); territoryProtectedMaterialsWhenOffline.add(Material.WOODEN_DOOR); territoryProtectedMaterialsWhenOffline.add(Material.TRAP_DOOR); @@ -438,7 +437,6 @@ public class Conf { territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET); - territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND); safeZoneNerfedCreatureTypes.add(EntityType.BLAZE); safeZoneNerfedCreatureTypes.add(EntityType.CAVE_SPIDER); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index 241a47e6..3a80dc09 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -131,39 +131,6 @@ public class FactionsEntityListener implements Listener { } } } else { - // Protect armor stands/item frames from being damaged in protected territories - if (damagee.getType() == EntityType.ITEM_FRAME || damagee.getType() == EntityType.ARMOR_STAND) { - // Manage projectiles launched by players - if (damager instanceof Projectile && ((Projectile) damager).getShooter() instanceof Entity) { - damager = (Entity) ((Projectile) damager).getShooter(); - } - - // Run the check for a player - if (damager instanceof Player) { - // Generate the action message. - String entityAction; - - if (damagee.getType() == EntityType.ITEM_FRAME) { - entityAction = "item frames"; - } else { - entityAction = "armor stands"; - } - - if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy " + entityAction, false)) { - event.setCancelled(true); - } - } else { - // we don't want to let mobs/arrows destroy item frames/armor stands - // so we only have to run the check as if there had been an explosion at the damager location - if (!this.checkExplosionForBlock(damager, damagee.getLocation().getBlock())) { - event.setCancelled(true); - } - } - - // we don't need to go after - return; - } - //this one should trigger if something other than a player takes damage if (damager instanceof Player) { // now itll only go here if the damage is dealt by a player @@ -617,8 +584,6 @@ public class FactionsEntityListener implements Listener { public void onPaintingPlace(HangingPlaceEvent event) { if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) { event.setCancelled(true); - // Fix: update player's inventory to avoid items glitches - event.getPlayer().updateInventory(); } } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 5183969a..8a03536b 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -658,36 +658,6 @@ public class FactionsPlayerListener implements Listener { } } - // For disabling interactions with item frames in another faction's territory - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { - // only need to check for item frames - if (event.getRightClicked().getType() != EntityType.ITEM_FRAME) { - return; - } - - Player player = event.getPlayer(); - Entity entity = event.getRightClicked(); - - if (!FactionsBlockListener.playerCanBuildDestroyBlock(player, entity.getLocation(), "use item frames", false)) { - event.setCancelled(true); - } - } - - // For disabling interactions with armor stands in another faction's territory - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { - Entity entity = event.getRightClicked(); - - // only need to check for armor stand and item frames - if (entity.getType() != EntityType.ARMOR_STAND) { - return; - } - - if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), entity.getLocation(), "use armor stands", false)) { - event.setCancelled(true); - } - } // for handling people who repeatedly spam attempts to open a door (or similar) in another faction's territory private Map interactSpammers = new HashMap<>();