Browse Source

Redoing vMinecraftChat.getName()

cerevisiae 14 years ago
parent
commit
56c0805fca
3 changed files with 47 additions and 8 deletions
  1. 13 7
      vMinecraftChat.java
  2. 2 1
      vMinecraftCommands.java
  3. 32 0
      vMinecraftUsers.java

+ 13 - 7
vMinecraftChat.java

@@ -212,18 +212,24 @@ public class vMinecraftChat {
 	//=====================================================================
     public static String getName(Player player){
     	
-    	//Get the prefix
-    	String playerPrefix = player.getPrefix();
+    	//Add the nickname or the name if there is none
+    	String output = vMinecraftUsers.getProfile(player).getNick();
     	
-    	//Add the name
-    	String output = player.getName();
+    	if(output.isEmpty())
+    		output = player.getName();
     	
     	//Add the color if there is one
     	if(player.getColor() != null && player.getColor() != "")
     		output = player.getColor().substring(0,2) + output;
+    	
     	//Add the tag if there is one
-    	if(playerPrefix != null && !playerPrefix.isEmpty())
-    		output = applyColors(playerPrefix.substring(1)) + output;
+    	output = vMinecraftUsers.getProfile(player).getTag() + output;
+    	
+    	//Add the suffix if there is one
+    	output += vMinecraftUsers.getProfile(player).getSuffix();
+    	
+    	/*if(playerPrefix != null && !playerPrefix.isEmpty())
+    		output = applyColors(playerPrefix.substring(1)) + output;*/
     	
     	//Return the name
         return output;
@@ -565,4 +571,4 @@ public class vMinecraftChat {
 		}
 		return message;
 	}
-}
+}

+ 2 - 1
vMinecraftCommands.java

@@ -170,7 +170,8 @@ public class vMinecraftCommands{
         		.globalmessages());
         return EXIT_SUCCESS;
     }
-        //=====================================================================
+    
+    //=====================================================================
 	//Function:	prefix (/prefix)
 	//Input:	Player player: The player using the command
 	//Output:	int: Exit Code

+ 32 - 0
vMinecraftUsers.java

@@ -397,6 +397,38 @@ class PlayerList
 		//=====================================================================
 		public String getTag() { return tag; }
 
+		//=====================================================================
+		//Function:	setNick
+		//Input:	String newTag: The nickname to set for the player
+		//Output:	None
+		//Use:		Sets a player nickname
+		//=====================================================================
+		public void setNick(String newNick){ nickName = newNick; }
+
+		//=====================================================================
+		//Function:	getNick
+		//Input:	None
+		//Output:	String: The player nickname
+		//Use:		Gets a player nickname
+		//=====================================================================
+		public String getNick() { return nickName; }
+
+		//=====================================================================
+		//Function:	setSuffix
+		//Input:	String newTag: The suffix to set for the player
+		//Output:	None
+		//Use:		Sets a player suffix
+		//=====================================================================
+		public void setSuffix(String newSuffix){ suffix = newSuffix; }
+
+		//=====================================================================
+		//Function:	getSuffix
+		//Input:	None
+		//Output:	String: The player suffix
+		//Use:		Gets a player suffix
+		//=====================================================================
+		public String getSuffix() { return suffix; }
+
 		//=====================================================================
 		//Function:	setMessage
 		//Input:	String newName: The name of the player they last messaged