From 52da824ac173a2e97261d276e1c1c99127dc1657 Mon Sep 17 00:00:00 2001 From: Flavius12 Date: Wed, 2 Sep 2015 15:06:39 +0200 Subject: [PATCH] v2.11 --- ServerAuth/plugin.yml | 2 +- .../ServerAuth/Commands/ChangePassword.php | 2 +- .../src/ServerAuth/Commands/Commands.php | 2 +- ServerAuth/src/ServerAuth/Commands/Login.php | 2 +- ServerAuth/src/ServerAuth/Commands/Logout.php | 2 +- .../src/ServerAuth/Commands/Register.php | 2 +- .../src/ServerAuth/Commands/Unregister.php | 2 +- ServerAuth/src/ServerAuth/EventListener.php | 2 +- .../Events/ServerAuthAuthenticateEvent.php | 2 +- .../Events/ServerAuthDeauthenticateEvent.php | 2 +- .../Events/ServerAuthPasswordChangeEvent.php | 2 +- .../Events/ServerAuthRegisterEvent.php | 2 +- .../Events/ServerAuthUnregisterEvent.php | 2 +- ServerAuth/src/ServerAuth/ServerAuth.php | 19 +++++++++++++++++-- .../src/ServerAuth/Tasks/MessageTask.php | 2 +- ServerAuth/src/ServerAuth/Tasks/MySQLTask.php | 2 +- 16 files changed, 32 insertions(+), 17 deletions(-) diff --git a/ServerAuth/plugin.yml b/ServerAuth/plugin.yml index 26140ef..69a4278 100644 --- a/ServerAuth/plugin.yml +++ b/ServerAuth/plugin.yml @@ -1,6 +1,6 @@ name: ServerAuth main: ServerAuth\ServerAuth -version: "2.10" +version: "2.11" api: [1.11.0] load: STARTUP author: EvolSoft diff --git a/ServerAuth/src/ServerAuth/Commands/ChangePassword.php b/ServerAuth/src/ServerAuth/Commands/ChangePassword.php index 25297e5..7659f90 100644 --- a/ServerAuth/src/ServerAuth/Commands/ChangePassword.php +++ b/ServerAuth/src/ServerAuth/Commands/ChangePassword.php @@ -1,7 +1,7 @@ set("lastlogin", $player->getLastPlayed()); $data->save(); $this->auth_users[strtolower($player->getName())] = ""; + if($cfg['login']['enable-failed-logins-kick'] && isset($this->auth_attempts[strtolower($player->getName())])){ + unset($this->auth_attempts[strtolower($player->getName())]); + } return ServerAuth::SUCCESS; }else{ + if($cfg['login']['enable-failed-logins-kick']){ + if(isset($this->auth_attempts[strtolower($player->getName())])){ + $this->auth_attempts[strtolower($player->getName())]++; + }else{ + $this->auth_attempts[strtolower($player->getName())] = 1; + } + if($this->auth_attempts[strtolower($player->getName())] >= $cfg['login']['max-login-attempts']){ + $player->close("", $this->translateColors("&", ServerAuth::getAPI()->getConfigLanguage()->getAll()["login"]["too-many-attempts"])); + unset($this->auth_attempts[strtolower($player->getName())]); + return ServerAuth::TOO_MANY_ATTEMPTS; + } + } return ServerAuth::ERR_WRONG_PASSWORD; } } diff --git a/ServerAuth/src/ServerAuth/Tasks/MessageTask.php b/ServerAuth/src/ServerAuth/Tasks/MessageTask.php index 0b708ea..8b5e0d7 100644 --- a/ServerAuth/src/ServerAuth/Tasks/MessageTask.php +++ b/ServerAuth/src/ServerAuth/Tasks/MessageTask.php @@ -1,7 +1,7 @@