Nearly all strings translated

This commit is contained in:
fullwall 2012-10-04 14:58:35 +08:00
parent 9f5d99904f
commit 960ff74fae
25 changed files with 429 additions and 308 deletions

View File

@ -4,10 +4,8 @@ import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.event.PlayerCreateNPCEvent;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -36,7 +34,6 @@ public class PaymentListener implements Listener {
return;
}
provider.withdrawPlayer(name, cost);
String message = Messaging.tr(Messages.MONEY_WITHDRAWN, StringHelper.wrap(formattedCost));
Messaging.send(event.getCreator(), ChatColor.GREEN + message);
Messaging.sendTr(event.getCreator(), Messages.MONEY_WITHDRAWN, formattedCost);
}
}

View File

@ -70,9 +70,11 @@ public class Settings {
value = list;
}
},
HIGHLIGHT_COLOUR("general.colour-scheme.message-highlight", "<e>"),
LOCALE("general.translation.locale", "en"),
MAX_NPC_LIMIT_CHECKS("npc.limits.max-permission-checks", 100),
MAX_SPEED("npc.limits.max-speed", 100),
MESSAGE_COLOUR("general.color-scheme.message", "<a>"),
NPC_COST("economy.npc.cost", 100D),
QUICK_SELECT("npc.selection.quick-select", false),
REMOVE_PLAYERS_FROM_PLAYER_LIST("npc.player.remove-from-list", true),

View File

