Implemented QueryRegenerateEvent as base for other interfaces

This commit is contained in:
Shoghi Cervantes
2015-05-26 01:17:34 +02:00
parent 66435d4f6a
commit 51062940c5
5 changed files with 27 additions and 9 deletions

View File

@ -172,12 +172,14 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
}
public function setName($name){
$info = $this->server->getQueryInformation();
$this->interface->sendOption("name",
"MCPE;".addcslashes($name, ";") .";".
Info::CURRENT_PROTOCOL.";".
\pocketmine\MINECRAFT_VERSION_NETWORK.";".
count($this->server->getOnlinePlayers()).";".
$this->server->getMaxPlayers()
$info->getPlayerCount().";".
$info->getMaxPlayerCount()
);
}

View File

@ -25,7 +25,6 @@
*/
namespace pocketmine\network\query;
use pocketmine\event\server\QueryRegenerateEvent;
use pocketmine\Server;
use pocketmine\utils\Binary;
use pocketmine\utils\Utils;
@ -58,7 +57,7 @@ class QueryHandler{
}
public function regenerateInfo(){
$this->server->getPluginManager()->callEvent($ev = new QueryRegenerateEvent($this->server, 5));
$ev = $this->server->getQueryInformation();
$this->longData = $ev->getLongQuery();
$this->shortData = $ev->getShortQuery();
$this->timeout = microtime(true) + $ev->getTimeout();