When ever I try to run my plugin on a sever i get an error.
[Sponge/sponge]: Could not pass FMLInitializationEvent to Plugin
I looked at my listener and I dont think i did anything wrong.
When ever I try to run my plugin on a sever i get an error.
[Sponge/sponge]: Could not pass FMLInitializationEvent to Plugin
I looked at my listener and I dont think i did anything wrong.
It’s rather hard for anyone to try to help you if you don’t give us anything to work with.
@Listener
public void onInitialization(GameInitializationEvent event) {
getLogger().info(PluginInfo.NAME + " loading…");
// Utils.readMutes();
Utils.startAFKService();
// Register all commands.
CommandLoader.registerCommands();
getGame().getEventManager().registerListeners(this, new SignChangeListener());
getGame().getEventManager().registerListeners(this, new PlayerJoinListener());
getGame().getEventManager().registerListeners(this, new MessageSinkListener());
getGame().getEventManager().registerListeners(this, new PlayerClickListener());
getGame().getEventManager().registerListeners(this, new PlayerInteractListener());
getGame().getEventManager().registerListeners(this, new PlayerMoveListener());
getGame().getEventManager().registerListeners(this, new PlayerDeathListener());
getGame().getEventManager().registerListeners(this, new TPAListener());
getGame().getEventManager().registerListeners(this, new MailListener());
getGame().getEventManager().registerListeners(this, new PlayerDisconnectListener());
getGame().getEventManager().registerListeners(this, new WeatherChangeListener());
getGame().getEventManager().registerListeners(this, new BlacklistListener());
getGame().getEventManager().registerListeners(this, new CommandListener());
getGame().getEventManager().registerListeners(this, new ChangeBlockListener());
getGame().getEventManager().registerListeners(this, new PlayerDamageListener());
getGame().getEventManager().registerListeners(this, new CommandSentListener());
}
[Sponge/sponge]: Could not pass FMLInitializationEvent to Plugin{id=Monster-Essentials, name=Monster-Essentials, version=1.0}
java.lang.NullPointerException
at monster.messentials.MessentialsCore.onInitialization(MessentialsCore.java:119) ~[MessentialsCore.class:?]
at org.spongepowered.common.event.listener.GameInitializationEventListener_MessentialsCore_onInitialization1.handle(Unknown Source) ~[?:?]
at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:86) ~[RegisteredListener.class:1.8.9-1763-3.1.0-BETA-1181]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:238) [SpongeModEventManager.class:1.8.9-1763-3.1.0-BETA-1181]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:282) [SpongeModEventManager.class:1.8.9-1763-3.1.0-BETA-1181]
at org.spongepowered.mod.SpongeMod.onStateEvent(SpongeMod.java:184) [SpongeMod.class:1.8.9-1763-3.1.0-BETA-1181]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.8.9.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) [LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) [LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.8.9.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.8.9.jar:?]
at net.minecraftforge.fml.common.LoadController.redirect$onPost$0(LoadController.java:53) [LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:737) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:97) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:325) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:205) [ko.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:441) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
NPE at line 119. Suggest you look at your listeners.
I don’t want to make assumptions, but an NPE is the most common error, and if you’re learning Java through plugins, I’d suggest against it. Check out the official Java tutorials (http://docs.oracle.com/javase/tutorial/), and attempt a smaller project without using outside APIs.
If you do know Java, then for goodness sake learn to read stacktraces.
Yeah, so in this we have a NullPointerException, which means something wasn’t initialized but you tried to use it anyways (i.e. a reference variable without assigning it a reference (i.e. =
or new
), and it tells you where, in by package, class, and method, and the file:lineNumber (as I bolded).