mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Ban-IP fix + message
This commit is contained in:
parent
ed8f38ef55
commit
cef574015f
@ -231,6 +231,12 @@ class PocketMinecraftServer{
|
|||||||
switch($packet["pid"]){
|
switch($packet["pid"]){
|
||||||
case 0x02:
|
case 0x02:
|
||||||
if(in_array($packet["ip"], $this->bannedIPs)){
|
if(in_array($packet["ip"], $this->bannedIPs)){
|
||||||
|
$this->send(0x1c, array(
|
||||||
|
$data[0],
|
||||||
|
$this->serverID,
|
||||||
|
MAGIC,
|
||||||
|
$this->serverType. $this->name . " [You're banned]",
|
||||||
|
), false, $packet["ip"], $packet["port"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!isset($this->custom["times_".$CID])){
|
if(!isset($this->custom["times_".$CID])){
|
||||||
|
@ -187,12 +187,12 @@ function serverCommands(){
|
|||||||
case "remove":
|
case "remove":
|
||||||
$ip = trim(implode($params));
|
$ip = trim(implode($params));
|
||||||
$new = array();
|
$new = array();
|
||||||
foreach(explode(file_get_contents(FILE_PATH."banned-ips.txt")) as $i){
|
foreach(explode("\n", str_replace(array("\r","\t"), "", file_get_contents(FILE_PATH."banned-ips.txt"))) as $i){
|
||||||
if($i == $ip){
|
if($i == $ip){
|
||||||
console("[INFO] IP \"$ip\" removed from ban list");
|
console("[INFO] IP \"$ip\" removed from ban list");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$new[$ip] = $ip;
|
$new[$i] = $i;
|
||||||
}
|
}
|
||||||
file_put_contents(FILE_PATH."banned-ips.txt", implode("\r\n", $new));
|
file_put_contents(FILE_PATH."banned-ips.txt", implode("\r\n", $new));
|
||||||
loadConfig();
|
loadConfig();
|
||||||
@ -282,7 +282,7 @@ function serverCommands(){
|
|||||||
case "remove":
|
case "remove":
|
||||||
$user = trim(implode(" ", $params));
|
$user = trim(implode(" ", $params));
|
||||||
$new = array();
|
$new = array();
|
||||||
foreach(explode(file_get_contents(FILE_PATH."white-list.txt")) as $u){
|
foreach(explode("\n", str_replace(array("\r","\t"), "", file_get_contents(FILE_PATH."white-list.txt"))) as $u){
|
||||||
if($u == $user){
|
if($u == $user){
|
||||||
console("[INFO] Player \"$user\" removed from white-list");
|
console("[INFO] Player \"$user\" removed from white-list");
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user