Non static Countdown Help

Discussion in 'Plugin Development' started by Ant_, Jul 22, 2015.

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

    Ant_

    Hey, I am having a hard time with my countdown. I'm trying to avoid a static reference because I have been told they are not good to use in plugin development.

    Class I'm trying to reference the method:
    http://hastebin.com/icenodovod.avrasm
    Method Class:
    http://hastebin.com/qilexiyade.avrasm

    It tells me to make it a static reference, but I would like to know how to do it without static references.

    Any help is appreciated! ^_^
     
  2. Offline

    teej107

  3. Offline

    Anrza

    @Ant_

    new Countdown().startCountdown();

    You need to get an instance of the Countdown class to call a non-static method. You do so by calling the constructor.

    An alternative to doing new Countdown() every time is to have a public static Countdown getInstance() method, which would return a Countdown instance that is set on startup.
     
Thread Status:
Not open for further replies.

Share This Page