Rename .getLastLocation --> .getCurrentChunk

This commit is contained in:
Olof Larsson 2013-04-11 11:27:04 +02:00
parent a34e2be362
commit 75a5764b4f
7 changed files with 26 additions and 26 deletions

View File

@ -40,9 +40,9 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
// Where did this player stand the last time we checked?
// This is a "chunk".
// Rename to "currentChunk"?
private transient PS lastStoodAt = PS.NULL;
public PS getLastStoodAt() { return this.lastStoodAt; }
public void setLastStoodAt(PS lastStoodAt) { this.lastStoodAt = lastStoodAt.getChunk(true); }
private transient PS currentChunk = null;
public PS getCurrentChunk() { return this.currentChunk; }
public void setCurrentChunk(PS currentChunk) { this.currentChunk = currentChunk.getChunk(true); }
// FIELD: factionId
private String factionId;
@ -441,7 +441,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
{
return;
}
Faction factionHere = BoardColl.get().getFactionAt(this.getLastStoodAt());
Faction factionHere = BoardColl.get().getFactionAt(this.getCurrentChunk());
String msg = Txt.parse("<i>")+" ~ "+factionHere.getTag(this);
if (factionHere.getDescription().length() > 0)
{

View File

@ -42,11 +42,11 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
String[] ChunkCoordParts = entry.getKey().split("[,\\s]+");
int chunkX = Integer.parseInt(ChunkCoordParts[0]);
int chunkZ = Integer.parseInt(ChunkCoordParts[1]);
PS ps = new PSBuilder().chunkX(chunkX).chunkZ(chunkZ).build();
PS chunk = PS.valueOf(chunkX, chunkZ);
TerritoryAccess territoryAccess = context.deserialize(entry.getValue(), TerritoryAccess.class);
ret.put(ps, territoryAccess);
ret.put(chunk, territoryAccess);
}
return ret;

View File

@ -36,9 +36,9 @@ public class CmdFactionsAccess extends FCommand
{
String type = this.argAsString(0);
type = (type == null) ? "" : type.toLowerCase();
PS loc = PS.valueOf(me);
PS chunk = PS.valueOf(me).getChunk(true);
TerritoryAccess territory = BoardColl.get().getTerritoryAccessAt(loc);
TerritoryAccess territory = BoardColl.get().getTerritoryAccessAt(chunk);
Faction locFaction = territory.getHostFaction();
boolean accessAny = Perm.ACCESS_ANY.has(sender, false);
@ -89,7 +89,7 @@ public class CmdFactionsAccess extends FCommand
}
msg("<i>%s has been %s<i> the access list for this territory.", target, Txt.parse(added ? "<lime>added to" : "<rose>removed from"));
SpoutFeatures.updateAccessInfoLoc(loc);
SpoutFeatures.updateAccessInfoLoc(chunk);
showAccessList(territory, locFaction);
}

View File

@ -36,12 +36,12 @@ public class LWCFeatures
return ConfServer.lwcIntegration && lwc != null;
}
public static void clearOtherChests(PS ps, Faction faction)
public static void clearOtherChests(PS chunkPs, Faction faction)
{
Chunk chunk = null;
try
{
chunk = ps.asBukkitChunk(true);
chunk = chunkPs.asBukkitChunk(true);
}
catch (Exception e)
{
@ -69,12 +69,12 @@ public class LWCFeatures
}
}
public static void clearAllChests(PS ps)
public static void clearAllChests(PS chunkPs)
{
Chunk chunk = null;
try
{
chunk = ps.asBukkitChunk(true);
chunk = chunkPs.asBukkitChunk(true);
}
catch (Exception e)
{

View File

@ -258,7 +258,7 @@ public class SpoutFeatures
{
mainListener.updateTerritoryDisplay(player, false);
}
else if (player.getLastStoodAt().equals(chunk))
else if (player.getCurrentChunk().equals(chunk))
{
mainListener.updateTerritoryDisplay(player, true);
}
@ -283,7 +283,7 @@ public class SpoutFeatures
for (FPlayer player : players)
{
if (chunk == null || player.getLastStoodAt().equals(chunk))
if (chunk == null || player.getCurrentChunk().equals(chunk))
mainListener.updateAccessInfo(player);
}
}

View File

@ -72,7 +72,7 @@ public class SpoutMainListener implements Listener
if (!sPlayer.isSpoutCraftEnabled() || (ConfServer.spoutTerritoryDisplaySize <= 0 && ! ConfServer.spoutTerritoryNoticeShow))
return false;
PS here = player.getLastStoodAt();
PS here = player.getCurrentChunk();
this.doAccessInfo(player, sPlayer, here);
@ -89,7 +89,7 @@ public class SpoutMainListener implements Listener
private void doLabels(FPlayer player, SpoutPlayer sPlayer, boolean notify)
{
PS here = player.getLastStoodAt();
PS here = player.getCurrentChunk();
Faction factionHere = BoardColl.get().getFactionAt(here);
String tag = factionHere.getColorTo(player).toString() + factionHere.getTag();

View File

@ -50,7 +50,7 @@ public class FactionsPlayerListener implements Listener
me.setLastLoginTime(System.currentTimeMillis());
// Store player's current Chunk and notify them where they are
me.setLastStoodAt(PS.valueOf(event.getPlayer()));
me.setCurrentChunk(PS.valueOf(event.getPlayer()));
if ( ! SpoutFeatures.updateTerritoryDisplay(me))
{
@ -91,25 +91,25 @@ public class FactionsPlayerListener implements Listener
FPlayer me = FPlayerColl.i.get(player);
// Did we change coord?
PS from = me.getLastStoodAt();
PS to = PS.valueOf(event.getTo()).getChunk(true);
PS chunkFrom = me.getCurrentChunk();
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
if (from.equals(to)) return;
if (chunkFrom.equals(chunkTo)) return;
// Yes we did change coord (:
me.setLastStoodAt(to);
TerritoryAccess access = BoardColl.get().getTerritoryAccessAt(to);
me.setCurrentChunk(chunkTo);
TerritoryAccess access = BoardColl.get().getTerritoryAccessAt(chunkTo);
// Did we change "host"(faction)?
boolean changedFaction = (BoardColl.get().getFactionAt(from) != access.getHostFaction());
boolean changedFaction = (BoardColl.get().getFactionAt(chunkFrom) != access.getHostFaction());
// let Spout handle most of this if it's available
boolean handledBySpout = changedFaction && SpoutFeatures.updateTerritoryDisplay(me);
if (me.isMapAutoUpdating())
{
me.sendMessage(BoardColl.get().getMap(me.getFaction(), to, player.getLocation().getYaw()));
me.sendMessage(BoardColl.get().getMap(me.getFaction(), chunkTo, player.getLocation().getYaw()));
}
else if (changedFaction && ! handledBySpout)
{
@ -306,7 +306,7 @@ public class FactionsPlayerListener implements Listener
}
Rel rel = me.getRelationToLocation();
if (BoardColl.get().getFactionAt(me.getLastStoodAt()).isNone()) return;
if (BoardColl.get().getFactionAt(me.getCurrentChunk()).isNone()) return;
if (rel == Rel.NEUTRAL && isCommandInList(fullCmd, ConfServer.territoryNeutralDenyCommands))
{