From 5b73ebc4569a069d00db3250dd19b153f01eb4c7 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Wed, 20 Jul 2011 15:45:36 -0500 Subject: [PATCH] New conf.json option "homesTeleportIgnoreEnemiesIfInOwnTerritory" (default true). If disabled, players will no longer be able to teleport to their faction home while close to an enemy even if they are in their own territory --- src/com/massivecraft/factions/Conf.java | 1 + src/com/massivecraft/factions/commands/FCommandHome.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 64292ecd..873e9b9b 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -68,6 +68,7 @@ public class Conf { public static boolean homesTeleportAllowedFromEnemyTerritory = true; public static boolean homesTeleportAllowedFromDifferentWorld = true; public static double homesTeleportAllowedEnemyDistance = 32; + public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true; public static boolean disablePVPForFactionlessPlayers = false; public static int noPVPDamageToOthersForXSecondsAfterLogin = 3; diff --git a/src/com/massivecraft/factions/commands/FCommandHome.java b/src/com/massivecraft/factions/commands/FCommandHome.java index 84942a2c..cba1ab46 100644 --- a/src/com/massivecraft/factions/commands/FCommandHome.java +++ b/src/com/massivecraft/factions/commands/FCommandHome.java @@ -57,7 +57,11 @@ public class FCommandHome extends FBaseCommand { Faction faction = Board.getFactionAt(new FLocation(player.getLocation())); // if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby - if (Conf.homesTeleportAllowedEnemyDistance > 0 && ! faction.isSafeZone() && ! me.isInOwnTerritory()) { + if ( + Conf.homesTeleportAllowedEnemyDistance > 0 + && !faction.isSafeZone() + && (!me.isInOwnTerritory() || (me.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory)) + ) { Location loc = player.getLocation(); World w = loc.getWorld(); double x = loc.getX();