Couple Of Questions. Yes? No? Yes.

Discussion in 'Plugin Development' started by RazorFlint, May 13, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    RazorFlint

    Just to clear a few things up.
    I only started to learn Programming a couple of weeks back and would like to know a few things about plugins.

    How Do i make my plugin's use Permissions?

    How Do you "fix" A plugin after a new build has come out?

    That's Pretty much it...
    Thank's :)
     
  2. Offline

    mxE333xm

    See the Tutorial ;)
    Basically add the Permissions Library to your buildpath, import it, and get the PermissionHandler Instance ;) There you can check out, if a player has a permission to do sth.

    In the best you haven't anything to do ;) Only if an Interface you are using has changed, you have to change the code to meet to the new interface.
     
  3. Offline

    Sammy

    Use my code:
    Code:
        public PermissionHandler Permissions;
        private boolean UsePermissions;
    Code:
        private void setupPermissions() {
            Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
    
            if (this.Permissions == null) {
                if (test != null) {
                    UsePermissions = true;
                    this.Permissions = ((Permissions) test).getHandler();
                    System.out.println("Permissions is enable for BrokenFingers.");
                } else {
                    log.info("Permission system not detected, defaulting to OP");
                    UsePermissions = false;
                }
            }
        }
    Code:
        public boolean casUseTriggerCmds(Player p) {
            if (UsePermissions) {
                return this.Permissions.has(p, "triggercmds");
            }
            return p.isOp();
        }
    Add setupPermissions() in the method onEnable()
    And on the command do this:
    Code:
             if (!plugin.casUseTriggerCmds(p)) {
                    p.sendMessage(ChatColor.RED + "You don't have permisson to use that command");
                    return true;
                }
    Hope it helps
     
  4. Offline

    RazorFlint

    Thank's :D

    Thank's For helping me out, and nicley displayed thanks. :D

    Oh So were do i put this (Im Still A Noob) :/
    Code:
             if (!plugin.casUseTriggerCmds(p)) {
                    p.sendMessage(ChatColor.RED + "You don't have permisson to use that command");
                    return true;
                }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
Thread Status:
Not open for further replies.

Share This Page