From 4a8721e453f96e5e6d1438943000a4d830985006 Mon Sep 17 00:00:00 2001 From: utarwyn Date: Thu, 17 May 2018 17:50:07 +0200 Subject: [PATCH] =?UTF-8?q?Prevent=20usage=20of=20armor=20stands=20by=20de?= =?UTF-8?q?fault=20=E2=80=94=20Prevent=20item=20frames=20from=20being=20sh?= =?UTF-8?q?ot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/massivecraft/factions/Conf.java | 2 ++ .../factions/listeners/FactionsEntityListener.java | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 79b408e0..99a811e9 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -411,6 +411,7 @@ 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); @@ -437,6 +438,7 @@ 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 a8edb958..8fefd298 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -133,6 +133,11 @@ 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. @@ -612,6 +617,8 @@ 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(); } }