Properly check perms

This commit is contained in:
Jesse Boyd 2016-02-11 14:19:48 +11:00
parent 4dc9f2ff35
commit a453a0a2ac
2 changed files with 9 additions and 1 deletions

View File

@ -5,7 +5,9 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweCommand;
import com.boydti.fawe.object.FawePlayer;
public class BukkitCommand implements CommandExecutor {
@ -17,7 +19,12 @@ public class BukkitCommand implements CommandExecutor {
@Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
this.cmd.execute(Fawe.imp().wrap(sender), args);
FawePlayer plr = Fawe.imp().wrap(sender);
if (!sender.hasPermission(this.cmd.getPerm())) {
BBC.NO_PERM.send(plr, this.cmd.getPerm());
return true;
}
this.cmd.execute(plr, args);
return true;
}

View File

@ -20,6 +20,7 @@ public enum BBC {
* Can use multiple arguments %s, %s1, %s2, %s3 etc
*/
COMMAND_SYNTAX("&cUsage: &7%s0", "Error"),
NO_PERM("&cYou are lacking the permission node: %s0", "Error"),
SCHEMATIC_NOT_FOUND("&cSchematic not found: &7%s0", "Error"),
SCHEMATIC_PASTING("&7The schematic is pasting. This cannot be undone.", "Info"),
FIX_LIGHTING_CHUNK("&7Lighting has been fixed in your current chunk. Relog to see the affect.", "Info"),