Despical / CommandFramework

A lightweight annotation based command system
https://spigotmc.org/resources/89933
GNU General Public License v3.0
23 stars 5 forks source link

Command Framework has not been relocated correctly! #14

Closed KweezyCode closed 3 months ago

KweezyCode commented 3 months ago
java.lang.IllegalStateException: Command Framework has not been relocated correctly!
        at me.despical.commandframework.CommandFramework.checkRelocation(CommandFramework.java:174)
        at me.despical.commandframework.CommandFramework.<init>(CommandFramework.java:139)
        at com.kweezy.kwessentials.KwEssentials.onEnable(KwEssentials.java:10)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:382)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.loadPlugin(CraftServer.java:285)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.enablePlugins(CraftServer.java:267)
        at net.minecraft.server.v1_5_R3.MinecraftServer.j(MinecraftServer.java:310)
        at net.minecraft.server.v1_5_R3.MinecraftServer.e(MinecraftServer.java:289)
        at net.minecraft.server.v1_5_R3.MinecraftServer.a(MinecraftServer.java:249)
        at net.minecraft.server.v1_5_R3.DedicatedServer.init(DedicatedServer.java:160)
        at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:388)
        at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(Unknown Source)

any reasons i should do this? how to supress it?

Despical commented 3 months ago

You need to relocate CommandFramework to avoid conflicts with other plugin JARs. Here is how you can do it using Maven or Gradle:

Maven

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-shade-plugin</artifactId>
   <version>3.4.1</version>
   <executions>
      <execution>
         <phase>package</phase>
         <goals>
            <goal>shade</goal>
         </goals>
         <configuration>
            <relocations>
               <relocation>
                  <pattern>me.despical.commandframework</pattern>
                  <shadedPattern>your.package.here</shadedPattern>
               </relocation>
            </relocations>
         </configuration>
      </execution>
   </executions>
</plugin>


Gradle

plugins {
    id 'com.github.johnrengelman.shadow' version '7.1.2'
}

shadowJar {
    relocate 'me.despical.commandframework', 'your.package.here'
}


Alternative Way Add -Dcommandframework.suppressrelocation=true to your command line. This should only be used for testing purposes and not for production.

KweezyCode commented 3 months ago

thank you