From 14145f1782631fad619717e477b4c0e12bee4f34 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sat, 9 Jul 2011 07:21:47 -0500 Subject: [PATCH] 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 --- src/org/mcteam/factions/Conf.java | 1 + src/org/mcteam/factions/commands/FCommandHome.java | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/org/mcteam/factions/Conf.java b/src/org/mcteam/factions/Conf.java index 441c09ad..604cecc4 100644 --- a/src/org/mcteam/factions/Conf.java +++ b/src/org/mcteam/factions/Conf.java @@ -65,6 +65,7 @@ public class Conf { public static boolean homesRespawnFromNoPowerLossWorlds = true; public static boolean homesTeleportCommandEnabled = true; public static boolean homesTeleportAllowedFromEnemyTerritory = true; + public static boolean homesTeleportAllowedFromDifferentWorld = true; public static double homesTeleportAllowedEnemyDistance = 32; public static boolean disablePVPForFactionlessPlayers = false; diff --git a/src/org/mcteam/factions/commands/FCommandHome.java b/src/org/mcteam/factions/commands/FCommandHome.java index ab5c4e59..2f5d889f 100644 --- a/src/org/mcteam/factions/commands/FCommandHome.java +++ b/src/org/mcteam/factions/commands/FCommandHome.java @@ -43,13 +43,18 @@ public class FCommandHome extends FBaseCommand { return; } - Faction faction = Board.getFactionAt(new FLocation(player.getLocation())); - if (!Conf.homesTeleportAllowedFromEnemyTerritory && me.isInEnemyTerritory()) { me.sendMessage("You cannot teleport to your faction home while in the territory of an enemy faction."); 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 (Conf.homesTeleportAllowedEnemyDistance > 0 && ! faction.isSafeZone() && ! me.isInOwnTerritory()) { Location loc = player.getLocation();