Explorar o código

Added prefix coloring. To get it to work the first character has to be the color you want your name to be followed by your prefix colored as you would any other quake colored line of text.

cerevisiae %!s(int64=14) %!d(string=hai) anos
pai
achega
724db6eab4
Modificáronse 2 ficheiros con 7 adicións e 10 borrados
  1. 5 8
      vminecraftChat.java
  2. 2 2
      vminecraftCommands.java

+ 5 - 8
vminecraftChat.java

@@ -128,7 +128,9 @@ public class vminecraftChat {
 	//Use:		Returns the colored name;
 	//Use:		Returns the colored name;
 	//=====================================================================
 	//=====================================================================
     public static String nameColor(Player player){
     public static String nameColor(Player player){
-        return player.getColor() + player.getName();
+    	String[] playerPrefix = new String[]{player.getPrefix()};
+        return applyColors(playerPrefix)[0].substring(3)
+        		+ player.getColor().substring(0,2) + player.getName();
     }
     }
     
     
 	//=====================================================================
 	//=====================================================================
@@ -243,12 +245,7 @@ public class vminecraftChat {
 					if (p.isAdmin() || (p.canUseCommand("/adminchat"))) {
 					if (p.isAdmin() || (p.canUseCommand("/adminchat"))) {
 
 
 						//Output the first line
 						//Output the first line
-						p.sendMessage(adminchat + msg[0]);
-						
-						//Get the rest of the lines and display them.
-						String[] tempOut = new String[msg.length - 1];
-						System.arraycopy(msg, 1, tempOut, 0, tempOut.length);
-						for(String str: tempOut)
+						for(String str: msg)
 							p.sendMessage(str);
 							p.sendMessage(str);
 					}
 					}
 				}
 				}
@@ -327,7 +324,7 @@ public class vminecraftChat {
 		//Format the name
 		//Format the name
 		String playerName = Colors.White + "<"
 		String playerName = Colors.White + "<"
 		+ nameColor(player) + Colors.White +"> ";
 		+ nameColor(player) + Colors.White +"> ";
-		if(vminecraftSettings.getInstance().quakeColors() && message.length()>2) {
+		if(vminecraftSettings.getInstance().quakeColors()) {
 
 
 			//Log the chat
 			//Log the chat
 			log.log(Level.INFO, "<"+player.getName()+"> "+message);
 			log.log(Level.INFO, "<"+player.getName()+"> "+message);

+ 2 - 2
vminecraftCommands.java

@@ -224,8 +224,8 @@ public class vminecraftCommands{
 			for(String msg: message)
 			for(String msg: message)
 			{
 			{
 				if (msg.contains(playerName))
 				if (msg.contains(playerName))
-					vminecraftChat.gmsg(
-							vminecraftChat.rainbow(
+					vminecraftChat.gmsg( playerName
+							+ vminecraftChat.rainbow(
 									msg.substring(playerName.length() - 1)));
 									msg.substring(playerName.length() - 1)));
 				else
 				else
 					vminecraftChat.gmsg(msg);
 					vminecraftChat.gmsg(msg);