From ab35dd9f9bda69e86f1ffea3d7fc3527d16fde14 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 22:57:27 +0200 Subject: [PATCH 01/31] Even more consistency! Also forgot somewhere the "error" message --- src/main/resources/messages_it.yml | 39 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/main/resources/messages_it.yml b/src/main/resources/messages_it.yml index 48ac45169..5a58cb28d 100644 --- a/src/main/resources/messages_it.yml +++ b/src/main/resources/messages_it.yml @@ -4,13 +4,14 @@ not_logged_in: '&cNon hai ancora eseguito l''autenticazione!' reg_voluntarily: 'Puoi eseguire la registrazione al server con il comando: "/register "' usage_log: '&cUtilizzo: /login ' wrong_pwd: '&cPassword non corretta!' -unregistered: '&cL''utente è stato rimosso dal database con successo!' +unregistered: '&cSei stato rimosso dal database con successo!' reg_disabled: '&cLa registrazione tramite i comandi di gioco è disabilitata.' valid_session: '&cAutenticato automaticamente attraverso la precedente sessione!' login: '&cAutenticazone effettuata correttamente!' vb_nonActiv: 'Il tuo account non è stato ancora verificato, controlla fra le tue email per scoprire come attivarlo!' -user_regged: '&cHai già effettuato la registrazione, non è possibile eseguirla nuovamente.' +user_regged: '&cHai già effettuato la registrazione, non puoi eseguirla nuovamente.' usage_reg: '&cUtilizzo: /register ' +error: 'Qualcosa è andato storto, riporta questo errore ad un Admin!' max_reg: 'Hai raggiunto il numero massimo di registrazioni per questo indirizzo IP!' no_perm: '&cNon hai il permesso di eseguire questa operazione.' login_msg: '&cPerfavore, esegui l''autenticazione con il comando: "/login "' @@ -23,35 +24,35 @@ password_error: 'Le Password non corrispondono!' password_error_nick: 'Non puoi usare il tuo nome utente come password, scegline un''altra!' password_error_unsafe: 'La password che hai inserito non è sicura, scegline un''altra!' invalid_session: 'I tuoi dati di connessione attuali non sono quelli utilizzati in precedenza. Attendi la fine della sessione attuale.' -reg_only: 'La registrazione è effettuabile soltanto attraverso il sito web! Perfavore, vai su http://example.com per procedere!' -logged_in: '&cHai già eseguito l''autenticazione!' +reg_only: 'Puoi giocare in questo server solo dopo aver effettuato la registrazione attraverso il sito web! Perfavore, vai su http://esempio.it per procedere!' +logged_in: '&cHai già eseguito l''autenticazione, non devi eseguirla nuovamente!' logout: '&cDisconnessione avvenuta correttamente!' -same_nick: 'Lo stesso nickname è già online sul server!' +same_nick: 'Questo stesso nome utente è già online sul server!' registered: '&cRegistrato correttamente!' -pass_len: 'La tua password è troppo corta o troppo lunga, scegline un''altra!' +pass_len: 'La password che hai inserito è troppo corta o troppo lunga, scegline un''altra!' reload: 'La configurazione e il database sono stati ricaricati con successo!' timeout: 'Tempo scaduto per effettuare l''autenticazione' usage_changepassword: 'Utilizzo: /changepassword ' -name_len: '&cIl tuo nickname è troppo corto o troppo lungo!' -regex: '&cIl tuo nickname contiene caratteri non consentiti. I caratteri consentiti sono: REG_EX' -add_email: '&cPer poter recuperare la password in futuro, aggiungi una email al tuo account con il comando: "/email add "' +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 "' bad_database_email: 'Il comando /email è utilizzabile solo con un database MySQL o SQLite, riporta questo errore ad un Admin!' recovery_email: '&cHai dimenticato la tua password? Puoi recuperarla eseguendo il comando: "/email recovery "' -usage_captcha: '&cUtilizzo: /captcha THE_CAPTCHA' -wrong_captcha: '&cCodice captcha sbagliato, perfavore riprova con il comando: "/captcha THE_CAPTCHA"' -valid_captcha: '&cIl tuo captcha è valido!' -kick_forvip: '&cUn utente VIP è entrato mentre il server era pieno!' +usage_captcha: '&cAbbiamo bisogno che tu inserisca un captcha, perfavore scrivi: "/captcha THE_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!' kick_fullserver: '&cIl server è attualmente pieno, riprova più tardi!' usage_email_add: '&fUtilizzo: /email add ' usage_email_change: '&fUtilizzo: /email change ' usage_email_recovery: '&fUtilizzo: /email recovery ' -new_email_invalid: 'La nuova email non è valida!' -old_email_invalid: 'La vecchia email non è valida!' +new_email_invalid: 'Il nuovo indirizzo email inserito non è valido!' +old_email_invalid: 'Il vecchio indirizzo email inserito non è valido!' email_invalid: 'L''indirizzo email inserito non è valido' -email_added: 'Email aggiunta correttamente!' -email_confirm: 'Conferma la tua email!' -email_changed: 'Email cambiata correttamente!' -email_send: 'Email di recupero inviata al tuo indirizzo email!' +email_added: 'Indirizzo email aggiunto correttamente!' +email_confirm: 'Conferma il tuo indirizzo email!' +email_changed: 'Indirizzo email cambiato correttamente!' +email_send: 'Una email di recupero è stata appena inviata al tuo indirizzo email!' email_exists: 'Il tuo account ha già un''indirizzo email configurato. Se vuoi, puoi cambiarlo con il seguente comando:' country_banned: 'Il tuo paese è bandito da questo server!' antibot_auto_enabled: 'Il servizio di AntiBot è stato automaticamente abilitato a seguito delle numerose connessioni!' From 5b991bf086362ab5f50e8e366fde248cac9aef39 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 23:10:24 +0200 Subject: [PATCH 02/31] Added Turkish translaton By CriticalAttack on Bukkit Dev --- src/main/resources/messages_t | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/main/resources/messages_t diff --git a/src/main/resources/messages_t b/src/main/resources/messages_t new file mode 100644 index 000000000..899bee304 --- /dev/null +++ b/src/main/resources/messages_t @@ -0,0 +1,59 @@ +unknown_user: '&fKullanici veritabanina ekli degil' +unsafe_spawn: '&fDogdugunuz konum guvenli degildi, lobiye isinlaniyorsunuz...' +not_logged_in: '&cGiris Yapmadin!' +reg_voluntarily: '&fKullanici adinla kayit olabilirsin! Komut: "/register sifren sifrentekrar"' +usage_log: '&cKullanimi: /login sifren' +wrong_pwd: '&cYanlis sifre' +unregistered: '&cSunucudan kaydiniz basariyla silindi!' +reg_disabled: '&cKayit deaktif' +valid_session: '&cOturum Acma' +login: '&cBasarili giris!' +vb_nonActiv: '&fHesabin aktiflestirilmedi! Emailini kontrol et' +user_regged: '&cKullanici zaten oyunda' +usage_reg: '&cKullanimi: /register sifre sifretekrar' +max_reg: '&fMaximim kayit limitini astin!' +no_perm: '&cYetkin yok' +error: '&fBir hata olustu; Lutfen adminle iletisime gec' +login_msg: '&cGiris Yapin : "/login sifre"' +reg_msg: '&cLutfen kaydolmak icin : "/register sifre sifretekrar"' +reg_email_msg: '&cLutfen Kaydolmak icin : "/register "' +usage_unreg: '&cKullanimi: /unregister sifren' +pwd_changed: '&cSifreniz degisti!' +user_unknown: '&cBu kullaniciyla kaydolunmamis!' +password_error: '&fSifren eslesmiyor' +password_error_nick: '&fYou can''t use your name as password, please choose another one' +password_error_unsafe: '&fThe chosen password is not safe, please choose another one' +invalid_session: '&fOturum veritabanlari uyusmuyor lutfen sonunu bekleyin' +reg_only: '&fSadece kayitli uyeler girebilir ! Kayit olmak icin www.orneksite.com adresini ziyaret ediniz !' +logged_in: '&cZaten Giris Yapilmis!' +logout: '&cBasarili cikis' +same_nick: '&fAyni kullanici oyunda' +registered: '&cBasarili kayit!' +pass_len: '&fSifren cok uzun ya da kisa olmamali ' +reload: '&fKonfigurasyon dosyasi ve veritabani yüklendi' +timeout: '&fZaman Asimi' +usage_changepassword: '&fkullanimi: /changepassword eskisifre yenisifre' +name_len: '&cKullanici adin cok kisa ya da cok uzun' +regex: '&cKullanici adin ozel karakterler iceriyor. Uygun karakterler: REG_EX' +add_email: '&cLutfen emailini ekle : /email add ' +bad_database_email: '[AuthMe] Bu /email komutu sadece MySql ve SQLite ile etkinlestireilebilir' +recovery_email: '&cSifreni mi unuttun? Degistirmek icin : /email recovery ' +usage_captcha: '&cBir captcha yazman lazim , yazmak icin: /captcha ' +wrong_captcha: '&cYanlis Captcha, kullanmak icin : /captcha THE_CAPTCHA' +valid_captcha: '&cCaptcha gecerli !' +kick_forvip: '&cSenin yerine bir VIP kullanıcı girdi!' +kick_fullserver: '&cServer suanda dolu gozukuyor, Uzgunum!' +usage_email_add: '&fKullanimi: /email add ' +usage_email_change: '&fKullanimi: /email change ' +usage_email_recovery: '&fKullanimi: /email recovery ' +new_email_invalid: '[AuthMe] Yeni eposta gecersiz!' +old_email_invalid: '[AuthMe] Eski eposta gecersiz!' +email_invalid: '[AuthMe] Gecersiz Eposta' +email_added: '[AuthMe] Eposta Eklendi !' +email_confirm: '[AuthMe] Epostani Dogrula !' +email_changed: '[AuthMe] Eposta Degistirildi !' +email_send: '[AuthMe] Kurtarma postasi gonderildi !' +email_exists: '[AuthMe] An email already exists on your account. You can change it using the command below' +country_banned: 'Ulken bu serverdan banlandi !' +antibot_auto_enabled: '[AuthMe] AntiBotMode otomatik olarak etkinlestirildi!' +antibot_auto_disabled: '[AuthMe] AntiBotMode %m dakika sonra otomatik olarak isgal yuzundan devredisi birakildi' From 4033dc5c29aca4f24e3f31a49e9e99c93a0dfb75 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 23:10:51 +0200 Subject: [PATCH 03/31] My keyboard fails sometims --- src/main/resources/{messages_t => messages_tr} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/{messages_t => messages_tr} (100%) diff --git a/src/main/resources/messages_t b/src/main/resources/messages_tr similarity index 100% rename from src/main/resources/messages_t rename to src/main/resources/messages_tr From ab96bcdf87f0a87e4611cde2940e59045608ee40 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 23:11:20 +0200 Subject: [PATCH 04/31] Last rename, promise --- src/main/resources/{messages_tr => messages_tr.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/{messages_tr => messages_tr.yml} (100%) diff --git a/src/main/resources/messages_tr b/src/main/resources/messages_tr.yml similarity index 100% rename from src/main/resources/messages_tr rename to src/main/resources/messages_tr.yml From 2119523716246839e9f540796053ba10fdf2921b Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 23:18:49 +0200 Subject: [PATCH 05/31] Added Basque translation By galaipa on Bukkit Dev --- src/main/resources/messages_eu.yml | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/main/resources/messages_eu.yml diff --git a/src/main/resources/messages_eu.yml b/src/main/resources/messages_eu.yml new file mode 100644 index 000000000..4a45b3f9b --- /dev/null +++ b/src/main/resources/messages_eu.yml @@ -0,0 +1,59 @@ +unknown_user: '&fErabiltzailea ez dago datu basean' +unsafe_spawn: '&fSpawn-era telegarraiatu zara' +not_logged_in: '&cSaioa hasi gabe!' +reg_voluntarily: '&fZure erabiltzailea erregistratu dezakezu:"/register pasahitza pasahitza"' +usage_log: '&cErabili: /login pasahitza' +wrong_pwd: '&cPasahitz okerra' +unregistered: '&cZure erregistroa ezabatu duzu!' +reg_disabled: '&cErregistroa desgaitua' +valid_session: '&cSession login' +login: '&cOngi etorri!' +vb_nonActiv: '&fZure kontua aktibatu gabe dago, konfirmatu zure emaila!' +user_regged: '&cErabiltzailea dagoeneko erregistratua' +usage_reg: '&cErabili: /register pasahitza pasahitza' +max_reg: '&fKontuko 2 erabiltzaile bakarrik izan ditzakezu' +no_perm: '&cBaimenik ez' +error: '&fErrorea; Mesedez jarri kontaktuan administratzaile batekin' +login_msg: '&cMesedez erabili "/login pasahitza" saioa hasteko' +reg_msg: '&cMesedez erabili "/register pasahitza pasahitza" erregistratzeko' +reg_email_msg: '&cMesdez erabili "/register " erregistratzeko' +usage_unreg: '&cErabili: /unregister password' +pwd_changed: '&cPasahitza aldatu duzu!' +user_unknown: '&cErabiltzailea ez dago erregistratuta' +password_error: '&fPasahitzak ez datoz bat' +password_error_nick: '&fYou can''t use your name as password, please choose another one' +password_error_unsafe: '&fThe chosen password is not safe, please choose another one' +invalid_session: '&fSession Dataes doesnt corrispond Plaese wait the end of session' +reg_only: '&fErregistratuako erabiltzaileak bakarrik! Mesedez bisitatu http://example.com erregistratzeko' +logged_in: '&cDagoeneko saioa hasita!' +logout: '&cAtera zara' +same_nick: '&fZure izen berdina duen erabiltzaile bat zerbitzarian jolasten dago' +registered: '&cOndo erregistratu zara!' +pass_len: '&fZure pasahitza motzegia edo luzeegia da' +reload: '&fConfiguration and database has been reloaded' +timeout: '&fDenbora gehiegi egon zara saioa hasi gabe' +usage_changepassword: '&fErabili: /changepassword pasahitzZaharra pasahitzBerria' +name_len: '&cZure erabiltzaile izena motzegia edo luzeegia da' +regex: '&cZure erabiltzaileak karaktere debekatuak ditu. Karaktere onartuak: REG_EX' +add_email: '&cMesedez gehitu zure emaila : /email add yourEmail confirmEmail' +bad_database_email: '[AuthMe] /email komandoa MySql-rekin bakarrik dago erabilgarri. Jarri kontaktuan administratzaile batekin' +recovery_email: '&cPasahitza ahaztu duzu? Erabili /email recovery ' +usage_captcha: '&cYou need to type a captcha, please type: /captcha ' +wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA' +valid_captcha: '&cYour captcha is valid !' +kick_forvip: '&cVIP erabiltzaile bat sartu da zerbitzaria beteta zegoenean!' +kick_fullserver: '&cZerbitzaria beteta dago, Barkatu!' +usage_email_add: '&fErabili: /email add ' +usage_email_change: '&fErabili: /email change ' +usage_email_recovery: '&fErabili: /email recovery ' +new_email_invalid: '[AuthMe] Email okerra!' +old_email_invalid: '[AuthMe] Email zaharra okerra!' +email_invalid: '[AuthMe] Email okerrea' +email_added: '[AuthMe] Emaila gehitu duzu !' +email_confirm: '[AuthMe] Konfirmatu zure emaila !' +email_changed: '[AuthMe] Emaila aldatua!' +email_send: '[AuthMe] Berreskuratze emaila bidalita !' +email_exists: '[AuthMe] An email already exists on your account. You can change it using the command below' +country_banned: '[AuthMe]Zure herrialdea blokeatuta dago zerbitzari honetan' +antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!' +antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes,hope invasion stopped' From f5029350e1aa69058a69cd4a170c6dfae9a8450e Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 23:28:21 +0200 Subject: [PATCH 06/31] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05c1edf28..57a948495 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ AuthMe Reloaded prevents players who aren't logged in from actions like placing
  • Possible to use without a Permissions plugin
  • Spoutcraft Login GUI
  • Automatic backup system of all your user password data -
  • Default Language Style: en, de, br, cz, pl, fr, it, ru, hu, sk, es, zhtw, fi, zhcn, nl ( feel free to send new translations ) +
  • Default Language Style: en, de, br, cz, pl, fr, it, ru, hu, sk, es, zhtw, fi, zhcn, nl, ko, eu, tr, pt ( feel free to send new translations )
  • Convert the FlatFile auths.db to an usefull authme.sql that you can use on a MySQL database !
  • Import your database from Rakamak, xAuth, CrazyLogin, RoyalAuth, vAuth !
  • From 350ed9cc9e52e1b71f0fcefc1198d3c7b0a788d5 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 23:29:27 +0200 Subject: [PATCH 07/31] Update Settings.java --- src/main/java/fr/xephi/authme/settings/Settings.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index fc6891974..085594c59 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -848,6 +848,8 @@ public final class Settings extends YamlConfiguration { pt, nl, gl, - bg + bg, + eu, + tr } } From 979c1f2528c511ae294e2c67bfc838d996b026d0 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Thu, 9 Jul 2015 23:33:29 +0200 Subject: [PATCH 08/31] Readme has finally all the translations I love Text Mechanic --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 57a948495..bac4f33ca 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ AuthMe Reloaded prevents players who aren't logged in from actions like placing
  • Possible to use without a Permissions plugin
  • Spoutcraft Login GUI
  • Automatic backup system of all your user password data -
  • Default Language Style: en, de, br, cz, pl, fr, it, ru, hu, sk, es, zhtw, fi, zhcn, nl, ko, eu, tr, pt ( feel free to send new translations ) +
  • Default Language Style: en, de, br, cz, pl, fr, uk, ru, hu, sk, es, fi, zhtw, zhhk, zhcn, lt, it, ko, pt, nl, gl, bg, eu, tr ( feel free to send new translations )
  • Convert the FlatFile auths.db to an usefull authme.sql that you can use on a MySQL database !
  • Import your database from Rakamak, xAuth, CrazyLogin, RoyalAuth, vAuth !
  • From e63764e585a6f80b94b651999488d4a4931b52be Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:15:12 +0200 Subject: [PATCH 09/31] Moved password checks with the others --- .../process/register/AsyncronousRegister.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java index 0a6be53f7..297957d14 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java @@ -52,15 +52,27 @@ public class AsyncronousRegister { allowRegister = false; } - else if ((lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null")) || !lowpass.matches(Settings.getPassRegex)) { + else if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) { m.send(player, "password_error"); allowRegister = false; } - else if ((lowpass.equalsIgnoreCase(player.getName()))) { + else if (lowpass.equalsIgnoreCase(player.getName())) { m.send(player, "password_error_nick"); allowRegister = false; } + + else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) { + m.send(player, "pass_len"); + allowRegister = false; + } + + else if (!Settings.unsafePasswords.isEmpty()) { + if (Settings.unsafePasswords.contains(password.toLowerCase())) { + m.send(player, "password_error_unsafe"); + allowRegister = false; + } + } else if (database.isAuthAvailable(name)) { m.send(player, "user_regged"); @@ -125,16 +137,6 @@ public class AsyncronousRegister { } protected void passwordRegister() { - if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) { - m.send(player, "pass_len"); - return; - } - if (!Settings.unsafePasswords.isEmpty()) { - if (Settings.unsafePasswords.contains(password.toLowerCase())) { - m.send(player, "password_error_unsafe"); - return; - } - } PlayerAuth auth = null; String hash = ""; try { From 11785c6547f3b9122fbb420893dc22af8a88cc9e Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:16:42 +0200 Subject: [PATCH 10/31] Easing out code --- .../java/fr/xephi/authme/commands/ChangePasswordCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java index c6c5fb5c7..70aa6958e 100644 --- a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java @@ -52,11 +52,11 @@ public class ChangePasswordCommand implements CommandExecutor { } String lowpass = args[1].toLowerCase(); - if ((lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null")) || !lowpass.matches(Settings.getPassRegex)) { + if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) { m.send(player, "password_error"); return true; } - if ((lowpass.equalsIgnoreCase(name))) { + if (lowpass.equalsIgnoreCase(name)) { m.send(player, "password_error_nick"); return true; } From 63497269f21ec12bc0f49aa804d651aebd0d4ffd Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:23:09 +0200 Subject: [PATCH 11/31] Admin Commands rework //TODO: Still needs to block output if doesn't have the permission for "Usage:" messages. //TODO: Add a way to replicate the "/authme" command when "/authme args[0]" is not in the list. --- .../xephi/authme/commands/AdminCommand.java | 327 ++++++++++-------- 1 file changed, 179 insertions(+), 148 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 947df69a2..2c2f4d326 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -57,21 +57,27 @@ public class AdminCommand implements CommandExecutor { public boolean onCommand(CommandSender sender, Command cmnd, String label, String[] args) { if (args.length == 0) { - sender.sendMessage("Usage: /authme reload - Reload the config"); + sender.sendMessage("Usage:"); + sender.sendMessage("/authme reload - Reload the config"); + sender.sendMessage("/authme version - Get AuthMe version info"); sender.sendMessage("/authme register - Register a player"); - sender.sendMessage("/authme changepassword - Change player password"); sender.sendMessage("/authme unregister - Unregister a player"); - sender.sendMessage("/authme purge - Purge Database"); - sender.sendMessage("/authme version - Get AuthMe version infos"); - sender.sendMessage("/authme lastlogin - Display Date about the Player's LastLogin"); + sender.sendMessage("/authme changepassword - Change a player's password"); + sender.sendMessage("/authme chgemail - Change a player's email"); + sender.sendMessage("/authme getemail - Get a player's email"); + sender.sendMessage("/authme getip - Display a player's IP if he's online"); + sender.sendMessage("/authme lastlogin - Display the date of a player's last login"); sender.sendMessage("/authme accounts - Display all player's accounts"); - sender.sendMessage("/authme setSpawn - Set AuthMe spawn to your current pos"); - sender.sendMessage("/authme spawn - Teleport you to the AuthMe SpawnPoint"); - sender.sendMessage("/authme chgemail - Change player email"); - sender.sendMessage("/authme getemail - Get player email"); - sender.sendMessage("/authme purgelastpos - Purge last position for a player"); - sender.sendMessage("/authme switchantibot on/off - Enable/Disable antibot method"); - sender.sendMessage("/authme forcelogin "); + sender.sendMessage("/authme purge - Purge database"); + sender.sendMessage("/authme purgebannedplayers - Purge database from banned players"); + sender.sendMessage("/authme purgelastpos - Purge last position infos for a player"); + sender.sendMessage("/authme setspawn - Set player's spawn to your current position"); + sender.sendMessage("/authme setfirstspawn - Set player's first spawn to your current position"); + sender.sendMessage("/authme spawn - Teleport yourself to the spawn point"); + sender.sendMessage("/authme firstspawn - Teleport yourself to the first spawn point"); + sender.sendMessage("/authme switchantibot on/off - Enable/Disable AntiBot feature"); + sender.sendMessage("/authme forcelogin - Enforce the login of a connected player"); + sender.sendMessage("/authme passpartutoken - Generate a timed token to login with every player's account (CONSOLE ONLY)"); return true; } @@ -80,15 +86,15 @@ public class AdminCommand implements CommandExecutor { return true; } - if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartuToken")) { + if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) { if (args.length > 1) { - System.out.println("[AuthMe] command usage: /authme passpartuToken"); + System.out.println("[AuthMe] command usage: /authme passpartutoken"); return true; } if (Utils.getInstance().obtainToken()) { - System.out.println("[AuthMe] You have 30s for insert this token ingame with /passpartu [token]"); + System.out.println("[AuthMe] You have 30s to insert this token ingame with /passpartu "); } else { - System.out.println("[AuthMe] Security error on passpartu token, redo it. "); + System.out.println("[AuthMe] Security error on passpartu token, please redo the command."); } return true; } @@ -100,7 +106,11 @@ public class AdminCommand implements CommandExecutor { if (args[0].equalsIgnoreCase("purge")) { if (args.length != 2) { - sender.sendMessage("Usage: /authme purge "); + sender.sendMessage("Usage: /authme purge "); + return true; + } + if (Integer.parseInt(args[1]) < 30) { + sender.sendMessage("You can only purge data older than 30 days") return true; } try { @@ -117,9 +127,10 @@ public class AdminCommand implements CommandExecutor { plugin.dataManager.purgeLimitedCreative(purged); if (Settings.purgeAntiXray) plugin.dataManager.purgeAntiXray(purged); + sender.sendMessage("[AuthMe] Database has been purged correctly"); return true; } catch (NumberFormatException e) { - sender.sendMessage("Usage: /authme purge "); + sender.sendMessage("Usage: /authme purge "); return true; } } else if (args[0].equalsIgnoreCase("reload")) { @@ -161,24 +172,23 @@ public class AdminCommand implements CommandExecutor { return true; } try { - if (database.getAuth(args[1].toLowerCase()) != null) { - PlayerAuth player = database.getAuth(args[1].toLowerCase()); - long lastLogin = player.getLastLogin(); - Date d = new Date(lastLogin); - final long diff = System.currentTimeMillis() - lastLogin; - final String msg = (int) (diff / 86400000) + " days " + (int) (diff / 3600000 % 24) + " hours " + (int) (diff / 60000 % 60) + " mins " + (int) (diff / 1000 % 60) + " secs."; - String lastIP = player.getIp(); - sender.sendMessage("[AuthMe] " + args[1] + " lastlogin : " + d.toString()); - sender.sendMessage("[AuthMe] The player : " + player.getNickname() + " is unlogged since " + msg); - sender.sendMessage("[AuthMe] LastPlayer IP : " + lastIP); - } else { - m.send(sender, "unknown_user"); - return true; - } + PlayerAuth auth = database.getAuth(args[1].toLowerCase()); } catch (NullPointerException e) { m.send(sender, "unknown_user"); return true; } + if (auth == null) { + m.send(sender, "user_unknown"); + return true; + } + long lastLogin = auth.getLastLogin(); + Date d = new Date(lastLogin); + final long diff = System.currentTimeMillis() - lastLogin; + final String msg = (int) (diff / 86400000) + " days " + (int) (diff / 3600000 % 24) + " hours " + (int) (diff / 60000 % 60) + " mins " + (int) (diff / 1000 % 60) + " secs."; + String lastIP = auth.getIp(); + sender.sendMessage("[AuthMe] " + args[1] + " lastlogin : " + d.toString()); + sender.sendMessage("[AuthMe] The player " + auth.getNickname() + " is unlogged since " + msg); + sender.sendMessage("[AuthMe] Last Player's IP: " + lastIP); } else if (args[0].equalsIgnoreCase("accounts")) { if (args.length != 2) { sender.sendMessage("Usage: /authme accounts "); @@ -186,83 +196,77 @@ public class AdminCommand implements CommandExecutor { return true; } if (!args[1].contains(".")) { - final CommandSender fSender = sender; - final String[] arguments = args; Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { - PlayerAuth pAuth = null; + PlayerAuth auth = null; String message = "[AuthMe] "; try { - pAuth = database.getAuth(arguments[1].toLowerCase()); + auth = database.getAuth(args[1].toLowerCase()); } catch (NullPointerException npe) { - fSender.sendMessage("[AuthMe] This player is unknown"); - return; + m.send(sender, "unknown_user"); + return true; } - if (pAuth != null) { - List accountList = database.getAllAuthsByName(pAuth); - if (accountList.isEmpty() || accountList == null) { - fSender.sendMessage("[AuthMe] This player is unknown"); - return; - } - if (accountList.size() == 1) { - fSender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); - return; - } - int i = 0; - for (String account : accountList) { - i++; - message = message + account; - if (i != accountList.size()) { - message = message + ", "; - } else { - message = message + "."; - } - } - fSender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - fSender.sendMessage(message); - } else { - fSender.sendMessage("[AuthMe] This player is unknown"); - return; + if (auth == null) { + m.send(sender, "unknown_user"); + return true; } + List accountList = database.getAllAuthsByName(auth); + if (accountList.isEmpty() || accountList == null) { + m.send(sender, "user_unknown"); + return true; + } + if (accountList.size() == 1) { + sender.sendMessage("[AuthMe] " + args[1] + " is a single account player"); + return true; + } + int i = 0; + for (String account : accountList) { + i++; + message = message + account; + if (i != accountList.size()) { + message = message + ", "; + } else { + message = message + "."; + } + } + sender.sendMessage("[AuthMe] " + args[1] + " has " + String.valueOf(accountList.size()) + " accounts"); + sender.sendMessage(message); } }); return true; } else { - final CommandSender fSender = sender; - final String[] arguments = args; Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { String message = "[AuthMe] "; - if (arguments[1] != null) { - List accountList = database.getAllAuthsByIp(arguments[1]); - if (accountList.isEmpty() || accountList == null) { - fSender.sendMessage("[AuthMe] Please put a valid IP"); - return; - } - if (accountList.size() == 1) { - fSender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); - return; - } - int i = 0; - for (String account : accountList) { - i++; - message = message + account; - if (i != accountList.size()) { - message = message + ", "; - } else { - message = message + "."; - } - } - fSender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - fSender.sendMessage(message); - } else { - fSender.sendMessage("[AuthMe] Please put a valid IP"); + if (args[1] == null) { + sender.sendMessage("[AuthMe] Please put a valid IP"); return; } + List accountList = database.getAllAuthsByIp(args[1]); + if (accountList.isEmpty() || accountList == null) { + sender.sendMessage("[AuthMe] This IP does not exist in the database"); + return true; + } + if (accountList.size() == 1) { + sender.sendMessage("[AuthMe] " + args[1] + " is a single account player"); + return true; + } + int i = 0; + for (String account : accountList) { + i++; + message = message + account; + if (i != accountList.size()) { + message = message + ", "; + } else { + message = message + "."; + } + } + sender.sendMessage("[AuthMe] " + args[1] + " has " + String.valueOf(accountList.size()) + " accounts"); + sender.sendMessage(message); } }); return true; @@ -270,9 +274,28 @@ public class AdminCommand implements CommandExecutor { } else if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) { if (args.length != 3) { - sender.sendMessage("Usage: /authme register playername password"); + sender.sendMessage("Usage: /authme register "); return true; } + String lowpass = args[2].toLowerCase(); + if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) { + m.send(player, "password_error"); + return true; + } + if (lowpass.equalsIgnoreCase(args[1])) { + m.send(player, "password_error_nick"); + return true; + } + if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) { + m.send(player, "pass_len"); + return true; + } + if (!Settings.unsafePasswords.isEmpty()) { + if (Settings.unsafePasswords.contains(lowpass)) { + m.send(player, "password_error_unsafe"); + return true; + } + } try { String name = args[1].toLowerCase(); if (database.isAuthAvailable(name)) { @@ -280,7 +303,7 @@ public class AdminCommand implements CommandExecutor { return true; } String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name); - PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0L, "your@email.com"); + PlayerAuth auth = new PlayerAuth(name, hash, "198.168.0.1", 0L, "your@email.com"); if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) auth.setSalt(PasswordSecurity.userSalt.get(name)); else auth.setSalt(""); @@ -297,42 +320,49 @@ public class AdminCommand implements CommandExecutor { return true; } else if (args[0].equalsIgnoreCase("getemail")) { if (args.length != 2) { - sender.sendMessage("Usage: /authme getemail playername"); + sender.sendMessage("Usage: /authme getemail "); return true; } String playername = args[1].toLowerCase(); - PlayerAuth getAuth = database.getAuth(playername); - if (getAuth == null) { + PlayerAuth auth = database.getAuth(playername); + if (auth == null) { m.send(sender, "unknown_user"); return true; } - sender.sendMessage("[AuthMe] " + args[1] + " email : " + getAuth.getEmail()); + sender.sendMessage("[AuthMe] " + args[1] + "'s email: " + getAuth.getEmail()); return true; } else if (args[0].equalsIgnoreCase("chgemail")) { if (args.length != 3) { - sender.sendMessage("Usage: /authme chgemail playername email"); + sender.sendMessage("Usage: /authme chgemail "); + return true; + } + if (!Settings.isEmailCorrect(args[2])) { + m.send(player, "email_invalid"); return true; } String playername = args[1].toLowerCase(); - PlayerAuth getAuth = database.getAuth(playername); - if (getAuth == null) { + PlayerAuth auth = database.getAuth(playername); + if (auth == null) { m.send(sender, "unknown_user"); return true; } - getAuth.setEmail(args[2]); - if (!database.updateEmail(getAuth)) { + auth.setEmail(args[2]); + if (!database.updateEmail(auth)) { m.send(sender, "error"); return true; } if (PlayerCache.getInstance().getAuth(playername) != null) - PlayerCache.getInstance().updatePlayer(getAuth); + PlayerCache.getInstance().updatePlayer(auth); + m.send(sender, "email_changed"); return true; } else if (args[0].equalsIgnoreCase("setspawn")) { try { if (sender instanceof Player) { - if (Spawn.getInstance().setSpawn(((Player) sender).getLocation())) - sender.sendMessage("[AuthMe] Correctly define new spawn"); - else sender.sendMessage("[AuthMe] SetSpawn fail , please retry"); + if (Spawn.getInstance().setSpawn(((Player) sender).getLocation())) { + sender.sendMessage("[AuthMe] Correctly defined new spawn point"); + } else { + sender.sendMessage("[AuthMe] SetSpawn has failed, please retry"); + } } else { sender.sendMessage("[AuthMe] Please use that command in game"); } @@ -344,8 +374,8 @@ public class AdminCommand implements CommandExecutor { try { if (sender instanceof Player) { if (Spawn.getInstance().setFirstSpawn(((Player) sender).getLocation())) - sender.sendMessage("[AuthMe] Correctly define new first spawn"); - else sender.sendMessage("[AuthMe] SetFirstSpawn fail , please retry"); + sender.sendMessage("[AuthMe] Correctly defined new first spawn point"); + else sender.sendMessage("[AuthMe] SetFirstSpawn has failed, please retry"); } else { sender.sendMessage("[AuthMe] Please use that command in game"); } @@ -367,13 +397,14 @@ public class AdminCommand implements CommandExecutor { plugin.dataManager.purgeLimitedCreative(bannedPlayers); if (Settings.purgeAntiXray) plugin.dataManager.purgeAntiXray(bannedPlayers); + sender.sendMessage("[AuthMe] Database has been purged correctly"); return true; } else if (args[0].equalsIgnoreCase("spawn")) { try { if (sender instanceof Player) { if (Spawn.getInstance().getSpawn() != null) ((Player) sender).teleport(Spawn.getInstance().getSpawn()); - else sender.sendMessage("[AuthMe] Spawn fail , please try to define the spawn"); + else sender.sendMessage("[AuthMe] Spawn has failed, please try to define the spawn"); } else { sender.sendMessage("[AuthMe] Please use that command in game"); } @@ -386,7 +417,7 @@ public class AdminCommand implements CommandExecutor { if (sender instanceof Player) { if (Spawn.getInstance().getFirstSpawn() != null) ((Player) sender).teleport(Spawn.getInstance().getFirstSpawn()); - else sender.sendMessage("[AuthMe] Spawn fail , please try to define the first spawn"); + else sender.sendMessage("[AuthMe] First spawn has failed, please try to define the first spawn"); } else { sender.sendMessage("[AuthMe] Please use that command in game"); } @@ -394,12 +425,30 @@ public class AdminCommand implements CommandExecutor { ConsoleLogger.showError(ex.getMessage()); } return true; - } else - if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) { + } else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) { if (args.length != 3) { - sender.sendMessage("Usage: /authme changepassword playername newpassword"); + sender.sendMessage("Usage: /authme changepassword "); return true; } + String lowpass = args[2].toLowerCase(); + if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) { + m.send(player, "password_error"); + return true; + } + if (lowpass.equalsIgnoreCase(args[1])) { + m.send(player, "password_error_nick"); + return true; + } + if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) { + m.send(player, "pass_len"); + return true; + } + if (!Settings.unsafePasswords.isEmpty()) { + if (Settings.unsafePasswords.contains(lowpass)) { + m.send(player, "password_error_unsafe"); + return true; + } + } try { String name = args[1].toLowerCase(); String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name); @@ -431,7 +480,7 @@ public class AdminCommand implements CommandExecutor { return true; } else if (args[0].equalsIgnoreCase("unregister") || args[0].equalsIgnoreCase("unreg") || args[0].equalsIgnoreCase("del")) { if (args.length != 2) { - sender.sendMessage("Usage: /authme unregister playername"); + sender.sendMessage("Usage: /authme unregister "); return true; } String name = args[1].toLowerCase(); @@ -477,24 +526,24 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "unregistered"); ConsoleLogger.info(args[1] + " unregistered"); return true; - } else if (args[0].equalsIgnoreCase("purgelastpos")) { + } else if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) { if (args.length != 2) { - sender.sendMessage("Usage: /authme purgelastpos playername"); + sender.sendMessage("Usage: /authme purgelastpos "); return true; } try { String name = args[1].toLowerCase(); PlayerAuth auth = database.getAuth(name); if (auth == null) { - sender.sendMessage("The player " + name + " is not registered "); + m.send(sender, "unknown_user"); return true; } - auth.setQuitLocX(0); - auth.setQuitLocY(0); - auth.setQuitLocZ(0); + auth.setQuitLocX(0D); + auth.setQuitLocY(0D); + auth.setQuitLocZ(0D); auth.setWorld("world"); database.updateQuitLoc(auth); - sender.sendMessage(name + " 's last pos location is now reset"); + sender.sendMessage(name + "'s last position location is now reset"); } catch (Exception e) { ConsoleLogger.showError("An error occured while trying to reset location or player do not exist, please see below: "); ConsoleLogger.showError(e.getMessage()); @@ -504,7 +553,7 @@ public class AdminCommand implements CommandExecutor { return true; } else if (args[0].equalsIgnoreCase("switchantibot")) { if (args.length != 2) { - sender.sendMessage("Usage : /authme switchantibot on/off"); + sender.sendMessage("Usage: /authme switchantibot on/off"); return true; } if (args[1].equalsIgnoreCase("on")) { @@ -517,49 +566,31 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("[AuthMe] AntiBotMod disabled"); return true; } - sender.sendMessage("Usage : /authme switchantibot on/off"); + sender.sendMessage("Usage: /authme switchantibot on/off"); return true; } else if (args[0].equalsIgnoreCase("getip")) { if (args.length < 2) { - sender.sendMessage("Usage : /authme getip onlinePlayerName"); + sender.sendMessage("Usage: /authme getip "); return true; } - if (Bukkit.getPlayer(args[1]) != null) { - Player player = Bukkit.getPlayer(args[1]); - sender.sendMessage(player.getName() + " actual ip is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort()); - sender.sendMessage(player.getName() + " real ip is : " + plugin.getIP(player)); - return true; - } else { + Player player = Bukkit.getPlayer(args[1]); + if (player == null) { sender.sendMessage("This player is not actually online"); - sender.sendMessage("Usage : /authme getip onlinePlayerName"); + sender.sendMessage("Usage: /authme getip "); return true; } - } else if (args[0].equalsIgnoreCase("resetposition")) { - if (args.length < 2) { - sender.sendMessage("Usage : /authme resetPosition "); + sender.sendMessage(player.getName() + "'s actual IP is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort()); + sender.sendMessage(player.getName() + "'s real IP is : " + plugin.getIP(player)); return true; - } - PlayerAuth auth = database.getAuth(args[1]); - if (auth == null) { - m.send(sender, "unknown_user"); - return true; - } - auth.setQuitLocX(0D); - auth.setQuitLocY(0D); - auth.setQuitLocZ(0D); - auth.setWorld("world"); - database.updateQuitLoc(auth); - sender.sendMessage("[AuthMe] Successfully reset position for " + auth.getNickname()); - return true; } else if (args[0].equalsIgnoreCase("forcelogin")) { if (args.length < 2) { - sender.sendMessage("Usage : /authme forcelogin "); + sender.sendMessage("Usage: /authme forcelogin "); return true; } try { Player player = Bukkit.getPlayer(args[1]); if (player == null || !player.isOnline()) { - sender.sendMessage("Online player only !"); + sender.sendMessage("Player needs to be online!"); return true; } if (!plugin.authmePermissible(player, "authme.canbeforced")) { @@ -567,7 +598,7 @@ public class AdminCommand implements CommandExecutor { return true; } plugin.management.performLogin(player, "dontneed", true); - sender.sendMessage("Force Login performed !"); + sender.sendMessage("Force Login performed!"); } catch (Exception e) { sender.sendMessage("An error occured while trying to get that player!"); } From 9e153bc663596a734704a24908431826240a5d7b Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:24:33 +0200 Subject: [PATCH 12/31] 192.168.0.1! --- src/main/java/fr/xephi/authme/api/API.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index c60de1210..75a87f23f 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -153,7 +153,7 @@ public class API { if (isRegistered(name)) { return false; } - PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com"); + PlayerAuth auth = new PlayerAuth(name, hash, "198.168.0.1", 0, "your@email.com"); if (!database.saveAuth(auth)) { return false; } From e469c74ef074593fc1a91a8655b5ac4321d60c4e Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:25:20 +0200 Subject: [PATCH 13/31] 192.168.0.1! --- src/main/java/fr/xephi/authme/converter/xAuthToFlat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index 02d9946f5..1cf95b6b8 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -49,7 +49,7 @@ public class xAuthToFlat { String pl = getIdPlayer(id); String psw = getPassword(id); if (psw != null && !psw.isEmpty() && pl != null) { - PlayerAuth auth = new PlayerAuth(pl, psw, "198.18.0.1", 0, "your@email.com"); + PlayerAuth auth = new PlayerAuth(pl, psw, "198.168.0.1", 0, "your@email.com"); database.saveAuth(auth); } } From ae1b074725a44e3f77ef9200fbd1e798c4418662 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:26:04 +0200 Subject: [PATCH 14/31] 192.168.0.1! --- src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java b/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java index 9a83f9d71..f84e1de56 100644 --- a/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java +++ b/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java @@ -7,7 +7,7 @@ public class PlayerAuth { private String nickname = ""; private String hash = ""; - private String ip = "198.18.0.1"; + private String ip = "198.168.0.1"; private long lastLogin = 0; private double x = 0; private double y = 0; From cead8354406cc440d2b8bab1f7c357aef8af848f Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:27:21 +0200 Subject: [PATCH 15/31] 192.168.0.1! --- src/main/java/fr/xephi/authme/datasource/FlatFile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 654f72e56..12f42ca4f 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -426,7 +426,7 @@ public class FlatFile implements DataSource { if (args[0].equalsIgnoreCase(user)) { switch (args.length) { case 2: - return new PlayerAuth(args[0], args[1], "198.18.0.1", 0, "your@email.com"); + return new PlayerAuth(args[0], args[1], "198.168.0.1", 0, "your@email.com"); case 3: return new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com"); case 4: @@ -708,7 +708,7 @@ public class FlatFile implements DataSource { String[] args = line.split(":"); switch (args.length) { case 2: - auths.add(new PlayerAuth(args[0], args[1], "198.18.0.1", 0, "your@email.com")); + auths.add(new PlayerAuth(args[0], args[1], "198.168.0.1", 0, "your@email.com")); case 3: auths.add(new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com")); case 4: From 843385419d93604026f5a96bf5cfdc4397a4241b Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:28:04 +0200 Subject: [PATCH 16/31] 192.168.0.1! --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index f2d6f5aba..d48e89b34 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -204,7 +204,7 @@ public class MySQL implements DataSource { if (rs.next()) { id = rs.getInt(columnID); if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) { - pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); + pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), "198.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); } else { if (!columnSalt.isEmpty()) { if (!columnGroup.isEmpty()) @@ -1079,7 +1079,7 @@ public class MySQL implements DataSource { PlayerAuth pAuth = null; int id = rs.getInt(columnID); if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) { - pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); + pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); } else { if (!columnSalt.isEmpty()) { if (!columnGroup.isEmpty()) From 07c884ce66d6f68c4c011843affc40b7bb6d61a4 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:28:29 +0200 Subject: [PATCH 17/31] 192.168.0.1! --- src/main/java/fr/xephi/authme/datasource/SQLite.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index cdbac8493..87bed4aa7 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -154,7 +154,7 @@ public class SQLite implements DataSource { rs = pst.executeQuery(); if (rs.next()) { if (rs.getString(columnIp).isEmpty()) { - return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); + return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); } else { if (!columnSalt.isEmpty()) { return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); From f3f4a2309813b25c2eb37ddcfc5c5dd68d82f7a0 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:32:26 +0200 Subject: [PATCH 18/31] Sometimes I'm sleeping --- src/main/java/fr/xephi/authme/api/API.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index 75a87f23f..5698e19f5 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -153,7 +153,7 @@ public class API { if (isRegistered(name)) { return false; } - PlayerAuth auth = new PlayerAuth(name, hash, "198.168.0.1", 0, "your@email.com"); + PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com"); if (!database.saveAuth(auth)) { return false; } From bb9f81f33567c730da4d8ead1cc6c2903152cef4 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:33:07 +0200 Subject: [PATCH 19/31] Sometimes I'm sleeping --- src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java b/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java index f84e1de56..62a5d4e3f 100644 --- a/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java +++ b/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java @@ -7,7 +7,7 @@ public class PlayerAuth { private String nickname = ""; private String hash = ""; - private String ip = "198.168.0.1"; + private String ip = "192.168.0.1"; private long lastLogin = 0; private double x = 0; private double y = 0; From 5cdd2e11892cdd9cc60c8b8bf361d927cfda9594 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:33:55 +0200 Subject: [PATCH 20/31] Sometimes I'm sleeping --- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 2c2f4d326..d6f90fb6e 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -303,7 +303,7 @@ public class AdminCommand implements CommandExecutor { return true; } String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name); - PlayerAuth auth = new PlayerAuth(name, hash, "198.168.0.1", 0L, "your@email.com"); + PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com"); if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) auth.setSalt(PasswordSecurity.userSalt.get(name)); else auth.setSalt(""); From 91d95e45fa3fc88cb17e7656b6b3bf6b0d00d239 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:34:22 +0200 Subject: [PATCH 21/31] Sometimes I'm sleeping --- src/main/java/fr/xephi/authme/converter/xAuthToFlat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index 1cf95b6b8..ff3ae8e6f 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -49,7 +49,7 @@ public class xAuthToFlat { String pl = getIdPlayer(id); String psw = getPassword(id); if (psw != null && !psw.isEmpty() && pl != null) { - PlayerAuth auth = new PlayerAuth(pl, psw, "198.168.0.1", 0, "your@email.com"); + PlayerAuth auth = new PlayerAuth(pl, psw, "192.168.0.1", 0, "your@email.com"); database.saveAuth(auth); } } From cf8d179eab67c58db58fbcf6d775fe584807c4d2 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:34:52 +0200 Subject: [PATCH 22/31] Sometimes I'm sleeping --- src/main/java/fr/xephi/authme/datasource/FlatFile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 12f42ca4f..2023cc45c 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -426,7 +426,7 @@ public class FlatFile implements DataSource { if (args[0].equalsIgnoreCase(user)) { switch (args.length) { case 2: - return new PlayerAuth(args[0], args[1], "198.168.0.1", 0, "your@email.com"); + return new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com"); case 3: return new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com"); case 4: @@ -708,7 +708,7 @@ public class FlatFile implements DataSource { String[] args = line.split(":"); switch (args.length) { case 2: - auths.add(new PlayerAuth(args[0], args[1], "198.168.0.1", 0, "your@email.com")); + auths.add(new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com")); case 3: auths.add(new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com")); case 4: From 58d3d5362b8beed1ca3f9d38e0bfa8493993ace0 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:35:16 +0200 Subject: [PATCH 23/31] Sometimes I'm sleeping --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index d48e89b34..36bd86c25 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -204,7 +204,7 @@ public class MySQL implements DataSource { if (rs.next()) { id = rs.getInt(columnID); if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) { - pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), "198.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); + pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); } else { if (!columnSalt.isEmpty()) { if (!columnGroup.isEmpty()) @@ -1079,7 +1079,7 @@ public class MySQL implements DataSource { PlayerAuth pAuth = null; int id = rs.getInt(columnID); if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) { - pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); + pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); } else { if (!columnSalt.isEmpty()) { if (!columnGroup.isEmpty()) From 3a7fd005b35bb1e4557097cee98c427bf6c6e9fc Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:36:03 +0200 Subject: [PATCH 24/31] Sometimes I'm sleeping --- src/main/java/fr/xephi/authme/datasource/SQLite.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 87bed4aa7..eaaa9f6c7 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -154,7 +154,7 @@ public class SQLite implements DataSource { rs = pst.executeQuery(); if (rs.next()) { if (rs.getString(columnIp).isEmpty()) { - return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); + return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); } else { if (!columnSalt.isEmpty()) { return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail)); From 8758e563bf657e0a47a407ffef3404551243c675 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:47:06 +0200 Subject: [PATCH 25/31] Remember to sync before pushing! --- src/main/java/fr/xephi/authme/datasource/FlatFile.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 2023cc45c..13cdfaf09 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -13,6 +13,7 @@ import java.util.List; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.settings.PlayersLogs; import fr.xephi.authme.settings.Settings; @@ -648,17 +649,17 @@ public class FlatFile implements DataSource { @Override public boolean isLogged(String user) { - return PlayersLogs.getInstance().players.contains(user.toLowerCase()); + return PlayerCache.getInstance().isAuthenticated(user); } @Override public void setLogged(String user) { - PlayersLogs.getInstance().addPlayer(user.toLowerCase()); + PlayersLogs.getInstance().savePlayerLogs(); } @Override public void setUnlogged(String user) { - PlayersLogs.getInstance().removePlayer(user.toLowerCase()); + PlayersLogs.getInstance().savePlayerLogs(); } @Override From 11ab01c45daa31bc41baa150b7a44a544976c4e4 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:51:34 +0200 Subject: [PATCH 26/31] Remember to sync before pushing! --- src/main/java/fr/xephi/authme/datasource/SQLite.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index eaaa9f6c7..0ea0a547b 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -12,6 +12,7 @@ import java.util.List; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException; import fr.xephi.authme.settings.PlayersLogs; import fr.xephi.authme.settings.Settings; @@ -74,8 +75,8 @@ public class SQLite implements DataSource { } } - private synchronized void connect() throws ClassNotFoundException, - SQLException { + private synchronized void connect() + throws ClassNotFoundException, SQLException { Class.forName("org.sqlite.JDBC"); ConsoleLogger.info("SQLite driver loaded"); this.con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); @@ -508,17 +509,17 @@ public class SQLite implements DataSource { @Override public boolean isLogged(String user) { - return PlayersLogs.getInstance().players.contains(user.toLowerCase()); + return PlayerCache.getInstance().isAuthenticated(user); } @Override public void setLogged(String user) { - PlayersLogs.getInstance().addPlayer(user.toLowerCase()); + PlayersLogs.getInstance().savePlayerLogs(); } @Override public void setUnlogged(String user) { - PlayersLogs.getInstance().removePlayer(user.toLowerCase()); + PlayersLogs.getInstance().savePlayerLogs(); } @Override From 6c4668ecece751f50db07c448560b0856b2924fc Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:53:34 +0200 Subject: [PATCH 27/31] Remember to sync before pushing! --- .../xephi/authme/process/register/AsyncronousRegister.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java index 297957d14..43e53c8a2 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java @@ -12,6 +12,7 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.PlayersLogs; import fr.xephi.authme.settings.Settings; public class AsyncronousRegister { @@ -76,9 +77,7 @@ public class AsyncronousRegister { else if (database.isAuthAvailable(name)) { m.send(player, "user_regged"); - if (plugin.pllog.getStringList("players").contains(name)) { - plugin.pllog.getStringList("players").remove(name); - } + PlayersLogs.getInstance().savePlayerLogs(); allowRegister = false; } From d52e242c53a0978f8798b1234dd70609c649dd17 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 16:56:58 +0200 Subject: [PATCH 28/31] Remember to sync before pushing! --- src/main/java/fr/xephi/authme/api/API.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index 5698e19f5..516157adf 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -13,7 +13,6 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Settings; @@ -23,16 +22,13 @@ public class API { public static final String newline = System.getProperty("line.separator"); public static API singleton; public AuthMe plugin; - public DataSource database; - public API(AuthMe plugin, DataSource database) { + public API(AuthMe plugin) { this.plugin = plugin; - this.database = database; } public API(Server serv) { this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe"); - this.database = this.plugin.database; } /** @@ -50,7 +46,7 @@ public class API { return null; } AuthMe authme = (AuthMe) p; - singleton = (new API(authme, authme.database)); + singleton = (new API(authme)); return singleton; } @@ -119,7 +115,7 @@ public class API { */ public boolean isRegistered(String playerName) { String player = playerName.toLowerCase(); - return database.isAuthAvailable(player); + return plugin.database.isAuthAvailable(player); } /** @@ -131,7 +127,7 @@ public class API { if (!isRegistered(playerName)) return false; String player = playerName.toLowerCase(); - PlayerAuth auth = database.getAuth(player); + PlayerAuth auth = plugin.database.getAuth(player); try { return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName); } catch (NoSuchAlgorithmException e) { @@ -154,7 +150,7 @@ public class API { return false; } PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com"); - if (!database.saveAuth(auth)) { + if (!plugin.database.saveAuth(auth)) { return false; } return true; From 91a4afb41fc1621fec594cf6ffa4699c59a63ff2 Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 17:02:57 +0200 Subject: [PATCH 29/31] Remember to sync before pushing! --- .../xephi/authme/commands/AdminCommand.java | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index d6f90fb6e..d5548a64b 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -33,7 +33,6 @@ import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; @@ -46,10 +45,8 @@ public class AdminCommand implements CommandExecutor { public AuthMe plugin; private Messages m = Messages.getInstance(); - public DataSource database; - public AdminCommand(AuthMe plugin, DataSource database) { - this.database = database; + public AdminCommand(AuthMe plugin) { this.plugin = plugin; } @@ -117,7 +114,7 @@ public class AdminCommand implements CommandExecutor { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, -(Integer.parseInt(args[1]))); long until = calendar.getTimeInMillis(); - List purged = database.autoPurgeDatabase(until); + List purged = plugin.database.autoPurgeDatabase(until); sender.sendMessage("Deleted " + purged.size() + " user accounts"); if (Settings.purgeEssentialsFile && plugin.ess != null) plugin.dataManager.purgeEssentials(purged); @@ -172,7 +169,7 @@ public class AdminCommand implements CommandExecutor { return true; } try { - PlayerAuth auth = database.getAuth(args[1].toLowerCase()); + PlayerAuth auth = plugin.database.getAuth(args[1].toLowerCase()); } catch (NullPointerException e) { m.send(sender, "unknown_user"); return true; @@ -203,7 +200,7 @@ public class AdminCommand implements CommandExecutor { PlayerAuth auth = null; String message = "[AuthMe] "; try { - auth = database.getAuth(args[1].toLowerCase()); + auth = plugin.database.getAuth(args[1].toLowerCase()); } catch (NullPointerException npe) { m.send(sender, "unknown_user"); return true; @@ -212,7 +209,7 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "unknown_user"); return true; } - List accountList = database.getAllAuthsByName(auth); + List accountList = plugin.database.getAllAuthsByName(auth); if (accountList.isEmpty() || accountList == null) { m.send(sender, "user_unknown"); return true; @@ -246,7 +243,7 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("[AuthMe] Please put a valid IP"); return; } - List accountList = database.getAllAuthsByIp(args[1]); + List accountList = plugin.database.getAllAuthsByIp(args[1]); if (accountList.isEmpty() || accountList == null) { sender.sendMessage("[AuthMe] This IP does not exist in the database"); return true; @@ -298,7 +295,7 @@ public class AdminCommand implements CommandExecutor { } try { String name = args[1].toLowerCase(); - if (database.isAuthAvailable(name)) { + if (plugin.database.isAuthAvailable(name)) { m.send(sender, "user_regged"); return true; } @@ -307,7 +304,7 @@ public class AdminCommand implements CommandExecutor { if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) auth.setSalt(PasswordSecurity.userSalt.get(name)); else auth.setSalt(""); - if (!database.saveAuth(auth)) { + if (!plugin.database.saveAuth(auth)) { m.send(sender, "error"); return true; } @@ -324,7 +321,7 @@ public class AdminCommand implements CommandExecutor { return true; } String playername = args[1].toLowerCase(); - PlayerAuth auth = database.getAuth(playername); + PlayerAuth auth = plugin.database.getAuth(playername); if (auth == null) { m.send(sender, "unknown_user"); return true; @@ -341,13 +338,13 @@ public class AdminCommand implements CommandExecutor { return true; } String playername = args[1].toLowerCase(); - PlayerAuth auth = database.getAuth(playername); + PlayerAuth auth = plugin.database.getAuth(playername); if (auth == null) { m.send(sender, "unknown_user"); return true; } auth.setEmail(args[2]); - if (!database.updateEmail(auth)) { + if (!plugin.database.updateEmail(auth)) { m.send(sender, "error"); return true; } @@ -388,7 +385,7 @@ public class AdminCommand implements CommandExecutor { for (OfflinePlayer off : plugin.getServer().getBannedPlayers()) { bannedPlayers.add(off.getName().toLowerCase()); } - database.purgeBanned(bannedPlayers); + plugin.database.purgeBanned(bannedPlayers); if (Settings.purgeEssentialsFile && plugin.ess != null) plugin.dataManager.purgeEssentials(bannedPlayers); if (Settings.purgePlayerDat) @@ -455,8 +452,8 @@ public class AdminCommand implements CommandExecutor { PlayerAuth auth = null; if (PlayerCache.getInstance().isAuthenticated(name)) { auth = PlayerCache.getInstance().getAuth(name); - } else if (database.isAuthAvailable(name)) { - auth = database.getAuth(name); + } else if (plugin.database.isAuthAvailable(name)) { + auth = plugin.database.getAuth(name); } if (auth == null) { m.send(sender, "unknown_user"); @@ -465,9 +462,9 @@ public class AdminCommand implements CommandExecutor { auth.setHash(hash); if (PasswordSecurity.userSalt.containsKey(name)) { auth.setSalt(PasswordSecurity.userSalt.get(name)); - database.updateSalt(auth); + plugin.database.updateSalt(auth); } - if (!database.updatePassword(auth)) { + if (!plugin.database.updatePassword(auth)) { m.send(sender, "error"); return true; } @@ -484,11 +481,11 @@ public class AdminCommand implements CommandExecutor { return true; } String name = args[1].toLowerCase(); - if (!database.isAuthAvailable(name)) { + if (!plugin.database.isAuthAvailable(name)) { m.send(sender, "user_unknown"); return true; } - if (!database.removeAuth(name)) { + if (!plugin.database.removeAuth(name)) { m.send(sender, "error"); return true; } @@ -533,7 +530,7 @@ public class AdminCommand implements CommandExecutor { } try { String name = args[1].toLowerCase(); - PlayerAuth auth = database.getAuth(name); + PlayerAuth auth = plugin.database.getAuth(name); if (auth == null) { m.send(sender, "unknown_user"); return true; @@ -542,7 +539,7 @@ public class AdminCommand implements CommandExecutor { auth.setQuitLocY(0D); auth.setQuitLocZ(0D); auth.setWorld("world"); - database.updateQuitLoc(auth); + plugin.database.updateQuitLoc(auth); sender.sendMessage(name + "'s last position location is now reset"); } catch (Exception e) { ConsoleLogger.showError("An error occured while trying to reset location or player do not exist, please see below: "); From aa871e2dcfdf10a1f263dba9bf4184dddfb36ded Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 17:04:03 +0200 Subject: [PATCH 30/31] Remember to sync before pushing! --- .../fr/xephi/authme/commands/ChangePasswordCommand.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java index 70aa6958e..7577a2029 100644 --- a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java @@ -11,7 +11,6 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; @@ -19,11 +18,9 @@ import fr.xephi.authme.settings.Settings; public class ChangePasswordCommand implements CommandExecutor { private Messages m = Messages.getInstance(); - private DataSource database; public AuthMe plugin; - public ChangePasswordCommand(DataSource database, AuthMe plugin) { - this.database = database; + public ChangePasswordCommand(AuthMe plugin) { this.plugin = plugin; } @@ -79,11 +76,11 @@ public class ChangePasswordCommand implements CommandExecutor { if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) auth.setSalt(PasswordSecurity.userSalt.get(name)); else auth.setSalt(""); - if (!database.updatePassword(auth)) { + if (!plugin.database.updatePassword(auth)) { m.send(player, "error"); return true; } - database.updateSalt(auth); + plugin.database.updateSalt(auth); PlayerCache.getInstance().updatePlayer(auth); m.send(player, "pwd_changed"); ConsoleLogger.info(player.getName() + " changed his password"); From ffab80188f40e1456c47a77808419df7d3f973ca Mon Sep 17 00:00:00 2001 From: Maxetto Date: Fri, 10 Jul 2015 17:06:13 +0200 Subject: [PATCH 31/31] Remember to sync before pushing! --- src/main/java/fr/xephi/authme/converter/xAuthToFlat.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index ff3ae8e6f..61be7cb83 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -23,10 +23,9 @@ public class xAuthToFlat { public DataSource database; public CommandSender sender; - public xAuthToFlat(AuthMe instance, DataSource database, - CommandSender sender) { + public xAuthToFlat(AuthMe instance, CommandSender sender) { this.instance = instance; - this.database = database; + this.database = instance.database; this.sender = sender; }