Instance class

Discussion in 'Plugin Development' started by Mathie, Feb 6, 2016.

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

    Mathie

    Hello,
    I try to instantiate a class but I have a strange error.

    My class:

    Code:
    public class test {
       
        private Plugin plugin;
    
        public test(Plugin plugin) {
            this.plugin = plugin;
        }
    }
    In my main:

    Code:
    Test test = new test(this);
    Error:

    I don't understand :/
    Thank you in advance !
     
  2. Offline

    N00BHUN73R

    Your class, test, takes the parameter (plugin)
    Now your main class is not Plugin.

    You must change Plugin plugin
    to YourMainClass plugin

    and

    private Plugin plugin; -> private MainClassHere plugin;
     
  3. Offline

    MaTaMoR_

    If his main class extends JavaPlugin it should work.
     
Thread Status:
Not open for further replies.

Share This Page