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

Need to add 30 sec save

Comments in 'Plugin Development' started by Driesboy1, Apr 17, 2016.

  1. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy
    Hi i need to add 30 sec nopvp
    and NOPVP is 30
    but i dont now how to add this
    i have try this but now i can fight 1x after 30 sec
    if ($a->GAME_STATE == 1 and $this->time % $this->pg->configs['NOPVP'] = 0)
    $ev->setCancelled();
    Code:
    public function onDamage(EntityDamageEvent $ev)
         {
             $this->time++;
             if ($ev->getCause() == 0b100 or $ev->getCause() == 0b1100 or $ev->getCause() == 0b11) {
                 $ev->setCancelled();
                 return;
             }
             foreach ($this->pg->arenas as $a) {
                 if ($ev->getEntity() instanceof Player) {
                     if ($a->inArena($ev->getEntity()->getName())) {
                         if ($ev->getCause() == 0b1111 and $this->pg->configs['starvation_can_damage_inArena_players'] == false)
                              $ev->setCancelled();
                          if ($a->GAME_STATE == 0)
                              $ev->setCancelled();
                         if ($a->GAME_STATE == 1 and $this->time % $this->pg->configs['NOPVP'] = 0)
                             $ev->setCancelled();
                          break;
                      }
                  }
  2. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy
    GAME_STATE == 1 is game started
  3. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy
  4. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy
    is the github file
  5. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    Maybe look into the code of TimeCommander - LDX, because that has a timer function :)

Share This Page

Advertisement