@ -155,7 +155,7 @@ public class CommandManager {
EntityType type = npc.getTrait(MobType.class).getType();
if (!types.contains(type)) {
throw new RequirementMissingException(Messaging.tr(Messages.COMMAND_INVALID_MOB_TYPE,
throw new RequirementMissingException(Messaging.tr(Messages.COMMAND_REQUIREMENTS_INVALID_MOB_TYPE,
type.getName()));
}
}

View File

@ -7,6 +7,7 @@ import net.citizensnpcs.command.Command;
import net.citizensnpcs.command.CommandContext;
import net.citizensnpcs.command.Requirements;
import net.citizensnpcs.command.exception.CommandException;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
@ -40,13 +41,13 @@ public class AdminCommands {
max = 1,
permission = "admin")
public void reload(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
Messaging.send(sender, "<e>Reloading Citizens...");
Messaging.sendTr(sender, Messages.CITIZENS_RELOADING);
try {
plugin.reload();
Messaging.send(sender, "<e>Citizens reloaded.");
Messaging.sendTr(sender, Messages.CITIZENS_RELOADED);
} catch (NPCLoadException ex) {
ex.printStackTrace();
throw new CommandException("Error occured while reloading, see console.");
throw new CommandException(Messages.CITIZENS_RELOAD_ERROR);
}
}
@ -60,8 +61,8 @@ public class AdminCommands {
flags = "a",
permission = "admin")
public void save(CommandContext args, CommandSender sender, NPC npc) {
Messaging.send(sender, "<e>Saving Citizens...");
Messaging.sendTr(sender, Messages.CITIZENS_SAVING);
plugin.storeNPCs(args);
Messaging.send(sender, "<e>Citizens saved.");
Messaging.sendTr(sender, Messages.CITIZENS_SAVED);
}
}

View File

@ -6,13 +6,15 @@ import java.util.Set;
import net.citizensnpcs.Citizens;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.trait.trait.Owner;
import net.citizensnpcs.command.Command;
import net.citizensnpcs.command.CommandContext;
import net.citizensnpcs.command.CommandManager.CommandInfo;
import net.citizensnpcs.command.Requirements;
import net.citizensnpcs.command.exception.CommandException;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.Paginator;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.command.CommandSender;
@ -37,14 +39,10 @@ public class HelpCommands {
@Requirements
public void citizensHelp(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
Paginator paginator = new Paginator().header("Citizens Help");
for (String line : getLines(sender, npc, "citizens"))
paginator.addLine(line);
if (!paginator.sendPage(sender, page))
throw new CommandException("The page '" + page + "' does not exist.");
sendHelp(sender, "citizens", page);
}
private List<String> getLines(CommandSender sender, NPC npc, String baseCommand) {
private List<String> getLines(CommandSender sender, String baseCommand) {
// Ensures that commands with multiple modifiers are only added once
Set<CommandInfo> processed = Sets.newHashSet();
List<String> lines = new ArrayList<String>();
@ -54,13 +52,9 @@ public class HelpCommands {
|| (!sender.hasPermission("citizens.admin") && !sender.hasPermission("citizens."
+ command.permission())))
continue;
Requirements requirements = info.getRequirements();
if (requirements != null && npc != null) {
if (requirements.ownership() && !npc.getTrait(Owner.class).isOwnedBy(sender))
continue;
}
lines.add("<7>/<c>" + command.aliases()[0]
+ (command.usage().isEmpty() ? "" : " " + command.usage()) + " <7>- <e>" + command.desc());
+ (command.usage().isEmpty() ? "" : " " + command.usage()) + " <7>- <e>"
+ Messaging.tryTranslate(command.desc()));
if (command.modifiers().length > 1)
processed.add(info);
}
@ -78,11 +72,7 @@ public class HelpCommands {
@Requirements
public void npcHelp(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
Paginator paginator = new Paginator().header("NPC Help");
for (String line : getLines(sender, npc, "npc"))
paginator.addLine(line);
if (!paginator.sendPage(sender, page))
throw new CommandException("The page '" + page + "' does not exist.");
sendHelp(sender, "NPC", page);
}
@Command(
@ -96,11 +86,16 @@ public class HelpCommands {
@Requirements
public void scriptHelp(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
Paginator paginator = new Paginator().header("Script Help");
for (String line : getLines(sender, npc, "script"))
sendHelp(sender, "script", page);
}
private void sendHelp(CommandSender sender, String name, int page) throws CommandException {
Paginator paginator = new Paginator().header(StringHelper.capitalize(name)
+ Messaging.tr(Messages.COMMAND_HELP_HEADER));
for (String line : getLines(sender, name.toLowerCase()))
paginator.addLine(line);
if (!paginator.sendPage(sender, page))
throw new CommandException("The page '" + page + "' does not exist.");
throw new CommandException(Messages.COMMAND_PAGE_MISSING, page);
}
@Command(
@ -114,11 +109,7 @@ public class HelpCommands {
@Requirements
public void templatesHelp(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
Paginator paginator = new Paginator().header("Templates Help");
for (String line : getLines(sender, npc, "templates"))
paginator.addLine(line);
if (!paginator.sendPage(sender, page))
throw new CommandException("The page '" + page + "' does not exist.");
sendHelp(sender, "templates", page);
}
@Command(
@ -132,10 +123,6 @@ public class HelpCommands {
@Requirements
public void waypointsHelp(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
Paginator paginator = new Paginator().header("Waypoints Help");
for (String line : getLines(sender, npc, "waypoints"))
paginator.addLine(line);
if (!paginator.sendPage(sender, page))
throw new CommandException("The page '" + page + "' does not exist.");
sendHelp(sender, "waypoints", page);
}
}

View File

@ -32,6 +32,7 @@ import net.citizensnpcs.trait.LookClose;
import net.citizensnpcs.trait.Poses;
import net.citizensnpcs.trait.Powered;
import net.citizensnpcs.trait.VillagerProfession;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.Paginator;
import net.citizensnpcs.util.Pose;
@ -39,7 +40,6 @@ import net.citizensnpcs.util.StringHelper;
import net.citizensnpcs.util.Util;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@ -88,18 +88,18 @@ public class NPCCommands {
try {
age = args.getInteger(1);
if (age < -24000 || age > 0)
throw new CommandException("Invalid age. Valid: adult, baby, number between -24000 and 0");
throw new CommandException(Messages.INVALID_AGE);
ageStr = "age " + StringHelper.wrap(age);
} catch (NumberFormatException ex) {
if (args.getString(1).equalsIgnoreCase("baby")) {
age = -24000;
ageStr = "a baby";
} else if (!args.getString(1).equalsIgnoreCase("adult"))
throw new CommandException("Invalid age. Valid: adult, baby, number between -24000 and 0");
throw new CommandException(Messages.INVALID_AGE);
}
trait.setAge(age);
Messaging.sendF(sender, StringHelper.wrap(npc.getName()) + " is now %s.", ageStr);
Messaging.sendTr(sender, Messages.AGE_SET, npc.getName(), ageStr);
} else if (!toggleLock)
trait.describe(sender);
}
@ -116,10 +116,10 @@ public class NPCCommands {
Iterable<String> files = Splitter.on(',').split(args.getJoinedStrings(1, ','));
if (args.hasFlag('r')) {
npc.getTrait(Behaviour.class).removeScripts(files);
sender.sendMessage(ChatColor.GREEN + "Behaviours removed.");
Messaging.sendTr(sender, Messages.BEHAVIOURS_REMOVED);
} else {
npc.getTrait(Behaviour.class).addScripts(files);
sender.sendMessage(ChatColor.GREEN + "Behaviours added.");
Messaging.sendTr(sender, Messages.BEHAVIOURS_ADDED);
}
}
@ -133,11 +133,8 @@ public class NPCCommands {
permission = "npc.controllable")
public void controllable(CommandContext args, CommandSender sender, NPC npc) {
boolean enabled = npc.getTrait(Controllable.class).toggle();
if (enabled) {
Messaging.send(sender, StringHelper.wrap(npc.getName()) + " can now be controlled.");
} else {
Messaging.send(sender, StringHelper.wrap(npc.getName()) + " can no longer be controlled.");
}
String key = enabled ? Messages.CONTROLLABLE_SET : Messages.CONTROLLABLE_REMOVED;
Messaging.sendTr(sender, key);
}
@Command(
@ -164,7 +161,7 @@ public class NPCCommands {
copy.getTrait(CurrentLocation.class).setLocation(player.getLocation());
}
Messaging.sendF(sender, ChatColor.GREEN + "%s has been copied.", StringHelper.wrap(npc.getName()));
Messaging.sendTr(sender, Messages.NPC_COPIED, npc.getName());
selector.select(sender, npc);
}
@ -180,8 +177,7 @@ public class NPCCommands {
public void create(CommandContext args, final Player player, NPC npc) throws CommandException {
String name = StringHelper.parseColors(args.getJoinedStrings(1));
if (name.length() > 16) {
Messaging.sendError(player,
"NPC names cannot be longer than 16 characters. The name has been shortened.");
Messaging.sendErrorTr(player, Messages.NPC_NAME_TOO_LONG);
name = name.substring(0, 15);
}
EntityType type = EntityType.PLAYER;
@ -189,24 +185,22 @@ public class NPCCommands {
String inputType = args.getFlag("type");
type = Util.matchEntityType(inputType);
if (type == null) {
Messaging.sendError(player, "'" + inputType
+ "' is not a valid mob type. Using default type.");
Messaging.sendErrorTr(player, Messages.NPC_CREATE_INVALID_MOBTYPE, inputType);
type = EntityType.PLAYER;
} else if (!LivingEntity.class.isAssignableFrom(type.getEntityClass())) {
Messaging.sendError(player, "'%s' is not a living entity type. Using default type.");
Messaging.sendErrorTr(player, Messages.NOT_LIVING_MOBTYPE, type);
type = EntityType.PLAYER;
}
}
npc = npcRegistry.createNPC(type, name);
String msg = ChatColor.GREEN + "You created " + StringHelper.wrap(npc.getName())
+ " at your location";
String msg = "You created " + StringHelper.wrap(npc.getName()) + " at your location";
int age = 0;
if (args.hasFlag('b')) {
if (!Ageable.class.isAssignableFrom(type.getEntityClass()))
Messaging.sendError(player, "The mob type '" + type.name().toLowerCase().replace("_", "-")
+ "' cannot be aged.");
Messaging.sendErrorTr(player, Messages.MOBTYPE_CANNOT_BE_AGED, type.name().toLowerCase()
.replace("_", "-"));
else {
age = -24000;
msg += " as a baby";
@ -287,14 +281,15 @@ public class NPCCommands {
public void despawn(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
if (npc == null || args.argsLength() == 2) {
if (args.argsLength() < 2)
throw new CommandException("No NPC selected.");
npc = CitizensAPI.getNPCRegistry().getById(args.getInteger(1));
throw new CommandException(Messages.COMMAND_MUST_HAVE_SELECTED);
int id = args.getInteger(1);
npc = CitizensAPI.getNPCRegistry().getById(id);
if (npc == null)
throw new CommandException("No NPC found with that ID.");
throw new CommandException(Messages.NO_NPC_WITH_ID_FOUND, id);
}
npc.getTrait(Spawned.class).setSpawned(false);
npc.despawn();
Messaging.send(sender, ChatColor.GREEN + "You despawned " + StringHelper.wrap(npc.getName()) + ".");
Messaging.sendTr(sender, Messages.NPC_DESPAWNED, npc.getName());
}
@Command(
@ -331,7 +326,7 @@ public class NPCCommands {
EntityType type = Util.matchEntityType(args.getFlag("type"));
if (type == null)
throw new CommandException("'" + type + "' is not a valid mob type.");
throw new CommandException(Messages.COMMAND_INVALID_MOBTYPE, type);
for (NPC add : npcRegistry) {
if (!npcs.contains(add) && add.getTrait(MobType.class).getType() == type)
@ -351,7 +346,7 @@ public class NPCCommands {
int page = args.getInteger(1, 1);
if (!paginator.sendPage(sender, page))
throw new CommandException("The page '" + page + "' does not exist.");
throw new CommandException(Messages.COMMAND_PAGE_MISSING);
}
@Command(
@ -379,12 +374,12 @@ public class NPCCommands {
public void mount(CommandContext args, Player player, NPC npc) {
boolean enabled = npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled();
if (!enabled) {
Messaging.send(player, StringHelper.wrap(npc.getName()) + " is not controllable.");
Messaging.sendTr(player, Messages.NPC_NOT_CONTROLLABLE, npc.getName());
return;
}
boolean success = npc.getTrait(Controllable.class).mount(player);
if (!success)
Messaging.sendF(player, ChatColor.GREEN + "Couldn't mount %s.", StringHelper.wrap(npc.getName()));
Messaging.sendTr(player, Messages.FAILED_TO_MOUNT_NPC, npc.getName());
}
@Command(
@ -458,16 +453,17 @@ public class NPCCommands {
max = 2,
permission = "npc.owner")
public void owner(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
Owner ownerTrait = npc.getTrait(Owner.class);
if (args.argsLength() == 1) {
Messaging.send(sender, StringHelper.wrap(npc.getName() + "'s Owner: ")
+ npc.getTrait(Owner.class).getOwner());
Messaging.sendTr(sender, Messages.NPC_OWNER, npc.getName(), ownerTrait.getOwner());
return;
}
String name = args.getString(1);
if (npc.getTrait(Owner.class).isOwnedBy(name))
throw new CommandException("'" + name + "' is already the owner of " + npc.getName() + ".");
npc.getTrait(Owner.class).setOwner(name);
Messaging.send(sender, (name.equalsIgnoreCase("server") ? "<a>The server" : StringHelper.wrap(name))
if (ownerTrait.isOwnedBy(name))
throw new CommandException(Messages.ALREADY_OWNER, name, npc.getName());
ownerTrait.setOwner(name);
boolean serverOwner = name.equalsIgnoreCase(Owner.SERVER);
Messaging.send(sender, (serverOwner ? "[[The server]]" : StringHelper.wrap(name))
+ " is now the owner of " + StringHelper.wrap(npc.getName()) + ".");
}
@ -485,30 +481,30 @@ public class NPCCommands {
Poses trait = npc.getTrait(Poses.class);
if (args.hasValueFlag("save")) {
if (args.getFlag("save").isEmpty())
throw new CommandException("Invalid name.");
throw new CommandException(Messages.INVALID_POSE_NAME);
if (!(sender instanceof Player))
throw new ServerCommandException();
if (trait.addPose(args.getFlag("save"), ((Player) sender).getLocation())) {
Messaging.sendF(sender, ChatColor.GREEN + "Pose added.");
Messaging.sendTr(sender, Messages.POSE_ADDED);
} else
throw new CommandException("The pose '" + args.getFlag("load") + "' already exists.");
throw new CommandException(Messages.POSE_ALREADY_EXISTS, args.getFlag("load"));
} else if (args.hasValueFlag("load")) {
if (args.getFlag("load").isEmpty())
throw new CommandException("Invalid name.");
throw new CommandException(Messages.INVALID_POSE_NAME);
Pose pose = trait.getPose(args.getFlag("load"));
if (pose == null)
throw new CommandException("The pose '" + args.getFlag("load") + "' does not exist.");
throw new CommandException(Messages.POSE_MISSING, args.getFlag("load"));
trait.assumePose(pose);
} else if (args.hasValueFlag("remove")) {
if (args.getFlag("remove").isEmpty())
throw new CommandException("Invalid name.");
throw new CommandException(Messages.INVALID_POSE_NAME);
if (trait.removePose(trait.getPose(args.getFlag("remove"))))
Messaging.sendF(sender, ChatColor.GREEN + "Position removed.");
Messaging.sendTr(sender, Messages.POSE_REMOVED);
else
throw new CommandException("The pose '" + args.getFlag("remove") + "' does not exist.");
throw new CommandException(Messages.POSE_MISSING, args.getFlag("remove"));
} else if (!args.hasFlag('a')) {
Paginator paginator = new Paginator().header("Pose");
paginator.addLine("<e>Key: <a>ID <b>Name <c>Pitch/Yaw");
@ -520,7 +516,7 @@ public class NPCCommands {
int page = args.getInteger(1, 1);
if (!paginator.sendPage(sender, page))
throw new CommandException("The page '" + page + "' does not exist.");
throw new CommandException(Messages.COMMAND_PAGE_MISSING);
}
// Assume Player's pose
@ -563,11 +559,10 @@ public class NPCCommands {
try {
parsed = Profession.valueOf(profession.toUpperCase());
} catch (IllegalArgumentException ex) {
throw new CommandException("'" + profession + "' is not a valid profession.");
throw new CommandException(Messages.INVALID_PROFESSION);
}
npc.getTrait(VillagerProfession.class).setProfession(parsed);
Messaging.send(sender,
StringHelper.wrap(npc.getName()) + " is now a " + StringHelper.wrap(profession) + ".");
Messaging.sendTr(sender, Messages.PROFESSION_SET, npc.getName(), profession);
}
@Command(aliases = { "npc" }, usage = "remove|rem (all)", desc = "Remove a NPC", modifiers = { "remove",
@ -580,20 +575,20 @@ public class NPCCommands {
if (!sender.hasPermission("citizens.npc.remove.all") && !sender.hasPermission("citizens.admin"))
throw new NoPermissionsException();
npcRegistry.deregisterAll();
Messaging.send(sender, "<a>You permanently removed all NPCs.");
Messaging.sendTr(sender, Messages.REMOVED_ALL_NPCS);
return;
}
if (!(sender instanceof Player))
throw new CommandException("You must be ingame to use this command");
throw new CommandException(Messages.COMMAND_MUST_BE_INGAME);
Player player = (Player) sender;
if (npc == null)
throw new CommandException("You must have an NPC selected to execute that command.");
throw new CommandException(Messages.COMMAND_MUST_HAVE_SELECTED);
if (!npc.getTrait(Owner.class).isOwnedBy(player))
throw new CommandException("You must be the owner of this NPC to execute that command.");
throw new CommandException(Messages.COMMAND_MUST_BE_OWNER);
if (!player.hasPermission("citizens.npc.remove") && !player.hasPermission("citizens.admin"))
throw new NoPermissionsException();
npc.destroy();
Messaging.send(player, "<a>You permanently removed " + StringHelper.wrap(npc.getName()) + ".");
Messaging.sendTr(player, Messages.NPC_REMOVED, npc.getName());
}
@Command(
@ -607,14 +602,11 @@ public class NPCCommands {
String oldName = npc.getName();
String newName = args.getJoinedStrings(1);
if (newName.length() > 16) {
Messaging.sendError(sender,
"NPC names cannot be longer than 16 characters. The name has been shortened.");
Messaging.sendErrorTr(sender, Messages.NPC_NAME_TOO_LONG);
newName = newName.substring(0, 15);
}
npc.setName(newName);
String msg = String.format("You renamed %s to %s.", StringHelper.wrap(oldName),
StringHelper.wrap(newName));
Messaging.send(sender, ChatColor.GREEN + msg);
Messaging.sendTr(sender, Messages.NPC_RENAMED, oldName, newName);
}
@Command(
@ -643,9 +635,9 @@ public class NPCCommands {
} else
toSelect = npcRegistry.getById(args.getInteger(1));
if (toSelect == null || !toSelect.getTrait(Spawned.class).shouldSpawn())
throw new CommandException("No NPC could be found.");
throw new CommandException(Messages.NPC_NOT_FOUND);
if (npc != null && toSelect.getId() == npc.getId())
throw new CommandException("You already have that NPC selected.");
throw new CommandException(Messages.NPC_ALREADY_SELECTED);
selector.select(sender, toSelect);
Messaging.sendWithNPC(sender, Setting.SELECTION_MESSAGE.asString(), toSelect);
}
@ -662,22 +654,20 @@ public class NPCCommands {
public void spawn(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
NPC respawn = npcRegistry.getById(args.getInteger(1));
if (respawn == null)
throw new CommandException("No NPC with the ID '" + args.getInteger(1) + "' exists.");
throw new CommandException(Messages.NO_NPC_WITH_ID_FOUND, args.getInteger(1));
if (respawn.isSpawned())
throw new CommandException(respawn.getName() + " is already spawned at another location."
+ " Use '/npc tphere' to teleport the NPC to your location.");
throw new CommandException(Messages.NPC_ALREADY_SPAWNED, respawn.getName());
Location location = respawn.getTrait(CurrentLocation.class).getLocation();
if (location == null) {
if (sender instanceof Player)
location = ((Player) sender).getLocation();
else
throw new CommandException("No stored location available - command must be used ingame.");
if (!(sender instanceof Player))
throw new CommandException(Messages.NO_STORED_SPAWN_LOCATION);
location = ((Player) sender).getLocation();
}
if (respawn.spawn(location)) {
selector.select(sender, respawn);
Messaging.send(sender, ChatColor.GREEN + "You spawned " + StringHelper.wrap(respawn.getName())
+ ".");
Messaging.sendTr(sender, Messages.NPC_SPAWNED, respawn.getName());
}
}
@ -692,11 +682,10 @@ public class NPCCommands {
public void speed(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
float newSpeed = (float) Math.abs(args.getDouble(1));
if (newSpeed >= Setting.MAX_SPEED.asDouble())
throw new CommandException("Speed is above the limit.");
throw new CommandException(Messages.SPEED_MODIFIER_ABOVE_LIMIT);
npc.getNavigator().getDefaultParameters().speedModifier(newSpeed);
Messaging.sendF(sender, ChatColor.GREEN + "NPC speed modifier set to %s.",
StringHelper.wrap(newSpeed));
Messaging.sendTr(sender, Messages.SPEED_MODIFIER_SET, newSpeed);
}
@Command(
@ -712,8 +701,7 @@ public class NPCCommands {
if (!npc.isSpawned())
npc.spawn(npc.getTrait(CurrentLocation.class).getLocation());
player.teleport(npc.getBukkitEntity(), TeleportCause.COMMAND);
Messaging.send(player, ChatColor.GREEN + "You teleported to " + StringHelper.wrap(npc.getName())
+ ".");
Messaging.sendTr(player, Messages.TELEPORTED_TO_NPC);
}
@Command(aliases = { "npc" }, usage = "tphere", desc = "Teleport a NPC to your location", modifiers = {
@ -723,7 +711,7 @@ public class NPCCommands {
if (!npc.isSpawned())
npc.spawn(npc.getTrait(CurrentLocation.class).getLocation());
npc.getBukkitEntity().teleport(player, TeleportCause.COMMAND);
Messaging.send(player, StringHelper.wrap(npc.getName()) + " was teleported to your location.");
Messaging.sendTr(player, Messages.NPC_TELEPORTED, npc.getName());
}
@Command(
@ -741,8 +729,7 @@ public class NPCCommands {
npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, !vulnerable);
else
npc.data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, !vulnerable);
Messaging.sendF(sender, ChatColor.GREEN + "%s is %s vulnerable.", StringHelper.wrap(npc.getName()),
vulnerable ? "now" : "no longer");
String key = vulnerable ? Messages.VULNERABLE_SET : Messages.VULNERABLE_STOPPED;
Messaging.sendTr(sender, key, npc.getName());
}
}

View File

@ -11,6 +11,7 @@ import net.citizensnpcs.api.scripting.ScriptFactory;
import net.citizensnpcs.command.Command;
import net.citizensnpcs.command.CommandContext;
import net.citizensnpcs.command.exception.CommandException;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import org.bukkit.command.CommandSender;
@ -33,7 +34,7 @@ public class ScriptCommands {
throws CommandException {
File file = new File(CitizensAPI.getScriptFolder(), args.getString(1));
if (!file.exists())
throw new CommandException("The file '" + args.getString(1) + "' doesn't exist!");
throw new CommandException(Messages.SCRIPT_FILE_MISSING, args.getString(1));
CitizensAPI.getScriptCompiler().compile(file).withCallback(new CompileCallback() {
@Override
public void onCompileTaskFinished() {
@ -47,9 +48,9 @@ public class ScriptCommands {
s.invoke(m, new Object[] {});
}
}
Messaging.send(sender, "<a>Done.");
Messaging.sendTr(sender, Messages.SCRIPT_COMPILED);
}
}).begin();
sender.sendMessage("Compiling...");
Messaging.sendTr(sender, Messages.SCRIPT_COMPILING);
}
}

View File

@ -15,9 +15,7 @@ import net.citizensnpcs.npc.Template;
import net.citizensnpcs.npc.Template.TemplateBuilder;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.google.common.base.Function;
@ -41,7 +39,7 @@ public class TemplateCommands {
public void apply(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
Template template = Template.byName(args.getString(1));
if (template == null)
throw new CommandException("Template not found.");
throw new CommandException(Messages.TEMPLATE_MISSING);
int appliedCount = 0;
if (args.argsLength() == 2) {
if (npc == null)
@ -68,8 +66,7 @@ public class TemplateCommands {
appliedCount++;
}
}
Messaging.sendF(sender, ChatColor.GREEN + "Template applied to %s NPCs.",
StringHelper.wrap(appliedCount));
Messaging.sendTr(sender, Messages.TEMPLATE_APPLIED, appliedCount);
}
@Command(
@ -84,9 +81,9 @@ public class TemplateCommands {
public void create(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
String name = args.getString(1);
if (Template.byName(name) != null)
throw new CommandException("A template by that name already exists.");
throw new CommandException(Messages.TEMPLATE_CONFLICT);
TemplateBuilder.create(name).from(npc).override(args.hasFlag('o')).buildAndSave();
Messaging.send(sender, ChatColor.GREEN + "Template created.");
Messaging.sendTr(sender, Messages.TEMPLATE_CREATED);
}
}

View File

@ -11,10 +11,10 @@ import net.citizensnpcs.command.CommandContext;
import net.citizensnpcs.command.Requirements;
import net.citizensnpcs.command.exception.CommandException;
import net.citizensnpcs.command.exception.NoPermissionsException;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.google.common.base.Joiner;
@ -51,9 +51,9 @@ public class TraitCommands {
added.add(StringHelper.wrap(traitName));
}
if (added.size() > 0)
Messaging.sendF(sender, ChatColor.GREEN + "Added %s successfully.", Joiner.on(", ").join(added));
Messaging.sendTr(sender, Messages.TRAITS_ADDED, Joiner.on(", ").join(added));
if (failed.size() > 0)
Messaging.sendF(sender, ChatColor.GRAY + "Couldn't add %s.", Joiner.on(", ").join(failed));
Messaging.sendTr(sender, Messages.TRAITS_FAILED_TO_ADD, Joiner.on(", ").join(failed));
}
@Command(
@ -70,11 +70,11 @@ public class TraitCommands {
throw new NoPermissionsException();
Class<? extends Trait> clazz = CitizensAPI.getTraitFactory().getTraitClass(args.getString(0));
if (clazz == null)
throw new CommandException("Trait not found.");
throw new CommandException(Messages.TRAIT_NOT_FOUND);
if (!clazz.isAssignableFrom(CommandConfigurable.class))
throw new CommandException("That trait is not configurable");
throw new CommandException(Messages.TRAIT_NOT_CONFIGURABLE);
if (!npc.hasTrait(clazz))
throw new CommandException("The NPC doesn't have that trait.");
throw new CommandException(Messages.TRAIT_NOT_FOUND_ON_NPC);
CommandConfigurable trait = (CommandConfigurable) npc.getTrait(clazz);
trait.configure(args);
}
@ -107,10 +107,9 @@ public class TraitCommands {
removed.add(StringHelper.wrap(traitName));
}
if (removed.size() > 0)
Messaging.sendF(sender, ChatColor.GREEN + "Removed %s successfully.",
Joiner.on(", ").join(removed));
Messaging.sendTr(sender, Messages.TRAITS_REMOVED, Joiner.on(", ").join(removed));
if (failed.size() > 0)
Messaging.sendF(sender, ChatColor.GRAY + "Couldn't change %s.", Joiner.on(", ").join(failed));
Messaging.sendTr(sender, Messages.FAILED_TO_REMOVE, Joiner.on(", ").join(failed));
}
@Command(
@ -143,11 +142,10 @@ public class TraitCommands {
added.add(StringHelper.wrap(traitName));
}
if (added.size() > 0)
Messaging.sendF(sender, ChatColor.GREEN + "Added %s successfully.", Joiner.on(", ").join(added));
Messaging.sendTr(sender, Messages.TRAITS_ADDED, Joiner.on(", ").join(added));
if (removed.size() > 0)
Messaging.sendF(sender, ChatColor.GREEN + "Removed %s successfully.",
Joiner.on(", ").join(removed));
Messaging.sendTr(sender, Messages.TRAITS_REMOVED, Joiner.on(", ").join(removed));
if (failed.size() > 0)
Messaging.sendF(sender, ChatColor.GRAY + "Couldn't change %s.", Joiner.on(", ").join(failed));
Messaging.sendTr(sender, Messages.TRAITS_FAILED_TO_CHANGE, Joiner.on(", ").join(failed));
}
}

View File

@ -11,7 +11,6 @@ import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@Requirements(ownership = true, selected = true)
@ -34,14 +33,13 @@ public class WaypointCommands {
if (args.hasFlag('a')) {
waypoints.describeProviders(sender);
} else
Messaging.sendTr(sender, ChatColor.GREEN, Messages.CURRENT_WAYPOINT_PROVIDER,
Messaging.sendTr(sender, Messages.CURRENT_WAYPOINT_PROVIDER,
StringHelper.wrap(waypoints.getCurrentProviderName()));
return;
}
boolean success = waypoints.setWaypointProvider(args.getString(1));
if (!success)
throw new CommandException("Provider not found.");
Messaging.sendTr(sender, ChatColor.GREEN, Messages.WAYPOINT_PROVIDER_SET,
StringHelper.wrap(args.getString(1)));
Messaging.sendTr(sender, Messages.WAYPOINT_PROVIDER_SET, StringHelper.wrap(args.getString(1)));
}
}

View File

@ -1,12 +1,18 @@
package net.citizensnpcs.command.exception;
import net.citizensnpcs.util.Messaging;
public class CommandException extends Exception {
public CommandException() {
super();
}
public CommandException(String message) {
super(message);
super(Messaging.tryTranslate(message));
}
public CommandException(String key, Object... replacements) {
super(Messaging.tr(key, replacements));
}
public CommandException(Throwable t) {

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import org.bukkit.entity.Player;
@ -31,7 +32,7 @@ public abstract class Editor implements Listener {
else if (edit.getClass() == editor.getClass())
leave(player);
else
Messaging.sendError(player, "You're already in an editor!");
Messaging.sendErrorTr(player, Messages.ALREADY_IN_EDITOR);
}
public static boolean hasEditor(Player player) {

View File

@ -35,7 +35,6 @@ import net.citizensnpcs.npc.entity.CitizensVillagerNPC;
import net.citizensnpcs.npc.entity.CitizensWolfNPC;
import net.citizensnpcs.npc.entity.CitizensZombieNPC;
import net.citizensnpcs.util.ByIdArray;
import net.citizensnpcs.util.Messaging;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.entity.Entity;
@ -131,8 +130,10 @@ public class CitizensNPCRegistry implements NPCRegistry {
throw new IllegalArgumentException("Invalid EntityType: " + type);
try {
return npcClass.getConstructor(int.class, String.class).newInstance(id, name);
} catch (Exception ex) {
Messaging.log(ex);
} catch (Throwable ex) {
if (ex.getCause() != null)
ex = ex.getCause();
ex.printStackTrace();
return null;
}
}

View File

@ -16,7 +16,6 @@ import net.citizensnpcs.util.Util;
import net.minecraft.server.EntitySheep;
import net.minecraft.server.World;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -41,15 +40,13 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable {
DyeColor color = DyeColor.getByData((byte) (15 - hand.getData().getData()));
getTrait(WoolColor.class).setColor(color);
Messaging.sendTr(equipper, ChatColor.GREEN, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED,
StringHelper.wrap(getName()),
StringHelper.wrap(color.name().toLowerCase().replace("_", " ")));
Messaging.sendTr(equipper, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED, getName(), color.name()
.toLowerCase().replace("_", " "));
hand.setAmount(hand.getAmount() - 1);
} else {
getTrait(WoolColor.class).setColor(DyeColor.WHITE);
Messaging.sendTr(equipper, ChatColor.GREEN, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED,
StringHelper.wrap(getName()), StringHelper.wrap("white"));
Messaging.sendTr(equipper, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED, getName(), "white");
}
}

View File

@ -1,7 +1,7 @@
package net.citizensnpcs.trait.text;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
@ -10,7 +10,7 @@ import org.bukkit.conversations.Prompt;
import org.bukkit.entity.Player;
public class PageChangePrompt extends NumericPrompt {
private Text text;
private final Text text;
public PageChangePrompt(Text text) {
this.text = text;
@ -20,7 +20,7 @@ public class PageChangePrompt extends NumericPrompt {
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
Player player = (Player) context.getForWhom();
if (!text.sendPage(player, input.intValue())) {
Messaging.sendError(player, "Invalid page number.");
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_PAGE);
return new StartPrompt(text);
}
return (Prompt) context.getSessionData("previous");
@ -28,11 +28,11 @@ public class PageChangePrompt extends NumericPrompt {
@Override
public String getFailedValidationText(ConversationContext context, String input) {
return ChatColor.RED + "Invalid page number.";
return ChatColor.RED + Messaging.tr(Messages.TEXT_EDITOR_INVALID_PAGE);
}
@Override
public String getPromptText(ConversationContext context) {
return StringHelper.parseColors("<a>Enter a page number to view more text entries.");
return Messaging.tr(Messages.TEXT_EDITOR_PAGE_PROMPT);
}
}

View File

@ -1,7 +1,7 @@
package net.citizensnpcs.trait.text;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.command.CommandSender;
import org.bukkit.conversations.ConversationContext;
@ -17,6 +17,7 @@ public class StartPrompt extends StringPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
CommandSender sender = (CommandSender) context.getForWhom();
if (input.equalsIgnoreCase("add"))
return new TextAddPrompt(text);
else if (input.equalsIgnoreCase("edit"))
@ -24,19 +25,16 @@ public class StartPrompt extends StringPrompt {
else if (input.equalsIgnoreCase("remove"))
return new TextRemovePrompt(text);
else if (input.equalsIgnoreCase("random"))
Messaging.send((CommandSender) context.getForWhom(),
"<e>Random talker <a>set to <e>" + text.toggleRandomTalker() + "<a>.");
Messaging.send(sender, "[[Random talker]] set to [[" + text.toggleRandomTalker() + "]].");
else if (input.equalsIgnoreCase("realistic looking"))
Messaging.send((CommandSender) context.getForWhom(),
"<e>Realistic looking <a>set to <e>" + text.toggleRealisticLooking() + "<a>.");
Messaging.send(sender, "[[Realistic looking]] set to [[" + text.toggleRealisticLooking() + "]].");
else if (input.equalsIgnoreCase("close"))
Messaging.send((CommandSender) context.getForWhom(),
"<e>Close talker <a>set to <e>" + text.toggle() + "<a>.");
Messaging.send(sender, "[[Close talker]] set to [[" + text.toggle() + "]].");
else if (input.equalsIgnoreCase("help")) {
context.setSessionData("said-text", false);
Messaging.send((CommandSender) context.getForWhom(), getPromptText(context));
Messaging.send(sender, getPromptText(context));
} else
Messaging.sendError((CommandSender) context.getForWhom(), "Invalid edit type.");
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_EDIT_TYPE);
return new StartPrompt(text);
}
@ -45,8 +43,7 @@ public class StartPrompt extends StringPrompt {
public String getPromptText(ConversationContext context) {
if (context.getSessionData("said-text") == Boolean.TRUE)
return "";
String text = StringHelper
.parseColors("<a>Type <e>add <a>to add an entry, <e>edit <a>to edit entries, <e>remove <a>to remove entries, <e>close <a>to toggle the NPC as a close talker, and <e>random <a>to toggle the NPC as a random talker. Type <e>help<a> to show this again.");
String text = Messaging.tr(Messages.TEXT_EDITOR_START_PROMPT);
context.setSessionData("said-text", Boolean.TRUE);
return text;
}

View File

@ -2,7 +2,6 @@ package net.citizensnpcs.trait.text;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
@ -26,7 +25,7 @@ public class TextRemovePrompt extends StringPrompt {
return new StartPrompt(text);
}
text.remove(index);
Messaging.sendF(player, "<e>Removed <a>entry at index <e>%d<a>.", index);
Messaging.sendTr(player, Messages.TEXT_EDITOR_REMOVED_ENTRY, index);
return new StartPrompt(text);
} catch (NumberFormatException ex) {
if (input.equalsIgnoreCase("page")) {
@ -41,7 +40,6 @@ public class TextRemovePrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
text.sendPage(((Player) context.getForWhom()), 1);
return StringHelper
.parseColors("<a>Enter the index of the entry you wish to remove or <e>page <a>to view more pages.");
return Messaging.tr(Messages.TEXT_EDITOR_REMOVE_PROMPT);
}
}

View File

@ -112,7 +112,7 @@ public class LinearWaypointProvider implements WaypointProvider {
@Override
public void begin() {
Messaging.sendTr(player, ChatColor.AQUA, Messages.LINEAR_WAYPOINT_EDITOR_BEGIN);
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_BEGIN);
}
private void createWaypointMarker(int index, Waypoint waypoint) {
@ -138,7 +138,7 @@ public class LinearWaypointProvider implements WaypointProvider {
public void end() {
if (!editing)
return;
Messaging.sendTr(player, ChatColor.AQUA, Messages.LINEAR_WAYPOINT_EDITOR_END);
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_END);
editing = false;
if (!showPath)
return;
@ -216,10 +216,8 @@ public class LinearWaypointProvider implements WaypointProvider {
if (showPath)
createWaypointMarker(editingSlot, element);
editingSlot = Math.min(editingSlot + 1, waypoints.size());
Messaging.send(
player,
String.format("<e>Added<a> a waypoint at (" + formatLoc(at)
+ ") (<e>%d<a>, <e>%d<a>)", editingSlot + 1, waypoints.size()));
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_ADDED_WAYPOINT, editingSlot + 1,
waypoints.size());
} else if (waypoints.size() > 0) {
event.setCancelled(true);
editingSlot = Math.min(0, Math.max(waypoints.size() - 1, editingSlot));
@ -227,10 +225,8 @@ public class LinearWaypointProvider implements WaypointProvider {
if (showPath)
removeWaypointMarker(waypoint);
editingSlot = Math.max(0, editingSlot - 1);
Messaging.send(
player,
String.format("<e>Removed<a> a waypoint (<e>%d<a> remaining) (<e>%d<a>)",
waypoints.size(), editingSlot + 1));
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_REMOVED_WAYPOINT, waypoints.size(),
editingSlot + 1);
}
currentGoal.onProviderChanged();
}
@ -242,8 +238,8 @@ public class LinearWaypointProvider implements WaypointProvider {
if (!event.getRightClicked().hasMetadata("waypointindex"))
return;
editingSlot = event.getRightClicked().getMetadata("waypointindex").get(0).asInt();
Messaging.sendF(player, ChatColor.GREEN + "Editing slot set to %s.",
StringHelper.wrap(editingSlot));
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_EDIT_SLOT_SET, editingSlot,
formatLoc(waypoints.get(editingSlot).getLocation()));
}
@EventHandler
@ -266,8 +262,8 @@ public class LinearWaypointProvider implements WaypointProvider {
editingSlot = 0;
if (editingSlot < 0)
editingSlot = waypoints.size() - 1;
Messaging.send(player, "<a>Editing slot set to " + StringHelper.wrap(editingSlot) + " ("
+ formatLoc(waypoints.get(editingSlot).getLocation()) + ").");
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_EDIT_SLOT_SET, editingSlot,
formatLoc(waypoints.get(editingSlot).getLocation()));
}
private void removeWaypointMarker(Waypoint waypoint) {
@ -284,10 +280,10 @@ public class LinearWaypointProvider implements WaypointProvider {
showPath = !showPath;
if (showPath) {
createWaypointMarkers();
Messaging.sendF(player, "%s waypoint markers.", StringHelper.wrap("Showing"));
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_SHOWING_MARKERS);
} else {
destroyWaypointMarkers();
Messaging.sendF(player, "%s showing waypoint markers.", StringHelper.wrap("Stopped"));
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_NOT_SHOWING_MARKERS);
}
}

View File

@ -11,7 +11,6 @@ import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -35,9 +34,9 @@ public class Waypoints extends Trait {
}
public void describeProviders(CommandSender sender) {
Messaging.sendTr(sender, ChatColor.AQUA, Messages.AVAILABLE_WAYPOINT_PROVIDERS);
Messaging.sendTr(sender, Messages.AVAILABLE_WAYPOINT_PROVIDERS);
for (String name : providers.keySet()) {
Messaging.send(sender, ChatColor.GREEN + " - " + StringHelper.wrap(name));
Messaging.send(sender, " - " + StringHelper.wrap(name));
}
}

View File

@ -15,25 +15,68 @@ import java.util.ResourceBundle;
import com.google.common.io.Closeables;
public class Messages {
public static final String AVAILABLE_WAYPOINT_PROVIDERS = "citizens.waypoints.available-providers-message";
public static final String AGE_SET = "citizens.commands.npc.age.set";
public static final String AGE_TRAIT_DESCRIPTION = "citizens.traits.age-description";
public static final String ALREADY_IN_EDITOR = "citizens.editors.already-in-editor";
public static final String ALREADY_OWNER = "citizens.commands.npc.owner.already-owner";
public static final String AVAILABLE_WAYPOINT_PROVIDERS = "citizens.waypoints.available-providers-header";
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 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_RELOAD_ERROR = "citizens.notifications.error-reloading";
public static final String CITIZENS_RELOADED = "citizens.notifications.reloaded";
public static final String CITIZENS_RELOADING = "citizens.notifications.reloading";
public static final String CITIZENS_SAVED = "citizens.notifications.saved";
public static final String CITIZENS_SAVING = "citizens.notifications.saving";
public static final String COMMAND_HELP_HEADER = "citizens.commands.help.header";
public static final String COMMAND_ID_NOT_FOUND = "citizens.commands.id-not-found";
public static final String COMMAND_INVALID_MOB_TYPE = "citizens.commands.disallowed-mobtype";
public static final String COMMAND_INVALID_MOBTYPE = "citizens.commands.invalid-mobtype";
public static final String COMMAND_INVALID_NUMBER = "citizens.commands.invalid-number";
public static final String COMMAND_MISSING_TRAIT = "citizens.commands.missing-required-trait";
public static final String COMMAND_MUST_BE_INGAME = "citizens.commands.must-be-ingame";
public static final String COMMAND_MUST_BE_OWNER = "citizens.commands.must-be-owner";
public static final String COMMAND_MUST_HAVE_SELECTED = "citizens.commands.must-have-selected";
public static final String COMMAND_MISSING_TRAIT = "citizens.commands.requirements.missing-required-trait";
public static final String COMMAND_MUST_BE_INGAME = "citizens.commands.requirements.must-be-ingame";
public static final String COMMAND_MUST_BE_OWNER = "citizens.commands.requirements.must-be-owner";
public static final String COMMAND_MUST_HAVE_SELECTED = "citizens.commands.requirements.must-have-selected";
public static final String COMMAND_PAGE_MISSING = "citizens.commands.page-missing";
public static final String COMMAND_REPORT_ERROR = "citizens.commands.console-error";
public static final String CURRENT_WAYPOINT_PROVIDER = "citizens.waypoints.current-provider-message";
public static final String COMMAND_REQUIREMENTS_INVALID_MOB_TYPE = "citizens.commands.requirements.disallowed-mobtype";
public static final String CONTROLLABLE_REMOVED = "citizens.commands.npc.controllable.removed";
public static final String CONTROLLABLE_SET = "citizens.commands.npc.controllable.set";
public static final String CURRENT_WAYPOINT_PROVIDER = "citizens.waypoints.current-provider";
public static final String DATABASE_CONNECTION_FAILED = "citizens.notifications.database-connection-failed";
private static ResourceBundle defaultBundle;
public static final String EQUIPMENT_EDITOR_ALL_ITEMS_REMOVED = "citizens.editors.equipment.all-items-removed";
public static final String EQUIPMENT_EDITOR_BEGIN = "citizens.editors.equipment.begin";
public static final String EQUIPMENT_EDITOR_END = "citizens.editors.equipment.end";
public static final String EQUIPMENT_EDITOR_INVALID_BLOCK = "citizens.editors.equipment.invalid-block";
public static final String EQUIPMENT_EDITOR_SHEEP_COLOURED = "citizens.editors.equipment.sheep-coloured";
public static final String ERROR_CLEARING_GOALS = "citizens.nms-errors.clearing-goals";
public static final String ERROR_GETTING_FIELD = "citizens.nms-errors.getting-field";
public static final String ERROR_GETTING_ID_MAPPING = "citizens.nms-errors.getting-id-mapping";
public static final String ERROR_INITALISING_SUB_PLUGIN = "citizens.sub-plugins.error-on-load";
public static final String ERROR_LOADING_ECONOMY = "citizens.economy.error-loading";
public static final String ERROR_SPAWNING_CUSTOM_ENTITY = "citizens.nms-errors.spawning-custom-entity";
public static final String ERROR_STOPPING_NETWORK_THREADS = "citizens.nms-errors.stopping-network-threads";
public static final String ERROR_UPDATING_NAVIGATION_WORLD = "citizens.nms-errors.updating-navigation-world";
public static final String ERROR_UPDATING_PATHFINDING_RANGE = "citizens.nms-errors.updating-pathfinding-range";
public static final String ERROR_UPDATING_SPEED = "citizens.nms-erorrs.updating-land-modifier";
public static final String EXCEPTION_UPDATING_NPC = "citizens.notifications.exception-updating-npc";
public static final String FAILED_LOAD_SAVES = "citizens.saves.load-failed";
public static final String FAILED_TO_MOUNT_NPC = "citizens.commands.npc.mount.failed";
public static final String FAILED_TO_REMOVE = "citizens.commands.trait.failed-to-remove";
public static final String INVALID_AGE = "citizens.commands.npc.age.invalid-age";
public static final String INVALID_POSE_NAME = "citizens.commands.npc.pose.invalid-name";
public static final String INVALID_PROFESSION = "citizens.commands.npc.profession.invalid-profession";
public static final String LINEAR_WAYPOINT_EDITOR_ADDED_WAYPOINT = "citizens.editors.waypoints.linear.added-waypoint";
public static final String LINEAR_WAYPOINT_EDITOR_BEGIN = "citizens.editors.waypoints.linear.begin";
public static final String LINEAR_WAYPOINT_EDITOR_EDIT_SLOT_SET = "citizens.editors.waypoints.linear.edit-slot-set";
public static final String LINEAR_WAYPOINT_EDITOR_END = "citizens.editors.waypoints.linear.end";
public static final String LINEAR_WAYPOINT_EDITOR_NOT_SHOWING_MARKERS = "citizens.editors.waypoints.linear.not-showing-markers";
public static final String LINEAR_WAYPOINT_EDITOR_RANGE_EXCEEDED = "citizens.editors.waypoints.linear.range-exceeded";
public static final String LINEAR_WAYPOINT_EDITOR_REMOVED_WAYPOINT = "citizens.editors.waypoints.linear.removed-waypoint";
public static final String LINEAR_WAYPOINT_EDITOR_SHOWING_MARKERS = "citizens.editors.waypoints.linear.showing-markers";
public static final String LOAD_NAME_NOT_FOUND = "citizens.notifications.npc-name-not-found";
public static final String LOAD_TASK_NOT_SCHEDULED = "citizens.load-task-error";
public static final String LOAD_UNKNOWN_NPC_TYPE = "citizens.notifications.unknown-npc-type";
@ -41,36 +84,74 @@ public class Messages {
public static final String LOCALE_NOTIFICATION = "citizens.notifications.locale";
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-message";
public static final String MINIMUM_COST_REQUIRED = "citizens.economy.minimum-cost-required";
public static final String MOBTYPE_CANNOT_BE_AGED = "citizens.commands.npc.age.cannot-be-aged";
public static final String MONEY_WITHDRAWN = "citizens.economy.money-withdrawn";
public static final String NO_NPC_WITH_ID_FOUND = "citizens.commands.npc.spawn.missing-npc-id";
public static final String NO_STORED_SPAWN_LOCATION = "citizens.commands.npc.spawn.no-location";
public static final String NOT_LIVING_MOBTYPE = "citizens.commands.npc.create.not-living-mobtype";
public static final String NPC_ALREADY_SELECTED = "citizens.commands.npc.select.already-selected";
public static final String NPC_ALREADY_SPAWNED = "citizens.commands.npc.spawn.already-spawned";
public static final String NPC_COPIED = "citizens.commands.npc.copy.copied";
public static final String NPC_CREATE_INVALID_MOBTYPE = "citizens.commands.npc.create.invalid-mobtype";
public static final String NPC_DESPAWNED = "citizens.commands.npc.despawn.despawned";
public static final String NPC_NAME_TOO_LONG = "citizens.commands.npc.create.npc-name-too-long";
public static final String NPC_NOT_CONTROLLABLE = "citizens.commands.npc.controllable.not-controllable";
public static final String NPC_NOT_FOUND = "citizens.notifications.npc-not-found";
public static final String NPC_OWNER = "citizens.commands.npc.owner.owner";
public static final String NPC_REMOVED = "citizens.commands.npc.remove.removed";
public static final String NPC_RENAMED = "citizens.commands.npc.rename.renamed";
public static final String NPC_SPAWNED = "citizens.commands.npc.spawn.spawned";
public static final String NPC_TELEPORTED = "citizens.commands.npc.tphere.teleported";
public static final String NUM_LOADED_NOTIFICATION = "citizens.notifications.npcs-loaded";
public static final String OVER_NPC_LIMIT = "citizens.limits.over-npc-limit";
public static final String POSE_ADDED = "citizens.commands.npc.pose.added";
public static final String POSE_ALREADY_EXISTS = "citizens.commands.npc.pose.already-exists";
public static final String POSE_MISSING = "citizens.commands.npc.pose.missing";
public static final String POSE_REMOVED = "citizens.commands.npc.pose.removed";
public static final String PROFESSION_SET = "citizens.commands.npc.profession.set";
public static final String REMOVED_ALL_NPCS = "citizens.commands.npc.remove.removed-all";
public static final String SAVE_METHOD_SET_NOTIFICATION = "citizens.notifications.save-method-set";
public static final String UNKNOWN_COMMAND = "citizens.commands.unknown-command";
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider-message";
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
public static final String EQUIPMENT_EDITOR_BEGIN = "citizens.editors.equipment.begin-message";
public static final String EQUIPMENT_EDITOR_END = "citizens.editors.equipment.end-message";
public static final String SCRIPT_COMPILED = "citizens.commands.script.compiled";
public static final String SCRIPT_COMPILING = "citizens.commands.script.compiling";
public static final String SCRIPT_FILE_MISSING = "citizens.commands.script.file-missing";
public static final String SKIPPING_BROKEN_TRAIT = "citizens.notifications.skipping-broken-trait";
public static final String TRAIT_LOAD_FAILED = "citizens.notifications.trait-load-failed";
public static final String EXCEPTION_UPDATING_NPC = "citizens.notifications.exception-updating-npc";
public static final String EQUIPMENT_EDITOR_INVALID_BLOCK = "citizens.editors.equipment.invalid-block";
public static final String EQUIPMENT_EDITOR_SHEEP_COLOURED = "citizens.editors.equipment.sheep-coloured";
public static final String EQUIPMENT_EDITOR_ALL_ITEMS_REMOVED = "citizens.editors.equipment.all-items-removed";
public static final String AGE_TRAIT_DESCRIPTION = "citizens.traits.age-description";
public static final String SKIPPING_INVALID_POSE = "citizens.notifications.skipping-invalid-pose";
public static final String TEXT_EDITOR_END = "citizens.editors.text.end-message";
public static final String TEXT_EDITOR_BEGIN = "citizens.editors.text.begin-message";
public static final String TEXT_EDITOR_ADDED_ENTRY = "citizens.editors.text.added-entry";
public static final String SPEED_MODIFIER_ABOVE_LIMIT = "citizens.commands.npc.speed.modifier-above-limit";
public static final String SPEED_MODIFIER_SET = "citizens.commands.npc.speed.set";
public static final String TELEPORTED_TO_NPC = "citizens.commands.npc.tp.teleported";
public static final String TEMPLATE_APPLIED = "citizens.commands.template.applied";
public static final String TEMPLATE_CONFLICT = "citizens.commands.template.conflict";
public static final String TEMPLATE_CREATED = "citizens.commands.template.created";
public static final String TEMPLATE_MISSING = "citizens.commands.template.missing";
public static final String TEXT_EDITOR_ADD_PROMPT = "citizens.editors.text.add-prompt";
public static final String TEXT_EDITOR_ADDED_ENTRY = "citizens.editors.text.added-entry";
public static final String TEXT_EDITOR_BEGIN = "citizens.editors.text.begin";
public static final String TEXT_EDITOR_EDIT_BEGIN_PROMPT = "citizens.editors.text.edit-begin-prompt";
public static final String TEXT_EDITOR_EDIT_PROMPT = "citizens.editors.text.edit-prompt";
public static final String TEXT_EDITOR_EDITED_TEXT = "citizens.editors.text.edited-text";
public static final String TEXT_EDITOR_END = "citizens.editors.text.end";
public static final String TEXT_EDITOR_INVALID_EDIT_TYPE = "citizens.editors.text.invalid-edit-type";
public static final String TEXT_EDITOR_INVALID_INDEX = "citizens.editors.text.invalid-index";
public static final String TEXT_EDITOR_INVALID_INPUT = "citizens.editors.text.invalid-input";
public static final String TEXT_EDITOR_EDIT_BEGIN_PROMPT = "citizens.editors.text.edit-begin-prompt";
public static final String LINEAR_WAYPOINT_EDITOR_BEGIN = "citizens.editors.waypoints.linear.begin-message";
public static final String LINEAR_WAYPOINT_EDITOR_END = "citizens.editors.waypoints.linear.end-message";
public static final String LINEAR_WAYPOINT_EDITOR_RANGE_EXCEEDED = "citizens.editors.waypoints.linear.range-exceeded-message";
public static final String TEXT_EDITOR_INVALID_PAGE = "citizens.editors.text.invalid-page";
public static final String TEXT_EDITOR_PAGE_PROMPT = "citizens.editors.text.change-page-prompt";
public static final String TEXT_EDITOR_REMOVE_PROMPT = "citizens.editors.text.remove-prompt";
public static final String TEXT_EDITOR_REMOVED_ENTRY = "citizens.editors.text.removed-entry";
public static final String TEXT_EDITOR_START_PROMPT = "citizens.editors.text.start-prompt";
public static final String TRAIT_LOAD_FAILED = "citizens.notifications.trait-load-failed";
public static final String TRAIT_NOT_CONFIGURABLE = "citizens.commands.traitc.not-configurable";
public static final String TRAIT_NOT_FOUND = "citizens.commands.traitc.missing";
public static final String TRAIT_NOT_FOUND_ON_NPC = "citizens.commands.traitc.not-on-npc";
public static final String TRAITS_ADDED = "citizens.commands.trait.added";
public static final String TRAITS_FAILED_TO_ADD = "citizens.commands.trait.failed-to-add";
public static final String TRAITS_FAILED_TO_CHANGE = "citizens.commands.trait.failed-to-change";
public static final String TRAITS_REMOVED = "citizens.commands.trait.removed";
public static final String UNKNOWN_COMMAND = "citizens.commands.unknown-command";
public static final String VULNERABLE_SET = "citizens.commands.npc.vulnerable.set";
public static final String VULNERABLE_STOPPED = "citizens.commands.npc.vulnerable.stopped";
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider";
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
private static Properties getDefaultBundleProperties() {
Properties defaults = new Properties();

View File

@ -1,6 +1,5 @@
package net.citizensnpcs.util;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.regex.Pattern;
@ -17,6 +16,10 @@ import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
public class Messaging {
private static final Pattern CHAT_NEWLINE = Pattern.compile("<br>|<n>|\\n", Pattern.MULTILINE);
private static final Splitter CHAT_NEWLINE_SPLITTER = Splitter.on(CHAT_NEWLINE);
private static final Joiner SPACE = Joiner.on(" ").useForNull("null");
public static void debug(Object... msg) {
@ -24,12 +27,6 @@ public class Messaging {
log(msg);
}
private static String getFormatted(Object[] msg) {
String toFormat = msg[0].toString();
Object[] args = msg.length > 1 ? Arrays.copyOfRange(msg, 1, msg.length) : new Object[] {};
return String.format(toFormat, args);
}
public static void log(Level level, Object... msg) {
Bukkit.getLogger().log(level, "[Citizens] " + SPACE.join(msg));
}
@ -38,16 +35,6 @@ public class Messaging {
log(Level.INFO, msg);
}
public static void log(Throwable ex) {
if (ex.getCause() != null)
ex = ex.getCause();
ex.printStackTrace();
}
public static void logF(Object... msg) {
log(getFormatted(msg));
}
public static void logTr(String key, Object... msg) {
log(Level.INFO, Translator.tr(key, msg));
}
@ -59,30 +46,25 @@ public class Messaging {
public static void sendError(CommandSender sender, Object... msg) {
send(sender, ChatColor.RED.toString() + SPACE.join(msg));
}
public static void sendErrorF(CommandSender sender, Object... msg) {
sendF(sender, ChatColor.RED.toString() + SPACE.join(msg));
}
public static void sendErrorTr(CommandSender sender, String key, Object... msg) {
sendMessageTo(sender, ChatColor.RED + Translator.tr(key, msg));
}
public static void sendF(CommandSender sender, Object... msg) {
sendMessageTo(sender, getFormatted(msg));
}
private static final Pattern CHAT_NEWLINE = Pattern.compile("<br>|<n>|\\n", Pattern.MULTILINE);
private static final Splitter CHAT_NEWLINE_SPLITTER = Splitter.on(CHAT_NEWLINE);
private static void sendMessageTo(CommandSender sender, String rawMessage) {
rawMessage = StringHelper.parseColors(rawMessage);
for (String message : CHAT_NEWLINE_SPLITTER.split(rawMessage))
for (String message : CHAT_NEWLINE_SPLITTER.split(rawMessage)) {
String trimmed = message.trim();
String messageColour = StringHelper.parseColors(Setting.MESSAGE_COLOUR.asString());
if (!trimmed.isEmpty()) {
if (trimmed.charAt(0) != ChatColor.COLOR_CHAR)
message = StringHelper.parseColors(Setting.MESSAGE_COLOUR.asString()) + message;
else
messageColour = ChatColor.getByChar(message.substring(1, 2)).toString();
}
message = message.replace("[[", StringHelper.parseColors(Setting.HIGHLIGHT_COLOUR.asString()));
message = message.replace("]]", messageColour);
sender.sendMessage(message);
}
public static void sendTr(CommandSender sender, ChatColor rootColour, String key, Object... msg) {
sendMessageTo(sender, rootColour + Translator.tr(key, msg));
}
}
public static void sendTr(CommandSender sender, String key, Object... msg) {
@ -108,10 +90,6 @@ public class Messaging {
log(Level.SEVERE, messages);
}
public static void severeF(Object... messages) {
log(Level.SEVERE, getFormatted(messages));
}
public static void severeTr(String key, Object... messages) {
log(Level.SEVERE, Translator.tr(key, messages));
}
@ -119,4 +97,15 @@ public class Messaging {
public static String tr(String key, Object... messages) {
return Translator.tr(key, messages);
}
public static String tryTranslate(Object possible) {
String message = possible.toString();
int count = 0;
for (int i = 0; i < message.length(); i++) {
char c = message.charAt(i);
if (c == '.')
count++;
}
return count >= 2 ? tr(message) : message;
}
}

View File

@ -55,7 +55,7 @@ public class NMS {
List<?> list = (List<?>) NMS.GOAL_FIELD.get(selector);
list.clear();
} catch (Exception e) {
Messaging.logF("Could not clear goals: %s", e.getMessage());
Messaging.logTr(Messages.ERROR_CLEARING_GOALS, e.getMessage());
}
}
}
@ -78,7 +78,7 @@ public class NMS {
f = clazz.getDeclaredField(field);
f.setAccessible(true);
} catch (Exception e) {
Messaging.logF("Could not fetch field %s: %s.", field, e.getMessage());
Messaging.logTr(Messages.ERROR_GETTING_FIELD, field, e.getMessage());
}
return f;
}
@ -138,7 +138,7 @@ public class NMS {
try {
LAND_SPEED_MODIFIER_FIELD.setFloat(handle, speed);
} catch (Exception e) {
Messaging.logF("Could not update land speed modifier: %s.", e.getMessage());
Messaging.logTr(Messages.ERROR_UPDATING_SPEED, e.getMessage());
}
}
@ -150,7 +150,7 @@ public class NMS {
Constructor<? extends Entity> constructor = getCustomEntityConstructor(clazz, type);
entity = constructor.newInstance(handle);
} catch (Exception e) {
Messaging.logF("Could not spawn custom entity: %s.", e.getMessage());
Messaging.logTr(Messages.ERROR_SPAWNING_CUSTOM_ENTITY, e.getMessage());
return null;
}
handle.addEntity(entity);
@ -164,7 +164,7 @@ public class NMS {
try {
THREAD_STOPPER.set(manager, false);
} catch (Exception e) {
Messaging.logF("Could not stop network threads: %s.", e.getMessage());
Messaging.logTr(Messages.ERROR_STOPPING_NETWORK_THREADS, e.getMessage());
}
}
@ -183,7 +183,7 @@ public class NMS {
try {
NAVIGATION_WORLD_FIELD.set(handle.getNavigation(), worldHandle);
} catch (Exception e) {
Messaging.logF("Could not update navigation world: %s.", e.getMessage());
Messaging.logTr(Messages.ERROR_UPDATING_NAVIGATION_WORLD, e.getMessage());
}
}
@ -194,7 +194,7 @@ public class NMS {
try {
PATHFINDING_RANGE.set(navigation, pathfindingRange);
} catch (Exception e) {
Messaging.logF("Could not update pathfinding range: %s.", e.getMessage());
Messaging.logTr(Messages.ERROR_UPDATING_PATHFINDING_RANGE, e.getMessage());
}
}
@ -227,7 +227,7 @@ public class NMS {
field = getField(EntityTypes.class, "e");
ENTITY_CLASS_TO_INT = (Map<Class<? extends Entity>, Integer>) field.get(null);
} catch (Exception e) {
Messaging.logF("Could not fetch entity id mapping fields: %s", e.getMessage());
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
}
}
}

View File

@ -1,9 +1,10 @@
package net.citizensnpcs.util;
import net.citizensnpcs.Settings.Setting;
import org.bukkit.ChatColor;
public class StringHelper {
public static String capitalize(Object string) {
String capitalize = string.toString();
return capitalize.replaceFirst(String.valueOf(capitalize.charAt(0)),
@ -69,14 +70,19 @@ public class StringHelper {
}
public static String wrap(Object string) {
return wrap(string, ChatColor.GREEN);
return wrap(string, parseColors(Setting.MESSAGE_COLOUR.asString()));
}
public static String wrap(Object string, ChatColor colour) {
return ChatColor.YELLOW + string.toString() + colour;
return wrap(string, colour.toString());
}
public static String wrap(Object string, String colour) {
return parseColors(Setting.HIGHLIGHT_COLOUR.asString()) + string.toString() + colour;
}
public static String wrapHeader(Object string) {
return "<a>=====[ " + string.toString() + "<a> ]=====";
String highlight = Setting.HIGHLIGHT_COLOUR.asString();
return highlight + "=====[ " + string.toString() + highlight + " ]=====";
}
}

View File

@ -99,6 +99,7 @@ public class Translator {
}
static String tr(String key, Object... msg) {
return msg.length == 0 ? instance.translate(key) : instance.format(key, msg);
return StringHelper
.parseColors(msg.length == 0 ? instance.translate(key) : instance.format(key, msg));
}
}

View File

@ -1,55 +1,136 @@
citizens.changed-implementation=Citizens implementation changed, disabling plugin.
citizens.commands.console-error=Please report this error: [See console]
citizens.commands.disallowed-mobtype=The NPC cannot be the mob type '{0}' to use that command.
citizens.commands.invalid-number=That is not a valid number.
citizens.commands.help.header=Help
citizens.commands.id-not-found=Couldn't find any NPC with ID {0}.
citizens.commands.missing-required-trait=Missing required trait {0}.
citizens.commands.must-be-ingame=You must be ingame to use that command.
citizens.commands.must-have-selected=You must have an NPC selected to execute that command.
citizens.commands.must-be-owner=You must be the owner of this NPC to execute that command.
citizens.commands.invalid-mobtype={0} is not a valid mobtype.
citizens.commands.invalid-number=That is not a valid number.
citizens.commands.npc.age.cannot-be-aged=The mob type '{0}' cannot be aged.
citizens.commands.npc.age.invalid-age=Invalid age. Valid ages are adult, baby, number between -24000 and 0
citizens.commands.npc.age.set=[[{0}]] is now [[{1}]].
citizens.commands.npc.behaviour.added=Behaviours added.
citizens.commands.npc.behaviour.removed=Behaviours removed.
citizens.commands.npc.controllable.not-controllable=[[{0}]] is not controllable.
citizens.commands.npc.controllable.removed=[[{0}]] can no longer be controlled.
citizens.commands.npc.controllable.set=[[{0}]] can now be controlled.
citizens.commands.npc.copy.copied=[[{0}]] has been copied.
citizens.commands.npc.create.invalid-mobtype='{0}' is not a valid mob type. Using default type.
citizens.commands.npc.create.not-living-mobtype='{0}' is not a living entity type. Using default type.
citizens.commands.npc.create.npc-name-too-long=NPC names cannot be longer than 16 characters. The name has been shortened.
citizens.commands.npc.despawn.despawned=You despawned [[{0}]].
citizens.commands.npc.mount.failed=Couldn't mount [[{0}]].
citizens.commands.npc.owner.already-owner='{0}' is already the owner of {1}.
citizens.commands.npc.owner.owner=[[{0}]]'s owner is [[{1}]].
citizens.commands.npc.pose.added=Pose added.
citizens.commands.npc.pose.already-exists=The pose '{0}' already exists.
citizens.commands.npc.pose.invalid-name=Invalid pose name.
citizens.commands.npc.pose.missing=The pose '{1}' does not exist.
citizens.commands.npc.pose.removed=Pose removed.
citizens.commands.npc.profession.invalid-profession='{0}' is not a valid profession.
citizens.commands.npc.profession.set=[[{0}]] is now a [[{1}]].
citizens.commands.npc.remove.removed-all=You permanently removed all NPCs.
citizens.commands.npc.remove.removed=You permanently removed [[{0}]].
citizens.commands.npc.rename.renamed=You renamed [[{0}]] to [[{1}]].
citizens.commands.npc.select.already-selected=You already have that NPC selected.
citizens.commands.npc.spawn.already-spawned={0} is already spawned at another location. Use '/npc tphere' to teleport the NPC to your location.
citizens.commands.npc.spawn.missing-npc-id=No NPC with the ID '{0}' exists.
citizens.commands.npc.spawn.no-location=No stored location available - command must be used ingame.
citizens.commands.npc.spawn.spawned=You spawned [[{0}]].
citizens.commands.npc.speed.modifier-above-limit=Speed is above the limit.
citizens.commands.npc.speed.set=NPC speed modifier set to [[{0}]].
citizens.commands.npc.tp.teleported=You teleported to [[{0}]].
citizens.commands.npc.tphere.teleported=[[{0}]] was teleported to your location.
citizens.commands.npc.vulnerable.set=[[{0}]] is now vulnerable.
citizens.commands.npc.vulnerable.stopped=[[{0}]] is no longer vulnerable.
citizens.commands.page-missing=The page [[{0}]] does not exist.
citizens.commands.requirements.disallowed-mobtype=The NPC cannot be the mob type '{0}' to use that command.
citizens.commands.requirements.missing-required-trait=Missing required trait {0}.
citizens.commands.requirements.must-be-ingame=You must be ingame to use that command.
citizens.commands.requirements.must-be-owner=You must be the owner of this NPC to execute that command.
citizens.commands.requirements.must-have-selected=You must have an NPC selected to execute that command.
citizens.commands.script.compiled=Script compiled.
citizens.commands.script.compiling=Script compiling...
citizens.commands.script.file-missing=The file {0} doesn't exist!
citizens.commands.template.applied=Template applied to [[{0}]] NPCs.
citizens.commands.template.conflict=A template by that name already exists.
citizens.commands.template.created=Template created.
citizens.commands.template.missing=Template not found.
citizens.commands.trait.added=Added {0} successfully.
citizens.commands.trait.failed-to-add=<7>Couldn't add {0}.
citizens.commands.trait.failed-to-change=<7>Couldn't change {0}.
citizens.commands.trait.failed-to-remove=<7>Couldn't remove {0}.
citizens.commands.trait.removed=Removed {0} successfully.
citizens.commands.traitc.missing=Trait not found.
citizens.commands.traitc.not-configurable=That trait is not configurable.
citizens.commands.traitc.not-on-npc=The NPC doesn't have that trait.
citizens.commands.unknown-command=Unknown command. Did you mean:
citizens.economy.error-loading=Unable to use economy handling. Has Vault been enabled?
citizens.economy.minimum-cost-required-message=Need at least {0}.
citizens.economy.money-withdrawn=Withdrew {0} for your NPC.
citizens.editors.equipment.begin-message=<b>Entered the equipment editor!<br><e>Right click <a>to equip the NPC!
citizens.editors.equipment.end-message=<a>Exited the equipment editor.
citizens.economy.minimum-cost-required=Need at least {0}.
citizens.economy.money-withdrawn=Withdrew [[{0}]] for your NPC.
citizens.editors.already-in-editor=You're already in an editor!
citizens.editors.equipment.all-items-removed=[[{0}]] had all of its items removed.
citizens.editors.equipment.begin=<b>Entered the equipment editor!<br>[[Right click]] to equip the NPC!
citizens.editors.equipment.end=Exited the equipment editor.
citizens.editors.equipment.invalid-block=Invalid block!
citizens.editors.equipment.sheep-coloured={0} is now coloured {1}.
citizens.editors.equipment.all-items-removed=<e>{0}<a> had all of its items removed.
citizens.editors.text.begin-message=<b>Entered the text editor!
citizens.editors.text.end-message=<a>Exited the text editor.
citizens.editors.text.invalid-index='{0}' is not a valid index!
citizens.editors.text.edited-text=<a>Changed entry at index <e>{0}<a>to <e>{1}<a>.
citizens.editors.text.added-entry=<e>Added <a>the entry <e>{0}<a>.
citizens.editors.text.invalid-input=Invalid input.
citizens.editors.text.edit-begin-prompt=<a>Enter the index of the entry you wish to edit or <e>page <a>to view more pages.
citizens.editors.equipment.sheep-coloured=[[{0}]] is now coloured [[{1}]].
citizens.editors.text.add-prompt=Enter text to add to the NPC.
citizens.editors.text.added-entry=[[Added]] the entry [[{0}]].
citizens.editors.text.begin=<b>Entered the text editor!
citizens.editors.text.change-page-prompt=Enter a page number to view more text entries.
citizens.editors.text.edit-begin-prompt=Enter the index of the entry you wish to edit or [[page]] to view more pages.
citizens.editors.text.edit-prompt=Enter text to edit the entry.
citizens.traits.age-description={0}'s age is {1}. Locked is {2}.
citizens.editors.text.edited-text=Changed entry at index [[{0}]]to [[{1}]].
citizens.editors.text.end=Exited the text editor.
citizens.editors.text.invalid-edit-type=Invalid edit type.
citizens.editors.text.invalid-index='{0}' is not a valid index!
citizens.editors.text.invalid-input=Invalid input.
citizens.editors.text.invalid-page=Invalid page number.
citizens.editors.text.remove-prompt=Enter the index of the entry you wish to remove or [[page]] to view more pages.
citizens.editors.text.removed-entry=[[Removed]] entry at index [[{0}]].
citizens.editors.text.start-prompt=Type [[add]] to add an entry, [[edit]] to edit entries, [[remove]] to remove entries, [[close]] to toggle the NPC as a close talker, and [[random]] to toggle the NPC as a random talker. Type [[help]] to show this again.
citizens.editors.waypoints.linear.added-waypoint=[[Added]] a waypoint at ({0}) ([[{1}]], [[{2}]])
citizens.editors.waypoints.linear.begin=<b>Entered the linear waypoint editor!<br>[[Left click]] to add a waypoint, [[right click]] to remove.<br>Type [[toggle path]] to toggle showing entities at waypoints.
citizens.editors.waypoints.linear.edit-slot-set=Editing slot set to [[{0}]] ({1}).
citizens.editors.waypoints.linear.end=Exited the linear waypoint editor.
citizens.editors.waypoints.linear.not-showing-markers=[[Stopped]] showing waypoint markers.
citizens.editors.waypoints.linear.range-exceeded=Previous waypoint is {0} blocks away but the distance limit is {1}.
citizens.editors.waypoints.linear.removed-waypoint=[[Removed]] a waypoint ([[{0}]] remaining) ([[{1}]])
citizens.editors.waypoints.linear.showing-markers=[[Showing]] waypoint markers.
citizens.limits.over-npc-limt=Over the NPC limit of {0}.
citizens.load-task-error=NPC load task couldn't be scheduled, disabling...
citizens.saves.load-failed=Unable to load saves, disabling...
citizens.sub-plugins.load=Loading {0}
citizens.sub-plugins.error-on-load={0} initializing {1}
citizens.settings.writing-default=Writing default setting: '{0}'
citizens.notifications.enabled=v{0} enabled.
citizens.nms-errors.clearing-goals=Could not clear goals: {0}.
citizens.nms-errors.getting-field=Could not fetch field {0}: {1}.
citizens.nms-errors.getting-id-mapping=Could not fetch entity id mapping fields: {0}.
citizens.nms-errors.spawning-custom-entity=Could not spawn custom entity: {0}.
citizens.nms-errors.stopping-network-threads=Could not stop network threads: {0}.
citizens.nms-errors.updating-land-modifier=Could not update land speed modifier: {0}.
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.exception-updating-npc=Exception while updating {0}: {1}.
citizens.notifications.trait-load-failed=The trait '{0}' failed to load for NPC ID: '{1}'.
citizens.notifications.skipping-invalid-pose=Skipping pose {0} - invalid yaw/pitch ({1}).
citizens.notifications.skipping-broken-trait=Skipped broken or missing trait '{0}' while loading ID '{1}'. Has the name changed?
citizens.notifications.npc-name-not-found=Could not find a name for ID '{0}'.
citizens.notifications.npc-not-found=No NPC could be found.
citizens.notifications.npcs-loaded=Loaded {0} NPCs ({1} spawned).
citizens.notifications.reloaded=Citizens reloaded.
citizens.notifications.reloading=Reloading Citizens...
citizens.notifications.save-method-set=Save method set to {0}.
citizens.notifications.database-connection-failed=Unable to connect to database, falling back to YAML
citizens.notifications.saved=Citizens saved.
citizens.notifications.saving=Saving Citizens...
citizens.notifications.skipping-broken-trait=Skipped broken or missing trait '{0}' while loading ID '{1}'. Has the name changed?
citizens.notifications.skipping-invalid-pose=Skipping pose {0} - invalid yaw/pitch ({1}).
citizens.notifications.trait-load-failed=The trait '{0}' failed to load for NPC ID: '{1}'.
citizens.notifications.unknown-npc-type=NPC type '{0}' was not recognized. Did you spell it correctly?
citizens.waypoints.available-providers-message=List of available providers
citizens.waypoints.current-provider-message=The current waypoint provider is {0}.
citizens.waypoints.set-provider-message=Set the waypoint provider to {0}.
citizens.editors.waypoints.linear.begin-message=Entered the linear waypoint editor!<br><e>Left click<a> to add a waypoint, <e>right click<a> to remove.<br><a>Type <e>toggle path<a> to toggle showing entities at waypoints.
citizens.editors.waypoints.linear.end-message=Exited the linear waypoint editor.
citizens.editors.waypoints.linear.range-exceeded-message=Previous waypoint is {0} blocks away but the distance limit is {1}.
citizens.saves.load-failed=Unable to load saves, disabling...
citizens.settings.writing-default=Writing default setting: '{0}'
citizens.sub-plugins.error-on-load={0} initializing {1}
citizens.sub-plugins.load=Loading {0}
citizens.traits.age-description={0}'s age is {1}. Locked is {2}.
citizens.waypoints.available-providers-header=<b>List of available providers
citizens.waypoints.current-provider=The current waypoint provider is {0}.
citizens.waypoints.set-provider=Set the waypoint provider to {0}.