Reformat code for item frames/armor stands protection
This commit is contained in:
parent
4a8721e453
commit
5fecc4979c
@ -438,7 +438,7 @@ public class Conf {
|
||||
territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET);
|
||||
territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET);
|
||||
territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET);
|
||||
territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND);
|
||||
territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND);
|
||||
|
||||
safeZoneNerfedCreatureTypes.add(EntityType.BLAZE);
|
||||
safeZoneNerfedCreatureTypes.add(EntityType.CAVE_SPIDER);
|
||||
|
@ -134,9 +134,9 @@ public class FactionsEntityListener implements Listener {
|
||||
// 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();
|
||||
}
|
||||
if (damager instanceof Projectile && ((Projectile) damager).getShooter() instanceof Entity) {
|
||||
damager = (Entity) ((Projectile) damager).getShooter();
|
||||
}
|
||||
|
||||
// Run the check for a player
|
||||
if (damager instanceof Player) {
|
||||
@ -154,10 +154,10 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
// 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
|
||||
|
@ -675,19 +675,19 @@ public class FactionsPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
// 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();
|
||||
@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;
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
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<String, InteractAttemptSpam> interactSpammers = new HashMap<>();
|
||||
|
Loading…
Reference in New Issue
Block a user