hmm sure? i think the Plugin "PingKick" had it , but i found this-> PHP: public function join($data, $event){ switch($event){ case "player.spawn": $this->api->schedule(20, array($this, "join"), array(), true); $ping = round($data->getLag(), 2); if($this->pingcheck !== 0){ if($this->enabled == "true"){ if($this->pingkick < $ping){ $this->server->api->ban->kick($data->username, "Ping was too high"); }else{ break; } }else{ break;//this function looks like a jet fighter lol :P } }else{ break; } } } but dont know what $data is, here is the full "plugin" , its only one php file https://github.com/ZacHack/PingKick/blob/master/PingKick.php
me too but i think he mean it so: PHP: $data = new Data($this, "blabla"); and then he wants to use there own function -> Data::getLag();
What an IP is? An IP is an "license plate". You can know how many kilometers have a car by his license plate?
Exactly. Example: PHP: $tB = microtime(true);$socket = fSockOpen($player->getAddress(), 80, $errno, $errstr, 10);if(!($socket)) { $this->getServer()->getLogger()->info($player->getAddress() . " was uncreachable.");}$tA = microtime(true);$ping = round((($tA - $tB) * 1000), 0);$this->getServer()->getLogger()->info("Ping of " . $player->getAddress() . " was: " . $ping . ".ms");
but what if the thing on 80 have slow response and why dont see what the function $this->getlag() does?
As of PocketMine 1.4 onwards, ping is a value only known by RakLib. PocketMine and its plugins cannot know its value. Using `ping` on an IP address may not always succeed. Some routers simply reject your attempts to ping it. This will block the main thread for a period of time. This will lag the server. This is something from PocketMine 1.3 https://github.com/PocketMine/Pocke...55a4f03e6de084967c971cd7/src/Player.php#L1061 Alpha_1.3 stuff https://github.com/PocketMine/Pocke...55a4f03e6de084967c971cd7/src/Player.php#L1054
So it is not possible. Moreover, the value returned from `ping` doesn't return the exact latency between server and the client.