C:/Program Files (x86)/Git/f show command now displays relations to other factions.
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
				
			|||||||
package com.bukkit.mcteam.factions;
 | 
					package com.bukkit.mcteam.factions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import java.util.logging.Logger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -180,7 +181,7 @@ public class Commands {
 | 
				
			|||||||
		} else if (Conf.aliasCreate.contains(command)) {
 | 
							} else if (Conf.aliasCreate.contains(command)) {
 | 
				
			||||||
			create(me, TextUtil.implode(tokens));
 | 
								create(me, TextUtil.implode(tokens));
 | 
				
			||||||
		} else if (Conf.aliasTag.contains(command)) {
 | 
							} else if (Conf.aliasTag.contains(command)) {
 | 
				
			||||||
			name(me, TextUtil.implode(tokens));
 | 
								tag(me, TextUtil.implode(tokens));
 | 
				
			||||||
		} else if (Conf.aliasDescription.contains(command)) {
 | 
							} else if (Conf.aliasDescription.contains(command)) {
 | 
				
			||||||
			description(me, TextUtil.implode(tokens));
 | 
								description(me, TextUtil.implode(tokens));
 | 
				
			||||||
		} else if (Conf.aliasChat.contains(command)) {
 | 
							} else if (Conf.aliasChat.contains(command)) {
 | 
				
			||||||
@@ -309,7 +310,7 @@ public class Commands {
 | 
				
			|||||||
		me.sendMessage(Conf.colorCommand+Conf.aliasBase.get(0)+" "+Conf.aliasDescription.get(0)+" "+"[description]");
 | 
							me.sendMessage(Conf.colorCommand+Conf.aliasBase.get(0)+" "+Conf.aliasDescription.get(0)+" "+"[description]");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static void name(Follower me, String name) {
 | 
						public static void tag(Follower me, String tag) {
 | 
				
			||||||
		ArrayList<String> errors = new ArrayList<String>();
 | 
							ArrayList<String> errors = new ArrayList<String>();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (me.withoutFaction()) {
 | 
							if (me.withoutFaction()) {
 | 
				
			||||||
@@ -318,11 +319,11 @@ public class Commands {
 | 
				
			|||||||
			errors.add(Conf.colorSystem+"You must be moderator to rename your faction");
 | 
								errors.add(Conf.colorSystem+"You must be moderator to rename your faction");
 | 
				
			||||||
		} 
 | 
							} 
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (Faction.isTagTaken(name) && ! TextUtil.getComparisonString(name).equals(me.getFaction().getComparisonTag())) {
 | 
							if (Faction.isTagTaken(tag) && ! TextUtil.getComparisonString(tag).equals(me.getFaction().getComparisonTag())) {
 | 
				
			||||||
			errors.add(Conf.colorSystem+"That name is already taken");
 | 
								errors.add(Conf.colorSystem+"That tag is already taken");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		errors.addAll(Faction.validateTag(name));
 | 
							errors.addAll(Faction.validateTag(tag));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (errors.size() > 0) {
 | 
							if (errors.size() > 0) {
 | 
				
			||||||
			me.sendMessage(errors);
 | 
								me.sendMessage(errors);
 | 
				
			||||||
@@ -331,16 +332,16 @@ public class Commands {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		Faction myFaction = me.getFaction();
 | 
							Faction myFaction = me.getFaction();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		String oldname = myFaction.getTag();
 | 
							String oldtag = myFaction.getTag();
 | 
				
			||||||
		myFaction.setTag(name);
 | 
							myFaction.setTag(tag);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed your faction tag to "+Conf.colorMember+name);
 | 
							myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed your faction tag to "+Conf.colorMember+myFaction.getTag());
 | 
				
			||||||
		for (Faction faction : Faction.getAll()) {
 | 
							for (Faction faction : Faction.getAll()) {
 | 
				
			||||||
			if (faction.id == me.factionId) {
 | 
								if (faction.id == me.factionId) {
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			faction.sendMessage(Conf.colorSystem+"The faction "+me.getRelationColor(faction)+oldname+Conf.colorSystem+" chainged their name to "+me.getRelationColor(faction)+name);
 | 
								faction.sendMessage(Conf.colorSystem+"The faction "+me.getRelationColor(faction)+oldtag+Conf.colorSystem+" chainged their name to "+me.getRelationColor(faction)+myFaction.getTag());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -366,18 +367,46 @@ public class Commands {
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		me.sendMessage(TextUtil.titleize(faction.getTag(me)), false);
 | 
							me.sendMessage(TextUtil.titleize(faction.getTag(me)), false);
 | 
				
			||||||
		me.sendMessage(Conf.colorChrome+"Description: "+Conf.colorSystem+faction.getDescription());
 | 
							me.sendMessage(Conf.colorChrome+"Description: "+Conf.colorSystem+faction.getDescription());
 | 
				
			||||||
		if (faction.id != 0) {
 | 
							if (faction.id == 0) {
 | 
				
			||||||
			me.sendMessage(Conf.colorChrome+"Land / Power / Maxpower: "+Conf.colorSystem+ faction.getLandRounded()+" / "+faction.getPowerRounded()+" / "+faction.getPowerMaxRounded());
 | 
								return;
 | 
				
			||||||
			if(faction.getOpen()) {
 | 
					 | 
				
			||||||
				me.sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"no invitation is needed");
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				me.sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"invitation is required");
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							if(faction.getOpen()) {
 | 
				
			||||||
 | 
								me.sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"no invitation is needed");
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								me.sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"invitation is required");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							me.sendMessage(Conf.colorChrome+"Land / Power / Maxpower: "+Conf.colorSystem+ faction.getLandRounded()+" / "+faction.getPowerRounded()+" / "+faction.getPowerMaxRounded());
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
							String listpart;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// List relation
 | 
				
			||||||
 | 
							String allyList = Conf.colorChrome+"Allies: ";
 | 
				
			||||||
 | 
							String enemyList = Conf.colorChrome+"Enemies: ";
 | 
				
			||||||
 | 
							for (Faction otherFaction : Faction.getAll()) {
 | 
				
			||||||
 | 
								if (otherFaction == faction) {
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								listpart = otherFaction.getTag(me)+Conf.colorSystem+", ";
 | 
				
			||||||
 | 
								if (otherFaction.getRelation(faction) == Relation.ALLY) {
 | 
				
			||||||
 | 
									allyList += listpart;
 | 
				
			||||||
 | 
								} else if (otherFaction.getRelation(faction) == Relation.ENEMY) {
 | 
				
			||||||
 | 
									enemyList += listpart;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (allyList.endsWith(", ")) {
 | 
				
			||||||
 | 
								allyList = allyList.substring(0, allyList.length()-2);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (enemyList.endsWith(", ")) {
 | 
				
			||||||
 | 
								enemyList = enemyList.substring(0, enemyList.length()-2);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							me.sendMessage(allyList);
 | 
				
			||||||
 | 
							me.sendMessage(enemyList);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// List the members...
 | 
				
			||||||
		String onlineList = Conf.colorChrome+"Members online: ";
 | 
							String onlineList = Conf.colorChrome+"Members online: ";
 | 
				
			||||||
		String offlineList = Conf.colorChrome+"Members offline: ";
 | 
							String offlineList = Conf.colorChrome+"Members offline: ";
 | 
				
			||||||
		String listpart;
 | 
					 | 
				
			||||||
		for (Follower follower : admins) {
 | 
							for (Follower follower : admins) {
 | 
				
			||||||
			listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
 | 
								listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
 | 
				
			||||||
			if (follower.isOnline()) {
 | 
								if (follower.isOnline()) {
 | 
				
			||||||
@@ -731,8 +760,10 @@ public class Commands {
 | 
				
			|||||||
			me.sendMessage(Conf.colorSystem+"You are not part of any faction");
 | 
								me.sendMessage(Conf.colorSystem+"You are not part of any faction");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							String message = String.format(Conf.factionChatFormat, me.getNameAndRelevant(me), msg);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		me.getFaction().sendMessage(String.format(Conf.factionChatFormat, me.getNameAndRelevant(me), msg), false);
 | 
							me.getFaction().sendMessage(message, false);
 | 
				
			||||||
 | 
							Logger.getLogger("Minecraft").info("FactionChat "+me.getFaction().getTag()+": "+message);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static void version(Follower me) {
 | 
						public static void version(Follower me) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,7 @@ public class Conf {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	public static int factionTagLengthMin = 3;
 | 
						public static int factionTagLengthMin = 3;
 | 
				
			||||||
	public static int factionTagLengthMax = 3;
 | 
						public static int factionTagLengthMax = 3;
 | 
				
			||||||
 | 
						public static boolean factionTagForceUpperCase = true;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// Configuration on the Faction tag in chat messages.
 | 
						// Configuration on the Faction tag in chat messages.
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -35,7 +36,7 @@ public class Conf {
 | 
				
			|||||||
	public static boolean chatTagRelationColored = true;
 | 
						public static boolean chatTagRelationColored = true;
 | 
				
			||||||
	public static int chatTagInsertIndex = 1;
 | 
						public static int chatTagInsertIndex = 1;
 | 
				
			||||||
	public static String chatTagFormat = "%s"+ChatColor.WHITE+" ";
 | 
						public static String chatTagFormat = "%s"+ChatColor.WHITE+" ";
 | 
				
			||||||
	public static String factionChatFormat = colorMember+"%s"+ChatColor.WHITE+" %s";
 | 
						public static String factionChatFormat = "%s"+ChatColor.WHITE+" %s";
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static int mapHeight = 8;
 | 
						public static int mapHeight = 8;
 | 
				
			||||||
	public static int mapWidth = 49;
 | 
						public static int mapWidth = 49;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,10 @@ public class Faction {
 | 
				
			|||||||
		return this.getTag(otherFollower.getRelationColor(this).toString());
 | 
							return this.getTag(otherFollower.getRelationColor(this).toString());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	public void setTag(String str) {
 | 
						public void setTag(String str) {
 | 
				
			||||||
		this.tag = str.toUpperCase();
 | 
							if (Conf.factionTagForceUpperCase) {
 | 
				
			||||||
 | 
								str = str.toUpperCase();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							this.tag = str;
 | 
				
			||||||
		this.save();
 | 
							this.save();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user