Fixed the functions that call wordWrap so they should no longer output the username multiple times.

This commit is contained in:
cerevisiae 2010-11-29 21:00:03 -06:00
parent 11dc691220
commit 38a6caae71
2 changed files with 34 additions and 38 deletions

View File

@ -272,21 +272,17 @@ public class vminecraftChat {
public static boolean quote(Player player, String message)
{
//Format the name
String playerName = "<" + nameColor(player) + Colors.White +"> ";
String playerName = Colors.White + "<" + nameColor(player)
+ Colors.White + "> ";
if(vminecraftSettings.getInstance().greentext()) {
//Log the chat
log.log(Level.INFO, "<"+player.getName()+"> "+message);
log.log(Level.INFO, "<"+player.getName()+"> " +message);
//Get the multi line array
String[] msg = wordWrap(playerName + message);
String[] msg = wordWrap(playerName + Colors.LightGreen + message);
//Output the first line
gmsg( playerName + Colors.LightGreen + 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)
//Output the lines
for(String str: msg)
gmsg(Colors.LightGreen + str);
return true;
}
@ -303,20 +299,16 @@ public class vminecraftChat {
public static boolean rage(Player player, String message)
{
//Format the name
String playerName = "<" + nameColor(player) + Colors.White +"> ";
String playerName = Colors.White + "<"
+ nameColor(player) + Colors.White +"> ";
if (vminecraftSettings.getInstance().FFF()) {
log.log(Level.INFO, "<"+player.getName()+"> "+message);
//Get the multi line array
String[] msg = wordWrap(playerName + message);
String[] msg = wordWrap(playerName + Colors.Red + message);
//Output the first line
gmsg( playerName + Colors.Red + 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)
//Output the message
for(String str: msg)
gmsg(Colors.Red + str);
return true;
}
@ -333,7 +325,8 @@ public class vminecraftChat {
public static boolean quakeColors(Player player, String message)
{
//Format the name
String playerName = "<" + nameColor(player) + Colors.White +"> ";
String playerName = Colors.White + "<"
+ nameColor(player) + Colors.White +"> ";
if(vminecraftSettings.getInstance().quakeColors() && message.length()>2) {
//Log the chat
@ -344,12 +337,8 @@ public class vminecraftChat {
//Apply colors to the lines
applyColors(msg);
//Output the first line
gmsg( playerName + 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)
//Output the message
for(String str: msg)
gmsg(str);
//Loop through the string finding the color codes and inserting them

View File

@ -203,26 +203,33 @@ public class vminecraftCommands{
{
//If the command is enabled
if(vminecraftSettings.getInstance().cmdFabulous()) {
String playerName = "<" + vminecraftChat.nameColor(player)
+ Colors.White + "> ";
//Format the name
String playerName = Colors.White + "<"
+ nameColor(player) + Colors.White +"> ";
//Make sure a message has been specified
if (args.length < 1) {return false;}
String str = " ";
//Merge the message again
str = etc.combineSplit(0, args, " ");
str = etc.combineSplit(0, args, " ");
//Output for server
log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
//Prepend the player name
//Prepend the player name and cut into lines.
String[] message = vminecraftChat.wordWrap(playerName + str);
//Output the first line
vminecraftChat.gmsg( playerName + vminecraftChat.rainbow(message[0]));
//Get the rest of the lines and display them.
String[] tempOut = new String[message.length - 1];
System.arraycopy(message, 1, tempOut, 0, tempOut.length);
for(String msg: tempOut)
vminecraftChat.gmsg(vminecraftChat.rainbow(msg));
//Output the message
for(String msg: message)
{
if (msg.contains(playerName))
vminecraftChat.gmsg(
vminecraftChat.rainbow(
msg.substring(playerName.length() - 1)));
else
vminecraftChat.gmsg(msg);
}
return true;
}