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

how to handle QueryRegenerateEvent?

Comments in 'Plugin Development' started by LittleFlower, Jul 7, 2015.

  1. LittleFlower
    Offline

    LittleFlower New Member

    Joined:
    Jul 1, 2015
    Posts:
    1
    Minecraft User:
    MiihZen
    Hi, I searched for that in the whole forum, the whole github, and I can't find a way to do that, I am editing the grabbag plugin by @aliuly for setting my main server online players with the count of all online players in my secondary servers, @PEMapModder suggested this for change the default query on a old thread:
    PHP:
    public function queryEverything(QueryRegenerateEvent $e){
    $e->setPlayerCount($all["Players"]);
    $e->setMaxPlayerCount($all["Max-Players"]);
    }
    but after that how i can call this function since QueryRegenerateEvent is not auto callable event such onEnable, onPlayerJoin, etc?
    also, this code seems to work or i losing time? sorry for my english ^^
    Last edited: Jul 7, 2015
  2. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    Not using the correct function I think :
    Code:
         $this->getServer()->getQueryInformation()->setPlayerCount($numberOfPlayer);
            $this->getServer()->getQueryInformation()->setMaxPlayerCount($numberOfMaxPlayers);
    
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    QueryRegenerateEvent is automatically fired every few ticks.
    iksaku likes this.

Share This Page

Advertisement