Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating a Timer

Comments in 'Plugin Development' started by WitherTube, Feb 24, 2016.

  1. WitherTube
    Offline

    WitherTube New Member

    Joined:
    Dec 21, 2015
    Posts:
    44
    Minecraft User:
    Wither_Tube
    Hey :D
    i want to add a Timer for my minigame ^^ which start at 15:00 minutes and ends at 0:00 with task. I want to add the BlockTouchEvent . If a the first player touch a specifical block his name will be display in the chat and the Time will be reduce to 3:00 minutes. At that moment everybody have 3:00 minutes to reach the goal but only the second and third Player will be display :D. I hope you understood that what i wrote ^^.
    Erkam likes this.
  2. Erkam
    Offline

    Erkam New Member

    Joined:
    Dec 13, 2015
    Posts:
    1
    Minecraft User:
    Erkam1
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    This, in my opinion, is more a Plugin Request than a Question. To be honest, you should be able to do the stuff with the Block yourself. That means, you need a Timer. That means, go ahead and use the search bar before posting a new thread.
  4. musaichi
    Offline

    musaichi New Member

    Joined:
    Mar 2, 2015
    Posts:
    33
    Minecraft User:
    musaichi
    Try to use CallBackTask.
    PHP:
    function onEnable(){
    $this->minute 15;
    }
    function 
    onTouch(BlockTouchEvent $e){
    $this->getServer()->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this"scheduler"]), 1200); //1200 = 20*60
    }
    function 
    scheduler(){
    $this->minute--; //timer start
    }
    This is example.have fun!
    WitherTube and Skullex like this.
  5. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Try to use the search bar...
    applqpak likes this.
  6. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    CallBack task is deprecated...
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Don't use CallbackTask. It is deprecated, and will probably get removed in the new API.
    WitherTube likes this.
  8. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Use a delayed or repeating task, if you want the time to be available whilst your 'timer' is running then I'd use a repeating task as you can get the task to track how long it's been running. I'd recommend using a delayed task if you only want to cancel events as you can easily manage it if you know what your doing.
    Skullex likes this.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Or just schedule your same task after every delay.
  10. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    And for InteractEvent the search bar is still waiting for you
    And if you want to learn how to sutract time from your timer, go learn coding, sorry

Share This Page

Advertisement