Wowza! Errors java.lang.NullPointerException

  • Hi Guys,


    I'm trying to write my first plugin, It's literally just a framework at the moment. I added my jar file to a created directory "plugins" in the server root and then typed in reloadplugins into the in-game console.


    I got a message saying that it had failed (or something along those lines) and then on the server log I got tons of errors (as in repeatedly until I restarted the server).


    From that can anyone see what I was doing wrong? I Appreciate you may need more info!

  • I can most likely help with your problem but I would need to see your "onMessageReceived" method and please also indicate which one line number 99 is :)


    you could send me the whole code in pm if you wish :)

  • The "plugin" is simply:

    With of course the yml file

  • Yeah looking inside my jar file I can also see the api jar files, which I'm sure is not right!


    To get my code to compile (using NetBeans) I right clicked on my project name, selected properties, went to the libraries option and added the PluginAPI jar with the add JAR/folder option.


    Which allow me to compile, as without it moans about the imports not working (i.e. net.risingworld.api.... )


    To create my jar I right clicked on my project and selected "build"


    It's been a while since I wrote any code, and I'm new to NetBeans (old Eclipse guy here).


    This is my attempt at almost a "hello world" plugin.

  • oh what are you using to create the plugin? netbeans IDE?


    yes your plugin code looks good so the error is somewhere in the compilation or the files you have included in the jar maybe :/

  • did you maybe put the api jar file in the src folder in your project?

  • yeah that shouldn't be there, just put the api jar on your desktop or some random folder and then just include it as a library as you did before already.


    see here: Getting started

  • Brilliant, thanks Minotorious, I'll give that a shot. I was trying to be "organized" and keeping everything together.


    I assume that by including the api in my source folder there was a conflict as to which class files to use, as in "my" copy of the api classes or the actual api classes on the server?


    Edit: OK I've moved the api jar and recompiled, my new jar no longer contains the api classes :)


    It's getting late so I will upload this and test it on the server tomorrow, and I'll post an update on how it goes.

  • Agh! Still no joy. :(


    So here is my MedievalRealms plugin folder which contains my MedievalRealms.jar plugin file show in the following server tree.



    Here is my YML file called plugin.yml which lies in the resources folder within my packages src


    Code
    name: MedievalRealms
    main: org.yahwho.medievalrealms.MedievalRealms
    version: 1.0.0
    author: Yahwho
    team: Medieval Realms
    description: "Medieval Realms Server Plugin"
    license: MIT
    website: https://medievalrealms.co.uk


    Here is my java file



    I've also attached my compiled MedievalRealms.jar file.




    On my desktop I've extracted my MedievalRealms.jar file alongside an extracted copy of ConnectToTS.jar


    I've gone though all the files and structure and it look as far as I can tell identical?


    But when I start my server with MedievalRealms.jar inside my servers root/plugins/MedievalRealms/ directory diddly squat happens?


    If I type in reloadplugins in my in game console I get: WARNING: ERROR OCCURRED WHILST RELOADING THE PLUGINS!


    Okay, so as a test, I removed my plugins folder and restarted server and typed in reloadplugins again, same thing happens WARNING: ERROR OCCURRED WHILST RELOADING THE PLUGINS! along with the (looping) error that I get in the log




    note: I have not tried installing any 3rd party plugin incl. the ConnectToTS.jar one


    I'm trying this now - yep that doesn't do anything either entering /ts into chat comes up with "unknown command"


    The file ConnectToTS.jar lies in this directory D:\Rising World\server_0.9.2.1\plugins\ConnetToTS\


  • Hmm... I tried the plugin, but I wasn't able to reproduce this error 8| The plugin code looks fine btw. The error seems to be happening inside the game, although I'm not sure if it really causes this issue (or if this error just occurs because the plugin reload went wrong)... can you maybe post the whole server log here? :)

  • Thanks for the log! Apparently the plugin API does not get loaded properly. Is the setting plugins_enabled in the server.properties maybe set to false? It looks like this results in some errors once the "reloadplugins" command is used 8|

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!