fengberd / FDevTools

The first devtools plugin for Nukkit!
GNU General Public License v3.0
25 stars 7 forks source link

Could not load plugin when composed into JAR #9

Closed quartzsaber closed 6 years ago

quartzsaber commented 6 years ago

If I load the plugin via FDevTools, it loads. But if I compose it into jar with makeplugin and load that jar instead, nukkit says [CRITICAL] Could not load plugin 'MyPlugin' and provides no further information.

My directory structure:

MyPlugin_src/
├ plugin.yml
└ src/
    └ com/example/myplugin
        └ Main.java

Content of plugin.yml:

name: MyPlugin
main: com.example.myplugin.Main
version: "1.0.0"
api: ["1.0.0"]
author: min050820@gmail.com
description: Keep EXP even after death!

I wonder what's wrong. My plugin works as expected in source format.

fengberd commented 6 years ago

I can't find any mistakes,is this [CRITICAL] message send by Nukkit or FDT?

Best Regards, FENGberd

On Fri, Jan 5, 2018 at 9:24 PM, minary notifications@github.com wrote:

If I load the plugin via FDevTools, it loads. But if I compose it into jar with makeplugin and load that jar instead, nukkit says [CRITICAL] Could not load plugin 'MyPlugin' and provides no further information.

My directory structure:

├ plugin.yml └ src/ └ com/example/myplugin └ Main.java

Content of plugin.yml:

main: com.example.myplugin.Main version: "1.0.0" api: ["1.0.0"] author: min050820@gmail.com description: Keep EXP even after death!

I wonder what's wrong. My plugin works as expected in source format.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fengberd/FDevTools/issues/9, or mute the thread https://github.com/notifications/unsubscribe-auth/AIGMcbwIj2IrEY7u2f0FaTuW91nYiLNmks5tHiKmgaJpZM4RUcLN .

quartzsaber commented 6 years ago

I believe it's from nukkit since I removed FDT when testing the JAR. I'll post the whole log soon.

quartzsaber commented 6 years ago

Here is the whole log from nukkit. Note that I removed FDT to test my plugin. (So FDT not loading is expected.)

min050820@raspberrypi:~/nukkit$ java -jar nukkit.jar
Using log level 'INFO'
17:42:10 [INFO] Loading nukkit.yml...
17:42:10 [INFO] Loading server properties...
17:42:10 [INFO] Selected English (eng) as the base language
17:42:10 [INFO] Starting Minecraft: PE server version v1.2.2
17:42:11 [INFO] Opening server on 0.0.0.0:19132
17:42:11 [INFO] This server is running Nukkit version 1.0dev "??(Apple)?(Pie)" (API 1.0.0)
17:42:11 [INFO] Nukkit is distributed under the LGPL License
17:42:14 [INFO] Loading recipes...
17:42:14 [INFO] Loaded 415 recipes.
17:42:14 [INFO] Successfully loaded 0 resource packs
17:42:14 [INFO] Loading MyPlugin v1.0.0
17:42:14 [CRITICAL] Could not load plugin 'MyPlugin'
17:42:15 [INFO] Preparing level "world"
17:42:15 [INFO] Starting GS4 status listener
17:42:15 [INFO] Setting query port to 19132
17:42:15 [INFO] Query is running on 0.0.0.0:19132
17:42:15 [INFO] Default game type: Survival Mode
17:42:15 [INFO] Done (6.179s)! For help, type "help" or "?"
> stop
17:42:21 [INFO] [CONSOLE: Stopping the server]
17:42:21 [INFO] Unloading level "world"
17:42:21 [INFO] Stopping other threads

Should I go to nukkit issue tracker then?

quartzsaber commented 6 years ago

Okay, now I know what happened. I opened the JAR file, and it contained no class file. At all!

I believe it happens when there are multiple plugins loaded by FDT. When I removed my helloworld plugin (which was also loaded by FDT), /makeplugin correctly made JAR file with class files. Also, I should note that I put multiple classes in one .java file, in case it has something to do with this issue.

fengberd commented 6 years ago

Fine,glad to hear you've solved it.