From 0ce5eaeafe29f024422a38c4ecf518928e22d235 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 11 Aug 2013 13:27:47 +0800 Subject: [PATCH] Add citizens.npc.trait.* permission --- .../net/citizensnpcs/commands/TraitCommands.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/citizensnpcs/commands/TraitCommands.java b/src/main/java/net/citizensnpcs/commands/TraitCommands.java index f56ad580f..b073fd5ba 100644 --- a/src/main/java/net/citizensnpcs/commands/TraitCommands.java +++ b/src/main/java/net/citizensnpcs/commands/TraitCommands.java @@ -31,7 +31,8 @@ public class TraitCommands { List added = Lists.newArrayList(); List failed = Lists.newArrayList(); for (String traitName : Splitter.on(',').split(args.getJoinedStrings(0))) { - if (!sender.hasPermission("citizens.npc.trait." + traitName)) { + if (!sender.hasPermission("citizens.npc.trait." + traitName) + && !sender.hasPermission("citizens.npc.trait.*")) { failed.add(String.format("%s: No permission", traitName)); continue; } @@ -69,7 +70,8 @@ public class TraitCommands { permission = "citizens.npc.trait-configure") public void configure(CommandContext args, CommandSender sender, NPC npc) throws CommandException { String traitName = args.getString(0); - if (!sender.hasPermission("citizens.npc.trait-configure." + traitName)) + if (!sender.hasPermission("citizens.npc.trait-configure." + traitName) + && !sender.hasPermission("citizens.npc.trait-configure.*")) throw new NoPermissionsException(); Class clazz = CitizensAPI.getTraitFactory().getTraitClass(args.getString(0)); if (clazz == null) @@ -93,7 +95,8 @@ public class TraitCommands { List removed = Lists.newArrayList(); List failed = Lists.newArrayList(); for (String traitName : Splitter.on(',').split(args.getJoinedStrings(0))) { - if (!sender.hasPermission("citizens.npc.trait." + traitName)) { + if (!sender.hasPermission("citizens.npc.trait." + traitName) + && !sender.hasPermission("citizens.npc.trait.*")) { failed.add(String.format("%s: No permission", traitName)); continue; } @@ -129,7 +132,8 @@ public class TraitCommands { List removed = Lists.newArrayList(); List failed = Lists.newArrayList(); for (String traitName : Splitter.on(',').split(args.getJoinedStrings(0))) { - if (!sender.hasPermission("citizens.npc.trait." + traitName)) { + if (!sender.hasPermission("citizens.npc.trait." + traitName) + && !sender.hasPermission("citizens.npc.trait.*")) { failed.add(String.format("%s: No permission", traitName)); continue; }