New conf.json option "homesTeleportAllowedFromDifferentWorld" (defaults to true) which can be used to prevent people from teleporting to their faction home if in a different world from it

This commit is contained in:
Brettflan 2011-07-09 07:21:47 -05:00
parent d69b278728
commit 14145f1782
2 changed files with 8 additions and 2 deletions

View File

@ -65,6 +65,7 @@ public class Conf {
public static boolean homesRespawnFromNoPowerLossWorlds = true; public static boolean homesRespawnFromNoPowerLossWorlds = true;
public static boolean homesTeleportCommandEnabled = true; public static boolean homesTeleportCommandEnabled = true;
public static boolean homesTeleportAllowedFromEnemyTerritory = true; public static boolean homesTeleportAllowedFromEnemyTerritory = true;
public static boolean homesTeleportAllowedFromDifferentWorld = true;
public static double homesTeleportAllowedEnemyDistance = 32; public static double homesTeleportAllowedEnemyDistance = 32;
public static boolean disablePVPForFactionlessPlayers = false; public static boolean disablePVPForFactionlessPlayers = false;

View File

@ -43,13 +43,18 @@ public class FCommandHome extends FBaseCommand {
return; return;
} }
Faction faction = Board.getFactionAt(new FLocation(player.getLocation()));
if (!Conf.homesTeleportAllowedFromEnemyTerritory && me.isInEnemyTerritory()) { if (!Conf.homesTeleportAllowedFromEnemyTerritory && me.isInEnemyTerritory()) {
me.sendMessage("You cannot teleport to your faction home while in the territory of an enemy faction."); me.sendMessage("You cannot teleport to your faction home while in the territory of an enemy faction.");
return; return;
} }
if (!Conf.homesTeleportAllowedFromDifferentWorld && player.getWorld().getId() != myFaction.getHome().getWorld().getId()) {
me.sendMessage("You cannot teleport to your faction home while in a different world.");
return;
}
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 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()) {
Location loc = player.getLocation(); Location loc = player.getLocation();