Skip to content

Commit

Permalink
v2.00
Browse files Browse the repository at this point in the history
  • Loading branch information
Flavius12 committed Aug 31, 2015
1 parent 5bc6620 commit 3e5f848
Show file tree
Hide file tree
Showing 21 changed files with 266 additions and 100 deletions.
3 changes: 1 addition & 2 deletions ServerAuth/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ServerAuth
main: ServerAuth\ServerAuth
version: "1.11"
version: "2.00"
api: [1.11.0]
load: STARTUP
author: EvolSoft
Expand All @@ -11,7 +11,6 @@ commands:
serverauth:
aliases: [sa, sauth, auth]
description: ServerAuth Commands.
permission: serverauth
register:
aliases: [reg]
description: Allows registering an account
Expand Down
6 changes: 6 additions & 0 deletions ServerAuth/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
---
#Keep logged in by IP
IPLogin: false
#Force single authentication
force-single-auth: true
#Allow not authenticated users to move
allow-move: false
#Block chat for not authenticated users
Expand Down Expand Up @@ -44,6 +46,10 @@ mysql:
login:
#Enable login on your server
enabled: true
#Enable failed logins kick
enable-failed-logins-kick: true
#Max number of attempts
max-login-attempts: 5
#Login message interval
message-interval: 2
#Register settings
Expand Down
10 changes: 10 additions & 0 deletions ServerAuth/resources/languages/EN_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#Translation by Flavius12, EvolSoft
---
join-message: "&bAuthentication system provided by &aServerAuth &bplugin"
single-auth: "&cA player with this nickname is already authenticated!"
mysql-success: "&aServerAuth successfully connected to the MySQL database!"
mysql-restored: "&aMySQL connection restored!"
mysql-fail: "&cServerAuth can't connect to the MySQL database. Data will be saved locally. Error: {MYSQL_ERROR}"
config-reloaded: "&aConfiguration reloaded!"
operation-cancelled: "&cOperation cancelled"
login:
message: "&cPlease login with /login <password>"
disabled: "&cLogin disabled in this server"
Expand All @@ -10,6 +16,7 @@ login:
login-success: "&aYou have been logged in!"
login-timeout: "&cLogin Timeout"
already-login: "&aYou are already logged in"
too-many-attempts: "&cToo many login attempts!"
register:
message: "&cPlease register with /register <password>"
message-conf: "&cPlease register with /register <password> <confirmPassword>"
Expand All @@ -32,14 +39,17 @@ unregister:
disabled: "&cUnregister disabled in this server"
login-required: "&cYou need to be logged in to unregister"
command: "&cUsage: /unregister <password>"
command-cons: "&cUsage: /unregister <player>"
unregister-success: "&aYou are now unregistered!"
unregister-success-3rd: "&aThe player is now unregistered!"
errors:
generic: "&cAn error has occurred"
wrong-password: "&cWrong Password"
password-no-match: "&cPassword doesn't match confirmation"
password-too-short: "&cPassword too short"
password-too-long: "&cPassword too long"
user-not-registered: "&cYou are not registered"
user-not-registered-3rd: "&cThe player isn't registered"
user-not-authenticated: "&cYou are not logged in"
max-ip-reached: "&cYou reached the maximum number of registrations per IP"
...
10 changes: 10 additions & 0 deletions ServerAuth/resources/languages/ES_es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#Translation by TonyDroidd
---
join-message: "&bSistema de autenticación proporcionado por &aServerAuth &bplugin"
single-auth: "&cA player with this nickname is already authenticated!"
mysql-success: "&aServerAuth successfully connected to the MySQL database!"
mysql-restored: "&aMySQL connection restored!"
mysql-fail: "&cServerAuth can't connect to the MySQL database. Data will be saved locally. Error: {MYSQL_ERROR}"
config-reloaded: "&aConfiguration reloaded!"
operation-cancelled: "&cOperation cancelled"
login:
message: "&cPor favor, inicia sesion usando /login <contraseña>"
disabled: "&cAutenticacion esta desactivada en este servidor"
Expand All @@ -10,6 +16,7 @@ login:
login-success: "&aHaz iniciado sesion!"
login-timeout: "&cEl tiempo de autenticacion ha expirado!"
already-login: "&aYa haz iniciado sesión!"
too-many-attempts: "&cDemasiados intentos de acceso!"
register:
message: "&cPor favor, registrate usando /register <contraseña>"
message-conf: "&cPor favor, registrate con /register <contraseña> <confirmarContraseña>"
Expand All @@ -32,14 +39,17 @@ unregister:
disabled: "&cNo tienes permisos de desregistrarte"
login-required: "&cNecesitas iniciar sesion para desregistrarte"
command: "&cUsa: /unregister <contraseña>"
command-cons: "&cUsage: /unregister <player>"
unregister-success: "&aTe haz desregistrado!"
unregister-success-3rd: "&aThe player is now unregistered!"
errors:
generic: "&cHa ocurrido un error desconocido!"
wrong-password: "&cLa contraseña incorrecta"
password-no-match: "&cLas contraseñas no coinciden"
password-too-short: "&cLa contraseña es muy corta"
password-too-long: "&cLa contraseña es muy larga!"
user-not-registered: "&cNo estas registrado en este servidor"
user-not-registered-3rd: "&cThe player isn't registered"
user-not-authenticated: "&cNo haz iniciado sesion!"
max-ip-reached: "&cHas alcanzado el número máximo de inscripciones para ip"
...
10 changes: 10 additions & 0 deletions ServerAuth/resources/languages/IT_it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#Translation by Flavius12, EvolSoft
---
join-message: "&bSistema di autenticazione fornito da &aServerAuth"
single-auth: "&cUn player con questo nickname è già autenticato!"
mysql-success: "&aServerAuth connesso al database MySQL con successo!"
mysql-restored: "&aConnessione MySQL ripristinata!"
mysql-fail: "&cServerAuth non è riuscito a connettersi al database MySQL. I dati verranno salvati localmente. Errore: {MYSQL_ERROR}"
config-reloaded: "&aConfigurazione ricaricata!"
operation-cancelled: "&cOperazione cancellata"
login:
message: "&cEsegui il login con /login <password>"
disabled: "&cIl login è disabilitato in questo server"
Expand All @@ -10,6 +16,7 @@ login:
login-success: "&aHai eseguito il login!"
login-timeout: "&cTempo di login scaduto"
already-login: "&aSei già autenticato"
too-many-attempts: "&cTroppi tentativi di login!"
register:
message: "&cRegistrati con /register <password>"
message-conf: "&cRegistrati con /register <password> <confermaPassword>"
Expand All @@ -32,14 +39,17 @@ unregister:
disabled: "&cLa cancellazione dell'account è disabilitata in questo server"
login-required: "&cDevi essere autenticato per cancellare l'account"
command: "&cUso: /unregister <password>"
command-cons: "&cUso: /unregister <player>"
unregister-success: "&aIl tuo account è stato cancellato!"
unregister-success-3rd: "&aL'account del player è stato cancellato!"
errors:
generic: "&cSi è verificato un errore"
wrong-password: "&cPassword errata"
password-no-match: "&cLe password non corrispondono"
password-too-short: "&cLa password è troppo corta"
password-too-long: "&cLa password è troppo lunga"
user-not-registered: "&cNon sei registrato"
user-not-registered-3rd: "&cIl player non è registrato"
user-not-authenticated: "&cNon sei autenticato"
max-ip-reached: "&cHai raggiunto il numero massimo di registrazioni per IP"
...
4 changes: 2 additions & 2 deletions ServerAuth/src/ServerAuth/Commands/ChangePassword.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/*
* ServerAuth (v1.11) by EvolSoft
* ServerAuth (v2.00) by EvolSoft
* Developer: EvolSoft (Flavius12)
* Website: http://www.evolsoft.tk
* Date: 10/05/2015 12:14 AM (UTC)
* Date: 31/08/2015 10:27 AM (UTC)
* Copyright & License: (C) 2015 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerAuth/blob/master/LICENSE)
*/
Expand Down
26 changes: 22 additions & 4 deletions ServerAuth/src/ServerAuth/Commands/Commands.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/*
* ServerAuth (v1.11) by EvolSoft
* ServerAuth (v2.00) by EvolSoft
* Developer: EvolSoft (Flavius12)
* Website: http://www.evolsoft.tk
* Date: 10/05/2015 12:14 AM (UTC)
* Date: 31/08/2015 10:31 AM (UTC)
* Copyright & License: (C) 2015 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerAuth/blob/master/LICENSE)
*/
Expand All @@ -19,6 +19,7 @@
use pocketmine\plugin\PluginBase;

