Remove some start messages, better colour matching

This commit is contained in:
fullwall 2012-12-02 17:55:10 +08:00
parent d2815fe805
commit f054289f46
4 changed files with 8 additions and 12 deletions

View File

@ -189,8 +189,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
despawnNPCs();
npcRegistry = null;
}
Messaging.logTr(Messages.CITIZENS_DISABLED, getDescription().getVersion());
}
@Override
@ -225,7 +223,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
registerCommands();
enableSubPlugins();
Messaging.logTr(Messages.CITIZENS_ENABLED, getDescription().getVersion());
// Setup NPCs after all plugins have been enabled (allows for multiworld
// support and for NPCs to properly register external settings)
@ -337,7 +334,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
traitFactory.addPlotters(metrics.createGraph("traits"));
metrics.start();
Messaging.logTr(Messages.METRICS_NOTIFICATION);
} catch (IOException e) {
Messaging.logTr(Messages.METRICS_ERROR_NOTIFICATION, e.getMessage());
}

View File

@ -20,8 +20,6 @@ public class Messages {
public static final String BEHAVIOURS_ADDED = "citizens.commands.npc.behaviour.added";
public static final String BEHAVIOURS_REMOVED = "citizens.commands.npc.behaviour.removed";
public static final String CHAT_TRIGGER_PROMPT = "citizens.editors.waypoints.triggers.chat.prompt";
public static final String CITIZENS_DISABLED = "citizens.notifications.disabled";
public static final String CITIZENS_ENABLED = "citizens.notifications.enabled";
public static final String CITIZENS_IMPLEMENTATION_DISABLED = "citizens.changed-implementation";
public static final String CITIZENS_INCOMPATIBLE = "citizens.notifications.incompatible-version";
public static final String CITIZENS_INVALID_COMMAND_CLASS = "citizens.commands.invalid.class";
@ -102,7 +100,6 @@ public class Messages {
public static final String LOOKCLOSE_SET = "citizens.commands.npc.lookclose.set";
public static final String LOOKCLOSE_STOPPED = "citizens.commands.npc.lookclose.stopped";
public static final String METRICS_ERROR_NOTIFICATION = "citizens.notifications.metrics-load-error";
public static final String METRICS_NOTIFICATION = "citizens.notifications.metrics-started";
public static final String MINIMUM_COST_REQUIRED = "citizens.economy.minimum-cost-required";
public static final String MISSING_TRANSLATIONS = "citizens.notifications.missing-translations";
public static final String MOBTYPE_CANNOT_BE_AGED = "citizens.commands.npc.age.cannot-be-aged";

View File

@ -1,5 +1,6 @@
package net.citizensnpcs.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.citizensnpcs.Settings.Setting;
@ -65,9 +66,14 @@ public class StringHelper {
}
public static String parseColors(String parsed) {
return COLOR_MATCHER.matcher(parsed).replaceAll(ChatColor.COLOR_CHAR + "$1");
Matcher matcher = COLOR_MATCHER.matcher(parsed);
String replace = matcher.group(1) != null ? GROUP_1 : GROUP_2;
return matcher.replaceAll(replace);
}
private static String GROUP_1 = ChatColor.COLOR_CHAR + "$1";
private static String GROUP_2 = ChatColor.COLOR_CHAR + "$2";
public static String wrap(Object string) {
return wrap(string, parseColors(Setting.MESSAGE_COLOUR.asString()));
}
@ -89,7 +95,7 @@ public class StringHelper {
String colors = "";
for (ChatColor color : ChatColor.values())
colors += color.getChar();
COLOR_MATCHER = Pattern.compile("[&<]([COLORS])[>]?".replace("COLORS", colors),
COLOR_MATCHER = Pattern.compile("&([COLORS])|<([COLORS])>".replace("COLORS", colors),
Pattern.CASE_INSENSITIVE);
}
}

View File

@ -179,14 +179,11 @@ citizens.nms-errors.updating-land-modifier=Could not update land speed modifier:
citizens.nms-errors.updating-navigation-world=Could not update navigation world: {0}.
citizens.nms-errors.updating-pathfinding-range=Could not update pathfinding range: {0}.
citizens.notifications.database-connection-failed=Unable to connect to database, falling back to YAML
citizens.notifications.disabled=v{0} disabled.
citizens.notifications.enabled=v{0} enabled.
citizens.notifications.error-reloading=Error occured while reloading, see console.
citizens.notifications.exception-updating-npc=Exception while updating {0}: {1}.
citizens.notifications.incompatible-version=v{0} is not compatible with Minecraft v{1}. Disabling.
citizens.notifications.locale=Using locale {0}.
citizens.notifications.metrics-load-error=Unable to start metrics: {0}.
citizens.notifications.metrics-started=Metrics started.
citizens.notifications.missing-translations=Missing translations file for locale {0}. Defaulting to en locale.
citizens.notifications.npc-name-not-found=Could not find a name for ID {0}.
citizens.notifications.npc-not-found=No NPC could be found.