Updated TNT explosion protection to cover TNT minecarts

Added trapped chest, hopper, and dropper to default territoryProtectedMaterials and territoryProtectedMaterialsWhenOffline lists

Existing users will need to update their config to add these, like so:
/f config territoryProtectedMaterials TRAPPED_CHEST
/f config territoryProtectedMaterials DROPPER
/f config territoryProtectedMaterials HOPPER
/f config territoryProtectedMaterialsWhenOffline TRAPPED_CHEST
/f config territoryProtectedMaterialsWhenOffline DROPPER
/f config territoryProtectedMaterialsWhenOffline HOPPER

Also cleaned up some leftover code
This commit is contained in:
Brettflan 2013-04-23 08:52:39 -05:00
parent cec9422a13
commit d7ad010d2f
3 changed files with 9 additions and 33 deletions

View File

@ -316,6 +316,9 @@ public class Conf
territoryProtectedMaterials.add(Material.SOIL);
territoryProtectedMaterials.add(Material.BEACON);
territoryProtectedMaterials.add(Material.ANVIL);
territoryProtectedMaterials.add(Material.TRAPPED_CHEST);
territoryProtectedMaterials.add(Material.DROPPER);
territoryProtectedMaterials.add(Material.HOPPER);
territoryDenyUseageMaterials.add(Material.FIREBALL);
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
@ -339,6 +342,9 @@ public class Conf
territoryProtectedMaterialsWhenOffline.add(Material.SOIL);
territoryProtectedMaterialsWhenOffline.add(Material.BEACON);
territoryProtectedMaterialsWhenOffline.add(Material.ANVIL);
territoryProtectedMaterialsWhenOffline.add(Material.TRAPPED_CHEST);
territoryProtectedMaterialsWhenOffline.add(Material.DROPPER);
territoryProtectedMaterialsWhenOffline.add(Material.HOPPER);
territoryDenyUseageMaterialsWhenOffline.add(Material.FIREBALL);
territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL);

View File

@ -47,35 +47,4 @@ public class FPlayers extends PlayerEntityCollection<FPlayer>
}
}
}
public void autoLeaveOnInactivityRoutine()
{
if (Conf.autoLeaveAfterDaysOfInactivity <= 0.0)
{
return;
}
long now = System.currentTimeMillis();
double toleranceMillis = Conf.autoLeaveAfterDaysOfInactivity * 24 * 60 * 60 * 1000;
for (FPlayer fplayer : FPlayers.i.get())
{
if (fplayer.isOffline() && now - fplayer.getLastLoginTime() > toleranceMillis)
{
if (Conf.logFactionLeave || Conf.logFactionKick)
P.p.log("Player "+fplayer.getName()+" was auto-removed due to inactivity.");
// if player is faction admin, sort out the faction since he's going away
if (fplayer.getRole() == Role.ADMIN)
{
Faction faction = fplayer.getFaction();
if (faction != null)
fplayer.getFaction().promoteNewLeader();
}
fplayer.leave(false);
fplayer.detach();
}
}
}
}

View File

@ -16,6 +16,7 @@ import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed;
@ -206,7 +207,7 @@ public class FactionsEntityListener implements Listener
}
else if
(
boomer instanceof TNTPrimed
(boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart)
&&
(
(faction.isNone() && Conf.wildernessBlockTNT && ! Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()))
@ -222,7 +223,7 @@ public class FactionsEntityListener implements Listener
// TNT which needs prevention
event.setCancelled(true);
}
else if (boomer instanceof TNTPrimed && Conf.handleExploitTNTWaterlog)
else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && Conf.handleExploitTNTWaterlog)
{
// TNT in water/lava doesn't normally destroy any surrounding blocks, which is usually desired behavior, but...
// this change below provides workaround for waterwalling providing perfect protection,