mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 14:15:50 +01:00
Support spaces in names for /npc rename
This commit is contained in:
parent
235b0faa36
commit
32c7ef28bb
@ -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);
|
||||
}
|
||||
|
@ -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.");
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user