mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Added capability to unblock addresses without a restart
This commit is contained in:
parent
0c798222a4
commit
ae3a8a5493
@ -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"));
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -171,4 +171,10 @@ class Network{
|
||||
$interface->blockAddress($address, $timeout);
|
||||
}
|
||||
}
|
||||
|
||||
public function unblockAddress(string $address){
|
||||
foreach($this->advancedInterfaces as $interface){
|
||||
$interface->unblockAddress($address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user