Support spaces in names for /npc rename

This commit is contained in:
fullwall 2012-08-05 14:15:04 +08:00
parent 235b0faa36
commit 32c7ef28bb
3 changed files with 8 additions and 6 deletions

View File

@ -47,12 +47,12 @@ public class HelpCommands {
List<String> lines = new ArrayList<String>();
for (Command cmd : plugin.getCommands(baseCommand)) {
if (cmds.contains(cmd)
|| (!sender.hasPermission("citizens.admin") && !sender
.hasPermission("citizens." + cmd.permission())))
|| (!sender.hasPermission("citizens.admin") && !sender.hasPermission("citizens."
+ cmd.permission())))
continue;
lines.add("<7>/<c>" + cmd.aliases()[0] + (cmd.usage().isEmpty() ? "" : " " + cmd.usage()) + " <7>- <e>"
+ cmd.desc());
lines.add("<7>/<c>" + cmd.aliases()[0] + (cmd.usage().isEmpty() ? "" : " " + cmd.usage())
+ " <7>- <e>" + cmd.desc());
if (cmd.modifiers().length > 1)
cmds.add(cmd);
}

View File

@ -423,7 +423,7 @@ public class NPCCommands {
permission = "npc.rename")
public void rename(CommandContext args, CommandSender sender, NPC npc) {
String oldName = npc.getName();
String newName = args.getString(1);
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.");

View File

@ -79,10 +79,12 @@ public abstract class CitizensNPC extends AbstractNPC {
Trait trait = CitizensAPI.getTraitFactory().getTrait(traitKey.name());
if (trait == null) {
Messaging.severeF(
"Skipped missing trait '%s' while loading NPC ID: '%d'. Has the name changed?",
"Skipped broken or missing trait '%s' while loading ID '%d'. Has the name changed?",
traitKey.name(), getId());
continue;
}
if (traitKey.keyExists("enabled") && !traitKey.getBoolean("enabled"))
continue;
addTrait(trait);
try {
trait.load(traitKey);