Solved Loading a permissions plugin last and getting own permissions

Discussion in 'Plugin Development' started by ERROR372, Jun 28, 2013.

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

    ERROR372

    For the past few weeks, I have been developing my own permissions plugin (after getting tired of waiting ages for each update on others). I am nearly done with it and about to head into the testing stage, but came to realize two problems, both having to do with the /reload command. Note: my permissions plugin is called GeneralPermissions, and I'll reference it as such.

    After a /reload:

    1) GeneralPermissions is loading before other plugins, thus I am not getting all the permissions the server has when running. I have tried doing "softdepend: [gibberish]" to have it look for that non-existent plugin before enabling, but this doesn't change a thing. I do not want to use depend, because I would like to eventually publish this, and I can't know for sure what plugins other servers will use or in what order they will be enabled.

    This is vital due to handling <permission>.* permissions. I do not add <permission>.* to the player's permissions because I would like admins to be able to single out which permissions you want and don't want. However, an example from my server is the PetCreeper plugin. Using petcreeper.* I can get all the permissions from it. But when I call a /reload, PetCreeper enables after GeneralPermissions. Thus anyone on the server at the time will lose all their PetCreeper permissions.

    How can I ensure that GeneralPermissions enables after every other plugin is enabled?


    2) When I handle re-assigning player permissions, I noticed that the permissions I've listed in my plugin.yml for GeneralPermissions are not being added. I can only assume they are actually added to the Bukkit.getPluginManager().getPermissions() set at the end of the onEnable() method. Due to this, players that are already on are not getting GeneralPermissions's permissions. An example is: permissions.noChestRemove, which prevents players from removing/inserting items in a chest. However, after a /reload, I print out all the permissions the server has listed (for debugging purposes), and permissions.noChestRemove is not on there. So players that have that permission in their file will be able to remove/insert items in chests after a /reload.

    How can I load GeneralPermissions's permissions and then subsequently use them on a /reload?



    Thank you for your time. If any of this is confusing, feel free to ask for clarification.


    EDIT: So I have fixed the above two problems using scheduleSyncDelayedTask, however, I'm aware some servers have many plugins (such as my own), some of which take a little while to boot up. Is there a way I can determine when the /reload is complete and then activate the delayed task?

    EDIT2: Nevermind, seems the scheduleSyncDelayedTask indeed waits for the reload to complete, so this is no problem. Changing thread to solved.
     
Thread Status:
Not open for further replies.

Share This Page