Permissions, unable to get working.

Discussion in 'Spigot Plugin Development' started by rubik_cube_man, May 12, 2015.

  1. Hello,
    I'm here because I'm currently having problems developing a "simple" permissions plugin.
    No matter what I do, and how many tutorials I follow, or open source plugins I look into, I cannot find a way that will get permissions working. I have debuged everything in my code, so that I know the correct values are being parsed in, and there are no errors in the console.

    Code (Text):
    PermissionAttachment pa = player.addAttachment(plugin);
                pa.setPermission(permission.replaceAll("-", ""), !permission.startsWith("-"));
    player.recalculatePermissions(); //This line also isn't explained in tutorials... I just found it... o_O
    Even simple permissions like "" doesn't work... everything just continues as though permissions hasn't been effected.

    Thanks Rubik.
  2. Code (Text):

    public void onJoin(PlayerJoinEvent e){
    Player player = e.getPlayer();
    Making a permissions system is hard.. I've struggled too.. to fix mine for like ranks and such I'm using mysql and it will sync.. you should just use mysql and config it to ur server.. it is easy and u can make ur plugins work with it as well.. but bukkit has a perms thing too..

  3. Is that meant to be blank?
  4. Yes.. u can find a MYSQL tut on bukkit.. (RESOURCES) section :)
  5. Yeah, I am currently registering adding perms to players and stuff on the PlayerJoinEvent, problem is that this plugin is the API for my Network, so is like a couple of 100 of classes large, event's like such are located elsewhere and difficult to stick into code snippets. Also, everything is synced across a database. It's the only way when you have 1000+ servers. The reason I'm making a perms plugin is I want to cut down on the size of perms plugins out there, and keep it updated myself.
    The problem was the permissions weren't taking effect, not getting the permission there in the first place. The method runs perfectly fine at the correct times.
  6. @rubik_cube_man use replace instead of replaceAll. - is a meta character, which means it has a special meaning in regular expressions. Replace will replace String literals - in other words, no meta characters, replace things as is.
  7. Yeah, I should probably pay more attention in school. I don't... o_O