use ServerAuth\ServerAuth;
use ServerAuth\Tasks\MySQLTask;

class Commands extends PluginBase implements CommandExecutor {

Expand All @@ -32,7 +33,7 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
case "serverauth":
if(isset($args[0])){
$args[0] = strtolower($args[0]);
if($args[0]=="help"){
if($args[0] == "help"){
if($sender->hasPermission("serverauth.help")){
$sender->sendMessage($this->plugin->translateColors("&", "&b=> &aAvailable Commands &b<="));
$sender->sendMessage($this->plugin->translateColors("&", "&a/changepassword &b=>&a Change the account password"));
Expand Down Expand Up @@ -60,7 +61,24 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
}elseif($args[0]=="reload"){
if($sender->hasPermission("serverauth.reload")){
$this->plugin->reloadConfig();
$sender->sendMessage($this->plugin->translateColors("&", ServerAuth::PREFIX . "&aConfiguration Reloaded."));
$this->cfg = $this->plugin->getConfig()->getAll();
//Restart MySQL
ServerAuth::getAPI()->task->cancel();
$this->plugin->task = $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask(new MySQLTask($this->plugin), 20);
$this->plugin->mysql = false;
//Check MySQL
if($this->cfg["use-mysql"] == true){
$check = $this->plugin->checkDatabase($this->cfg["mysql"]["host"], $this->cfg["mysql"]["port"], $this->cfg["mysql"]["username"], $this->cfg["mysql"]["password"]);
if($check[0]){
$this->plugin->initializeDatabase($this->cfg["mysql"]["host"], $this->cfg["mysql"]["port"], $this->cfg["mysql"]["username"], $this->cfg["mysql"]["password"], $this->cfg["mysql"]["database"], $this->cfg["mysql"]["table_prefix"]);
Server::getInstance()->getLogger()->info($this->plugin->translateColors("&", ServerAuth::PREFIX . ServerAuth::getAPI()->getConfigLanguage()->getAll()["mysql-success"]));
$this->mysql = true;
}else{
Server::getInstance()->getLogger()->info($this->plugin->translateColors("&", ServerAuth::PREFIX . ServerAuth::getAPI()->replaceArrays(ServerAuth::getAPI()->getConfigLanguage()->getAll()["mysql-fail"], array("MYSQL_ERROR" => $check[1]))));
}
}
//End MySQL Restart
$sender->sendMessage($this->plugin->translateColors("&", ServerAuth::PREFIX . ServerAuth::getAPI()->getConfigLanguage()->getAll()["config-reloaded"]));
break;
}else{
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
Expand Down
6 changes: 4 additions & 2 deletions ServerAuth/src/ServerAuth/Commands/Login.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/*
* ServerAuth (v1.11) by EvolSoft
* ServerAuth (v2.00) by EvolSoft
* Developer: EvolSoft (Flavius12)
* Website: http://www.evolsoft.tk
* Date: 10/05/2015 12:14 AM (UTC)
* Date: 31/08/2015 10:48 AM (UTC)
* Copyright & License: (C) 2015 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerAuth/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -50,6 +50,8 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["login"]["already-login"]));
}elseif($status == ServerAuth::ERR_USER_NOT_REGISTERED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["user-not-registered"]));
}elseif($status == ServerAuth::CANCELLED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["operation-cancelled"]));
}else{
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["generic"]));
}
Expand Down
6 changes: 4 additions & 2 deletions ServerAuth/src/ServerAuth/Commands/Logout.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/*
* ServerAuth (v1.11) by EvolSoft
* ServerAuth (v2.00) by EvolSoft
* Developer: EvolSoft (Flavius12)
* Website: http://www.evolsoft.tk
* Date: 10/05/2015 12:14 AM (UTC)
* Date: 31/08/2015 10:56 AM (UTC)
* Copyright & License: (C) 2015 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerAuth/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -46,6 +46,8 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["user-not-authenticated"]));
}elseif($status == ServerAuth::ERR_USER_NOT_REGISTERED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["user-not-registered"]));
}elseif($status == ServerAuth::CANCELLED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["operation-cancelled"]));
}else{
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["generic"]));
}
Expand Down
10 changes: 7 additions & 3 deletions ServerAuth/src/ServerAuth/Commands/Register.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/*
* ServerAuth (v1.11) by EvolSoft
* ServerAuth (v2.00) by EvolSoft
* Developer: EvolSoft (Flavius12)
* Website: http://www.evolsoft.tk
* Date: 15/07/2015 10:02 AM (UTC)
* Date: 31/08/2015 11:03 AM (UTC)
* Copyright & License: (C) 2015 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerAuth/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -56,6 +56,8 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["password-too-long"]));
}elseif($status == ServerAuth::ERR_MAX_IP_REACHED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["max-ip-reached"]));
}elseif($status == ServerAuth::CANCELLED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["operation-cancelled"]));
}else{
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["generic"]));
}
Expand All @@ -70,7 +72,7 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
if(count($args) == 1){
$status = ServerAuth::getAPI()->registerPlayer($sender, $args[0]);
if($status == ServerAuth::SUCCESS){
print ServerAuth::getAPI()->authenticatePlayer($sender, $args[0]);
ServerAuth::getAPI()->authenticatePlayer($sender, $args[0]);
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["register"]["register-success"]));
}elseif($status == ServerAuth::ERR_USER_ALREADY_REGISTERED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["register"]["already-registered"]));
Expand All @@ -80,6 +82,8 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["password-too-long"]));
}elseif($status == ServerAuth::ERR_MAX_IP_REACHED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["max-ip-reached"]));
}elseif($status == ServerAuth::CANCELLED){
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["operation-cancelled"]));
}else{
$sender->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["errors"]["generic"]));
}
Expand Down
Loading

0 comments on commit 3e5f848

Please sign in to comment.