From 24e85e0e77fc8a25a41c6b6839801a51af4a8d1a Mon Sep 17 00:00:00 2001 From: Brettflan Date: Thu, 30 Jun 2011 05:17:34 -0500 Subject: [PATCH] Faction homes are now un-set if the territory they are set in is lost (unclaimed, or claimed by another faction), but only when someone tries to /f home or dies and would normally respawn there --- src/org/mcteam/factions/Faction.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/org/mcteam/factions/Faction.java b/src/org/mcteam/factions/Faction.java index 36f119f9..472c45ce 100644 --- a/src/org/mcteam/factions/Faction.java +++ b/src/org/mcteam/factions/Faction.java @@ -95,12 +95,23 @@ public class Faction { } public Location getHome() { + confirmValidHome(); return home; } public boolean hasHome() { + confirmValidHome(); return this.home != null; } + + public void confirmValidHome() { + if (!Conf.homesMustBeInClaimedTerritory || Board.getFactionAt(new FLocation(this.home)) == this) { + return; + } + + sendMessage("Your faction home has been un-set since it is no longer in your territory."); + this.home = null; + } // ------------------------------- // Understand the types