mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-01 23:23:31 +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>();
|
List<String> lines = new ArrayList<String>();
|
||||||
for (Command cmd : plugin.getCommands(baseCommand)) {
|
for (Command cmd : plugin.getCommands(baseCommand)) {
|
||||||
if (cmds.contains(cmd)
|
if (cmds.contains(cmd)
|
||||||
|| (!sender.hasPermission("citizens.admin") && !sender
|
|| (!sender.hasPermission("citizens.admin") && !sender.hasPermission("citizens."
|
||||||
.hasPermission("citizens." + cmd.permission())))
|
+ cmd.permission())))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lines.add("<7>/<c>" + cmd.aliases()[0] + (cmd.usage().isEmpty() ? "" : " " + cmd.usage()) + " <7>- <e>"
|
lines.add("<7>/<c>" + cmd.aliases()[0] + (cmd.usage().isEmpty() ? "" : " " + cmd.usage())
|
||||||
+ cmd.desc());
|
+ " <7>- <e>" + cmd.desc());
|
||||||
if (cmd.modifiers().length > 1)
|
if (cmd.modifiers().length > 1)
|
||||||
cmds.add(cmd);
|
cmds.add(cmd);
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ public class NPCCommands {
|
|||||||
permission = "npc.rename")
|
permission = "npc.rename")
|
||||||
public void rename(CommandContext args, CommandSender sender, NPC npc) {
|
public void rename(CommandContext args, CommandSender sender, NPC npc) {
|
||||||
String oldName = npc.getName();
|
String oldName = npc.getName();
|
||||||
String newName = args.getString(1);
|
String newName = args.getJoinedStrings(1);
|
||||||
if (newName.length() > 16) {
|
if (newName.length() > 16) {
|
||||||
Messaging.sendError(sender,
|
Messaging.sendError(sender,
|
||||||
"NPC names cannot be longer than 16 characters. The name has been shortened.");
|
"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());
|
Trait trait = CitizensAPI.getTraitFactory().getTrait(traitKey.name());
|
||||||
if (trait == null) {
|
if (trait == null) {
|
||||||
Messaging.severeF(
|
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());
|
traitKey.name(), getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (traitKey.keyExists("enabled") && !traitKey.getBoolean("enabled"))
|
||||||
|
continue;
|
||||||
addTrait(trait);
|
addTrait(trait);
|
||||||
try {
|
try {
|
||||||
trait.load(traitKey);
|
trait.load(traitKey);
|
||||||
|
Loading…
Reference in New Issue
Block a user