Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
SimpleAuthHelper-2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Aug 27, 2015
1 parent 6e6d96a commit 655f641
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 10 deletions.
7 changes: 5 additions & 2 deletions SimpleAuthHelper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ that. You are more likely to get a response and help that way.

_NOTE:_

This documentation was last updated for version **2.0.0**.
This documentation was last updated for version **2.0.1**.


You can also download this plugin from this [page](https://github.com/alejandroliu/pocketmine-plugins/releases/tag/SimpleAuthHelper-2.0.0).
You can also download this plugin from this [page](https://github.com/alejandroliu/pocketmine-plugins/releases/tag/SimpleAuthHelper-2.0.1).

<!-- template-end -->

Expand Down Expand Up @@ -162,6 +162,8 @@ are kicked and any new joins are not allowed.

# Changes

* 2.0.1: language defaults
- make sure that languages default to English (reported by @minebuilder0110)
* 2.0.0: Major upgrade
- uses now a common translation library
- Removed little used feature: nest-egg
Expand Down Expand Up @@ -208,3 +210,4 @@ are kicked and any new joins are not allowed.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

2 changes: 1 addition & 1 deletion SimpleAuthHelper/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ depend: [SimpleAuth]

name: SimpleAuthHelper
description: Simplifies the way people authenticate to servers
version: 2.0.0
version: 2.0.1
author: aliuly

commands:
Expand Down
8 changes: 8 additions & 0 deletions SimpleAuthHelper/resources/messages/eng.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
; eng.ini
"%1%-mode"=""
"%1% already registered"=""
"%1% has just joined"=""
"%1% unauthenticated players were kicked"=""
"%1% unregistered"=""
"**CENSORED**"=""
"<nagme>"=""
"Adventure"=""
"Creative"=""
"DBM Error: %1%"=""
"Database connectivity restored!"=""
"Database is experiencing technical difficulties"=""
Expand All @@ -15,10 +19,14 @@
"Restored database connection"=""
"SimpleAuthHelper has been disabled"=""
"SimpleAuth not found!"=""
"Spectator"=""
"Survival"=""
"This command only works in-game."=""
"Unable to find SimpleAuth"=""
"Unable to unregister %1%"=""
"You are no longer registered!"=""
"You can only do this in-game"=""
"You do not have permission to do that."=""
"auth error"="Authentication error. Try again later!"
"chat protected"="Do not send your password on the chat window"
"chpwd error"="Old password does not match"
Expand Down
8 changes: 8 additions & 0 deletions SimpleAuthHelper/resources/messages/messages.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
; messages.ini
"%1%-mode"=""
"%1% already registered"=""
"%1% has just joined"=""
"%1% unauthenticated players were kicked"=""
"%1% unregistered"=""
"**CENSORED**"=""
"<nagme>"=""
"Adventure"=""
"Creative"=""
"DBM Error: %1%"=""
"Database connectivity restored!"=""
"Database is experiencing technical difficulties"=""
Expand All @@ -15,10 +19,14 @@
"Restored database connection"=""
"SimpleAuthHelper has been disabled"=""
"SimpleAuth not found!"=""
"Spectator"=""
"Survival"=""
"This command only works in-game."=""
"Unable to find SimpleAuth"=""
"Unable to unregister %1%"=""
"You are no longer registered!"=""
"You can only do this in-game"=""
"You do not have permission to do that."=""
"auth error"=""
"chat protected"=""
"chpwd error"=""
Expand Down
8 changes: 8 additions & 0 deletions SimpleAuthHelper/resources/messages/spa.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
; spa.ini
"%1%-mode"="modo-%1%"
"%1% already registered"="%1% ya esta registrado"
"%1% has just joined"="%1% se ha conectado al juego"
"%1% unauthenticated players were kicked"="%1% jugadores deconocidos retirados"
"%1% unregistered"="%1% de-registrado"
"**CENSORED**"="**CENSURADO**"
"<nagme>"="no"
"Adventure"="Aventura"
"Creative"="Creativo"
"DBM Error: %1%"="Error DBM: %1%"
"Database connectivity restored!"="Acceso a base de datos restaurado"
"Database is experiencing technical difficulties"="Base datos en problemas"
Expand All @@ -15,10 +19,14 @@
"Restored database connection"="Base de datos retaurada"
"SimpleAuthHelper has been disabled"="SimpleAuthHelper ha sido des-habilitado"
"SimpleAuth not found!"="No se encotró SimpleAuth!"
"Spectator"="Espectador"
"Survival"="Supervivencia"
"This command only works in-game."="Esto solo funciona dentro del juego"
"Unable to find SimpleAuth"="No encuentro SimleAuth"
"Unable to unregister %1%"="No se puede de-registrar a %1%"
"You are no longer registered!"="Usted ya no está registrado!"
"You can only do this in-game"="Solo puede hacer esto en el juego"
"You do not have permission to do that."="No tiene permiso para hacer eso"
"auth error"="No se pudo identificar. Pruebe más tarde!"
"chat protected"="No ingrese su contraseña en la pantalla"
"chpwd error"="No concuerda con su contraseña anterior"
Expand Down
21 changes: 18 additions & 3 deletions SimpleAuthHelper/src/aliuly/helper/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

use aliuly\helper\common\PluginCallbackTask;
use aliuly\helper\common\mc;
use aliuly\helper\common\MPMU;

use aliuly\helper\EventListener;
use aliuly\helper\PermsHacker;
use aliuly\helper\DbMonitorTask;
Expand All @@ -48,16 +50,29 @@ class Main extends PluginBase implements Listener,CommandExecutor {
protected $monitor;

public function onEnable(){
mc::plugin_init($this,$this->getFile());

if (!is_dir($this->getDataFolder())) mkdir($this->getDataFolder());
if (mc::plugin_init($this,$this->getFile()) === false) {
file_put_contents($this->getDataFolder()."messages.ini",MPMU::getResourceContents($this,"messages/eng.ini")."\n\"<nagme>\"=\"yes\"\n");
mc::plugin_init($this,$this->getFile());
$this->getLogger()->error(TextFormat::RED."Your selected language \"".$this->getServer()->getProperty("settings.language")."\" is not supported");
$this->getLogger()->error(TextFormat::YELLOW."Creating a custom \"messages.ini\" with English strings");
$this->getLogger()->error(TextFormat::AQUA."Please consider translating and submitting a translation");
$this->getLogger()->error(TextFormat::AQUA."to the developer");
} else {
if (mc::_("<nagme>") === "yes") {
$this->getLogger()->error(TextFormat::RED."Your selected language \"".$this->getServer()->getProperty("settings.language")."\" is not supported");
$this->getLogger()->error(TextFormat::AQUA."Please consider translating \"messages.ini\"");
$this->getLogger()->error(TextFormat::AQUA."and submitting a translation to the developer");
}
}
$this->auth = $this->getServer()->getPluginManager()->getPlugin("SimpleAuth");
if (!$this->auth) {
$this->getLogger()->error(TextFormat::RED.mc::_("Unable to find SimpleAuth"));
throw new \RuntimeException("Missing Dependancy");
return;
}

if (!is_dir($this->getDataFolder())) mkdir($this->getDataFolder());

$defaults = [
"version" => $this->getDescription()->getVersion(),
"# max-attemps" => "kick player after this many login attempts. ",// NOTE: This conflicts with SimpleAuth's blockAfterFail setting
Expand Down
9 changes: 5 additions & 4 deletions libcommon/src/aliuly/common/mc.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,23 @@ public static function n($a,$b,$c) {
*
* @param Plugin $plugin - owning plugin
* @param str $path - output of $plugin->getFile()
* @return int|false - false on error or the number of messages loaded
*/
public static function plugin_init($plugin,$path) {
if (file_exists($plugin->getDataFolder()."messages.ini")) {
self::load($plugin->getDataFolder()."messages.ini");
return;
return self::load($plugin->getDataFolder()."messages.ini");
}
$msgs = $path."resources/messages/".
$plugin->getServer()->getProperty("settings.language").
".ini";
if (!file_exists($msgs)) return;
mc::load($msgs);
if (!file_exists($msgs)) return false;
return mc::load($msgs);
}
/**
* Load the specified message catalogue.
* Can read .ini or .po files.
* @param str $f - Filename to load
* @return int|false - returns the number of strings loaded or false on error
*/
public static function load($f) {
$potxt = "\n".file_get_contents($f)."\n";
Expand Down

0 comments on commit 655f641

Please sign in to comment.