Added config option territoryBlockFireballs, defaults to false; if enabled, prevents destruction of blocks by Ghast fireballs inside faction territory... note that this only works in CB build 557 and higher, where fireball detection was added

This commit is contained in:
Brettflan 2011-03-17 18:02:29 -05:00
parent 45162a3444
commit d5308bc75d
3 changed files with 11 additions and 3 deletions

View File

@ -361,9 +361,6 @@ public class Commands {
} }
page -= 1; page -= 1;
// TODO Doesn't the second sort bellow completely overwrite the first??
// Sort by total followers first // Sort by total followers first
Collections.sort(FactionList, new Comparator<Faction>(){ Collections.sort(FactionList, new Comparator<Faction>(){
@Override @Override

View File

@ -43,6 +43,8 @@ public class Conf {
public static double territoryShieldFactor = 0.5; public static double territoryShieldFactor = 0.5;
public static boolean territoryBlockCreepers = false; public static boolean territoryBlockCreepers = false;
public static boolean territoryBlockFireballs = false;
public static List<Material> territoryProtectedMaterials = new ArrayList<Material>(); public static List<Material> territoryProtectedMaterials = new ArrayList<Material>();
// Command names / aliases // Command names / aliases

View File

@ -4,6 +4,7 @@ import java.text.MessageFormat;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -75,6 +76,14 @@ public class FactionsEntityListener extends EntityListener {
return; return;
} }
} }
else if (Conf.territoryBlockFireballs && event.getEntity() instanceof Fireball)
{ // ghast fireball which might need prevention, if inside faction territory
if (Board.get(event.getLocation().getWorld()).getFactionIdAt(Coord.from(event.getLocation())) > 0)
{
event.setCancelled(true);
return;
}
}
} }
public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub) { public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub) {