Null on register

Discussion in 'Plugin Development' started by DevManABCD, Nov 15, 2014.

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

    DevManABCD

    When i want to define my Config class i get this:


    Code:
    [SIZE=12px][FONT=Open Sans][COLOR=#f5f5f5][15:04:10] [Server thread/WARN]: java.lang.NullPointerException[/COLOR][/FONT][/SIZE]
    [SIZE=12px][FONT=Open Sans][COLOR=#f5f5f5][15:04:10] [Server thread/WARN]: at pl.diverse.opentools.Managers.Config.<init>(Config.java:19)[/COLOR][/FONT][/SIZE]
    [SIZE=12px][FONT=Open Sans][COLOR=#f5f5f5][15:04:10] [Server thread/WARN]: at pl.diverse.opentools.OpenTools.load(OpenTools.java:65)[/COLOR][/FONT][/SIZE]
    Line 65:

    this.config = new Config(plugin);

    Config, line: 19:

    public File dir = this.plugin.getDataFolder();

    I think its because of plugin null, but plugin is defined by:

    protected static OpenTools plugin;

    public void onEnable() {
    plugin = this;
    load();
    registerCommands();
    registerEvents();
    scheduler();
    }
     
  2. Offline

    teej107

    Don't refer to "this" or any of the object outside of object methods and constructors.
     
Thread Status:
Not open for further replies.

Share This Page