Extra TNT Controls: need help with Java timer function

Discussion in 'WIP and Development Status' started by Flyhighguy, Jun 7, 2011.

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


    I am writing a plugin that allows users to change the delay on TNT. I have all the code worked out, I just need to figure out how to use the java.utils.Timer method thing. Could someone please post some code or link me to something paticularly helpful as all the resources I've looked at aren't any help. Thank you!
  2. Offline


    OK first always look at the javadoc: http://download.oracle.com/javase/6/docs/api/java/util/Timer.html

    And here is some example code how to use it:
    Timer t = new Timer();
    long delay = 10000; //delay of 10 seconds (in milliseconds)
    t.schedule(new TimerTask() {
        public void run() {
            //do whatever you want here
    }, delay);
    You can also create an own class which extends TimerTask and use it as the first parameter.

    Hope this helps.
  3. Offline


    Thanks, I however I decided to try and use the server sheduler, as you probably know. Anyway, I might try this again as I am having problems with the other method...
Thread Status:
Not open for further replies.

Share This Page