From 75a5764b4f80cd2626a37fc877dc7f1dfa5b2df5 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 11 Apr 2013 11:27:04 +0200 Subject: [PATCH] Rename .getLastLocation --> .getCurrentChunk --- src/com/massivecraft/factions/FPlayer.java | 8 ++++---- .../factions/adapters/BoardMapAdapter.java | 4 ++-- .../factions/cmd/CmdFactionsAccess.java | 6 +++--- .../factions/integration/LWCFeatures.java | 8 ++++---- .../factions/integration/SpoutFeatures.java | 4 ++-- .../integration/SpoutMainListener.java | 4 ++-- .../listeners/FactionsPlayerListener.java | 18 +++++++++--------- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index 479f7050..55d0fe37 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -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("")+" ~ "+factionHere.getTag(this); if (factionHere.getDescription().length() > 0) { diff --git a/src/com/massivecraft/factions/adapters/BoardMapAdapter.java b/src/com/massivecraft/factions/adapters/BoardMapAdapter.java index d7c8a456..0b695ce0 100644 --- a/src/com/massivecraft/factions/adapters/BoardMapAdapter.java +++ b/src/com/massivecraft/factions/adapters/BoardMapAdapter.java @@ -42,11 +42,11 @@ public class BoardMapAdapter implements JsonDeserializer%s has been %s the access list for this territory.", target, Txt.parse(added ? "added to" : "removed from")); - SpoutFeatures.updateAccessInfoLoc(loc); + SpoutFeatures.updateAccessInfoLoc(chunk); showAccessList(territory, locFaction); } diff --git a/src/com/massivecraft/factions/integration/LWCFeatures.java b/src/com/massivecraft/factions/integration/LWCFeatures.java index 6b542a76..5a029553 100644 --- a/src/com/massivecraft/factions/integration/LWCFeatures.java +++ b/src/com/massivecraft/factions/integration/LWCFeatures.java @@ -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) { diff --git a/src/com/massivecraft/factions/integration/SpoutFeatures.java b/src/com/massivecraft/factions/integration/SpoutFeatures.java index e99d2be7..a2d2f6b1 100644 --- a/src/com/massivecraft/factions/integration/SpoutFeatures.java +++ b/src/com/massivecraft/factions/integration/SpoutFeatures.java @@ -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); } } diff --git a/src/com/massivecraft/factions/integration/SpoutMainListener.java b/src/com/massivecraft/factions/integration/SpoutMainListener.java index a1a64dac..6a6b04ba 100644 --- a/src/com/massivecraft/factions/integration/SpoutMainListener.java +++ b/src/com/massivecraft/factions/integration/SpoutMainListener.java @@ -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(); diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 44b70dc9..490bfc5e 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -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)) {