Merge branch 'master' of github.com:MassiveCraft/Factions
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/SpoutAPI.jar
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/SpoutAPI.jar
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/iConomy.jar
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/iConomy.jar
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -182,13 +182,19 @@ public class Conf
 | 
			
		||||
	public static transient Set<CreatureType> safeZoneNerfedCreatureTypes = EnumSet.noneOf(CreatureType.class);
 | 
			
		||||
 | 
			
		||||
	// Spout features
 | 
			
		||||
	public static boolean spoutFactionTagsOverNames = true;
 | 
			
		||||
	public static boolean spoutFactionTitlesOverNames = true;
 | 
			
		||||
	public static boolean spoutFactionAdminCapes = true; // TODO: What are these for?
 | 
			
		||||
	public static boolean spoutFactionModeratorCapes = true;
 | 
			
		||||
	public static int spoutTerritoryDisplayPosition = 3;
 | 
			
		||||
	public static float spoutTerritoryDisplaySize = 1.0f;
 | 
			
		||||
	public static boolean spoutTerritoryDisplayShowDescription = true;
 | 
			
		||||
	public static boolean spoutFactionTagsOverNames = true;  // show faction tags over names over player heads
 | 
			
		||||
	public static boolean spoutFactionTitlesOverNames = true;  // whether to include player's title in that
 | 
			
		||||
	public static boolean spoutFactionAdminCapes = true;  // Show capes on faction admins, colored based on the viewer's relation to the target player
 | 
			
		||||
	public static boolean spoutFactionModeratorCapes = true;  // same, but for faction moderators
 | 
			
		||||
	public static int spoutTerritoryDisplayPosition = 3;  // permanent territory display, instead of by chat; 0 = disabled, 1 = top left, 2 = top center, 3+ = top right
 | 
			
		||||
	public static float spoutTerritoryDisplaySize = 1.0f;  // text scale (size) for territory display
 | 
			
		||||
	public static boolean spoutTerritoryDisplayShowDescription = true;  // whether to show the faction description, not just the faction tag
 | 
			
		||||
	public static boolean spoutTerritoryOwnersShow = true;  // show territory owner list as well
 | 
			
		||||
	public static boolean spoutTerritoryNoticeShow = true;  // show additional brief territory notice near center of screen, to be sure player notices transition
 | 
			
		||||
	public static int spoutTerritoryNoticeTop = 40;  // how far down the screen to place the additional notice
 | 
			
		||||
	public static boolean spoutTerritoryNoticeShowDescription = false;  // whether to show the faction description in the notice, not just the faction tag
 | 
			
		||||
	public static float spoutTerritoryNoticeSize = 1.5f;  // text scale (size) for notice
 | 
			
		||||
	public static float spoutTerritoryNoticeLeaveAfterSeconds = 2.00f;  // how many seconds before the notice goes away
 | 
			
		||||
	public static String capeAlly = "https://github.com/MassiveCraft/Factions/raw/master/capes/ally.png";
 | 
			
		||||
	public static String capeEnemy = "https://github.com/MassiveCraft/Factions/raw/master/capes/enemy.png";
 | 
			
		||||
	public static String capeMember = "https://github.com/MassiveCraft/Factions/raw/master/capes/member.png";
 | 
			
		||||
 
 | 
			
		||||
