Prevent usage of armor stands by default — Prevent item frames from being shot

This commit is contained in:
utarwyn 2018-05-17 17:50:07 +02:00
parent e1f0938f59
commit 4a8721e453
2 changed files with 9 additions and 0 deletions

View File

@ -411,6 +411,7 @@ public class Conf {
territoryDenyUseageMaterials.add(Material.BUCKET); territoryDenyUseageMaterials.add(Material.BUCKET);
territoryDenyUseageMaterials.add(Material.WATER_BUCKET); territoryDenyUseageMaterials.add(Material.WATER_BUCKET);
territoryDenyUseageMaterials.add(Material.LAVA_BUCKET); territoryDenyUseageMaterials.add(Material.LAVA_BUCKET);
territoryDenyUseageMaterials.add(Material.ARMOR_STAND);
territoryProtectedMaterialsWhenOffline.add(Material.WOODEN_DOOR); territoryProtectedMaterialsWhenOffline.add(Material.WOODEN_DOOR);
territoryProtectedMaterialsWhenOffline.add(Material.TRAP_DOOR); territoryProtectedMaterialsWhenOffline.add(Material.TRAP_DOOR);
@ -437,6 +438,7 @@ public class Conf {
territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND);
safeZoneNerfedCreatureTypes.add(EntityType.BLAZE); safeZoneNerfedCreatureTypes.add(EntityType.BLAZE);
safeZoneNerfedCreatureTypes.add(EntityType.CAVE_SPIDER); safeZoneNerfedCreatureTypes.add(EntityType.CAVE_SPIDER);

View File

@ -133,6 +133,11 @@ public class FactionsEntityListener implements Listener {
} else { } else {
// Protect armor stands/item frames from being damaged in protected territories // Protect armor stands/item frames from being damaged in protected territories
if (damagee.getType() == EntityType.ITEM_FRAME || damagee.getType() == EntityType.ARMOR_STAND) { 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 // Run the check for a player
if (damager instanceof Player) { if (damager instanceof Player) {
// Generate the action message. // Generate the action message.
@ -612,6 +617,8 @@ public class FactionsEntityListener implements Listener {
public void onPaintingPlace(HangingPlaceEvent event) { public void onPaintingPlace(HangingPlaceEvent event) {
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) { if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) {
event.setCancelled(true); event.setCancelled(true);
// Fix: update player's inventory to avoid items glitches
event.getPlayer().updateInventory();
} }
} }