mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
Block IP addresses on ban-ip
This commit is contained in:
@@ -71,7 +71,7 @@ namespace pocketmine {
|
||||
use pocketmine\wizard\Installer;
|
||||
|
||||
const VERSION = "Alpha_1.4dev";
|
||||
const API_VERSION = "1.9.0";
|
||||
const API_VERSION = "1.10.0";
|
||||
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
|
||||
const MINECRAFT_VERSION = "v0.10.4 alpha";
|
||||
|
||||
|
@@ -622,6 +622,16 @@ class Server{
|
||||
$this->mainInterface->putRaw($address, $port, $payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks an IP address from the main interface. Setting timeout to -1 will block it forever
|
||||
*
|
||||
* @param string $address
|
||||
* @param int $timeout
|
||||
*/
|
||||
public function blockAddress($address, $timeout = 300){
|
||||
$this->mainInterface->blockAddress($address, $timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $address
|
||||
* @param int $port
|
||||
@@ -639,7 +649,7 @@ class Server{
|
||||
}
|
||||
}
|
||||
|
||||
$this->mainInterface->blockAddress($address, 600);
|
||||
$this->blockAddress($address, 600);
|
||||
}
|
||||
//TODO: add raw packet events
|
||||
}
|
||||
@@ -1834,6 +1844,9 @@ class Server{
|
||||
$this->reloadWhitelist();
|
||||
$this->operators->reload();
|
||||
|
||||
foreach($this->getIPBans()->getEntries() as $entry){
|
||||
$this->blockAddress($entry->getName(), -1);
|
||||
}
|
||||
|
||||
$this->pluginManager->registerInterface(PharPluginLoader::class);
|
||||
$this->pluginManager->loadPlugins($this->pluginPath);
|
||||
@@ -1911,6 +1924,9 @@ class Server{
|
||||
|
||||
}
|
||||
|
||||
foreach($this->getIPBans()->getEntries() as $entry){
|
||||
$this->blockAddress($entry->getName(), -1);
|
||||
}
|
||||
|
||||
if($this->getProperty("settings.send-usage", true) !== false){
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "sendUsage"]), 6000, 6000);
|
||||
|
@@ -75,6 +75,8 @@ class BanIpCommand extends VanillaCommand{
|
||||
}
|
||||
}
|
||||
|
||||
$sender->getServer()->blockAddress($ip, -1);
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Banned IP Address " . $ip);
|
||||
}
|
||||
}
|
Submodule src/raklib updated: 9a1c1868b3...658529ec44
Reference in New Issue
Block a user