1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Detect the time?

Discussion in 'Development' started by minijaham, Apr 20, 2021.

  1. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Is there an event where it gets the time change or a way to do this?
    I'm trying to make something where a certain thing executes when the time turns back to the morning.

    I couldn't find any useful resources online, and my "solution" to this was very inefficient(repeating task that has checks for the time)

    Thanks,
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    And the time I'm talking about here is the in-game time
     
  3. HeyDeniis_

    HeyDeniis_ Baby Zombie

    Messages:
    137
    hmm Maybe I could use DataPacket SendEvent and check if the packet is SetTimePacket
    PHP:
    public function onSend(DataPacketSendEvent $e){
      if(
    $e->getPacket() instanceof SetTimePacket){
        
    $time $e->getPacket()->time;
      }
    }
     
    minijaham likes this.
  4. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
    PHP:
    $yourlevel->setTime(Level::TIME_DAY);
    Like this?
     
    minijaham likes this.
  5. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    This was what I was looking for. Thanks!
     
  6. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.