mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 12:46:04 +01:00
shorten names when renaming NPC
This commit is contained in:
parent
d511cafec4
commit
d6410781a5
@ -108,6 +108,18 @@ public class NPCCommands {
|
|||||||
npc.despawn();
|
npc.despawn();
|
||||||
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" },
|
||||||
@ -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(
|
||||||
@ -148,6 +164,18 @@ public class NPCCommands {
|
|||||||
npcManager.selectNPC(player, toSelect);
|
npcManager.selectNPC(player, toSelect);
|
||||||
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" },
|
||||||
@ -207,13 +235,13 @@ public class NPCCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "npc" },
|
aliases = { "npc" },
|
||||||
usage = "lookclose",
|
usage = "lookclose",
|
||||||
desc = "Toggle an NPC's look-close state",
|
desc = "Toggle an NPC's look-close state",
|
||||||
modifiers = { "lookclose", "look", "rotate" },
|
modifiers = { "lookclose", "look", "rotate" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1,
|
||||||
permission = "npc.look-close")
|
permission = "npc.look-close")
|
||||||
public void toggleNPCLookClose(CommandContext args, Player player, NPC npc) {
|
public void toggleNPCLookClose(CommandContext args, Player player, NPC npc) {
|
||||||
LookClose trait = npc.getTrait(LookClose.class);
|
LookClose trait = npc.getTrait(LookClose.class);
|
||||||
trait.toggle();
|
trait.toggle();
|
||||||
|
Loading…
Reference in New Issue
Block a user