Solved OP but no permission

Discussion in 'Spigot Plugin Development' started by Impasta1000, Jun 7, 2016.

Thread Status:
Not open for further replies.
  1. I am an OP on my server, but I do not have the permission "StaffUtils.*" (which is from my custom plugin).
    Tried this with PermissionsEX and I added the permission which worked.
    But the question here is, why does an OP not have the permission??

    Permissions in plugin.yml
    Code (Text):
            description: Gives access to all StaffUtils commands
            default: false
                StaffUtils.Chat.*: true
                StaffUtils.Player.*: true
            description: Gives access to all Chat-related commands
            default: false
                StaffUtils.Chat.Clear: true
                StaffUtils.Chat.ClearBypass: true
            description: Gives access to clear chat
            default: false
            default: false
            description: Gives access to bypass chat clear
            default: false
            description: Gives access to all Player-related commands
    Method which prints out false at the end
    Code (Text):
    public void clearChat() {
            for (Player p : Bukkit.getOnlinePlayers()) {
                if (p.hasPermission("StaffUtils.Chat.ClearBypass") || p.isOp()){
                    p.sendMessage(Api.colour(" &6&l<!> Chat has been cleared. Since you have sufficient permission, chat has not been cleared for you."));
                } else if (!p.hasPermission("StaffUtils.Chat.ClearBypass")) {
                    for (int i = 0; i < 100; i++) {
                    p.sendMessage(Api.colour(" &6&l<!> Chat has been cleared!"));
                p.sendMessage("" + p.hasPermission("StaffUtils.Chat.ClearBypass"));
  2. under StaffUtils.* change to it default: op instead of default: false
  3. You dont need the || p.isOp() and instead of doing else if no permission just use else { } it will do the same thig.
  4. Permission defaults:
    - true: Everyone
    - not_op: Only non-operators.
    - op: Operators.
    - false: Only through console and permissions plugins.

    You use false, thus OP is not allowed.
  5. Thanks!! Changed and worked!

    Yeah I know, just added those in for insurance that it wasn't the method that was the problem.

    I see, thanks a lot!! Am enlightened today and shall not make the same mistake.
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.