fix for Spout faction labels not updating for players who have /f map on

This commit is contained in:
Brettflan 2011-12-16 00:31:23 -06:00
parent 8ec0173eae
commit e66e71f36b

View File

@ -175,6 +175,11 @@ public class FactionsPlayerListener extends PlayerListener
@Override @Override
public void onPlayerMove(PlayerMoveEvent event) public void onPlayerMove(PlayerMoveEvent event)
{ {
// Did we change block?
if (event.getFrom().equals(event.getTo())
|| (event.getFrom().getBlockX() == event.getTo().getBlockX() && event.getFrom().getBlockZ() == event.getTo().getBlockZ())
) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer me = FPlayers.i.get(player); FPlayer me = FPlayers.i.get(player);
@ -190,21 +195,29 @@ public class FactionsPlayerListener extends PlayerListener
// Yes we did change coord (: // Yes we did change coord (:
me.setLastStoodAt(to); me.setLastStoodAt(to);
// Did we change "host"(faction)?
boolean spoutClient = SpoutFeatures.availableFor(player);
Faction factionFrom = Board.getFactionAt(from);
Faction factionTo = Board.getFactionAt(to);
boolean changedFaction = (factionFrom != factionTo);
if (changedFaction && SpoutFeatures.updateTerritoryDisplay(me))
changedFaction = false;
if (me.isMapAutoUpdating()) if (me.isMapAutoUpdating())
{ {
me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw())); me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw()));
if (spoutClient && Conf.spoutTerritoryOwnersShow)
SpoutFeatures.updateOwnerList(me);
} }
else else
{ {
// Did we change "host"(faction)?
Faction factionFrom = Board.getFactionAt(from);
Faction factionTo = Board.getFactionAt(to);
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
String ownersTo = myFaction.getOwnerListString(to); String ownersTo = myFaction.getOwnerListString(to);
boolean spoutClient = SpoutFeatures.availableFor(player);
if (factionFrom != factionTo) if (changedFaction)
{ {
me.sendFactionHereMessage(); me.sendFactionHereMessage();
if if