Referencing Other Classes in an Enum Class

Discussion in 'Plugin Development' started by Acer_Mortem, Apr 20, 2014.

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

    Acer_Mortem

    I've created an Enum class to manage various parts of my plugin, and from the Enum class, I launch a method found in my main class Unfortunately, I cannot access my main class to launch this method. Does someone know how to make a reference of another class in an Enum class?

    Example:

    (In Enum Class)
    Code:
        public static NewSkillsMain plugin = NewSkillsMain.getNewSkills();
    (In Main Classs)
    Code:
        public static NewSkillsMain getNewSkills(){
            return this;
        }
    The problem is: I keep getting an error on the "this," as "this" is not static, and hence cannot be used in a static context. Does anyone know a way around using "this"?
     
  2. Offline

    Garris0n

    Have a static variable and set it to the instance in the onEnable...
     
    Acer_Mortem likes this.
  3. Offline

    Acer_Mortem

    ... <3
     
  4. Offline

    ZeusAllMighty11

    Why are you referencing your main class in an enum?
     
    xTigerRebornx likes this.
  5. Offline

    Acer_Mortem


    To access some other methods in various parts of my plugin.
     
Thread Status:
Not open for further replies.

Share This Page