Permissions Support

Discussion in 'Plugin Development' started by Astrognome, Feb 4, 2011.

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

    Astrognome

    I am trying to write a plugin. I am a bit of a java noob. Could somone do an in depth tutorial on how to integrate Nikko's Permissions? Preferably a video tutorial, but a written one would be fine.
     
  2. Offline

    Plague

    For me the best way is to look at working code, so pick one :)
     
  3. Offline

    gnftoxic

    Hi Astrognome, I could provide a video tutorial on how to use the "Permissions" plugin for you. It's rather simple, actually. Nikko provides some documentation on his plugin thread how to build in Permissions, however I can show you a good way (maybe the best) to use and allow the plugin to work with or without Permissions.

    Though, for now, I'm heading to Zombies on Black Ops, I'll record a video later, probably in an hour. :)
     
  4. Offline

    Astrognome

    Thanks, toxic! I couldn't quite figure out the code on Nikko's page.
    --- merged: Feb 5, 2011 4:06 AM ---
    Yheah. I tried to reverse engineer a plugin or two, but all the other other code blended in made it a bit confusing.
     
  5. Offline

    fullwall

    Code:
    public class PermissionsClass{
        private static Permissions permissionsPlugin;
        private static boolean permissionsEnabled = false;
    
        public static void initialize(Server server) {
            Plugin test = server.getPluginManager().getPlugin("Permissions");
            if (test != null) {
                Logger log = Logger.getLogger("Minecraft");
                permissionsPlugin = (Permissions) test;
                permissionsEnabled = true;
                log.log(Level.INFO, " Permissions enabled.");
            } else {
                Logger log = Logger.getLogger("Minecraft");
                log.log(Level.SEVERE,
                        " Nijikokuns' Permissions plugin isn't loaded, there are no restrictions on commands.");
            }
        }
    
    
        private static boolean permission(Player player, String string) {
            return Permissions.Security.permission(player, string);
        }
    
        public static boolean enable(Player player) {
            if (permissionsEnabled) {
                return permission(player, "permission.nodes.here");
            }
            return true;
        }
    This is the code I like to reuse
     
  6. Offline

    Astrognome

    Thanks. I think I can figure it out now.
     
  7. Offline

    robhol

    Classifying that as SEVERE is a bit... I don't know.. some owners just don't want to run it. Nice snippet though.
     
  8. Offline

    fullwall

    The level doesn't actually change how the message is displayed :).
     
Thread Status:
Not open for further replies.

Share This Page