Merge branch '2.9' of github.com:essentials/Essentials into 2.9

This commit is contained in:
KHobbits 2012-12-03 09:09:17 +00:00
commit d7bcf6508d
3 changed files with 13 additions and 3 deletions

View File

@ -605,6 +605,7 @@ public class Util
} }
private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)"); private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]"); private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]");
private static transient final Pattern LOGCOLOR_PATTERN = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]");
private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])"); private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-Fa-f]"); private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-Fa-f]");
private static transient final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00A7+[Kk]"); private static transient final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00A7+[Kk]");
@ -622,6 +623,15 @@ public class Util
return VANILLA_PATTERN.matcher(input).replaceAll(""); return VANILLA_PATTERN.matcher(input).replaceAll("");
} }
public static String stripLogColorFormat(final String input)
{
if (input == null)
{
return null;
}
return LOGCOLOR_PATTERN.matcher(input).replaceAll("");
}
public static String replaceFormat(final String input) public static String replaceFormat(final String input)
{ {
if (input == null) if (input == null)

View File

@ -76,7 +76,7 @@ warn-on-smite: true
# motd and rules are now configured in the files motd.txt and rules.txt # motd and rules are now configured in the files motd.txt and rules.txt
# When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take priority. # When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take priority.
# Commands in in this list, will tell Essentials to 'not give up' the command to other plugins. # Commands in this list, will tell Essentials to 'not give up' the command to other plugins.
# In this state, which plugin 'wins' appears to be almost random. # In this state, which plugin 'wins' appears to be almost random.
# #
# If you have two plugin with the same command and you wish to force Essentials to take over, you need an alias. # If you have two plugin with the same command and you wish to force Essentials to take over, you need an alias.

View File

@ -12,8 +12,8 @@ import java.util.logging.Level;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jivesoftware.smack.Roster.SubscriptionMode;
import org.jivesoftware.smack.*; import org.jivesoftware.smack.*;
import org.jivesoftware.smack.Roster.SubscriptionMode;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
@ -263,7 +263,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
for (LogRecord logRecord : copy) for (LogRecord logRecord : copy)
{ {
final String message = String.format("[" + logRecord.getLevel().getLocalizedName() + "] " + logRecord.getMessage(), logRecord.getParameters()); final String message = String.format("[" + logRecord.getLevel().getLocalizedName() + "] " + logRecord.getMessage(), logRecord.getParameters());
if (!XMPPManager.this.sendMessage(user, message)) if (!XMPPManager.this.sendMessage(user, Util.stripLogColorFormat(message)))
{ {
failedUsers.add(user); failedUsers.add(user);
break; break;