Rename .getLastLocation --> .getCurrentChunk
This commit is contained in:
		@@ -40,9 +40,9 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
 | 
				
			|||||||
	// Where did this player stand the last time we checked?
 | 
						// Where did this player stand the last time we checked?
 | 
				
			||||||
	// This is a "chunk".
 | 
						// This is a "chunk".
 | 
				
			||||||
	// Rename to "currentChunk"?
 | 
						// Rename to "currentChunk"?
 | 
				
			||||||
	private transient PS lastStoodAt = PS.NULL; 
 | 
						private transient PS currentChunk = null; 
 | 
				
			||||||
	public PS getLastStoodAt() { return this.lastStoodAt; }
 | 
						public PS getCurrentChunk() { return this.currentChunk; }
 | 
				
			||||||
	public void setLastStoodAt(PS lastStoodAt) { this.lastStoodAt = lastStoodAt.getChunk(true); }
 | 
						public void setCurrentChunk(PS currentChunk) { this.currentChunk = currentChunk.getChunk(true); }
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// FIELD: factionId
 | 
						// FIELD: factionId
 | 
				
			||||||
	private String factionId;
 | 
						private String factionId;
 | 
				
			||||||
@@ -441,7 +441,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		Faction factionHere = BoardColl.get().getFactionAt(this.getLastStoodAt());
 | 
							Faction factionHere = BoardColl.get().getFactionAt(this.getCurrentChunk());
 | 
				
			||||||
		String msg = Txt.parse("<i>")+" ~ "+factionHere.getTag(this);
 | 
							String msg = Txt.parse("<i>")+" ~ "+factionHere.getTag(this);
 | 
				
			||||||
		if (factionHere.getDescription().length() > 0)
 | 
							if (factionHere.getDescription().length() > 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,11 +42,11 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
 | 
				
			|||||||
			String[] ChunkCoordParts = entry.getKey().split("[,\\s]+");
 | 
								String[] ChunkCoordParts = entry.getKey().split("[,\\s]+");
 | 
				
			||||||
			int chunkX = Integer.parseInt(ChunkCoordParts[0]);
 | 
								int chunkX = Integer.parseInt(ChunkCoordParts[0]);
 | 
				
			||||||
			int chunkZ = Integer.parseInt(ChunkCoordParts[1]);
 | 
								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);
 | 
								TerritoryAccess territoryAccess = context.deserialize(entry.getValue(), TerritoryAccess.class);
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			ret.put(ps, territoryAccess);
 | 
								ret.put(chunk, territoryAccess);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,9 +36,9 @@ public class CmdFactionsAccess extends FCommand
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		String type = this.argAsString(0);
 | 
							String type = this.argAsString(0);
 | 
				
			||||||
		type = (type == null) ? "" : type.toLowerCase();
 | 
							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();
 | 
							Faction locFaction = territory.getHostFaction();
 | 
				
			||||||
		boolean accessAny = Perm.ACCESS_ANY.has(sender, false);
 | 
							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"));
 | 
							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);
 | 
							showAccessList(territory, locFaction);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,12 +36,12 @@ public class LWCFeatures
 | 
				
			|||||||
		return ConfServer.lwcIntegration && lwc != null;
 | 
							return ConfServer.lwcIntegration && lwc != null;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static void clearOtherChests(PS ps, Faction faction)
 | 
						public static void clearOtherChests(PS chunkPs, Faction faction)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Chunk chunk = null;
 | 
							Chunk chunk = null;
 | 
				
			||||||
		try
 | 
							try
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			chunk = ps.asBukkitChunk(true);
 | 
								chunk = chunkPs.asBukkitChunk(true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		catch (Exception e)
 | 
							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;
 | 
							Chunk chunk = null;
 | 
				
			||||||
		try
 | 
							try
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			chunk = ps.asBukkitChunk(true);
 | 
								chunk = chunkPs.asBukkitChunk(true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		catch (Exception e)
 | 
							catch (Exception e)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -258,7 +258,7 @@ public class SpoutFeatures
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				mainListener.updateTerritoryDisplay(player, false);
 | 
									mainListener.updateTerritoryDisplay(player, false);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if (player.getLastStoodAt().equals(chunk))
 | 
								else if (player.getCurrentChunk().equals(chunk))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				mainListener.updateTerritoryDisplay(player, true);
 | 
									mainListener.updateTerritoryDisplay(player, true);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -283,7 +283,7 @@ public class SpoutFeatures
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		for (FPlayer player : players)
 | 
							for (FPlayer player : players)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (chunk == null || player.getLastStoodAt().equals(chunk))
 | 
								if (chunk == null || player.getCurrentChunk().equals(chunk))
 | 
				
			||||||
			mainListener.updateAccessInfo(player);
 | 
								mainListener.updateAccessInfo(player);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ public class SpoutMainListener implements Listener
 | 
				
			|||||||
		if (!sPlayer.isSpoutCraftEnabled() || (ConfServer.spoutTerritoryDisplaySize <= 0 && ! ConfServer.spoutTerritoryNoticeShow))
 | 
							if (!sPlayer.isSpoutCraftEnabled() || (ConfServer.spoutTerritoryDisplaySize <= 0 && ! ConfServer.spoutTerritoryNoticeShow))
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		PS here = player.getLastStoodAt();
 | 
							PS here = player.getCurrentChunk();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.doAccessInfo(player, sPlayer, here);
 | 
							this.doAccessInfo(player, sPlayer, here);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -89,7 +89,7 @@ public class SpoutMainListener implements Listener
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private void doLabels(FPlayer player, SpoutPlayer sPlayer, boolean notify)
 | 
						private void doLabels(FPlayer player, SpoutPlayer sPlayer, boolean notify)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		PS here = player.getLastStoodAt();
 | 
							PS here = player.getCurrentChunk();
 | 
				
			||||||
		Faction factionHere = BoardColl.get().getFactionAt(here);
 | 
							Faction factionHere = BoardColl.get().getFactionAt(here);
 | 
				
			||||||
		String tag = factionHere.getColorTo(player).toString() + factionHere.getTag();
 | 
							String tag = factionHere.getColorTo(player).toString() + factionHere.getTag();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,7 @@ public class FactionsPlayerListener implements Listener
 | 
				
			|||||||
		me.setLastLoginTime(System.currentTimeMillis());
 | 
							me.setLastLoginTime(System.currentTimeMillis());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Store player's current Chunk and notify them where they are
 | 
							// 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))
 | 
							if ( ! SpoutFeatures.updateTerritoryDisplay(me))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -91,25 +91,25 @@ public class FactionsPlayerListener implements Listener
 | 
				
			|||||||
		FPlayer me = FPlayerColl.i.get(player);
 | 
							FPlayer me = FPlayerColl.i.get(player);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Did we change coord?
 | 
							// Did we change coord?
 | 
				
			||||||
		PS from = me.getLastStoodAt();
 | 
							PS chunkFrom = me.getCurrentChunk();
 | 
				
			||||||
		PS to = PS.valueOf(event.getTo()).getChunk(true);
 | 
							PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (from.equals(to)) return;
 | 
							if (chunkFrom.equals(chunkTo)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Yes we did change coord (:
 | 
							// Yes we did change coord (:
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		me.setLastStoodAt(to);
 | 
							me.setCurrentChunk(chunkTo);
 | 
				
			||||||
		TerritoryAccess access = BoardColl.get().getTerritoryAccessAt(to);
 | 
							TerritoryAccess access = BoardColl.get().getTerritoryAccessAt(chunkTo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Did we change "host"(faction)?
 | 
							// 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
 | 
							// let Spout handle most of this if it's available
 | 
				
			||||||
		boolean handledBySpout = changedFaction && SpoutFeatures.updateTerritoryDisplay(me);
 | 
							boolean handledBySpout = changedFaction && SpoutFeatures.updateTerritoryDisplay(me);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (me.isMapAutoUpdating())
 | 
							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)
 | 
							else if (changedFaction && ! handledBySpout)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -306,7 +306,7 @@ public class FactionsPlayerListener implements Listener
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Rel rel = me.getRelationToLocation();
 | 
							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))
 | 
							if (rel == Rel.NEUTRAL && isCommandInList(fullCmd, ConfServer.territoryNeutralDenyCommands))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user