@@ -153,7 +153,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void resetFactionData(boolean doSpotUpdate)
 | 
			
		||||
	public final void resetFactionData(boolean doSpotUpdate)
 | 
			
		||||
	{
 | 
			
		||||
		// clean up any territory ownership in old faction, if there is one
 | 
			
		||||
		if (Factions.i.exists(this.getFactionId()))
 | 
			
		||||
 
 | 
			
		||||
@@ -123,6 +123,22 @@ public class CmdConfig extends FCommand
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// float
 | 
			
		||||
			else if (target.getType() == float.class)
 | 
			
		||||
			{
 | 
			
		||||
				try
 | 
			
		||||
				{
 | 
			
		||||
					float floatVal = Float.parseFloat(value);
 | 
			
		||||
					target.setFloat(null, floatVal);
 | 
			
		||||
					success = "\""+fieldName+"\" option set to "+floatVal+".";
 | 
			
		||||
				}
 | 
			
		||||
				catch(NumberFormatException ex)
 | 
			
		||||
				{
 | 
			
		||||
					sendMessage("Cannot set \""+fieldName+"\": float (numeric) value required.");
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// String
 | 
			
		||||
			else if (target.getType() == String.class)
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -50,16 +50,16 @@ public class SpoutFeatures
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If any Spout feature is enabled in conf.json, and we're successfully hooked into it
 | 
			
		||||
	// If we're successfully hooked into Spout
 | 
			
		||||
	public static boolean enabled()
 | 
			
		||||
	{
 | 
			
		||||
		return spoutMe && (
 | 
			
		||||
				   Conf.spoutFactionTagsOverNames
 | 
			
		||||
				|| Conf.spoutFactionTitlesOverNames
 | 
			
		||||
				|| Conf.spoutFactionAdminCapes
 | 
			
		||||
				|| Conf.spoutFactionModeratorCapes
 | 
			
		||||
				|| Conf.spoutTerritoryDisplayPosition > 0
 | 
			
		||||
				);
 | 
			
		||||
		return spoutMe;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If Spout is available and the specified Player is running the Spoutcraft client
 | 
			
		||||
	public static boolean availableFor(Player player)
 | 
			
		||||
	{
 | 
			
		||||
		return spoutMe && SpoutManager.getPlayer(player).isSpoutCraftEnabled();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -67,21 +67,26 @@ public class SpoutFeatures
 | 
			
		||||
	public static boolean updateTerritoryDisplay(FPlayer player)
 | 
			
		||||
	{
 | 
			
		||||
		if (!enabled())
 | 
			
		||||
		{
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return mainListener.updateTerritoryDisplay(player);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// update owner list for specified player
 | 
			
		||||
	public static void updateOwnerList(FPlayer player)
 | 
			
		||||
	{
 | 
			
		||||
		if (!enabled())
 | 
			
		||||
			return;
 | 
			
		||||
 | 
			
		||||
		mainListener.updateOwnerList(player);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void playerDisconnect(FPlayer player)
 | 
			
		||||
	{
 | 
			
		||||
		if (!enabled())
 | 
			
		||||
		{
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		mainListener.removeTerritoryLabel(player.getName());
 | 
			
		||||
		mainListener.removeTerritoryLabels(player.getName());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -267,26 +272,30 @@ public class SpoutFeatures
 | 
			
		||||
	{
 | 
			
		||||
		if (inColor == null)
 | 
			
		||||
		{
 | 
			
		||||
			return new Color(191, 191, 191, alpha);
 | 
			
		||||
			return SpoutFixedColor(191, 191, 191, alpha);
 | 
			
		||||
		}
 | 
			
		||||
		switch (inColor.getCode())
 | 
			
		||||
		{
 | 
			
		||||
			case 0x1:	return new Color(0, 0, 191, alpha);
 | 
			
		||||
			case 0x2:	return new Color(0, 191, 0, alpha);
 | 
			
		||||
			case 0x3:	return new Color(0, 191, 191, alpha);
 | 
			
		||||
			case 0x4:	return new Color(191, 0, 0, alpha);
 | 
			
		||||
			case 0x5:	return new Color(191, 0, 191, alpha);
 | 
			
		||||
			case 0x6:	return new Color(191, 191, 0, alpha);
 | 
			
		||||
			case 0x7:	return new Color(191, 191, 191, alpha);
 | 
			
		||||
			case 0x8:	return new Color(64, 64, 64, alpha);
 | 
			
		||||
			case 0x9:	return new Color(64, 64, 255, alpha);
 | 
			
		||||
			case 0xA:	return new Color(64, 255, 64, alpha);
 | 
			
		||||
			case 0xB:	return new Color(64, 255, 255, alpha);
 | 
			
		||||
			case 0xC:	return new Color(255, 64, 64, alpha);
 | 
			
		||||
			case 0xD:	return new Color(255, 64, 255, alpha);
 | 
			
		||||
			case 0xE:	return new Color(255, 255, 64, alpha);
 | 
			
		||||
			case 0xF:	return new Color(255, 255, 255, alpha);
 | 
			
		||||
			default:	return new Color(0, 0, 0, alpha);
 | 
			
		||||
			case 0x1:	return SpoutFixedColor(0, 0, 191, alpha);
 | 
			
		||||
			case 0x2:	return SpoutFixedColor(0, 191, 0, alpha);
 | 
			
		||||
			case 0x3:	return SpoutFixedColor(0, 191, 191, alpha);
 | 
			
		||||
			case 0x4:	return SpoutFixedColor(191, 0, 0, alpha);
 | 
			
		||||
			case 0x5:	return SpoutFixedColor(191, 0, 191, alpha);
 | 
			
		||||
			case 0x6:	return SpoutFixedColor(191, 191, 0, alpha);
 | 
			
		||||
			case 0x7:	return SpoutFixedColor(191, 191, 191, alpha);
 | 
			
		||||
			case 0x8:	return SpoutFixedColor(64, 64, 64, alpha);
 | 
			
		||||
			case 0x9:	return SpoutFixedColor(64, 64, 255, alpha);
 | 
			
		||||
			case 0xA:	return SpoutFixedColor(64, 255, 64, alpha);
 | 
			
		||||
			case 0xB:	return SpoutFixedColor(64, 255, 255, alpha);
 | 
			
		||||
			case 0xC:	return SpoutFixedColor(255, 64, 64, alpha);
 | 
			
		||||
			case 0xD:	return SpoutFixedColor(255, 64, 255, alpha);
 | 
			
		||||
			case 0xE:	return SpoutFixedColor(255, 255, 64, alpha);
 | 
			
		||||
			case 0xF:	return SpoutFixedColor(255, 255, 255, alpha);
 | 
			
		||||
			default:	return SpoutFixedColor(0, 0, 0, alpha);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	private static Color SpoutFixedColor(int r, int g, int b, int a)
 | 
			
		||||
	{
 | 
			
		||||
		return new Color(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,8 @@ public class SpoutMainListener extends SpoutListener
 | 
			
		||||
	//-----------------------------------------------------------------------------------------//
 | 
			
		||||
 | 
			
		||||
	private transient static Map<String, GenericLabel> territoryLabels = new HashMap<String, GenericLabel>();
 | 
			
		||||
	private transient static Map<String, NoticeLabel> territoryChangeLabels = new HashMap<String, NoticeLabel>();
 | 
			
		||||
	private transient static Map<String, GenericLabel> ownerLabels = new HashMap<String, GenericLabel>();
 | 
			
		||||
	private final static int SCREEN_WIDTH = 427;
 | 
			
		||||
//	private final static int SCREEN_HEIGHT = 240;
 | 
			
		||||
 | 
			
		||||
@@ -43,47 +45,149 @@ public class SpoutMainListener extends SpoutListener
 | 
			
		||||
	public boolean updateTerritoryDisplay(FPlayer player)
 | 
			
		||||
	{
 | 
			
		||||
		SpoutPlayer sPlayer = SpoutManager.getPlayer(player.getPlayer());
 | 
			
		||||
		if (!sPlayer.isSpoutCraftEnabled() || Conf.spoutTerritoryDisplaySize <= 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (!sPlayer.isSpoutCraftEnabled() || (Conf.spoutTerritoryDisplaySize <= 0 && ! Conf.spoutTerritoryNoticeShow))
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		GenericLabel label; 
 | 
			
		||||
		if (territoryLabels.containsKey(player.getName()))
 | 
			
		||||
		{
 | 
			
		||||
			label = territoryLabels.get(player.getName());
 | 
			
		||||
		} else {
 | 
			
		||||
			label = new GenericLabel();
 | 
			
		||||
			label.setScale(Conf.spoutTerritoryDisplaySize);
 | 
			
		||||
/*			// this should work once the Spout team fix it to account for text scaling; we can then get rid of alignLabel method added below
 | 
			
		||||
			switch (Conf.spoutTerritoryDisplayPosition) {
 | 
			
		||||
				case 1: label.setAlign(WidgetAnchor.TOP_LEFT).setAnchor(WidgetAnchor.TOP_LEFT); break;
 | 
			
		||||
				case 2: label.setAlign(WidgetAnchor.TOP_CENTER).setAnchor(WidgetAnchor.TOP_CENTER); break;
 | 
			
		||||
				default: label.setAlign(WidgetAnchor.TOP_RIGHT).setAnchor(WidgetAnchor.TOP_RIGHT);
 | 
			
		||||
			}
 | 
			
		||||
 */
 | 
			
		||||
			sPlayer.getMainScreen().attachWidget(P.p, label);
 | 
			
		||||
			territoryLabels.put(player.getName(), label);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Faction factionHere = Board.getFactionAt(new FLocation(player));
 | 
			
		||||
		String msg = factionHere.getTag();
 | 
			
		||||
 | 
			
		||||
		if (Conf.spoutTerritoryDisplayShowDescription && factionHere.getDescription().length() > 0)
 | 
			
		||||
		{
 | 
			
		||||
			msg += " - "+factionHere.getDescription();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		label.setTextColor(SpoutFeatures.getSpoutColor(player.getRelationColor(factionHere), 0));
 | 
			
		||||
		label.setText(msg);
 | 
			
		||||
		alignLabel(label, msg);
 | 
			
		||||
		label.setDirty(true);
 | 
			
		||||
		doLabels(player, sPlayer);
 | 
			
		||||
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void updateOwnerList(FPlayer player)
 | 
			
		||||
	{
 | 
			
		||||
		SpoutPlayer sPlayer = SpoutManager.getPlayer(player.getPlayer());
 | 
			
		||||
		if (!sPlayer.isSpoutCraftEnabled() || (Conf.spoutTerritoryDisplaySize <= 0 && ! Conf.spoutTerritoryNoticeShow))
 | 
			
		||||
			return;
 | 
			
		||||
 | 
			
		||||
		FLocation here = new FLocation(player);
 | 
			
		||||
		Faction factionHere = Board.getFactionAt(here);
 | 
			
		||||
 | 
			
		||||
		doOwnerList(player, sPlayer, here, factionHere);
 | 
			
		||||
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void removeTerritoryLabels(String playerName)
 | 
			
		||||
	{
 | 
			
		||||
		territoryLabels.remove(playerName);
 | 
			
		||||
		territoryChangeLabels.remove(playerName);
 | 
			
		||||
		ownerLabels.remove(playerName);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	private void doLabels(FPlayer player, SpoutPlayer sPlayer)
 | 
			
		||||
	{
 | 
			
		||||
		FLocation here = new FLocation(player);
 | 
			
		||||
		Faction factionHere = Board.getFactionAt(here);
 | 
			
		||||
		String tag = factionHere.getTag(player);
 | 
			
		||||
 | 
			
		||||
		// ----------------------
 | 
			
		||||
		// Main territory display
 | 
			
		||||
		// ----------------------
 | 
			
		||||
		if (Conf.spoutTerritoryDisplayPosition > 0 && Conf.spoutTerritoryDisplaySize > 0)
 | 
			
		||||
		{
 | 
			
		||||
			GenericLabel label; 
 | 
			
		||||
			if (territoryLabels.containsKey(player.getName()))
 | 
			
		||||
				label = territoryLabels.get(player.getName());
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				label = new GenericLabel();
 | 
			
		||||
				label.setScale(Conf.spoutTerritoryDisplaySize);
 | 
			
		||||
/*				// this should work once the Spout team fix it to account for text scaling; we can then get rid of alignLabel method added below
 | 
			
		||||
				switch (Conf.spoutTerritoryDisplayPosition) {
 | 
			
		||||
					case 1: label.setAlign(WidgetAnchor.TOP_LEFT).setAnchor(WidgetAnchor.TOP_LEFT); break;
 | 
			
		||||
					case 2: label.setAlign(WidgetAnchor.TOP_CENTER).setAnchor(WidgetAnchor.TOP_CENTER); break;
 | 
			
		||||
					default: label.setAlign(WidgetAnchor.TOP_RIGHT).setAnchor(WidgetAnchor.TOP_RIGHT);
 | 
			
		||||
				}
 | 
			
		||||
 */
 | 
			
		||||
				sPlayer.getMainScreen().attachWidget(P.p, label);
 | 
			
		||||
				territoryLabels.put(player.getName(), label);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			String msg = tag;
 | 
			
		||||
 | 
			
		||||
			if (Conf.spoutTerritoryDisplayShowDescription && !factionHere.getDescription().isEmpty())
 | 
			
		||||
				msg += " - " + factionHere.getDescription();
 | 
			
		||||
 | 
			
		||||
			label.setText(msg);
 | 
			
		||||
			alignLabel(label, msg);
 | 
			
		||||
			label.setDirty(true);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// -----------------------
 | 
			
		||||
		// Fading territory notice
 | 
			
		||||
		// -----------------------
 | 
			
		||||
		if (Conf.spoutTerritoryNoticeShow && Conf.spoutTerritoryNoticeSize > 0)
 | 
			
		||||
		{
 | 
			
		||||
			NoticeLabel label; 
 | 
			
		||||
			if (territoryChangeLabels.containsKey(player.getName()))
 | 
			
		||||
				label = territoryChangeLabels.get(player.getName());
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				label = new NoticeLabel(Conf.spoutTerritoryNoticeLeaveAfterSeconds);
 | 
			
		||||
				label.setScale(Conf.spoutTerritoryNoticeSize);
 | 
			
		||||
				label.setY(Conf.spoutTerritoryNoticeTop);
 | 
			
		||||
				sPlayer.getMainScreen().attachWidget(P.p, label);
 | 
			
		||||
				territoryChangeLabels.put(player.getName(), label);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			String msg = tag;
 | 
			
		||||
 | 
			
		||||
			if (Conf.spoutTerritoryNoticeShowDescription && !factionHere.getDescription().isEmpty())
 | 
			
		||||
				msg += " - " + factionHere.getDescription();
 | 
			
		||||
 | 
			
		||||
			label.setText(msg);
 | 
			
		||||
			alignLabel(label, msg, 2);
 | 
			
		||||
			label.resetNotice();
 | 
			
		||||
			label.setDirty(true);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// and owner list, of course
 | 
			
		||||
		doOwnerList(player, sPlayer, here, factionHere);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private void doOwnerList(FPlayer player, SpoutPlayer sPlayer, FLocation here, Faction factionHere)
 | 
			
		||||
	{
 | 
			
		||||
		// ----------
 | 
			
		||||
		// Owner list
 | 
			
		||||
		// ----------
 | 
			
		||||
		if (Conf.spoutTerritoryDisplayPosition > 0 && Conf.spoutTerritoryDisplaySize > 0 && Conf.spoutTerritoryOwnersShow && Conf.ownedAreasEnabled)
 | 
			
		||||
		{
 | 
			
		||||
			GenericLabel label; 
 | 
			
		||||
			if (ownerLabels.containsKey(player.getName()))
 | 
			
		||||
				label = ownerLabels.get(player.getName());
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				label = new GenericLabel();
 | 
			
		||||
				label.setScale(Conf.spoutTerritoryDisplaySize);
 | 
			
		||||
				label.setY((int)(10 * Conf.spoutTerritoryDisplaySize));
 | 
			
		||||
				sPlayer.getMainScreen().attachWidget(P.p, label);
 | 
			
		||||
				ownerLabels.put(player.getName(), label);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			String msg = "";
 | 
			
		||||
 | 
			
		||||
			if (player.getFaction() == factionHere)
 | 
			
		||||
			{
 | 
			
		||||
				msg = factionHere.getOwnerListString(here);
 | 
			
		||||
 | 
			
		||||
				if (!msg.isEmpty())
 | 
			
		||||
					msg = Conf.ownedLandMessage + msg;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			label.setText(msg);
 | 
			
		||||
			alignLabel(label, msg);
 | 
			
		||||
			label.setDirty(true);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// this is only necessary because Spout text size scaling is currently bugged and breaks their built-in alignment methods
 | 
			
		||||
	public void alignLabel(GenericLabel label, String text)
 | 
			
		||||
	{
 | 
			
		||||
		alignLabel(label, text, Conf.spoutTerritoryDisplayPosition);
 | 
			
		||||
	}
 | 
			
		||||
	public void alignLabel(GenericLabel label, String text, int alignment)
 | 
			
		||||
	{
 | 
			
		||||
		int labelWidth = (int)((float)GenericLabel.getStringWidth(text) * Conf.spoutTerritoryDisplaySize);
 | 
			
		||||
		if (labelWidth > SCREEN_WIDTH)
 | 
			
		||||
@@ -92,7 +196,7 @@ public class SpoutMainListener extends SpoutListener
 | 
			
		||||
				return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		switch (Conf.spoutTerritoryDisplayPosition)
 | 
			
		||||
		switch (alignment)
 | 
			
		||||
		{
 | 
			
		||||
			case 1:		// left aligned
 | 
			
		||||
				label.setX(0);
 | 
			
		||||
@@ -105,8 +209,36 @@ public class SpoutMainListener extends SpoutListener
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void removeTerritoryLabel(String playerName)
 | 
			
		||||
 | 
			
		||||
	private static class NoticeLabel extends GenericLabel
 | 
			
		||||
	{
 | 
			
		||||
		territoryLabels.remove(playerName);
 | 
			
		||||
		private int initial;
 | 
			
		||||
		private int countdown;  // current delay countdown
 | 
			
		||||
 | 
			
		||||
		public NoticeLabel(float secondsOfLife)
 | 
			
		||||
		{
 | 
			
		||||
			initial = (int)(secondsOfLife * 20);
 | 
			
		||||
			resetNotice();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public final void resetNotice()
 | 
			
		||||
		{
 | 
			
		||||
			countdown = initial;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@Override
 | 
			
		||||
		public void onTick()
 | 
			
		||||
		{
 | 
			
		||||
			if (countdown <= 0)
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			this.countdown -= 1;
 | 
			
		||||
 | 
			
		||||
			if (this.countdown <= 0)
 | 
			
		||||
			{
 | 
			
		||||
				this.setText("");
 | 
			
		||||
				this.setDirty(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -201,27 +201,53 @@ public class FactionsPlayerListener extends PlayerListener
 | 
			
		||||
			Faction factionTo = Board.getFactionAt(to);
 | 
			
		||||
			Faction myFaction = me.getFaction();
 | 
			
		||||
			String ownersTo = myFaction.getOwnerListString(to);
 | 
			
		||||
			boolean spoutClient = SpoutFeatures.availableFor(player);
 | 
			
		||||
 | 
			
		||||
			if (factionFrom != factionTo)
 | 
			
		||||
			{
 | 
			
		||||
				me.sendFactionHereMessage();
 | 
			
		||||
				if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty())
 | 
			
		||||
				if
 | 
			
		||||
				(
 | 
			
		||||
					Conf.ownedAreasEnabled
 | 
			
		||||
					&&
 | 
			
		||||
					Conf.ownedMessageOnBorder
 | 
			
		||||
					&&
 | 
			
		||||
					(
 | 
			
		||||
						!spoutClient
 | 
			
		||||
						||
 | 
			
		||||
						!Conf.spoutTerritoryOwnersShow
 | 
			
		||||
					)
 | 
			
		||||
					&&
 | 
			
		||||
					myFaction == factionTo
 | 
			
		||||
					&&
 | 
			
		||||
					!ownersTo.isEmpty()
 | 
			
		||||
				)
 | 
			
		||||
				{
 | 
			
		||||
					me.sendMessage(Conf.ownedLandMessage+ownersTo);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && factionFrom == factionTo && myFaction == factionTo)
 | 
			
		||||
			else if (spoutClient && Conf.spoutTerritoryOwnersShow)
 | 
			
		||||
			{
 | 
			
		||||
				SpoutFeatures.updateOwnerList(me);
 | 
			
		||||
			}
 | 
			
		||||
			else if
 | 
			
		||||
			(
 | 
			
		||||
				Conf.ownedAreasEnabled
 | 
			
		||||
				&&
 | 
			
		||||
				Conf.ownedMessageInsideTerritory
 | 
			
		||||
				&&
 | 
			
		||||
				factionFrom == factionTo
 | 
			
		||||
				&&
 | 
			
		||||
				myFaction == factionTo
 | 
			
		||||
			)
 | 
			
		||||
			{
 | 
			
		||||
				String ownersFrom = myFaction.getOwnerListString(from);
 | 
			
		||||
				if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo))
 | 
			
		||||
				{
 | 
			
		||||
					if (!ownersTo.isEmpty())
 | 
			
		||||
					{
 | 
			
		||||
						me.sendMessage(Conf.ownedLandMessage+ownersTo);
 | 
			
		||||
					}
 | 
			
		||||
					else if (!Conf.publicLandMessage.isEmpty())
 | 
			
		||||
					{
 | 
			
		||||
						me.sendMessage(Conf.publicLandMessage);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user