From 25a9b6cb00751f0da3f3b31bb61a4acc92a9b161 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sun, 27 Dec 2015 00:08:59 +0100 Subject: [PATCH 01/13] Fix #382 Add missing placeholder to message key --- src/main/java/fr/xephi/authme/output/MessageKey.java | 2 +- src/main/resources/messages/messages_bg.yml | 2 +- src/main/resources/messages/messages_cz.yml | 2 +- src/main/resources/messages/messages_es.yml | 2 +- src/main/resources/messages/messages_fi.yml | 2 +- src/main/resources/messages/messages_fr.yml | 2 +- src/main/resources/messages/messages_gl.yml | 2 +- src/main/resources/messages/messages_it.yml | 2 +- src/main/resources/messages/messages_nl.yml | 2 +- src/main/resources/messages/messages_pl.yml | 2 +- src/main/resources/messages/messages_vn.yml | 2 +- src/main/resources/messages/messages_zhhk.yml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/output/MessageKey.java b/src/main/java/fr/xephi/authme/output/MessageKey.java index b93f956b7..c996fe4e4 100644 --- a/src/main/java/fr/xephi/authme/output/MessageKey.java +++ b/src/main/java/fr/xephi/authme/output/MessageKey.java @@ -85,7 +85,7 @@ public enum MessageKey { FORGOT_PASSWORD_MESSAGE("recovery_email"), - USAGE_CAPTCHA("usage_captcha"), + USAGE_CAPTCHA("usage_captcha", ""), CAPTCHA_WRONG_ERROR("wrong_captcha", "THE_CAPTCHA"), diff --git a/src/main/resources/messages/messages_bg.yml b/src/main/resources/messages/messages_bg.yml index 5a189ec37..9d9dc8486 100644 --- a/src/main/resources/messages/messages_bg.yml +++ b/src/main/resources/messages/messages_bg.yml @@ -37,7 +37,7 @@ name_len: '&cТвоя никнейм е твърде малък или голя regex: '&cТвоя никнейм съдържа забранени знацхи. Позволените са: REG_EX' add_email: '&cМоля добави своя имейл с : /email add имейл имейл' recovery_email: '&cЗабравихте своята парола? Моля използвай /email recovery <имейл>' -usage_captcha: '&cYou need to type a captcha, please type: /captcha <код>' +usage_captcha: '&cYou need to type a captcha, please type: /captcha ' wrong_captcha: '&cГрешен код, използвай : /captcha THE_CAPTCHA' valid_captcha: '&cТвоя код е валиден!' kick_forvip: '&cVIP влезе докато сървъра е пълен, ти беше изгонен!' diff --git a/src/main/resources/messages/messages_cz.yml b/src/main/resources/messages/messages_cz.yml index 4108ea5a6..f32d91201 100644 --- a/src/main/resources/messages/messages_cz.yml +++ b/src/main/resources/messages/messages_cz.yml @@ -37,7 +37,7 @@ name_len: '&cTvuj nick je prilis kratky, nebo prilis dlouhy' regex: '&cTvuj nick obsahuje nepovolene znaky. Pripustne znaky jsou: REG_EX' add_email: '&cPridej prosim svuj email pomoci : /email add TvujEmail TvujEmail' recovery_email: '&cZapomel jsi heslo? Zadej: /email recovery ' -usage_captcha: '&cPouzij: /captcha ' +usage_captcha: '&cPouzij: /captcha ' wrong_captcha: '&cSpatne opsana Captcha, pouzij prosim: /captcha THE_CAPTCHA' valid_captcha: '&cZadana captcha je v poradku!' kick_forvip: '&cVIP Hrac se pripojil na plny server!' diff --git a/src/main/resources/messages/messages_es.yml b/src/main/resources/messages/messages_es.yml index a70663309..d505761b0 100644 --- a/src/main/resources/messages/messages_es.yml +++ b/src/main/resources/messages/messages_es.yml @@ -38,7 +38,7 @@ name_len: '&cTu nombre de usuario es muy largo o muy corto' regex: '&cTu usuario tiene carácteres no admitidos, los cuales son: REG_EX' add_email: '&cPor favor agrega tu e-mail con: /email add tuEmail confirmarEmail' recovery_email: '&c¿Olvidaste tu contraseña? Por favor usa /email recovery ' -usage_captcha: '&cUso: /captcha ' +usage_captcha: '&cUso: /captcha ' wrong_captcha: '&cCaptcha incorrecto, please use : /captcha THE_CAPTCHA' valid_captcha: '&c¡ Captcha ingresado correctamente !' kick_forvip: '&cUn jugador VIP ha ingresado al servidor lleno!' diff --git a/src/main/resources/messages/messages_fi.yml b/src/main/resources/messages/messages_fi.yml index 541569489..5186049d1 100644 --- a/src/main/resources/messages/messages_fi.yml +++ b/src/main/resources/messages/messages_fi.yml @@ -37,7 +37,7 @@ name_len: '&cPelaajanimesi on liian lyhyt tai pitkä' regex: '&cPelaajanimesi sisältää luvattomia merkkejä. Hyväksytyt merkit: REG_EX' add_email: '&cLisää sähköpostisi: /email add sähköpostisi sähköpostisiUudelleen' recovery_email: '&cUnohtuiko salasana? Käytä komentoa: /email recovery ' -usage_captcha: '&cKäyttötapa: /captcha ' +usage_captcha: '&cKäyttötapa: /captcha ' wrong_captcha: '&cVäärä varmistus, käytä : /captcha THE_CAPTCHA' valid_captcha: '&cSinun varmistus onnistui.!' kick_forvip: '&cVIP pelaaja liittyi täyteen palvelimeen!' diff --git a/src/main/resources/messages/messages_fr.yml b/src/main/resources/messages/messages_fr.yml index a7115ddf3..20c40e60a 100644 --- a/src/main/resources/messages/messages_fr.yml +++ b/src/main/resources/messages/messages_fr.yml @@ -38,7 +38,7 @@ name_len: '&cVotre pseudo est trop long ou trop court' regex: '&cCaractères autorisés: REG_EX' add_email: '&cMerci d''ajouter votre email : /email add yourEmail confirmEmail' recovery_email: '&cVous avez oublié votre MotdePasse? Utilisez /email recovery ' -usage_captcha: '&cTrop de tentatives de connexion échouées, utilisez: /captcha ' +usage_captcha: '&cTrop de tentatives de connexion échouées, utilisez: /captcha ' wrong_captcha: '&cCaptcha incorrect, écrivez de nouveau : /captcha THE_CAPTCHA' valid_captcha: '&cLe Captcha est valide, merci!' kick_forvip: '&cUn joueur VIP a rejoint le serveur plein!' diff --git a/src/main/resources/messages/messages_gl.yml b/src/main/resources/messages/messages_gl.yml index c5a17d950..29944cece 100644 --- a/src/main/resources/messages/messages_gl.yml +++ b/src/main/resources/messages/messages_gl.yml @@ -37,7 +37,7 @@ name_len: '&cO teu nome é demasiado curto ou demasiado longo' regex: '&cO teu nome contén caracteres ilegais. Caracteres permitidos: REG_EX' add_email: '&cPor favor, engade o teu correo electrónico con: /email add ' recovery_email: '&cOlvidaches o contrasinal? Por favor, usa /email recovery ' -usage_captcha: '&cNecesitas escribir un captcha, por favor escribe: /captcha ' +usage_captcha: '&cNecesitas escribir un captcha, por favor escribe: /captcha ' wrong_captcha: '&cCaptcha equivocado, por favor usa: /captcha THE_CAPTCHA' valid_captcha: '&cO teu captcha é válido !' kick_forvip: '&cUn xogador VIP uniuse ao servidor cheo!' diff --git a/src/main/resources/messages/messages_it.yml b/src/main/resources/messages/messages_it.yml index d4cfde467..91752f0be 100644 --- a/src/main/resources/messages/messages_it.yml +++ b/src/main/resources/messages/messages_it.yml @@ -37,7 +37,7 @@ name_len: '&cIl tuo nome utente è troppo corto o troppo lungo!' regex: '&cIl tuo nome utente contiene caratteri non consentiti. I caratteri consentiti sono: REG_EX' add_email: '&cPer poter recuperare la password in futuro, aggiungi un indirizzo email al tuo account con il comando: "/email add "' recovery_email: '&cHai dimenticato la tua password? Puoi recuperarla eseguendo il comando: "/email recovery "' -usage_captcha: '&cAbbiamo bisogno che tu inserisca un captcha, perfavore scrivi: "/captcha THE_CAPTCHA"' +usage_captcha: '&cAbbiamo bisogno che tu inserisca un captcha, perfavore scrivi: "/captcha "' wrong_captcha: '&cCaptcha sbagliato, perfavore riprova con il comando: "/captcha THE_CAPTCHA"' valid_captcha: '&cIl captcha inserito è valido!' kick_forvip: '&cUn utente VIP è entrato mentre il server era pieno e ha preso il tuo posto!' diff --git a/src/main/resources/messages/messages_nl.yml b/src/main/resources/messages/messages_nl.yml index 6674158ec..9f3d8f1ac 100644 --- a/src/main/resources/messages/messages_nl.yml +++ b/src/main/resources/messages/messages_nl.yml @@ -36,7 +36,7 @@ name_len: '&cJe gebruikersnaam is te kort' regex: '&cJouw gebruikersnaam bevat illegale tekens. Toegestaane karakters: REG_EX' add_email: '&cVoeg uw E-mail alstublieft toe met: /email add ' recovery_email: '&cWachtwoord vergeten? Gebruik alstublieft "/email recovery "' -usage_captcha: '&cGebruik: /captcha ' +usage_captcha: '&cGebruik: /captcha ' wrong_captcha: '&cVerkeerde Captcha, gebruik alstublieft: /captcha THE_CAPTCHA' valid_captcha: '&cDe captcha is geldig!' kick_forvip: '&cEen VIP Gebruiker ga naar de volledige server!' diff --git a/src/main/resources/messages/messages_pl.yml b/src/main/resources/messages/messages_pl.yml index 1f7498abd..eb3403f9f 100644 --- a/src/main/resources/messages/messages_pl.yml +++ b/src/main/resources/messages/messages_pl.yml @@ -37,7 +37,7 @@ name_len: '&cTwoje konto ma za dluga badz za krotka nazwe' regex: '&cTwoje konto ma w nazwie niedozwolone znaki. Dozwolone znaki: REG_EX' add_email: '&cProsze dodac swoj email: /email add twojEmail powtorzEmail' recovery_email: '&cZapomniales hasla? Prosze uzyj komendy /email recovery ' -usage_captcha: '&cWpisz: /captcha ' +usage_captcha: '&cWpisz: /captcha ' wrong_captcha: '&cZly kod, prosze wpisac: /captcha THE_CAPTCHA' valid_captcha: '&cTwoj kod jest nieprawidlowy!' kick_forvip: '&cA Gracz VIP dolaczyl do gry!' diff --git a/src/main/resources/messages/messages_vn.yml b/src/main/resources/messages/messages_vn.yml index 548fbc063..18e86fe05 100644 --- a/src/main/resources/messages/messages_vn.yml +++ b/src/main/resources/messages/messages_vn.yml @@ -35,7 +35,7 @@ name_len: '&cTên đăng nhập của bạn quá ngắn hoặc quá dài' regex: '&cTên đăng nhập của bạn có chứa kí tự đặc biệt không được cho phép. Các kí tự hợp lệ: REG_EX' add_email: '&cVui lòng thêm địa chỉ email cho tài khoản với lệnh: /email add email-của-bạn nhập-lại-email-của-bạn' recovery_email: '&cQuên mật khẩu? Hãy dùng lệnh /email recovery ' -usage_captcha: '&cBạn cần nhập mã xác nhận: /captcha ' +usage_captcha: '&cBạn cần nhập mã xác nhận: /captcha ' wrong_captcha: '&cSai mã xác nhận, nhập lại: /captcha ' valid_captcha: '&aMã xác nhận hợp lệ!' kick_forvip: '&cNgười chơi VIP đã vào server hiện đang full!' diff --git a/src/main/resources/messages/messages_zhhk.yml b/src/main/resources/messages/messages_zhhk.yml index 7c534615e..be7afd51b 100644 --- a/src/main/resources/messages/messages_zhhk.yml +++ b/src/main/resources/messages/messages_zhhk.yml @@ -40,7 +40,7 @@ name_len: '&8[&6用戶系統&8] &c你的用戶名不符合規定長度。' regex: '&8[&6用戶系統&8] &c用戶名稱錯誤! 登入系統只接受以下字符: REG_EX' add_email: '&8[&6用戶系統&8] &b請為你的帳戶立即添加電郵地址: 《 /email add <電郵地址> <重覆電郵地址> 》' recovery_email: '&8[&6用戶系統&8] &c忘記密碼 ? 請使用這個指令來更新密碼: 《 /email recovery <電郵地址> 》' -usage_captcha: '&8[&6用戶系統&8] &f用法: 《 /captcha <驗證碼> 》' +usage_captcha: '&8[&6用戶系統&8] &f用法: 《 /captcha 》' wrong_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼無效,請使用 《 /captcha <驗證碼> 》 再次輸入。' valid_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼無效 !' kick_forvip: '&c因為有VIP玩家登入了伺服器。' From 68e5f636aec0426aec03239bad9472e5b352377d Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sun, 27 Dec 2015 21:21:09 +0100 Subject: [PATCH 02/13] Minor: Converters - reduce visibility - Change fields from public to private - Make classes package-private where appropriate - Remove redundant javadoc --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../authme/converter/CrazyLoginConverter.java | 7 ++---- .../authme/converter/ForceFlatToSqlite.java | 16 ++------------ .../authme/converter/RakamakConverter.java | 17 -------------- .../authme/converter/RoyalAuthConverter.java | 14 +----------- .../authme/converter/RoyalAuthYamlReader.java | 19 +--------------- .../authme/converter/vAuthConverter.java | 22 +++---------------- .../authme/converter/vAuthFileReader.java | 21 ++++-------------- .../authme/converter/xAuthConverter.java | 4 ++-- .../xephi/authme/converter/xAuthToFlat.java | 16 +++++++------- 10 files changed, 24 insertions(+), 114 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index a09b61455..347a77f08 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -578,7 +578,7 @@ public class AuthMe extends JavaPlugin { if (Settings.getDataSource == DataSource.DataSourceType.FILE) { ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated, it will be changed to SQLite... Connection will be impossible until conversion is done!"); - ForceFlatToSqlite converter = new ForceFlatToSqlite(database, this); + ForceFlatToSqlite converter = new ForceFlatToSqlite(database); DataSource source = converter.run(); if (source != null) { database = source; diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index 88a105d54..dd592a1a0 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -14,13 +14,11 @@ import java.io.IOException; /** * @author Xephi59 - * @version $Revision: 1.0 $ */ public class CrazyLoginConverter implements Converter { - public final AuthMe instance; - public final DataSource database; - public final CommandSender sender; + private final DataSource database; + private final CommandSender sender; /** * Constructor for CrazyLoginConverter. @@ -29,7 +27,6 @@ public class CrazyLoginConverter implements Converter { * @param sender CommandSender */ public CrazyLoginConverter(AuthMe instance, CommandSender sender) { - this.instance = instance; this.database = instance.database; this.sender = sender; } diff --git a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java index 02d3afa7a..b0ea61c0b 100644 --- a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java @@ -1,6 +1,5 @@ package fr.xephi.authme.converter; -import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; @@ -13,21 +12,10 @@ public class ForceFlatToSqlite { private final DataSource data; - /** - * Constructor for ForceFlatToSqlite. - * - * @param data DataSource - * @param plugin AuthMe - */ - public ForceFlatToSqlite(DataSource data, AuthMe plugin) { + public ForceFlatToSqlite(DataSource data) { this.data = data; } - /** - * Method run. - * - * @see java.lang.Runnable#run() - */ public DataSource run() { DataSource sqlite = null; try { @@ -39,7 +27,7 @@ public class ForceFlatToSqlite { Settings.setValue("DataSource.backend", "sqlite"); ConsoleLogger.info("Database successfully converted to sqlite !"); } catch (Exception e) { - ConsoleLogger.showError("An error occured while trying to convert flatfile to sqlite ..."); + ConsoleLogger.showError("An error occurred while trying to convert flatfile to sqlite ..."); return null; } return sqlite; diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index 8e2fc6b59..ab8b754ff 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -19,7 +19,6 @@ import java.util.Map.Entry; /** * @author Xephi59 - * @version $Revision: 1.0 $ */ public class RakamakConverter implements Converter { @@ -27,32 +26,16 @@ public class RakamakConverter implements Converter { public final DataSource database; public final CommandSender sender; - /** - * Constructor for RakamakConverter. - * - * @param instance AuthMe - * @param sender CommandSender - */ public RakamakConverter(AuthMe instance, CommandSender sender) { this.instance = instance; this.database = instance.database; this.sender = sender; } - /** - * Method getInstance. - * - * @return RakamakConverter - */ public RakamakConverter getInstance() { return this; } - /** - * Method run. - * - * @see java.lang.Runnable#run() - */ @Override public void run() { HashAlgorithm hash = Settings.getPasswordHash; diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java index 6906815dc..14d289fad 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java @@ -8,28 +8,16 @@ import org.bukkit.OfflinePlayer; import java.io.File; -/** - */ public class RoyalAuthConverter implements Converter { - public final AuthMe plugin; + private final AuthMe plugin; private final DataSource data; - /** - * Constructor for RoyalAuthConverter. - * - * @param plugin AuthMe - */ public RoyalAuthConverter(AuthMe plugin) { this.plugin = plugin; this.data = plugin.database; } - /** - * Method run. - * - * @see java.lang.Runnable#run() - */ @Override public void run() { for (OfflinePlayer o : plugin.getServer().getOfflinePlayers()) { diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java index f9ad11e20..c0437cb45 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java @@ -4,35 +4,18 @@ import fr.xephi.authme.settings.CustomConfiguration; import java.io.File; -/** - */ -public class RoyalAuthYamlReader extends CustomConfiguration { +class RoyalAuthYamlReader extends CustomConfiguration { - /** - * Constructor for RoyalAuthYamlReader. - * - * @param file File - */ public RoyalAuthYamlReader(File file) { super(file); load(); save(); } - /** - * Method getLastLogin. - * - * @return long - */ public long getLastLogin() { return getLong("timestamps.quit"); } - /** - * Method getHash. - * - * @return String - */ public String getHash() { return getString("login.password"); } diff --git a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java index 5db924d00..2e3d97464 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java @@ -2,38 +2,22 @@ package fr.xephi.authme.converter; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.datasource.DataSource; import org.bukkit.command.CommandSender; -/** - */ public class vAuthConverter implements Converter { - public final AuthMe plugin; - public final DataSource database; - public final CommandSender sender; + private final AuthMe plugin; + private final CommandSender sender; - /** - * Constructor for vAuthConverter. - * - * @param plugin AuthMe - * @param sender CommandSender - */ public vAuthConverter(AuthMe plugin, CommandSender sender) { this.plugin = plugin; - this.database = plugin.database; this.sender = sender; } - /** - * Method run. - * - * @see java.lang.Runnable#run() - */ @Override public void run() { try { - new vAuthFileReader(plugin, sender).convert(); + new vAuthFileReader(plugin).convert(); } catch (Exception e) { sender.sendMessage(e.getMessage()); ConsoleLogger.showError(e.getMessage()); diff --git a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java index bca9af2cf..a72c149d2 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java @@ -6,30 +6,24 @@ import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; -import org.bukkit.command.CommandSender; import java.io.File; import java.util.Scanner; import java.util.UUID; -/** - */ -public class vAuthFileReader { +class vAuthFileReader { - public final AuthMe plugin; - public final DataSource database; - public final CommandSender sender; + private final AuthMe plugin; + private final DataSource database; /** * Constructor for vAuthFileReader. * * @param plugin AuthMe - * @param sender CommandSender */ - public vAuthFileReader(AuthMe plugin, CommandSender sender) { + public vAuthFileReader(AuthMe plugin) { this.plugin = plugin; this.database = plugin.database; - this.sender = sender; } public void convert() { @@ -68,13 +62,6 @@ public class vAuthFileReader { return s.length() > 8 && s.charAt(8) == '-'; } - /** - * Method getName. - * - * @param uuid UUID - * - * @return String - */ private String getName(UUID uuid) { try { for (OfflinePlayer op : Bukkit.getOfflinePlayers()) { diff --git a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java index ae010cfaa..696f86fdc 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java @@ -5,8 +5,8 @@ import org.bukkit.command.CommandSender; public class xAuthConverter implements Converter { - public final AuthMe plugin; - public final CommandSender sender; + private final AuthMe plugin; + private final CommandSender sender; public xAuthConverter(AuthMe plugin, CommandSender sender) { this.plugin = plugin; diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index 6a31235fc..630d2c6f3 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -16,11 +16,11 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -public class xAuthToFlat { +class xAuthToFlat { - public final AuthMe instance; - public final DataSource database; - public final CommandSender sender; + private final AuthMe instance; + private final DataSource database; + private final CommandSender sender; /** * Constructor for xAuthToFlat. @@ -57,14 +57,14 @@ public class xAuthToFlat { database.saveAuth(auth); } } - sender.sendMessage("[AuthMe] Successfully convert from xAuth database"); + sender.sendMessage("[AuthMe] Successfully converted from xAuth database"); } catch (Exception e) { sender.sendMessage("[AuthMe] An error has been thrown while import xAuth database, the import hadn't fail but can be not complete "); } return true; } - public String getIdPlayer(int id) { + private String getIdPlayer(int id) { String realPass = ""; Connection conn = xAuth.getPlugin().getDatabaseController().getConnection(); PreparedStatement ps = null; @@ -86,7 +86,7 @@ public class xAuthToFlat { return realPass; } - public List getXAuthPlayers() { + private List getXAuthPlayers() { List xP = new ArrayList<>(); Connection conn = xAuth.getPlugin().getDatabaseController().getConnection(); PreparedStatement ps = null; @@ -107,7 +107,7 @@ public class xAuthToFlat { return xP; } - public String getPassword(int accountId) { + private String getPassword(int accountId) { String realPass = ""; Connection conn = xAuth.getPlugin().getDatabaseController().getConnection(); PreparedStatement ps = null; From 0103c5e2e5bdef4c2875131fbf46d9780a1d9a0f Mon Sep 17 00:00:00 2001 From: Xephi Date: Mon, 28 Dec 2015 11:37:13 +0100 Subject: [PATCH 03/13] Cannot do this async --- .../fr/xephi/authme/listener/AuthMeServerStop.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerStop.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerStop.java index f37c2c65f..eed3bd908 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerStop.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerStop.java @@ -16,9 +16,15 @@ public class AuthMeServerStop extends Thread { public void run() { // TODO: add a MessageKey if (Settings.kickPlayersBeforeStopping) { - for (Player p : plugin.getServer().getOnlinePlayers()) { - p.kickPlayer("Server is restarting"); - } + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() + { + @Override + public void run() { + for (Player p : plugin.getServer().getOnlinePlayers()) { + p.kickPlayer("Server is restarting"); + } + } + }); } } } From c94b6223a110b016acae4e30ddd3617716894cb0 Mon Sep 17 00:00:00 2001 From: Xephi Date: Mon, 28 Dec 2015 11:50:16 +0100 Subject: [PATCH 04/13] Add wildcard to perform reset position for each players --- .../authme/command/CommandInitializer.java | 4 +- .../authme/PurgeLastPositionCommand.java | 45 +++++++++++++------ .../xephi/authme/hooks/BungeeCordMessage.java | 3 +- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandInitializer.java b/src/main/java/fr/xephi/authme/command/CommandInitializer.java index 06ad2bd3b..0a52c7008 100644 --- a/src/main/java/fr/xephi/authme/command/CommandInitializer.java +++ b/src/main/java/fr/xephi/authme/command/CommandInitializer.java @@ -222,8 +222,8 @@ public final class CommandInitializer { .labels("resetpos", "purgelastposition", "purgelastpos", "resetposition", "resetlastposition", "resetlastpos") .description("Purge player's last position") - .detailedDescription("Purge the last know position of the specified player.") - .withArgument("player", "Player name", false) + .detailedDescription("Purge the last know position of the specified player or all of them.") + .withArgument("player/*", "Player name or * for all players", false) .permissions(OP_ONLY, AdminPermission.PURGE_LAST_POSITION) .executableCommand(new PurgeLastPositionCommand()) .build(); diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/PurgeLastPositionCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeLastPositionCommand.java index 3c56f0554..15a6e80b1 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/PurgeLastPositionCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeLastPositionCommand.java @@ -15,21 +15,38 @@ public class PurgeLastPositionCommand implements ExecutableCommand { String playerName = arguments.isEmpty() ? sender.getName() : arguments.get(0); String playerNameLowerCase = playerName.toLowerCase(); - // Get the user auth and make sure the user exists - PlayerAuth auth = commandService.getDataSource().getAuth(playerNameLowerCase); - if (auth == null) { - commandService.send(sender, MessageKey.UNKNOWN_USER); - return; + if (playerNameLowerCase.equalsIgnoreCase("*")) + { + for (PlayerAuth auth : commandService.getDataSource().getAllAuths()) + { + // Set the last position + auth.setQuitLocX(0D); + auth.setQuitLocY(0D); + auth.setQuitLocZ(0D); + auth.setWorld("world"); + commandService.getDataSource().updateQuitLoc(auth); + } + sender.sendMessage("All players last position locations are now reset"); + } + else + { + // Get the user auth and make sure the user exists + PlayerAuth auth = commandService.getDataSource().getAuth(playerNameLowerCase); + if (auth == null) { + commandService.send(sender, MessageKey.UNKNOWN_USER); + return; + } + + // Set the last position + auth.setQuitLocX(0D); + auth.setQuitLocY(0D); + auth.setQuitLocZ(0D); + auth.setWorld("world"); + commandService.getDataSource().updateQuitLoc(auth); + + // Show a status message + sender.sendMessage(playerNameLowerCase + "'s last position location is now reset"); } - // Set the last position - auth.setQuitLocX(0D); - auth.setQuitLocY(0D); - auth.setQuitLocZ(0D); - auth.setWorld("world"); - commandService.getDataSource().updateQuitLoc(auth); - - // Show a status message - sender.sendMessage(playerNameLowerCase + "'s last position location is now reset"); } } diff --git a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java index 11240003d..f5d3e0ae2 100644 --- a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java +++ b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java @@ -70,8 +70,7 @@ public class BungeeCordMessage implements PluginMessageListener { } else if ("register".equals(act)) { ConsoleLogger.info("Player " + auth.getNickname() + " has registered out from one of your server!"); - } - else if ("changepassword".equals(act)) { + } else if ("changepassword".equals(act)) { final String password = args[2]; auth.setHash(password); if (args.length == 4) From 806201e1cc7250f2ebf71a4f3f219eef7b5a64e1 Mon Sep 17 00:00:00 2001 From: Xephi Date: Mon, 28 Dec 2015 11:59:30 +0100 Subject: [PATCH 05/13] Add Hostname to restricted ip method --- .../authme/process/join/AsynchronousJoin.java | 2 +- .../java/fr/xephi/authme/settings/Settings.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java index 406f63335..56656e97f 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java @@ -58,7 +58,7 @@ public class AsynchronousJoin { } final String ip = plugin.getIP(player); - if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) { + if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip, player.getAddress().getHostName())) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { @Override diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index f4943a53d..6080d45eb 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -385,7 +385,7 @@ public final class Settings { * * @return boolean */ - public static boolean getRestrictedIp(String name, String ip) { + public static boolean getRestrictedIp(String name, String ip, String domain) { Iterator iterator = getRestrictedIp.iterator(); boolean trueOnce = false; @@ -396,8 +396,17 @@ public final class Settings { String testIp = args[1]; if (testName.equalsIgnoreCase(name)) { nameFound = true; - if (testIp.equalsIgnoreCase(ip)) { - trueOnce = true; + if (ip != null) + { + if (testIp.equalsIgnoreCase(ip)) { + trueOnce = true; + } + } + if (domain != null) + { + if (testIp.equalsIgnoreCase(domain)) { + trueOnce = true; + } } } } @@ -746,7 +755,7 @@ public final class Settings { if (!contains("Email.emailOauth2Token")) set("Email.emailOauth2Token", ""); - + if (!contains("Hook.sendPlayerTo")) { set("Hooks.sendPlayerTo", ""); From 0688a8645a31e61f2055227e1bd63d2b5bb8859a Mon Sep 17 00:00:00 2001 From: Xephi Date: Mon, 28 Dec 2015 12:29:00 +0100 Subject: [PATCH 06/13] Deprecated PLAINTEXT support --- src/main/java/fr/xephi/authme/AuthMe.java | 15 +++++++++++++++ .../fr/xephi/authme/security/HashAlgorithm.java | 1 + src/main/resources/config.yml | 1 - 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 347a77f08..32188d235 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -40,6 +40,8 @@ import fr.xephi.authme.output.Messages; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerPermission; import fr.xephi.authme.process.Management; +import fr.xephi.authme.security.HashAlgorithm; +import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.OtherAccounts; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; @@ -585,6 +587,19 @@ public class AuthMe extends JavaPlugin { } } + // TODO: Move this to another place maybe ? + if (Settings.getPasswordHash == HashAlgorithm.PLAINTEXT) + { + ConsoleLogger.showError("Your HashAlgorithm has been detected has plaintext and is now deprecrated, it will be changed and hashed now to AuthMe default hashing method"); + for (PlayerAuth auth : database.getAllAuths()) + { + auth.setHash(PasswordSecurity.getHash(HashAlgorithm.SHA256, auth.getHash(), auth.getNickname())); + database.updatePassword(auth); + } + Settings.setValue("settings.security.passwordHash", "SHA256"); + Settings.reload(); + } + if (Settings.isCachingEnabled) { database = new CacheDataSource(database); } diff --git a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java index bef417057..315fa9fde 100644 --- a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java +++ b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java @@ -13,6 +13,7 @@ public enum HashAlgorithm { XAUTH(fr.xephi.authme.security.crypts.XAUTH.class), MD5VB(fr.xephi.authme.security.crypts.MD5VB.class), PHPBB(fr.xephi.authme.security.crypts.PHPBB.class), + @Deprecated PLAINTEXT(fr.xephi.authme.security.crypts.PLAINTEXT.class), MYBB(fr.xephi.authme.security.crypts.MYBB.class), IPB3(fr.xephi.authme.security.crypts.IPB3.class), diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 435bd1e4d..7f151c495 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -181,7 +181,6 @@ settings: # Example unLoggedinGroup: NotLogged unLoggedinGroup: unLoggedinGroup # possible values: MD5, SHA1, SHA256, WHIRLPOOL, XAUTH, MD5VB, PHPBB, - # PLAINTEXT ( unhashed password), # MYBB, IPB3, PHPFUSION, SMF, XENFORO, SALTED2MD5, JOOMLA, BCRYPT, WBB3, SHA512, # DOUBLEMD5, PBKDF2, PBKDF2DJANGO, WORDPRESS, ROYALAUTH, CUSTOM(for developpers only) passwordHash: SHA256 From c4fa2a756aea81752897d7594b861213213f9831 Mon Sep 17 00:00:00 2001 From: Xephi Date: Mon, 28 Dec 2015 12:48:20 +0100 Subject: [PATCH 07/13] Remove an old todo --- .../java/fr/xephi/authme/process/email/AsyncChangeEmail.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java b/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java index 5cc1f9ec8..214b82152 100644 --- a/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java +++ b/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java @@ -80,8 +80,6 @@ public class AsyncChangeEmail { return; } m.send(player, MessageKey.EMAIL_CHANGED_SUCCESS); - // TODO ljacqu 20151124: Did I really miss "email_defined" or is it not present in the 'en' messages? - // player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); } else { if (plugin.database.isAuthAvailable(playerName)) { m.send(player, MessageKey.LOGIN_MESSAGE); From 32dbe60ae8960df48990483afed871e14e726dc5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 28 Dec 2015 12:51:40 +0100 Subject: [PATCH 08/13] Update newPlugin.yml --- newPlugin.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/newPlugin.yml b/newPlugin.yml index a00a77f60..f403da60b 100644 --- a/newPlugin.yml +++ b/newPlugin.yml @@ -111,7 +111,6 @@ permissions: authme.admin.accounts: true authme.admin.getemail: true authme.admin.getip: true - authme.admin.resetposition: true authme.admin.setspawn: true authme.admin.spawn: true authme.admin.setfirstspawn: true @@ -156,9 +155,6 @@ permissions: authme.admin.getip: description: Get IP from a player (fake and real) default: false - authme.admin.resetposition: - description: Reset last position for a player - default: false authme.admin.setspawn: description: Set the AuthMe spawn point default: false @@ -181,7 +177,7 @@ permissions: description: Purge banned players default: false authme.admin.purgelastpos: - description: Purge last pos of players + description: Purge last position of a player/players default: false authme.admin.converter: description: Allow the /authme converter command From 12093249363d0ea6f0052e18d919c888f49888b5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 28 Dec 2015 13:07:09 +0100 Subject: [PATCH 09/13] Update .travis.yml --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index f6b0f1404..9ae66a76e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,12 @@ cache: script: - mvn clean install -B && mvn clean -B +before_install: + - pip install --user codecov + +after_success: + - codecov + notifications: webhooks: urls: From b4fb4baace95e452bdbe634a6f8d09324b6fd574 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 28 Dec 2015 13:10:51 +0100 Subject: [PATCH 10/13] Damn travis --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ae66a76e..f6b0f1404 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,12 +10,6 @@ cache: script: - mvn clean install -B && mvn clean -B -before_install: - - pip install --user codecov - -after_success: - - codecov - notifications: webhooks: urls: From 98e8dfc3e2a13119ace72735a9034fa8f961d367 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 28 Dec 2015 13:11:28 +0100 Subject: [PATCH 11/13] Circle, please! --- circle.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/circle.yml b/circle.yml index 6da929d44..e0e5fbdd3 100644 --- a/circle.yml +++ b/circle.yml @@ -7,3 +7,7 @@ general: test: override: - mvn clean install -B + +test: + post: + - pip install codecov && codecov From 2bb5dee61c1816206a51d210aa8d810139409b5b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 28 Dec 2015 13:14:42 +0100 Subject: [PATCH 12/13] Damn automated ci services --- circle.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/circle.yml b/circle.yml index e0e5fbdd3..6da929d44 100644 --- a/circle.yml +++ b/circle.yml @@ -7,7 +7,3 @@ general: test: override: - mvn clean install -B - -test: - post: - - pip install codecov && codecov From 91e71cccf98fa05a879cb8ba570389c4403cffc0 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 28 Dec 2015 13:30:08 +0100 Subject: [PATCH 13/13] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 406859f7a..fb23fd75d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ - Build status (CircleCI): [![Circle CI](https://circleci.com/gh/Xephi/AuthMeReloaded.svg?style=svg)](https://circleci.com/gh/Xephi/AuthMeReloaded) +- Code Coverage: [![Coverage Status](https://coveralls.io/repos/AuthMe-Team/AuthMeReloaded/badge.svg?branch=master&service=github)](https://coveralls.io/github/AuthMe-Team/AuthMeReloaded?branch=master) + - Issue Tracking : [![Stories in Ready](https://badge.waffle.io/Xephi/AuthMeReloaded.png?label=ready&title=Ready)](https://waffle.io/Xephi/AuthMeReloaded) [![Stories in Bugs](https://badge.waffle.io/Xephi/AuthMeReloaded.png?label=bugs&title=Bugs)](https://waffle.io/Xephi/AuthMeReloaded) [![Stories in In%20Progress](https://badge.waffle.io/Xephi/AuthMeReloaded.png?label=in%20progress&title=In%20Progress)](https://waffle.io/Xephi/AuthMeReloaded) - Build Server (DEVELOPMENT BUILDS): Xephi's Jenkins