LuckPerms

LuckPerms

41.4k Downloads

NoClassDefFoundError by ClassNotFoundException for LuckPermsApiProvider

DasBabyPixel opened this issue ยท 5 comments

commented

I'm the Dev of our LobbySystem. Please keep in mind that I use for you probably strange methods of loading my permissions, just haven't found and other way to load my permissions, cause I load my permissions dynamically and don't ask "hasPermission(permission)" with Strings....

Field pluginField = LuckPermsApiProvider.class.getDeclaredField("plugin");
pluginField.setAccessible(true);
LuckPermsPlugin lpplugin = (LuckPermsPlugin) 		pluginField.get(LuckPerms.getApi());
PermissionRegistry registry = lpplugin.getPermissionRegistry();
for (String permission : api.getKnownPermissions()) {
	registry.offer(permission);
}

Sorry, I dont understand these **** github editors :P

Using CloudNet 3.2 btw.
Thanks for your good plugin and for any help!

05.02 16:17:28.877] INFO: [lobby-1] [16:16:58 ERROR]: Error occurred while enabling LobbySystem v1.0 (Is it up to date?)
[05.02 16:17:28.877] INFO: [lobby-1] java.lang.NoClassDefFoundError: me/lucko/luckperms/common/api/LuckPermsApiProvider
[05.02 16:17:28.877] INFO: [lobby-1]    at eu.darkcube.system.commandapi.CommandAPI.enable(CommandAPI.java:63) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at eu.darkcube.system.lobbysystem.Lobby.onEnable(Lobby.java:63) ~[?:?]
[05.02 16:17:28.877] INFO: [lobby-1]    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot.jar:git-Spigot-db6de12-18fbb24]
[05.02 16:17:28.877] INFO: [lobby-1]    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
[05.02 16:17:28.877] INFO: [lobby-1] Caused by: java.lang.ClassNotFoundException: me.lucko.luckperms.common.api.LuckPermsApiProvider
[05.02 16:17:28.877] INFO: [lobby-1]    at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_232]
[05.02 16:17:28.877] INFO: [lobby-1]    at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_232]
[05.02 16:17:28.877] INFO: [lobby-1]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) ~[?:1.8.0_232]
[05.02 16:17:28.877] INFO: [lobby-1]    at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_232]
[05.02 16:17:28.877] INFO: [lobby-1]    ... 13 more
commented

shouldn't be a softdepend if you require LP to be installed,
But, beyond that, need more information about your setup; logs? lp version?

commented

Why on earh are you loading the API like that?!?

Get it like described here: https://github.com/lucko/LuckPerms/wiki/Developer-API#obtaining-an-instance-of-the-api

And electronicboy is talking about the LP API version vs the LP plugin version.
Both need to match. So if you use LP 5.0.xxx you need the API 5.0

commented

either building against a different version of LP than you have installed, or, probably more likely, you didn't setup your dependency info in plugin.yml, and so your plugin is enabling after LP does

commented

@electronicboy I indeed have setup everything correctly

main: mainclass...
version: 1.0
name: LobbySystem
author: DasBabyPixel
website: website...

softdepend: [LuckPerms]

commands:
lobby:

commented

Instead of integrating directly with the LuckPerms internals, just register your permissions with Bukkit! This means all permission plugins (including LuckPerms) can pick up your data. :)

You can do this...

  1. In your plugin.yml file, as explained here: https://bukkit.gamepedia.com/Plugin_YAML (preferred)

or

  1. Programatically:
for (String permission : api.getKnownPermissions()) {
    try {
        Bukkit.getPluginManager().addPermission(new Permission(permission));
    } catch (IllegalArgumentException e) {
        // ignore: thrown if permission already registered
    }
}