-
Notifications
You must be signed in to change notification settings - Fork 0
/
SafeConnect.php
31 lines (28 loc) · 1.43 KB
/
SafeConnect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace thelucyclub\SafeConnect;
use pocketmine;
use raklib;
use spl;
use pocketmine\Server;
use pocketmine\network;
use pocketmine\utils\TextFormat as TF;
use pocketmine\Player;
class SafeConnect extends PluginBase implents Listener {
public function onLoad() {
Server::getInstance()->getLogger()->info(TF::AQUA . "\n\n SafeConnect" . TF::YELLOW . "\n by The Lucy Club" . TF::GREEN . "\nhttp://github.com/thelucyclub/SafeConnect");
}
public function onPlayerPreLoginEvent(PlayerPreLoginEvent $event) {
$player = $event->getPlayer();
Server::getInstance()->getLogger()->warning("$player is connecting... Please be patient");
$player->sendTip(TF::BLUE . "[SafeConnect] $player does not pose a possible threat\n\n\n" . TF::LIGHT_PURPLE . "Your ping is below 500ms. Impressive!");
$output = shell_exec('ping -c1 dl.thelucyclub.ml/ip_mcpe-deny.json');
if($output == "" or $output == "down") {
$player->close(TF::RED . "[SafeConnect] Can't reach API server at the moment. If you are the server owner, set the 'API-KEY' option in config.yml");
}
}
public function onPlayerJoinEvent(PlayerJoinEvent $event) {
$player = $event->getPlayer();
Server::getInstance()->getLogger()->notice(TF::RED . "$player passed checks. Player safe.");
$player->sendMessage(TF::YELLOW . "ALERT: SafeConnect has not detected you as a threat. Please note if your network ping is too high, you may be kicked for a threat.");
}
}