When I try to start my server with my plugin I get this error. I know it has something to do with line 12 but im not sure how to fix it. Main Code Code (Java): package me.artourious.compasslocator; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import me.artourious.compasslocator.PlayerQuitListener; public class Main extends JavaPlugin implements Listener{ private Main plugin; public void onEnable(){ plugin.getServer().getPluginManager().registerEvents(new PlayerQuitListener(this), this); } } Plugin.yml Code (Java): name: CompassLocator version: 1.0 author: Artourious main: me.artourious.compasslocator.Main description: My Plugin
You never set the instance to your Main class. You declared the variable but never assigned a value. In your onEnable() add: plugin = this;
No that would be adding an invalid parameter to the method. I have a feeling you don't understand java. I would suggest you read up on it while programming. public void onEnable() { plugin = this; }
Not sure why you threw the static keyword in there though. I'd also add that since you are registering your listeners to the main class, I assume this is going to be a one class plugin. If that's the case, there is no need to make a plugin instance anyway.