mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 22:23:59 +01:00
shorten names when renaming NPC
This commit is contained in:
parent
d511cafec4
commit
d6410781a5
@ -109,6 +109,18 @@ public class NPCCommands {
|
|||||||
Messaging.send(player, ChatColor.GREEN + "You despawned " + StringHelper.wrap(npc.getName()) + ".");
|
Messaging.send(player, ChatColor.GREEN + "You despawned " + StringHelper.wrap(npc.getName()) + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
aliases = { "npc" },
|
||||||
|
usage = "editor [editor]",
|
||||||
|
desc = "Enter an NPC editor",
|
||||||
|
modifiers = { "editor" },
|
||||||
|
min = 2,
|
||||||
|
max = 2,
|
||||||
|
permission = "npc.editor")
|
||||||
|
public void enterEditor(CommandContext args, Player player, NPC npc) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "npc" },
|
aliases = { "npc" },
|
||||||
usage = "rename [name]",
|
usage = "rename [name]",
|
||||||
@ -119,11 +131,15 @@ public class NPCCommands {
|
|||||||
permission = "npc.rename")
|
permission = "npc.rename")
|
||||||
public void renameNPC(CommandContext args, Player player, NPC npc) {
|
public void renameNPC(CommandContext args, Player player, NPC npc) {
|
||||||
String oldName = npc.getName();
|
String oldName = npc.getName();
|
||||||
npc.setName(args.getString(1));
|
String newName = args.getString(1);
|
||||||
Messaging.send(
|
if (newName.length() > 16) {
|
||||||
player,
|
Messaging.sendError(player, "NPC names cannot be longer than 16 characters. The name has been shortened.");
|
||||||
ChatColor.GREEN + "You renamed " + StringHelper.wrap(oldName) + " to "
|
newName = newName.substring(0, 15);
|
||||||
+ StringHelper.wrap(args.getString(1)) + ".");
|
}
|
||||||
|
npc.setName(newName);
|
||||||
|
Messaging.send(player,
|
||||||
|
ChatColor.GREEN + "You renamed " + StringHelper.wrap(oldName) + " to " + StringHelper.wrap(newName)
|
||||||
|
+ ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -149,6 +165,18 @@ public class NPCCommands {
|
|||||||
Messaging.sendWithNPC(player, Setting.SELECTION_MESSAGE.asString(), toSelect);
|
Messaging.sendWithNPC(player, Setting.SELECTION_MESSAGE.asString(), toSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
aliases = { "npc" },
|
||||||
|
usage = "character [character]",
|
||||||
|
desc = "Sets the character of an NPC",
|
||||||
|
modifiers = { "character" },
|
||||||
|
min = 2,
|
||||||
|
max = 2,
|
||||||
|
permission = "npc.character")
|
||||||
|
public void setNPCCharacter(CommandContext args, Player player, NPC npc) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "npc" },
|
aliases = { "npc" },
|
||||||
usage = "spawn [id]",
|
usage = "spawn [id]",
|
||||||
|
Loading…
Reference in New Issue
Block a user