Skip to content

Commit

Permalink
Add nocheatplus.command.(exempt|unexempt|removeplayer).self permissions.
Browse files Browse the repository at this point in the history
Somewhat incomplete, because the filter permission is not added for 
these. Might be fancy for the tester shortcut (less danger).
  • Loading branch information
asofold committed Aug 10, 2013
1 parent fdf2009 commit b3b13df
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
Expand Up @@ -84,4 +84,12 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
return null;
}

/* (non-Javadoc)
* @see fr.neatmonster.nocheatplus.command.AbstractCommand#testPermission(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[])
*/
@Override
public boolean testPermission(CommandSender sender, Command command, String alias, String[] args) {
return super.testPermission(sender, command, alias, args) || args.length >= 2 && args[1].trim().equalsIgnoreCase(sender.getName()) && sender.hasPermission(permission + ".self");
}

}
Expand Up @@ -58,5 +58,13 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
if (args.length == 3) return CommandUtil.getCheckTypeTabMatches(args[2]);
return null;
}

/* (non-Javadoc)
* @see fr.neatmonster.nocheatplus.command.AbstractCommand#testPermission(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[])
*/
@Override
public boolean testPermission(CommandSender sender, Command command, String alias, String[] args) {
return super.testPermission(sender, command, alias, args) || args.length >= 2 && args[1].trim().equalsIgnoreCase(sender.getName()) && sender.hasPermission(permission + ".self");
}

}
Expand Up @@ -61,5 +61,13 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
if (args.length == 3) return CommandUtil.getCheckTypeTabMatches(args[2]);
return null;
}

/* (non-Javadoc)
* @see fr.neatmonster.nocheatplus.command.AbstractCommand#testPermission(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[])
*/
@Override
public boolean testPermission(CommandSender sender, Command command, String alias, String[] args) {
return super.testPermission(sender, command, alias, args) || args.length >= 2 && args[1].trim().equalsIgnoreCase(sender.getName()) && sender.hasPermission(permission + ".self");
}

}
10 changes: 5 additions & 5 deletions NCPPlugin/src/main/resources/plugin.yml
Expand Up @@ -348,14 +348,14 @@ permissions:

# Shortcut: convenient testing.
nocheatplus.tester:
description: Monitoring and debugging permissions, including removing data and exemption.
description: Monitoring and debugging permissions, including removing data and exemption handling for oneself.
children:
# TODO: Might just inherit from shortcut.info, might implement exempt.self etc.
# TODO: Might just inherit from shortcut.info.
nocheatplus.shortcut.monitor: true
nocheatplus.admin.debug: true
nocheatplus.command.exempt: true
nocheatplus.command.unexempt: true
nocheatplus.command.removeplayer: true
nocheatplus.command.exempt.self: true
nocheatplus.command.unexempt.self: true
nocheatplus.command.removeplayer.self: true

# Shortcut: full administrator without check-bypass-permissions:
nocheatplus.admin:
Expand Down

0 comments on commit b3b13df

Please sign in to comment.