mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-30 06:33:56 +01:00
added ability to list all NPCs
This commit is contained in:
parent
3d3c4bcf3f
commit
ba923a066b
@ -289,8 +289,9 @@ public class NPCCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "npc" },
|
aliases = { "npc" },
|
||||||
usage = "list (page) (--owner (owner) --type (type) --char (char))",
|
usage = "list (page) ((-a) --owner (owner) --type (type) --char (char))",
|
||||||
desc = "List NPCs",
|
desc = "List NPCs",
|
||||||
|
flags = "a",
|
||||||
modifiers = { "list" },
|
modifiers = { "list" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 2,
|
max = 2,
|
||||||
@ -299,7 +300,10 @@ public class NPCCommands {
|
|||||||
public void list(CommandContext args, Player player, NPC npc) throws CommandException {
|
public void list(CommandContext args, Player player, NPC npc) throws CommandException {
|
||||||
List<NPC> npcs = new ArrayList<NPC>();
|
List<NPC> npcs = new ArrayList<NPC>();
|
||||||
|
|
||||||
if (args.getValueFlags().size() == 0 && args.argsLength() == 1 || args.argsLength() == 2) {
|
if (args.hasFlag('a')) {
|
||||||
|
for (NPC add : npcManager)
|
||||||
|
npcs.add(add);
|
||||||
|
} else if (args.getValueFlags().size() == 0 && args.argsLength() == 1 || args.argsLength() == 2) {
|
||||||
for (NPC add : npcManager)
|
for (NPC add : npcManager)
|
||||||
if (add.getTrait(Owner.class).getOwner().equalsIgnoreCase(player.getName()))
|
if (add.getTrait(Owner.class).getOwner().equalsIgnoreCase(player.getName()))
|
||||||
npcs.add(add);
|
npcs.add(add);
|
||||||
|
Loading…
Reference in New Issue
Block a user