MinusKube / SmartInvs

Advanced Inventory API for your Minecraft Bukkit plugins.
https://minuskube.gitbook.io/smartinvs/
Apache License 2.0
263 stars 65 forks source link

i dont understeand #208

Open JustNaka opened 2 years ago

JustNaka commented 2 years ago

i do this in main class in onenable

public static InventoryManager invManager;
invManager = new InventoryManager(this);
invManager.init();

this in gui class

public static final SmartInventory gui = SmartInventory.builder()
          .id("votesgui")
          .provider(new VoteGUI())
          .size(6, 9)
          .manager(MAINCLASS.invManager)
          .title(config.getString("votes_gui.title"))
          .closeable(false)
          .build();
 @Override         
 public void init(Player player, InventoryContents contents) {}   
 @Override
  public void update(Player player, InventoryContents contents) {}       

but give me this error

java.lang.NoClassDefFoundError: fr/minuskube/inv/content/InventoryProvider
        at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:1012) ~[?:?]
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:200) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:110) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:105) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
        at com.justnaka.mcitavotes.MCITAvotes.registerEvents(MCITAvotes.java:79) ~[MCITAvotes-1.0.jar:?]
        at com.justnaka.mcitavotes.MCITAvotes.onEnable(MCITAvotes.java:45) ~[MCITAvotes-1.0.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:564) ~[pufferfish-1.18.1.jar:git-Pufferfish-38]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:478) ~[pufferfish-1.18.1.jar:git-Pufferfish-38]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:729) ~[pufferfish-1.18.1.jar:git-Pufferfish-38]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:505) ~[pufferfish-1.18.1.jar:git-Pufferfish-38]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:315) ~[pufferfish-1.18.1.jar:git-Pufferfish-38]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1204) ~[pufferfish-1.18.1.jar:git-Pufferfish-38]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:319) ~[pufferfish-1.18.1.jar:git-Pufferfish-38]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: fr.minuskube.inv.content.InventoryProvider
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:153) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:105) ~[pufferfish-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
        ... 21 more
ololjvNek commented 2 years ago

Firstly read java docs.

java.lang.NoClassDefFoundError that exception says: Can't find classes loaded in/on plugin/server so you just need to extract SmartInvs into your plugin

JustNaka commented 2 years ago

in order not to import the SmartInvs plugin externally I imported the jar in the pom.xml in this way. what else should i do?

<dependency>
            <groupId>fr.minuskube.inv</groupId>
            <artifactId>smart-invs</artifactId>
            <version>1.2.7</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/jars/SmartInvs-1.2.7.jar</systemPath>
        </dependency>
Leguan16 commented 2 years ago

have you already tried it with the plugin in the plugins folder of the server?

lightPlugins commented 2 years ago

If you use Intellij, go to Project Structure -> Artifacts -> Available Elements -> Right Click -> Extract Into Output Root

That will solve your problem :)