Added custom permissions and messages

This commit is contained in:
Boosik 2015-02-08 13:01:29 +01:00
parent b82cceb7dc
commit 61d8f8f6fd
5 changed files with 21 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cz.boosik</groupId>
<artifactId>boosCooldowns</artifactId>
<version>3.9.6a</version>
<version>3.9.7</version>
<name>boosCooldowns</name>
<packaging>jar</packaging>
<url>http://maven.apache.org</url>

View File

@ -25,6 +25,10 @@ class BoosCoolDownListener implements Listener {
int warmupTime, int cooldownTime, double price, String item,
int count, int limit, int xpPrice) {
boolean blocked = false;
if (!player.hasPermission(BoosConfigManager.getPermission(player, regexCommad))){
boosChat.sendMessageToPlayer(player, BoosConfigManager.getPermissionMessage(player, regexCommad));
event.setCancelled(true);
}
if (limit != -1) {
blocked = BoosLimitManager.blocked(player, regexCommad,
originalCommand, limit);

View File

@ -654,4 +654,16 @@ public class BoosConfigManager {
return conf.getString("options.messages.limit_reset_now",
"&6Reseting limits for command&e &command& &6now.&f");
}
public static String getPermission(Player player, String regexCommad) {
String group = getCommandGroup(player);
return conf.getString("commands.groups." + group + "."
+ regexCommad + ".permission");
}
public static String getPermissionMessage(Player player, String regexCommad) {
String group = getCommandGroup(player);
return conf.getString("commands.groups." + group + "."
+ regexCommad + ".denied_message");
}
}

View File

@ -57,6 +57,9 @@ options:
commands:
groups:
default:
/permissionstest:
permission: "nice.permission"
denied_message: You lack required permissions to use this command!
/day_command:
limit: 5
shared_limit:

View File

@ -1,6 +1,6 @@
name: boosCooldowns
main: cz.boosik.boosCooldown.BoosCoolDown
version: 3.9.6a
version: 3.9.7
authors: [LordBoos (boosik)]
softdepend: [Vault]
description: >