mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-17 04:41:31 +01:00
change to permissions - no longer need permission for each command, only need to be the owner or an admin
This commit is contained in:
parent
1fcdbac419
commit
0448528a2e
@ -18,8 +18,7 @@ public class EditorCommands {
|
|||||||
desc = "Toggle equipment editor",
|
desc = "Toggle equipment editor",
|
||||||
modifiers = { "equip" },
|
modifiers = { "equip" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1)
|
||||||
permission = "npc.equip")
|
|
||||||
public void toggleEquipEditor(CommandContext args, Player player, NPC npc) {
|
public void toggleEquipEditor(CommandContext args, Player player, NPC npc) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -30,8 +29,7 @@ public class EditorCommands {
|
|||||||
desc = "Toggle path editor",
|
desc = "Toggle path editor",
|
||||||
modifiers = { "path" },
|
modifiers = { "path" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1)
|
||||||
permission = "npc.path")
|
|
||||||
public void togglePathEditor(CommandContext args, Player player, NPC npc) {
|
public void togglePathEditor(CommandContext args, Player player, NPC npc) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -42,8 +40,7 @@ public class EditorCommands {
|
|||||||
desc = "Toggle text editor",
|
desc = "Toggle text editor",
|
||||||
modifiers = { "text" },
|
modifiers = { "text" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1)
|
||||||
permission = "npc.text")
|
|
||||||
public void toggleTextEditor(CommandContext args, Player player, NPC npc) {
|
public void toggleTextEditor(CommandContext args, Player player, NPC npc) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -34,17 +34,18 @@ public class NPCCommands {
|
|||||||
characterManager = plugin.getCharacterManager();
|
characterManager = plugin.getCharacterManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(aliases = { "npc" }, desc = "Show basic NPC information", max = 0, permission = "npc.info")
|
@Command(aliases = { "npc" }, desc = "Show basic NPC information", max = 0)
|
||||||
public void showInfo(CommandContext args, Player player, NPC npc) {
|
public void showInfo(CommandContext args, Player player, NPC npc) {
|
||||||
Messaging.send(player, StringHelper.wrapHeader(npc.getName()));
|
Messaging.send(player, StringHelper.wrapHeader(npc.getName()));
|
||||||
Messaging.send(player, " <a>ID: <e>" + npc.getId());
|
Messaging.send(player, " <a>ID: <e>" + npc.getId());
|
||||||
Messaging.send(player, " <a>Character: <e>" + (npc.getCharacter() != null ? npc.getCharacter().getName()
|
Messaging.send(player, " <a>Character: <e>"
|
||||||
: "None"));
|
+ (npc.getCharacter() != null ? npc.getCharacter().getName() : "None"));
|
||||||
|
Messaging.send(player, " <a>Type: <e>" + npc.getTrait(MobType.class).getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "npc" },
|
aliases = { "npc" },
|
||||||
usage = "create [name] --type (type) --char (character) --temp (template)",
|
usage = "create [name] --type (type) --char (character)",
|
||||||
desc = "Create a new NPC",
|
desc = "Create a new NPC",
|
||||||
modifiers = { "create" },
|
modifiers = { "create" },
|
||||||
min = 2,
|
min = 2,
|
||||||
@ -98,22 +99,14 @@ public class NPCCommands {
|
|||||||
desc = "Despawn an NPC",
|
desc = "Despawn an NPC",
|
||||||
modifiers = { "despawn" },
|
modifiers = { "despawn" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1)
|
||||||
permission = "npc.despawn")
|
|
||||||
public void despawnNPC(CommandContext args, Player player, NPC npc) {
|
public void despawnNPC(CommandContext args, Player player, NPC npc) {
|
||||||
npc.getTrait(Spawned.class).setSpawned(false);
|
npc.getTrait(Spawned.class).setSpawned(false);
|
||||||
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(
|
@Command(aliases = { "npc" }, usage = "remove", desc = "Remove an NPC", modifiers = { "remove" }, min = 1, max = 1)
|
||||||
aliases = { "npc" },
|
|
||||||
usage = "remove",
|
|
||||||
desc = "Remove an NPC",
|
|
||||||
modifiers = { "remove" },
|
|
||||||
min = 1,
|
|
||||||
max = 1,
|
|
||||||
permission = "npc.remove")
|
|
||||||
public void removeNPC(CommandContext args, Player player, NPC npc) {
|
public void removeNPC(CommandContext args, Player player, NPC npc) {
|
||||||
npc.remove();
|
npc.remove();
|
||||||
Messaging.send(player, ChatColor.GREEN + "You permanently removed " + StringHelper.wrap(npc.getName()) + ".");
|
Messaging.send(player, ChatColor.GREEN + "You permanently removed " + StringHelper.wrap(npc.getName()) + ".");
|
||||||
@ -125,8 +118,7 @@ public class NPCCommands {
|
|||||||
desc = "Rename an NPC",
|
desc = "Rename an NPC",
|
||||||
modifiers = { "rename" },
|
modifiers = { "rename" },
|
||||||
min = 2,
|
min = 2,
|
||||||
max = 2,
|
max = 2)
|
||||||
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();
|
||||||
String newName = args.getString(1);
|
String newName = args.getString(1);
|
||||||
@ -145,8 +137,7 @@ public class NPCCommands {
|
|||||||
desc = "Selects an NPC with the given ID",
|
desc = "Selects an NPC with the given ID",
|
||||||
modifiers = { "select" },
|
modifiers = { "select" },
|
||||||
min = 2,
|
min = 2,
|
||||||
max = 2,
|
max = 2)
|
||||||
permission = "npc.select")
|
|
||||||
@Requirements(ownership = true)
|
@Requirements(ownership = true)
|
||||||
public void selectNPC(CommandContext args, Player player, NPC npc) {
|
public void selectNPC(CommandContext args, Player player, NPC npc) {
|
||||||
NPC toSelect = npcManager.getNPC(args.getInteger(1));
|
NPC toSelect = npcManager.getNPC(args.getInteger(1));
|
||||||
@ -168,8 +159,7 @@ public class NPCCommands {
|
|||||||
desc = "Sets the character of an NPC",
|
desc = "Sets the character of an NPC",
|
||||||
modifiers = { "character" },
|
modifiers = { "character" },
|
||||||
min = 2,
|
min = 2,
|
||||||
max = 2,
|
max = 2)
|
||||||
permission = "npc.character")
|
|
||||||
public void setNPCCharacter(CommandContext args, Player player, NPC npc) {
|
public void setNPCCharacter(CommandContext args, Player player, NPC npc) {
|
||||||
Character character = characterManager.getInstance(args.getString(1), npc);
|
Character character = characterManager.getInstance(args.getString(1), npc);
|
||||||
if (character == null) {
|
if (character == null) {
|
||||||
@ -193,8 +183,7 @@ public class NPCCommands {
|
|||||||
desc = "Toggle whether an NPC should sneak",
|
desc = "Toggle whether an NPC should sneak",
|
||||||
modifiers = { "sneak" },
|
modifiers = { "sneak" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1)
|
||||||
permission = "npc.sneak")
|
|
||||||
public void toggleSneak(CommandContext args, Player player, NPC npc) {
|
public void toggleSneak(CommandContext args, Player player, NPC npc) {
|
||||||
Sneak trait = npc.getTrait(Sneak.class);
|
Sneak trait = npc.getTrait(Sneak.class);
|
||||||
trait.toggle();
|
trait.toggle();
|
||||||
@ -209,8 +198,7 @@ public class NPCCommands {
|
|||||||
desc = "Spawn an existing NPC",
|
desc = "Spawn an existing NPC",
|
||||||
modifiers = { "spawn" },
|
modifiers = { "spawn" },
|
||||||
min = 2,
|
min = 2,
|
||||||
max = 2,
|
max = 2)
|
||||||
permission = "npc.spawn")
|
|
||||||
@Requirements
|
@Requirements
|
||||||
public void spawnNPC(CommandContext args, Player player, NPC npc) {
|
public void spawnNPC(CommandContext args, Player player, NPC npc) {
|
||||||
NPC respawn = npcManager.getNPC(args.getInteger(1));
|
NPC respawn = npcManager.getNPC(args.getInteger(1));
|
||||||
@ -240,8 +228,7 @@ public class NPCCommands {
|
|||||||
desc = "Teleport an NPC to your location",
|
desc = "Teleport an NPC to your location",
|
||||||
modifiers = { "tphere" },
|
modifiers = { "tphere" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1)
|
||||||
permission = "npc.tphere")
|
|
||||||
public void teleportNPCToPlayer(CommandContext args, Player player, NPC npc) {
|
public void teleportNPCToPlayer(CommandContext args, Player player, NPC npc) {
|
||||||
// Spawn the NPC if it isn't spawned to prevent NPEs
|
// Spawn the NPC if it isn't spawned to prevent NPEs
|
||||||
if (!npc.isSpawned())
|
if (!npc.isSpawned())
|
||||||
@ -256,8 +243,7 @@ public class NPCCommands {
|
|||||||
desc = "Teleport to an NPC",
|
desc = "Teleport to an NPC",
|
||||||
modifiers = { "tp", "teleport" },
|
modifiers = { "tp", "teleport" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,
|
max = 1)
|
||||||
permission = "npc.tp")
|
|
||||||
public void teleportToNPC(CommandContext args, Player player, NPC npc) {
|
public void teleportToNPC(CommandContext args, Player player, NPC npc) {
|
||||||
// Spawn the NPC if it isn't spawned to prevent NPEs
|
// Spawn the NPC if it isn't spawned to prevent NPEs
|
||||||
if (!npc.isSpawned())
|
if (!npc.isSpawned())
|
||||||
@ -267,7 +253,7 @@ public class NPCCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(aliases = { "npc" }, usage = "lookclose", desc = "Toggle an NPC's look-close state", modifiers = {
|
@Command(aliases = { "npc" }, usage = "lookclose", desc = "Toggle an NPC's look-close state", modifiers = {
|
||||||
"lookclose", "look", "rotate" }, min = 1, max = 1, permission = "npc.look-close")
|
"lookclose", "look", "rotate" }, min = 1, max = 1)
|
||||||
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