Hey could anyone teach me how could i parse the plugin.yml file and extract it to a .txt file or whatever that i could use to get an inputstream. Or any other way i could get a list of permissions Thanks !
getResource(String fileName) Read more about this here: https://hub.spigotmc.org/javadocs/b...JavaPlugin.html#getResource(java.lang.String)
Yea, I need a list or an array list of every permission define in the plugin.yml but i'm not creating a plugin, so i can't access the craftbukkit.jar location directly, i need to set my own path to the .jar file of the plugins, and get the permissions out of them.
@Nic2555 Iterate through the plugins that are enabled Get the plugin of the current iteration's description, and get the permissions from that. (plugin.getDescription().getPermissions()), which returns a List<Permission>. You can then iterate through that and get the name, children, etc. Of course, the plugin has to have to permissions registered in the plugin.yml for this to work.
I still can use the tools bukkit API is providing. I just need to understand how they works so i can use them correctly. Thanks for your reply. How could i iterate through enabled plugins if i'm not starting a server in anyways ? Can i , like, create a new plugin from the .jar and then use it to access the permission like the craftbukkit.jar would do ?
I'll post how to do it with or without CB since I'm still confused whether this is an actual plugin like they usually are or not. Without CB: Loop through the jar file contents. Treat it like a zip file. http://stackoverflow.com/questions/1429172/how-do-i-list-the-files-inside-a-jar-file Use a library from here: http://yaml.org/ for easy read from YAML files. I think Bukkit uses Snake YAML. With CB: http://infernaldevelopers.com/docs/Bukkit/1.7/org/bukkit/plugin/PluginManager.html#getPlugins() http://infernaldevelopers.com/docs/Bukkit/1.7/org/bukkit/plugin/Plugin.html#getDescription() http://infernaldevelopers.com/docs/Bukkit/1.7/org/bukkit/plugin/PluginDescriptionFile.html This applies to both options: Permissions don't have to be registered in the plugin.yml so if their not, you're kind of SOL.
Thanks, i'll work with that. I've allready got access to the plugin.yml using snakeyaml. But since there's plugin.yml file without permissions, I tought there could be a better way to access them. Anyways thanks for all the help. Hope it will work. If you are still interress in my project, i'm trying to make an automatic permission maker. Just to simplified the hard task of making permissions. Wish you a pretty good day ! - Nic I'm not using craftbukkit jar. It's an external application. it's not a plugin so i can't use the craftbukkit.jar sources like this.getClass.getPlugin.~
it's not a server. it's an application, a java application. i'm not starting any kind of minecraft server, i just need to import each permission from the plugin.jar files.
i need to show a list of every permission of a selected plugins. yea i allready got all this. but since there's plugin.yml whitout permissions, like Essentials, they got to be stored somewhere so i need to access these. And bukkit is allready doing it, i just wanted to know if there's way i could access them whitout running a server. EDIT by Timtower: merged posts
@Nic2555 No, plugins don't need to register permissions to use them, therefore there is no real way to accomplish this.
@Nic2555 Would be annoying and too much in my opinion. But you would have to read the class file and look for hasPermission keyword.
@Nic2555 Decompile all of the code of the plugin, then look for string literals that look like permissions.
actually did. Not a complete solution, but i was able to get the permissions, and manage to put the children under the parents. Lots of weird looking code, pretty ugly but working. Thanks for all of you guys, hope I can release that soon ! Have a good day ! -Nic