Added capability to unblock addresses without a restart

This commit is contained in:
Dylan K. Taylor 2017-08-14 14:12:06 +01:00
parent 0c798222a4
commit ae3a8a5493
5 changed files with 17 additions and 1 deletions

View File

@ -50,6 +50,7 @@ class PardonIpCommand extends VanillaCommand{
if(preg_match("/^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$/", $args[0])){
$sender->getServer()->getIPBans()->remove($args[0]);
$sender->getServer()->getNetwork()->unblockAddress($args[0]);
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.unbanip.success", [$args[0]]));
}else{
$sender->sendMessage(new TranslationContainer("commands.unbanip.invalid"));

View File

@ -34,6 +34,11 @@ interface AdvancedSourceInterface extends SourceInterface{
*/
public function blockAddress(string $address, int $timeout = 300);
/**
* @param string $address
*/
public function unblockAddress(string $address);
/**
* @param Network $network
*/

View File

@ -171,4 +171,10 @@ class Network{
$interface->blockAddress($address, $timeout);
}
}
public function unblockAddress(string $address){
foreach($this->advancedInterfaces as $interface){
$interface->unblockAddress($address);
}
}
}

View File

@ -152,6 +152,10 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
$this->interface->blockAddress($address, $timeout);
}
public function unblockAddress(string $address){
$this->interface->unblockAddress($address);
}
public function handleRaw($address, $port, $payload){
$this->server->handlePacket($address, $port, $payload);
}

@ -1 +1 @@
Subproject commit ddd953f0e2a6577dd39f0a450546dad12a472b01
Subproject commit cd31b332c38f98bafa238771caf1583f8461f7f8