Solved Events failing to register

Discussion in 'Plugin Development' started by Blir, Jul 28, 2013.

Thread Status:
Not open for further replies.
  1. Offline


    I'm working on a cross-server chat plugin that has a soft dependency on Essentials so that it can show AFK notifications cross-server as well as chat. This soft dependency seems to cause my events to fail to register when the plugin is run on a server that doesn't have Essentials:

    18:06:10 [SEVERE] [ConvoSync] Plugin ConvoSync vBeta 1.1 has failed to register
    events for class com.minepop.servegame.convosync.ConvoSync because com/earth2me/
    essentials/Essentials does not exist.

    Here's the source code:

    I don't understand why the soft dependency on Essentials is breaking my events because none of my listener methods have any dependency on Essentials. Essentials doesn't have a nice way to listen for players' AFK status changing, so I made a new thread to check if anything has changed every 250 ms (this thread is only started if Essentials is enabled and my plugin connects to it properly).
  2. Offline


    You are at least using Essentials in line 40 (setting it to null initially):

    private Essentials ess;

    However, I would move everything related to Essentials (so you don't have to import com.earth2me.essentials.Essentials there) outside of your class, into another class and only access that other class, after you have checked (in your onEnable) that Essentials is present on the server.

    Don't exactly know that your error is saying, but this would at least prevent ClassNotFoundExceptions..
  3. Offline


    Thanks, it works now! I still don't understand why it happened though, because I have another plugin with a soft dependency on Vault with all of the stuff in the same class, but it still works when Vault isn't present.
Thread Status:
Not open for further replies.

Share This Page