How to import permissionsEx into Eclipse? - Please Help

Discussion in 'Plugin Development' started by Strychnos27, Jul 8, 2012.

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

    Strychnos27

    Hello everyone! Well, now that you've seen my title, you probably have a hint of what I'm asking for help on.
    Well, heres the story...

    I currently am an Owner on a pretty popular server, but I don't have many staff, as I don't simply promote everyone on the spot.
    So, one main thing about my server, which is running PermissionsEx for a permissions plugin, is that people post on server threads to obtain Member. As of now, I am the only one promoting these people, and I have promoted over 400 people by hand and I've been starting to think about having my other staff Member which is a very low rank do some of the promoting as well.

    So, with the Java knowledge that I have, I decided I would make a plugin, a very simple plugin, where my staff can simply type for example: "/member name" and be done with it, and restrict the command to only moving people to Member rank. The reason I don't want to give them group set permissions is because I'm not sure what my staff be doing with it...

    So far, I have pulled up the PermissionsEx API code, which is in a website. But I don't know how to import the API and PermissionsEx compatibility in general.

    I know how to import the basic JavaPlugin from Bukkit with the import feature, but I don't know how to import PermissionsEx.

    Could anyone please explain to me what external Jar to add to the plugin files and what import method to use? Please answer me as soon as possible, if possible.


    Side note:
    Program: Eclipse
     
  2. Offline

    xGhOsTkiLLeRx

    Download the regular PermissionsEx.jar
    Then like this:

    Code:
    import ru.tehkode.permissions.PermissionUser;
    import ru.tehkode.permissions.PermissionGroup;
    import ru.tehkode.permissions.bukkit.PermissionsEx;
     
     
     
    PermissionUser user = PermissionsEx.getUser(player);
    // Only first group
    PermissionGroup group = user.getGroups(world)[0];
    // Get the prefix from the pex config
    groupPrefix = Actions.replaceThings(group.getPrefix(world));
    // Get the suffix from the pex config
    groupSuffix = Actions.replaceThings(group.getSuffix(world));
    Hope it helps!
     
  3. Offline

    Strychnos27

    Wow! This was very helpful for me! Thank you very much, I really, really appreciate it!
     
  4. Offline

    xGhOsTkiLLeRx

    https://github.com/PEXPlugins/PermissionsEx/wiki/Native-API-example
    Even more examples.
    Normally you should check if PermissionsEx is enabled on the server, otherwise it throws errors ;)

    Code:
    Plugin pexPlugin = this.getServer().getPluginManager().getPlugin("PermissionsEx");
    if (pexPlugin != null) {
        pex = true;
        this.getServer().getLogger().info("[ColorMe] Found PermissionsEx. Will use it for groups!");
    }
     
    ...
    if (plugin.pex) {
        // get stuff
    }
     
  5. Offline

    iorunner

    I am using eclipse juno. I downloaded the PermissionsEx.jar. I added it to the referenced Libraries folder of my plugin. I added the three usings above to the top of my class. The import ru can not be resolved. What step have I missed?
     
Thread Status:
Not open for further replies.

Share This Page