From 0de80f5b4bb616a6b89ba5de68de3e28b51d43b8 Mon Sep 17 00:00:00 2001 From: irobin591 Date: Thu, 23 Jul 2015 22:09:52 +0200 Subject: [PATCH 001/427] Update de translation --- src/main/resources/messages_de.yml | 99 +++++++++++++++--------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/src/main/resources/messages_de.yml b/src/main/resources/messages_de.yml index ed3d965f..17a1657b 100644 --- a/src/main/resources/messages_de.yml +++ b/src/main/resources/messages_de.yml @@ -1,58 +1,59 @@ -unknown_user: '&fBenutzer ist nicht in der Datenbank' -unsafe_spawn: '&fDeine Logoutposition war unsicher, du wurdest zum Spawn teleportiert' +unknown_user: '&cBenutzer ist nicht in der Datenbank' +unsafe_spawn: '&cDeine Logoutposition war unsicher, du wurdest zum Spawn teleportiert' not_logged_in: '&cNicht eingeloggt!' -reg_voluntarily: '&fDu kannst dich mit folgendem Befehl registrieren "/register "' +reg_voluntarily: 'Du kannst dich mit folgendem Befehl registrieren "/register "' usage_log: '&cBenutze: /login ' wrong_pwd: '&cFalsches Passwort' unregistered: '&cBenutzerkonto erfolgreich gelöscht!' reg_disabled: '&cRegistrierungen sind deaktiviert' -valid_session: '&cErfolgreich eingeloggt' -login: '&cErfolgreich eingeloggt!' -vb_nonActiv: '&fDein Account wurde noch nicht aktiviert. Bitte prüfe Deine E-Mails!' +valid_session: '&2Erfolgreich eingeloggt!' +login: '&2Erfolgreich eingeloggt!' +vb_nonActiv: '&cDein Account wurde noch nicht aktiviert. Bitte prüfe Deine E-Mails!' user_regged: '&cBenutzername ist schon vergeben' usage_reg: '&cBenutze: /register ' -max_reg: '&fDu hast die maximale Anzahl an Accounts erreicht' -no_perm: '&cKeine Rechte' -password_error_nick: '&fDu kannst nicht deinen Namen als Passwort nutzen!' -password_error_unsafe: '&fDu kannst nicht unsichere Passwörter nutzen!' -error: '&fEin Fehler ist aufgetreten. Bitte kontaktiere einen Admin' -login_msg: '&cBitte logge dich ein mit "/login "' -reg_msg: '&cBitte registriere dich mit "/register "' -reg_email_msg: '&cBitte registriere dich mit "/register "' +max_reg: '&cDu hast die maximale Anzahl an Accounts erreicht' +no_perm: '&4Du hast keine Rechte, um diese Aktion auszuführen!' +error: '&4Ein Fehler ist aufgetreten. Bitte kontaktiere einen Administrator' +login_msg: '&cBitte logge Dich ein mit "/login "' +reg_msg: '&3Bitte registriere Dich mit "/register "' +reg_email_msg: '&3Bitte registriere Dich mit "/register "' usage_unreg: '&cBenutze: /unregister ' -pwd_changed: '&cPasswort geändert!' -user_unknown: '&cBenutzername nicht registriert' -password_error: '&fPasswort falsch' -invalid_session: '&fUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist' -reg_only: '&fNur registrierte Spieler! Bitte besuche http://example.com zum registrieren' +pwd_changed: '&2Passwort geändert!' +user_unknown: '&cBenutzername nicht registriert!' +password_error: '&cPasswörter stimmen nicht überein!' +password_error_nick: '&cDu kannst nicht deinen Namen als Passwort nutzen!' +password_error_unsafe: '&cDu kannst nicht unsichere Passwörter nutzen!' +invalid_session: '&cUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist' +reg_only: '&4Nur für registrierte Spieler! Bitte besuche http://example.com zum registrieren' logged_in: '&cBereits eingeloggt!' -logout: '&cErfolgreich ausgeloggt' -same_nick: '&fSelber Name spielt bereits' -registered: '&cErfolgreich registriert!' -pass_len: '&fDein Passwort ist zu kurz oder zu lang' -reload: '&fKonfiguration und Datenbank neu geladen' -timeout: '&fZeitüberschreitung beim Login' -usage_changepassword: '&fBenutze: /changepassword ' -name_len: '&cDein Nickname ist zu kurz oder zu lang' -regex: '&cDein Nichname enthält nicht erlaubte Zeichen. Zulässige Zeichen: REG_EX' -add_email: '&cBitte hinterlege Deine E-Mail Adresse: /email add ' -bad_database_email: '[AuthMe] Der /email Befehl ist nur mit MySQL und SQLite kompatibel. Bitte kontaktiere einen Administrator!' -recovery_email: '&cPasswort vergessen? Nutze "/email recovery " für ein neues Passwort' -usage_captcha: '&cBenutze: /captcha ' -wrong_captcha: '&cFalsches Captcha, bitte nutze: /captcha ' -valid_captcha: '&cDas Captcha ist korrekt!' -kick_forvip: '&cEin VIP Spieler hat den vollen Server betreten!' -kick_fullserver: '&cDer Server ist momentan voll, Sorry!' -usage_email_add: '&fBenutzung: /email add ' -usage_email_change: '&fBenutzung: /email change ' -usage_email_recovery: '&fBenutzung: /email recovery ' -new_email_invalid: '[AuthMe] Die neue Email ist ungültig!' -old_email_invalid: '[AuthMe] Die alte Email ist ungültig!' -email_invalid: '[AuthMe] Ungültige Email' -email_added: '[AuthMe] Email hinzugefügt!' -email_confirm: '[AuthMe] Bitte bestätige deine Email!' -email_changed: '[AuthMe] Email aktualisiert!' -email_send: '[AuthMe] Wiederherstellungs-Email wurde gesendet !' -country_banned: 'Dein Land ist gesperrt' -antibot_auto_enabled: '[AuthMe] AntiBotMod wurde aufgrund hoher Netzauslastung automatisch aktiviert!' -antibot_auto_disabled: '[AuthMe] AntiBotMod wurde nach %m Minuten deaktiviert, hoffentlich ist die Invasion vorbei' +logout: '&2Erfolgreich ausgeloggt' +same_nick: '&4Jemand mit diesem Namen spielt bereits auf dem Server!' +registered: '&2Erfolgreich registriert!' +pass_len: '&cDein Passwort ist zu kurz oder zu lang!' +reload: '&2Konfiguration und Datenbank wurden erfolgreich neu geladen' +timeout: '&4Zeitüberschreitung beim Login' +usage_changepassword: '&cBenutze: /changepassword ' +name_len: '&4Dein Nickname ist zu kurz oder zu lang' +regex: '&4Dein Nickname enthält nicht erlaubte Zeichen. Zulässige Zeichen: REG_EX' +add_email: '&3Bitte hinterlege Deine E-Mail Adresse: /email add ' +bad_database_email: '&4Der /email Befehl ist nur mit MySQL und SQLite kompatibel. Bitte kontaktiere einen Administrator!' +recovery_email: '&3Passwort vergessen? Nutze "/email recovery " für ein neues Passwort' +usage_captcha: '&3Um dich einzuloggen, tippe dieses Captcha so ein: /captcha ' +wrong_captcha: '&cFalsches Captcha, bitte nutze: /captcha THE_CAPTCHA' +valid_captcha: '&2Das Captcha ist korrekt!' +kick_forvip: '&3Ein VIP Spieler hat den vollen Server betreten!' +kick_fullserver: '&4Der Server ist momentan voll, Sorry!' +usage_email_add: '&cBenutze: /email add ' +usage_email_change: '&cBenutze: /email change ' +usage_email_recovery: '&cBenutze: /email recovery ' +new_email_invalid: '&cDie neue Email ist ungültig!' +old_email_invalid: '&cDie alte Email ist ungültig!' +email_invalid: '&cUngültige Email' +email_added: '&2Email hinzugefügt!' +email_confirm: '&cBitte bestätige deine Email!' +email_changed: '&2Email aktualisiert!' +email_send: '&2Wiederherstellungs-Email wurde gesendet!' +email_exists: '&cEine Wiederherstellungs-Email wurde bereits versandt! Nutze folgenden Befehl um eine neue Email zu versenden:' +country_banned: '&4Dein Land ist gesperrt' +antibot_auto_enabled: '&4[AntiBotService] AntiBotMod wurde aufgrund hoher Netzauslastung automatisch aktiviert!' +antibot_auto_disabled: '&2[AntiBotService] AntiBotMod wurde nach %m Minuten deaktiviert, hoffentlich ist die Invasion vorbei' From 094f454cf2c333f0c3c9b62b0c98f8cae5c917ad Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 24 Jul 2015 09:21:17 +0200 Subject: [PATCH 002/427] Update messages_ru.yml --- src/main/resources/messages_ru.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/messages_ru.yml b/src/main/resources/messages_ru.yml index e1f0a593..536dc479 100644 --- a/src/main/resources/messages_ru.yml +++ b/src/main/resources/messages_ru.yml @@ -38,8 +38,8 @@ regex: '&4Ваш логин содержит запрещенные символ add_email: '&4Добавьте свой email: &5/email add ВАШ_EMAIL ВАШ_EMAIL' bad_database_email: '&4[AuthMe] Команда &5/email&4 доступна только при работе с MySQL или SQLite. Обратититесь к администрации сервера' recovery_email: '&4Забыли пароль? Используйте &5/email recovery ВАШ_EMAIL' -usage_captcha: '&4Вы должны ввести код, используйте: &5/captcha КОД' -wrong_captcha: '&4Неверный код, используйте: &5/captcha КОД' +usage_captcha: '&4Вы должны ввести код, используйте: &5/captcha ' +wrong_captcha: '&4Неверный код, используйте: &5/captcha THE_CAPTCHA' valid_captcha: '&2Вы успешно ввели код!' kick_forvip: '&6VIP игрок зашел на переполненный сервер!' kick_fullserver: '&4Сервер переполнен!' From b1505890800bc3f9e0f94427cf0a8ace04b4099a Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 24 Jul 2015 09:22:08 +0200 Subject: [PATCH 003/427] Update messages_uk.yml --- src/main/resources/messages_uk.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/messages_uk.yml b/src/main/resources/messages_uk.yml index f14d0444..aad7fc0c 100644 --- a/src/main/resources/messages_uk.yml +++ b/src/main/resources/messages_uk.yml @@ -38,8 +38,8 @@ regex: '&cВаш нікнейм містить заборонені символ add_email: '&cБудь ласка додайте свою електронну скриньку: /email add ВашEmail ВашEmail' bad_database_email: '[AuthMe] Команда /email доступна лише при роботі з MySQL, або SQLite, зверніться до адміністратора.' recovery_email: '&cЗабули пароль? Введіть /email recovery ВашПароль' -usage_captcha: '&cБудь ласка введіть капчу: /captcha СимволиЗверху' -wrong_captcha: '&cНевірне значення капчи: /captcha СимволиЗверху' +usage_captcha: '&cБудь ласка введіть капчу: /captcha ' +wrong_captcha: '&cНевірне значення капчи: /captcha THE_CAPTCHA' valid_captcha: '&cКапча введена вірно!' kick_forvip: '&cVIP зайшов на переповнений сервер!' kick_fullserver: '&cНажаль, сервер переповнений!' @@ -55,4 +55,4 @@ email_changed: '[AuthMe] &2Email змінено!' email_send: '[AuthMe] Лист для відновлення надіслано на ваш Email!' country_banned: 'Сервер не доступний для вашої країни | Your country is banned from this server' antibot_auto_enabled: '[AuthMe] AntiBotMod автоматично увімкнений (забагато одначасних з`єднань)!' -antibot_auto_disabled: '[AuthMe] AntiBotMod автоматично вимкнувся, сподіваємось атака зупинена' \ No newline at end of file +antibot_auto_disabled: '[AuthMe] AntiBotMod автоматично вимкнувся, сподіваємось атака зупинена' From e1a21c8a05d9bc5979df28584d10c0f285abef49 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 24 Jul 2015 09:25:37 +0200 Subject: [PATCH 004/427] Create team.txt --- team.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 team.txt diff --git a/team.txt b/team.txt new file mode 100644 index 00000000..55c21748 --- /dev/null +++ b/team.txt @@ -0,0 +1,10 @@ +AuthMe-Team: + +Xephi (Xephi59) - Leader, Main deveoper +darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author +Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor +Maxetto (maxetto) - Ticket Manager, Italian Translator, Basic Developer +Trojaner25 (Trojaner25) - Ticket manager, Basic Developer +irobin591 (irobin591) - DE Translator +WaterCXubic (WaterXCubic) - ZHHK Translator +Bodyash - Russian/Ukrainian translator From c6cd01dfdb110fb7293e2263840d7908ea4f77c1 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Fri, 24 Jul 2015 22:34:52 +0200 Subject: [PATCH 005/427] Update team.txt --- team.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/team.txt b/team.txt index 55c21748..c67b6f0c 100644 --- a/team.txt +++ b/team.txt @@ -1,6 +1,6 @@ AuthMe-Team: -Xephi (Xephi59) - Leader, Main deveoper +Xephi (Xephi59) - Leader, Main developer darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor Maxetto (maxetto) - Ticket Manager, Italian Translator, Basic Developer From ed371e4ac7019a2e50c26ff2e7f01773fb978b96 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 24 Jul 2015 22:35:38 +0200 Subject: [PATCH 006/427] Update Settings.java --- src/main/java/fr/xephi/authme/settings/Settings.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index ecb06d8d..0d3fb0ca 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -569,6 +569,8 @@ public final class Settings extends YamlConfiguration { } if (contains("Performances.useMultiThreading")) set("Performances.useMultiThreading", null); + if (contains("Performances")) + set("Performances", null); if (!contains("Email.emailWhitelisted")) { set("Email.emailWhitelisted", new ArrayList()); changes = true; From a614d3e554892176991b1b6a5b7161568f8cd5ab Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 24 Jul 2015 23:31:17 +0200 Subject: [PATCH 007/427] Removed performance section --- src/main/resources/config.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 91e2c2f9..0475c055 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,7 +1,7 @@ DataSource: - # Can be set to : file, sqlite, mysql + # Can be set to: sqlite, mysql backend: sqlite - # Do we need to cache all query? + # Enable database caching caching: true # Database location mySQLHost: 127.0.0.1 @@ -385,10 +385,6 @@ Hooks: useEssentialsMotd: false # Do we need to cache custom Attributes ? customAttributes: false -Performances: - # HIGHLY recommended to use this! This will increase database performance - # Default is true, change it to false if you experience issues - useMultiThreading: true Purge: # On Enable , does AuthMe need to purge automatically old accounts unused ? useAutoPurge: false From a7a4a511e790b51f3be92dcaae1c38c4ddb40898 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 25 Jul 2015 00:08:29 +0200 Subject: [PATCH 008/427] Hotfix: it was shit, sorry --- .../fr/xephi/authme/settings/Messages.java | 11 ++++++++--- .../fr/xephi/authme/settings/Settings.java | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index bf88b15d..2328d820 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -1,9 +1,12 @@ package fr.xephi.authme.settings; import java.io.File; +import java.io.InputStream; + import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; +import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; public class Messages extends CustomConfiguration { @@ -24,11 +27,13 @@ public class Messages extends CustomConfiguration { * @param filename * The filename to open */ + @SuppressWarnings("deprecation") public final void loadDefaults(File file) { - if (!file.exists()) + InputStream stream = AuthMe.getInstance().getResource(file.getName()); + if (stream == null) return; - - setDefaults(YamlConfiguration.loadConfiguration(file)); + + setDefaults(YamlConfiguration.loadConfiguration(stream)); } /** diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 0d3fb0ca..61b5a682 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -7,6 +7,7 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -102,7 +103,7 @@ public final class Settings extends YamlConfiguration { if (exists()) { load(); } else { - loadDefaults(file); + loadDefaults(file.getName()); load(); } configFile = (YamlConfiguration) plugin.getConfig(); @@ -685,7 +686,7 @@ public final class Settings extends YamlConfiguration { public final void reload() { load(); - loadDefaults(file); + loadDefaults(file.getName()); } /** @@ -717,12 +718,14 @@ public final class Settings extends YamlConfiguration { * @param filename * The filename to open */ - public final void loadDefaults(File file) { - if (!file.exists()) - return; - - setDefaults(YamlConfiguration.loadConfiguration(file)); - } + @SuppressWarnings("deprecation") + public final void loadDefaults(String filename) { + InputStream stream = plugin.getResource(filename); + if (stream == null) + return; + + setDefaults(YamlConfiguration.loadConfiguration(stream)); + } /** * Saves current configuration (plus defaults) to disk. From c51b131a54773bc3f5c5b5fd76e907ed379b67f7 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 25 Jul 2015 04:28:37 +0200 Subject: [PATCH 009/427] Concurrent shit --- .../xephi/authme/listener/AuthMePlayerListener.java | 4 +++- .../xephi/authme/process/join/AsyncronousJoin.java | 13 ++++++------- src/main/resources/plugin.yml | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index d9a53966..03beb3b6 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -862,8 +862,10 @@ public class AuthMePlayerListener implements Listener { if (!Settings.isForcedRegistrationEnabled) return; - if (causeByAuthMe.containsKey(name) && causeByAuthMe.get(name)) + if (causeByAuthMe.containsKey(name)) { + causeByAuthMe.remove(name); return; + } event.setCancelled(true); } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 5bd857ef..7e5101d0 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -52,7 +52,9 @@ public class AsyncronousJoin { } public void process() { - AuthMePlayerListener.gameMode.put(name, player.getGameMode()); + if (AuthMePlayerListener.gameMode.containsKey(name)) + AuthMePlayerListener.gameMode.remove(name); + AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode()); BukkitScheduler sched = plugin.getServer().getScheduler(); if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { @@ -74,9 +76,8 @@ public class AsyncronousJoin { @Override public void run() { - AuthMePlayerListener.causeByAuthMe.put(name, true); + AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); player.setGameMode(gM); - AuthMePlayerListener.causeByAuthMe.put(name, false); player.kickPlayer("You are not the Owner of this account, please try another name!"); if (Settings.banUnsafeIp) plugin.getServer().banIP(ip); @@ -125,9 +126,8 @@ public class AsyncronousJoin { @Override public void run() { - AuthMePlayerListener.causeByAuthMe.put(name, true); + AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); Utils.forceGM(player); - AuthMePlayerListener.causeByAuthMe.put(name, false); } }); @@ -164,9 +164,8 @@ public class AsyncronousJoin { @Override public void run() { - AuthMePlayerListener.causeByAuthMe.put(name, true); + AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); Utils.forceGM(player); - AuthMePlayerListener.causeByAuthMe.put(name, false); } }); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d74b46c9..c0bd7fb4 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -51,6 +51,8 @@ permissions: authme.passpartu: true authme.l: true authme.reg: true + authme.email: true + authme.captcha: true authme.admin.*: description: Gives access to all authme admin commands children: From 67bca0155299eb3965665d5ffbd186c973513bd6 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sat, 25 Jul 2015 10:11:54 +0200 Subject: [PATCH 010/427] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6468c75d..2e259e5b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ - JavaDocs: AuthMe Javadoc -- Maven Repo: AuthMe Repo +- Maven Repo: AuthMe Repo #####Statistics: @@ -39,7 +39,7 @@ McStats: http://mcstats.org/plugin/AuthMe #####Running Requirements: >- Java 1.7 (should work also with Java 1.8) ->- Spigot or CraftBukkit +>- Spigot or CraftBukkit (1.7.10 or 1.8.X)
###Plugin Description: From ebe9a78cb53c7db244ce674d6667e66d26b869bd Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 25 Jul 2015 10:20:32 +0200 Subject: [PATCH 011/427] Updated prototype --- .../NewConfiguration/{forcedActions.yml => actions.yml} | 0 .../NewConfiguration/advanced.yml | 3 --- .../NewConfiguration/database.yml | 3 ++- .../NewConfiguration/{emailSystem.yml => email.yml} | 0 .../NewConfiguration/general.yml | 2 -- 5 files changed, 2 insertions(+), 6 deletions(-) rename PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/{forcedActions.yml => actions.yml} (100%) rename PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/{emailSystem.yml => email.yml} (100%) diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/forcedActions.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml similarity index 100% rename from PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/forcedActions.yml rename to PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml index 5493ecd6..a432ec9c 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml @@ -17,9 +17,6 @@ sessionLogin: sessionExpireOnIpChange: true security: - # Should players in the OP list have every permissions? - opPermissions: true - # Online players aren't kicked out for "Logged in from another location!", this option should always be set to true! forceSingleSession: true # Should we display all other accounts from a player when he joins? diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml index 6a885599..6c26091b 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml @@ -1,7 +1,6 @@ # Database AuthMeReloaded configuration file # What type of database do you want to use? Avariable options: sqlite, mysql, redis -# (The old flatfile backend is now deprecated, if you set this option to 'file' the 'file to SQLite' converter will be executed!) backend: sqlite # Do you like to cache all the queries? (Performance Boost) caching: true @@ -12,6 +11,7 @@ databaseName: authme tableName: authme # MySql Database connection settings +# Avariable only if the AuthMeReloaded-Mysql module is installed! mysql: port: '3306' host: 127.0.0.1 @@ -19,6 +19,7 @@ mysql: password: '12345' # Redis Database connection settings +# Avariable only if the AuthMeReloaded-Redis module is installed! redis: # Get Redis from http://redis.io/ host: 127.0.0.1 diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/emailSystem.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml similarity index 100% rename from PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/emailSystem.yml rename to PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml index c1d290c2..48931ea4 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml @@ -67,8 +67,6 @@ password: # When it's true, registration require that kind of command: # /register doublePasswordCheck: true - # Should players can use their usernames as passwords? - allowNameAsPassword: false # Deny unsafe passwords for being used, put them on lowercase! unsafePasswords: - '123456' From 955aad27279bdddb731a610a5709a8270f4bda01 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 25 Jul 2015 18:39:19 +0200 Subject: [PATCH 012/427] wtf >.< --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9fcaa4c6..b44572f4 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,6 @@ Authentication plugin for CraftBukkit/Spigot! http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ - jar - UTF-8 From a51eab55669c9b6df0d85f784d2679770df84e8e Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 25 Jul 2015 18:45:48 +0200 Subject: [PATCH 013/427] Revert the wtf --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index b44572f4..913e8b36 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,8 @@ authme 5.0-SNAPSHOT + jar + AuthMeReloaded Authentication plugin for CraftBukkit/Spigot! http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ From d0e1d7b8b8af8c56a9a416c2b13916f947d54e45 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 26 Jul 2015 00:50:21 +0200 Subject: [PATCH 014/427] Change how config work for the first launch --- src/main/java/fr/xephi/authme/AuthMe.java | 1 - .../fr/xephi/authme/settings/Settings.java | 211 ++---------------- 2 files changed, 22 insertions(+), 190 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index ca7ae740..45a6052e 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -129,7 +129,6 @@ public class AuthMe extends JavaPlugin { try { settings = new Settings(this); - settings.loadConfigOptions(); } catch (Exception e) { ConsoleLogger.showError("Can't load the configuration file... Something went wrong, to avoid security issues the server will shutdown!"); this.getServer().shutdown(); diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 61b5a682..12b4c665 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -7,7 +7,6 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -100,21 +99,31 @@ public final class Settings extends YamlConfiguration { public Settings(AuthMe plugin) { this.file = new File(plugin.getDataFolder(), "config.yml"); this.plugin = plugin; - if (exists()) { + boolean exist = exists(); + if (exist) { load(); } else { - loadDefaults(file.getName()); + plugin.saveDefaultConfig(); load(); } configFile = (YamlConfiguration) plugin.getConfig(); PLUGIN_FOLDER = plugin.getDataFolder().toString(); + loadConfigOptions(exist); + } + + public void loadConfigOptions(boolean exist) { + plugin.getLogger().info("Loading Configuration File..."); + if (exist) + mergeConfig(); + + loadVariables(); + + if (exist) + saveDefaults(); } @SuppressWarnings("unchecked") - public void loadConfigOptions() { - plugin.getLogger().info("Loading Configuration File..."); - mergeConfig(); - + public static void loadVariables() { messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en")); isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false); isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true); @@ -274,176 +283,14 @@ public final class Settings extends YamlConfiguration { generateImage = configFile.getBoolean("Email.generateImage", true); // Load the welcome message - getWelcomeMessage(plugin); + getWelcomeMessage(); - saveDefaults(); } - @SuppressWarnings("unchecked") public static void reloadConfigOptions(YamlConfiguration newConfig) { configFile = newConfig; - messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en")); - isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false); - isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true); - isRegistrationEnabled = configFile.getBoolean("settings.registration.enabled", true); - isTeleportToSpawnEnabled = configFile.getBoolean("settings.restrictions.teleportUnAuthedToSpawn", false); - getWarnMessageInterval = configFile.getInt("settings.registration.messageInterval", 5); - isSessionsEnabled = configFile.getBoolean("settings.sessions.enabled", false); - getSessionTimeout = configFile.getInt("settings.sessions.timeout", 10); - getRegistrationTimeout = configFile.getInt("settings.restrictions.timeout", 30); - isChatAllowed = configFile.getBoolean("settings.restrictions.allowChat", false); - getMaxNickLength = configFile.getInt("settings.restrictions.maxNicknameLength", 20); - getMinNickLength = configFile.getInt("settings.restrictions.minNicknameLength", 3); - getPasswordMinLen = configFile.getInt("settings.security.minPasswordLength", 4); - getNickRegex = configFile.getString("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_?]*"); - isAllowRestrictedIp = configFile.getBoolean("settings.restrictions.AllowRestrictedUser", false); - getRestrictedIp = configFile.getStringList("settings.restrictions.AllowedRestrictedUser"); - isMovementAllowed = configFile.getBoolean("settings.restrictions.allowMovement", false); - getMovementRadius = configFile.getInt("settings.restrictions.allowedMovementRadius", 100); - getJoinPermissions = configFile.getStringList("GroupOptions.Permissions.PermissionsOnJoin"); - isKickOnWrongPasswordEnabled = configFile.getBoolean("settings.restrictions.kickOnWrongPassword", false); - isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); - isForceSingleSessionEnabled = configFile.getBoolean("settings.restrictions.ForceSingleSession", true); - isForceSpawnLocOnJoinEnabled = configFile.getBoolean("settings.restrictions.ForceSpawnLocOnJoinEnabled", false); - isSaveQuitLocationEnabled = configFile.getBoolean("settings.restrictions.SaveQuitLocation", false); - isForceSurvivalModeEnabled = configFile.getBoolean("settings.GameMode.ForceSurvivalMode", false); - isResetInventoryIfCreative = configFile.getBoolean("settings.GameMode.ResetInventoryIfCreative", false); - getmaxRegPerIp = configFile.getInt("settings.restrictions.maxRegPerIp", 1); - getPasswordHash = getPasswordHash(); - getUnloggedinGroup = configFile.getString("settings.security.unLoggedinGroup", "unLoggedInGroup"); - getDataSource = getDataSource(); - isCachingEnabled = configFile.getBoolean("DataSource.caching", true); - getMySQLHost = configFile.getString("DataSource.mySQLHost", "127.0.0.1"); - getMySQLPort = configFile.getString("DataSource.mySQLPort", "3306"); - getMySQLUsername = configFile.getString("DataSource.mySQLUsername", "authme"); - getMySQLPassword = configFile.getString("DataSource.mySQLPassword", "12345"); - getMySQLDatabase = configFile.getString("DataSource.mySQLDatabase", "authme"); - getMySQLTablename = configFile.getString("DataSource.mySQLTablename", "authme"); - getMySQLColumnEmail = configFile.getString("DataSource.mySQLColumnEmail", "email"); - getMySQLColumnName = configFile.getString("DataSource.mySQLColumnName", "username"); - getMySQLColumnPassword = configFile.getString("DataSource.mySQLColumnPassword", "password"); - getMySQLColumnIp = configFile.getString("DataSource.mySQLColumnIp", "ip"); - getMySQLColumnLastLogin = configFile.getString("DataSource.mySQLColumnLastLogin", "lastlogin"); - getMySQLColumnSalt = configFile.getString("ExternalBoardOptions.mySQLColumnSalt"); - getMySQLColumnGroup = configFile.getString("ExternalBoardOptions.mySQLColumnGroup", ""); - getMySQLlastlocX = configFile.getString("DataSource.mySQLlastlocX", "x"); - getMySQLlastlocY = configFile.getString("DataSource.mySQLlastlocY", "y"); - getMySQLlastlocZ = configFile.getString("DataSource.mySQLlastlocZ", "z"); - getMySQLlastlocWorld = configFile.getString("DataSource.mySQLlastlocWorld", "world"); - getMySQLColumnRealName = configFile.getString("DataSource.mySQLRealName", "realname"); - getNonActivatedGroup = configFile.getInt("ExternalBoardOptions.nonActivedUserGroup", -1); - unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", ""); - getUnrestrictedName = configFile.getStringList("settings.unrestrictions.UnrestrictedName"); - getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", ""); - getEnablePasswordVerifier = configFile.getBoolean("settings.restrictions.enablePasswordVerifier", true); - protectInventoryBeforeLogInEnabled = configFile.getBoolean("settings.restrictions.ProtectInventoryBeforeLogIn", true); - passwordMaxLength = configFile.getInt("settings.security.passwordMaxLength", 20); - isBackupActivated = configFile.getBoolean("BackupSystem.ActivateBackup", false); - isBackupOnStart = configFile.getBoolean("BackupSystem.OnServerStart", false); - isBackupOnStop = configFile.getBoolean("BackupSystem.OnServeStop", false); - backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); - enablePasspartu = configFile.getBoolean("Passpartu.enablePasspartu", false); - isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); - reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); - allowCommands = (List) configFile.getList("settings.restrictions.allowCommands"); - if (configFile.contains("allowCommands")) { - if (!allowCommands.contains("/login")) - allowCommands.add("/login"); - if (!allowCommands.contains("/register")) - allowCommands.add("/register"); - if (!allowCommands.contains("/l")) - allowCommands.add("/l"); - if (!allowCommands.contains("/reg")) - allowCommands.add("/reg"); - if (!allowCommands.contains("/passpartu")) - allowCommands.add("/passpartu"); - if (!allowCommands.contains("/email")) - allowCommands.add("/email"); - if (!allowCommands.contains("/captcha")) - allowCommands.add("/captcha"); - } - rakamakUsers = configFile.getString("Converter.Rakamak.fileName", "users.rak"); - rakamakUsersIp = configFile.getString("Converter.Rakamak.ipFileName", "UsersIp.rak"); - rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false); - noConsoleSpam = configFile.getBoolean("Security.console.noConsoleSpam", false); - removePassword = configFile.getBoolean("Security.console.removePassword", true); - getmailAccount = configFile.getString("Email.mailAccount", ""); - getmailPassword = configFile.getString("Email.mailPassword", ""); - getmailSMTP = configFile.getString("Email.mailSMTP", "smtp.gmail.com"); - getMailPort = configFile.getInt("Email.mailPort", 465); - getRecoveryPassLength = configFile.getInt("Email.RecoveryPasswordLength", 8); - getMySQLOtherUsernameColumn = (List) configFile.getList("ExternalBoardOptions.mySQLOtherUsernameColumns", new ArrayList()); - displayOtherAccounts = configFile.getBoolean("settings.restrictions.displayOtherAccounts", true); - getMySQLColumnId = configFile.getString("DataSource.mySQLColumnId", "id"); - getmailSenderName = configFile.getString("Email.mailSenderName", ""); - useCaptcha = configFile.getBoolean("Security.captcha.useCaptcha", false); - maxLoginTry = configFile.getInt("Security.captcha.maxLoginTry", 5); - captchaLength = configFile.getInt("Security.captcha.captchaLength", 5); - getMailSubject = configFile.getString("Email.mailSubject", "Your new AuthMe Password"); - getMailText = configFile.getString("Email.mailText", "Dear ,

This is your new AuthMe password for the server

:



Do not forget to change password after login!
/changepassword newPassword"); - emailRegistration = configFile.getBoolean("settings.registration.enableEmailRegistrationSystem", false); - saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8); - getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1); - multiverse = configFile.getBoolean("Hooks.multiverse", true); - chestshop = configFile.getBoolean("Hooks.chestshop", true); - bungee = configFile.getBoolean("Hooks.bungeecord", false); - getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds"); - banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); - doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false); - sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false); - useLogging = configFile.getBoolean("Security.console.logConsole", false); - disableSocialSpy = configFile.getBoolean("Hooks.disableSocialSpy", true); - bCryptLog2Rounds = configFile.getInt("ExternalBoardOptions.bCryptLog2Round", 10); - forceOnlyAfterLogin = configFile.getBoolean("settings.GameMode.ForceOnlyAfterLogin", false); - useEssentialsMotd = configFile.getBoolean("Hooks.useEssentialsMotd", false); - usePurge = configFile.getBoolean("Purge.useAutoPurge", false); - purgeDelay = configFile.getInt("Purge.daysBeforeRemovePlayer", 60); - purgePlayerDat = configFile.getBoolean("Purge.removePlayerDat", false); - purgeEssentialsFile = configFile.getBoolean("Purge.removeEssentialsFile", false); - defaultWorld = configFile.getString("Purge.defaultWorld", "world"); - getPhpbbPrefix = configFile.getString("ExternalBoardOptions.phpbbTablePrefix", "phpbb_"); - getPhpbbGroup = configFile.getInt("ExternalBoardOptions.phpbbActivatedGroupId", 2); - supportOldPassword = configFile.getBoolean("settings.security.supportOldPasswordHash", false); - getWordPressPrefix = configFile.getString("ExternalBoardOptions.wordpressTablePrefix", "wp_"); - purgeLimitedCreative = configFile.getBoolean("Purge.removeLimitedCreativesInventories", false); - purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false); - purgePermissions = configFile.getBoolean("Purge.removePermissions", false); - enableProtection = configFile.getBoolean("Protection.enableProtection", false); - countries = configFile.getStringList("Protection.countries"); - enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false); - antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5); - antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10); - forceCommands = configFile.getStringList("settings.forceCommands"); - forceCommandsAsConsole = configFile.getStringList("settings.forceCommandsAsConsole"); - recallEmail = configFile.getBoolean("Email.recallPlayers", false); - delayRecall = configFile.getInt("Email.delayRecall", 5); - useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true); - unsafePasswords = configFile.getStringList("settings.security.unsafePasswords"); - countriesBlacklist = configFile.getStringList("Protection.countriesBlacklist"); - broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false); - forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false); - forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false); - getMySQLColumnLogged = configFile.getString("DataSource.mySQLColumnLogged", "isLogged"); - spawnPriority = configFile.getString("settings.restrictions.spawnPriority", "authme,essentials,multiverse,default"); - getMaxLoginPerIp = configFile.getInt("settings.restrictions.maxLoginPerIp", 0); - getMaxJoinPerIp = configFile.getInt("settings.restrictions.maxJoinPerIp", 0); - checkVeryGames = configFile.getBoolean("VeryGames.enableIpCheck", false); - delayJoinMessage = configFile.getBoolean("settings.delayJoinMessage", false); - noTeleport = configFile.getBoolean("settings.restrictions.noTeleport", false); - crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db"); - getPassRegex = configFile.getString("settings.restrictions.allowedPasswordCharacters", "[\\x21-\\x7E]*"); - applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false); - emailBlacklist = configFile.getStringList("Email.emailBlacklisted"); - emailWhitelist = configFile.getStringList("Email.emailWhitelisted"); - forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands"); - forceRegisterCommandsAsConsole = (List) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList()); - customAttributes = configFile.getBoolean("Hooks.customAttributes"); - generateImage = configFile.getBoolean("Email.generateImage", true); - - // Reload the welcome message - getWelcomeMessage(AuthMe.getInstance()); - + loadVariables(); } public void mergeConfig() { @@ -607,7 +454,6 @@ public final class Settings extends YamlConfiguration { plugin.getLogger().warning("Merge new Config Options - I'm not an error, please don't report me"); plugin.getLogger().warning("Please check your config.yml file for new configs!"); } - plugin.saveConfig(); return; } @@ -685,8 +531,9 @@ public final class Settings extends YamlConfiguration { } public final void reload() { + if (!exists()) + plugin.saveDefaultConfig(); load(); - loadDefaults(file.getName()); } /** @@ -712,21 +559,6 @@ public final class Settings extends YamlConfiguration { return file.exists(); } - /** - * Loads a file from the plugin jar and sets as default - * - * @param filename - * The filename to open - */ - @SuppressWarnings("deprecation") - public final void loadDefaults(String filename) { - InputStream stream = plugin.getResource(filename); - if (stream == null) - return; - - setDefaults(YamlConfiguration.loadConfiguration(stream)); - } - /** * Saves current configuration (plus defaults) to disk. * @@ -779,7 +611,8 @@ public final class Settings extends YamlConfiguration { else isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); } - private static void getWelcomeMessage(AuthMe plugin) { + private static void getWelcomeMessage() { + AuthMe plugin = AuthMe.getInstance(); welcomeMsg = new ArrayList(); if (!useWelcomeMessage) { return; From ba70b17394c94e1ba21da3f5be7fda1c4b960c7d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 26 Jul 2015 01:18:35 +0200 Subject: [PATCH 015/427] Updated team --- team.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/team.txt b/team.txt index c67b6f0c..21b9cdb4 100644 --- a/team.txt +++ b/team.txt @@ -2,9 +2,10 @@ AuthMe-Team: Xephi (Xephi59) - Leader, Main developer darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author +Kloudy - Main developer Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor -Maxetto (maxetto) - Ticket Manager, Italian Translator, Basic Developer -Trojaner25 (Trojaner25) - Ticket manager, Basic Developer -irobin591 (irobin591) - DE Translator -WaterCXubic (WaterXCubic) - ZHHK Translator +Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor +Trojaner25 - Ticket manager, Basic Developer +irobin591 - DE Translator +WaterCXubic - ZHHK Translator Bodyash - Russian/Ukrainian translator From cd3e7b5d431fd54eaedfdc090083ebfca15cd598 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 27 Jul 2015 15:08:40 +0200 Subject: [PATCH 016/427] First attempt to fix the email registation issue --- .../register/ProcessSyncronousEmailRegister.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index e7510eae..c0c9e3fd 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -2,6 +2,7 @@ package fr.xephi.authme.process.register; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; @@ -34,11 +35,20 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; + + BukkitScheduler sched = plugin.getServer().getScheduler(); + +// if (time != 0) { +// LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); +// BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); +// LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); +// } + if (time != 0) { - LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); - BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } + LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); From ba06bb514ac20c6481531c0c24b253f90640e075 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 27 Jul 2015 16:09:06 +0200 Subject: [PATCH 017/427] Revert "First attempt to fix the email registation issue" This reverts commit cd3e7b5d431fd54eaedfdc090083ebfca15cd598. --- .../register/ProcessSyncronousEmailRegister.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index c0c9e3fd..e7510eae 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -2,7 +2,6 @@ package fr.xephi.authme.process.register; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; @@ -35,20 +34,11 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; - - BukkitScheduler sched = plugin.getServer().getScheduler(); - -// if (time != 0) { -// LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); -// BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); -// LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); -// } - if (time != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); + BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); From 5388f081174f30cf467d5c43f0a554c6adf97afe Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 00:04:16 +0200 Subject: [PATCH 018/427] Allow session timeout = 0 (with warnings) --- src/main/java/fr/xephi/authme/AuthMe.java | 4 +++ .../authme/process/quit/AsyncronousQuit.java | 26 ++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 45a6052e..4937fcb1 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -251,6 +251,10 @@ public class AuthMe extends JavaPlugin { if (!Settings.isForceSingleSessionEnabled) { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } + + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled){ + ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + } if (Settings.reloadSupport) try { diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 4c833d66..e60d9719 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -78,18 +78,20 @@ public class AsyncronousQuit { LimboCache.getInstance().deleteLimboPlayer(name); } if (Settings.isSessionsEnabled && !isKick) { - BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - PlayerCache.getInstance().removePlayer(name); - if (database.isLogged(name)) - database.setUnlogged(name); - plugin.sessions.remove(name); - } - - }, Settings.getSessionTimeout * 20 * 60); - plugin.sessions.put(name, task); + if (Settings.getSessionTimeout != 0){ + BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + PlayerCache.getInstance().removePlayer(name); + if (database.isLogged(name)) + database.setUnlogged(name); + plugin.sessions.remove(name); + } + + }, Settings.getSessionTimeout * 20 * 60); + plugin.sessions.put(name, task); + } } else { PlayerCache.getInstance().removePlayer(name); database.setUnlogged(name); From 79e65742322b6e4841708d23738dcc2f4302d2a0 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 00:40:25 +0200 Subject: [PATCH 019/427] Separate message for antibot kick --- .../xephi/authme/listener/AuthMePlayerListener.java | 10 +++++++++- src/main/java/fr/xephi/authme/settings/Settings.java | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 03beb3b6..5ce3148e 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -428,13 +428,21 @@ public class AuthMePlayerListener implements Listener { } } - if (Settings.isKickNonRegisteredEnabled) { + if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction){ if (!plugin.database.isAuthAvailable(name)) { event.setKickMessage(m.send("reg_only")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } } + + if (Settings.antiBotInAction){ + if (!plugin.database.isAuthAvailable(name)) { + event.setKickMessage(m.send("AntiBot service in action! Non registered players can't connect until the bot attack stops!")[0]); //Need to add string to messages + event.setResult(PlayerLoginEvent.Result.KICK_OTHER); + return; + } + } // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 12b4c665..6f513f60 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -22,6 +22,9 @@ import fr.xephi.authme.security.HashAlgorithm; public final class Settings extends YamlConfiguration { + //This is not an option! + public static Boolean antiBotInAction = false; + public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe"; public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache"; public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db"; @@ -606,9 +609,13 @@ public final class Settings extends YamlConfiguration { } public static void switchAntiBotMod(boolean mode) { - if (mode) + if (mode){ isKickNonRegisteredEnabled = true; - else isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); + antiBotInAction = true; + }else{ + isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); + antiBotInAction = false; + } } private static void getWelcomeMessage() { From 90d8fc85487d7103053ee528b3aa27d326df5d02 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 01:15:00 +0200 Subject: [PATCH 020/427] Second attempt to fix email registration --- .../register/ProcessSyncronousEmailRegister.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index e7510eae..a7a8ab88 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -1,7 +1,7 @@ package fr.xephi.authme.process.register; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; @@ -34,15 +34,17 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; + + BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0) { LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); - BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); - BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); + BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); + player.saveData(); if (!Settings.noConsoleSpam) ConsoleLogger.info(player.getName() + " registered " + plugin.getIP(player)); From f80017de6746bcd985dfa773edf7a6d1e8328dc4 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 01:26:04 +0200 Subject: [PATCH 021/427] Fixed xD --- .../process/register/ProcessSyncronousEmailRegister.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index a7a8ab88..ede70c18 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -37,11 +37,13 @@ public class ProcessSyncronousEmailRegister implements Runnable { BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0) { - LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); + if (LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId() != null) + LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); + if (LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId() != null) + LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); From c4f516582c806d1271e7b960d07828af692764a4 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 01:39:58 +0200 Subject: [PATCH 022/427] Ok, go away stupid checks! --- .../process/register/ProcessSyncronousEmailRegister.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index ede70c18..d2b25414 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -37,13 +37,9 @@ public class ProcessSyncronousEmailRegister implements Runnable { BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0) { - if (LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId() != null) - LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - if (LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId() != null) - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); From 223fff4b52c06d2105c34bd099db53e1408dafd5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 02:11:58 +0200 Subject: [PATCH 023/427] New attempt to fix the broken email registration -_- --- .../register/ProcessSyncronousEmailRegister.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index d2b25414..2ba9f63d 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -8,6 +8,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; @@ -28,6 +29,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { @Override public void run() { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); if (!Settings.getRegisteredGroup.isEmpty()) { Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); } @@ -36,12 +38,16 @@ public class ProcessSyncronousEmailRegister implements Runnable { int msgInterval = Settings.getWarnMessageInterval; BukkitScheduler sched = plugin.getServer().getScheduler(); - if (time != 0) { + if (time != 0 && limbo != null) { + limbo.getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + limbo.setTimeoutTaskId(id); + } + if (limbo != null){ + limbo.getMessageTaskId().cancel(); + BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); + limbo.setMessageTaskId(nwMsg); } - BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); player.saveData(); if (!Settings.noConsoleSpam) From 47211ab803fc2bbda6f5b4cd52209615fc784f9c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 02:57:50 +0200 Subject: [PATCH 024/427] Code cleanup --- src/main/java/fr/xephi/authme/Utils.java | 12 ++++++++++++ .../java/fr/xephi/authme/cache/backup/FileCache.java | 11 ++--------- .../xephi/authme/process/join/AsyncronousJoin.java | 6 +++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 15e01fe2..cadac9eb 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,5 +1,6 @@ package fr.xephi.authme; +import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -208,5 +209,16 @@ public class Utils { NOTLOGGEDIN, LOGGEDIN } + + public static void purgeDirectory(File dir) { + if (dir != null && dir.listFiles() != null) + for (File file : dir.listFiles()) { + if (file != null){ + if (file.isDirectory()) + purgeDirectory(file); + file.delete(); + } + } + } } diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 11fce587..948b0b07 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -24,6 +24,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.api.API; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.Utils; public class FileCache { @@ -547,15 +548,7 @@ public class FileCache { } if (file.exists()) { if (file.isDirectory() && file.listFiles() != null) { - for (File f : file.listFiles()) { - if (f.isDirectory() && f.listFiles() != null) { - for (File a : f.listFiles()) { - a.delete(); - } - f.delete(); - } else f.delete(); - } - file.delete(); + Utils.purgeDirectory(file); } else file.delete(); } } catch (Exception e) { diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 7e5101d0..2e72bde4 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -141,7 +141,7 @@ public class AsyncronousJoin { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null) { + if (player.isOnline() && tpEvent.getTo() != null) { if (tpEvent.getTo().getWorld() != null) player.teleport(tpEvent.getTo()); } @@ -185,7 +185,7 @@ public class AsyncronousJoin { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null) { + if (player.isOnline() && tpEvent.getTo() != null) { if (tpEvent.getTo().getWorld() != null) player.teleport(tpEvent.getTo()); } @@ -291,7 +291,7 @@ public class AsyncronousJoin { FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), loc); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { + if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { player.teleport(tpEvent.getTo()); } } From 88530542ace896bdd75c084030245f4ff6ff6807 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 17:06:54 +0200 Subject: [PATCH 025/427] Fixes --- src/main/java/fr/xephi/authme/Utils.java | 21 ++++++----- .../xephi/authme/cache/backup/FileCache.java | 35 ++++++++++--------- .../authme/listener/AuthMePlayerListener.java | 2 +- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index cadac9eb..ee20c578 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -210,15 +210,18 @@ public class Utils { LOGGEDIN } - public static void purgeDirectory(File dir) { - if (dir != null && dir.listFiles() != null) - for (File file : dir.listFiles()) { - if (file != null){ - if (file.isDirectory()) - purgeDirectory(file); - file.delete(); - } + public static void purgeDirectory(File file){ + String files[] = file.list(); + if (files != null && files.length != 0){ + for (String temp : files) { + File fileDelete = new File(file, temp); + if (fileDelete.isDirectory()){ + purgeDirectory(fileDelete); + fileDelete.delete(); + } else { + fileDelete.delete(); + } + } } } - } diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 948b0b07..b18ad9c1 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -45,9 +45,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); @@ -198,9 +198,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } try { File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); @@ -537,22 +537,25 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } try { File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path); - if (!file.exists()) { - file = new File("cache/" + player.getName().toLowerCase() + ".cache"); - } - if (file.exists()) { - if (file.isDirectory() && file.listFiles() != null) { - Utils.purgeDirectory(file); - } else file.delete(); + if (file.list() != null) { + Utils.purgeDirectory(file); + file.delete(); + } else { + file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + player.getName().toLowerCase() + ".cache"); + if(file.isFile()){ + file.delete(); + } else { + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache, it doesn't exist!"); + } } } catch (Exception e) { - ConsoleLogger.showError("File cannot be removed correctly :/"); + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache :/"); } } @@ -561,9 +564,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); if (!file.exists()) { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 5ce3148e..2fff82fd 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -438,7 +438,7 @@ public class AuthMePlayerListener implements Listener { if (Settings.antiBotInAction){ if (!plugin.database.isAuthAvailable(name)) { - event.setKickMessage(m.send("AntiBot service in action! Non registered players can't connect until the bot attack stops!")[0]); //Need to add string to messages + event.setKickMessage("AntiBot service in action! Non registered players can't connect until the bot attack stops!"); //Need to add string to messages event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } From 311d551653f8cb5eb01efd970b07c86dc76f5b84 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 17:26:16 +0200 Subject: [PATCH 026/427] Update pom --- pom.xml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 913e8b36..6e16eb03 100644 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,7 @@ mysql mysql-connector-java 5.1.36 + compile @@ -185,13 +186,15 @@ org.xerial sqlite-jdbc 3.8.10.1 + compile - com.sun.mail - javax.mail + javax.mail + javax.mail-api 1.5.4 + compile @@ -199,6 +202,7 @@ com.maxmind.geoip geoip-api 1.2.14 + compile @@ -224,6 +228,7 @@ org.spigotmc spigot-api ${bukkitVersion} + provided bungeecord-chat @@ -237,6 +242,7 @@ com.comphenix.attribute AttributeStorage 0.0.2-SNAPSHOT + compile org.bukkit @@ -272,6 +278,7 @@ net.citizensnpcs citizensapi 2.0.16-SNAPSHOT + provided org.bukkit @@ -290,7 +297,7 @@ Multiverse-Core 2.5 jar - compile + provided org.bukkit @@ -320,6 +327,7 @@ net.ess3 Essentials 2.14-SNAPSHOT + provided org.bukkit @@ -337,6 +345,7 @@ net.minelink CombatTagPlus 1.2.1-SNAPSHOT + provided org.bukkit @@ -410,6 +419,7 @@ com.trc202 CombatTag 6.2.1-SNAPSHOT + provided org.bukkit @@ -427,6 +437,7 @@ de.luricos.bukkit xAuth 2.6 + provided org.bukkit @@ -464,6 +475,7 @@ com.acrobot.chestshop chestshop 3.8.12 + provided org.bukkit From b0d9fdc9789c187e7486de91e82fc85b1a3fedb6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 18:36:12 +0200 Subject: [PATCH 027/427] code style --- .../authme/process/register/ProcessSyncronousEmailRegister.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index 2ba9f63d..96a200c2 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -36,7 +36,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; - + BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0 && limbo != null) { limbo.getTimeoutTaskId().cancel(); From 434b37b55f6dd6b288104fa84061ffcd353a9773 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:22:36 +0200 Subject: [PATCH 028/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e259e5b..41fdfc5b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From 56f037bb4c620bfd047116c23971c4b037dc03d0 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:23:31 +0200 Subject: [PATCH 029/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41fdfc5b..9bcc8c9f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From 32b0d5887643fa4b2c69365381457bbb29f6ec05 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:39:56 +0200 Subject: [PATCH 030/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bcc8c9f..38262070 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From e9078a9fab8c8056faa4901347e040359c451f79 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:40:38 +0200 Subject: [PATCH 031/427] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 38262070..28209ac6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -

The most used authentication plugin for CraftBukkit/Spigot!


From 41d87a9e06fd4edf8adaa0a204b89dc76359dcfd Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:53:35 +0200 Subject: [PATCH 032/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28209ac6..8bad8661 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From 79759bf139b42a41122db70fa46d72275224dea6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 14:12:01 +0200 Subject: [PATCH 033/427] Removed Passpartu feature --- README.md | 2 +- src/main/java/fr/xephi/authme/AuthMe.java | 2 - src/main/java/fr/xephi/authme/Utils.java | 38 -------------- .../xephi/authme/commands/AdminCommand.java | 15 ------ .../authme/commands/PasspartuCommand.java | 52 ------------------- .../authme/listener/AuthMePlayerListener.java | 4 +- .../fr/xephi/authme/settings/Settings.java | 13 +++-- src/main/resources/config.yml | 8 --- src/main/resources/plugin.yml | 9 +--- 9 files changed, 13 insertions(+), 130 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/commands/PasspartuCommand.java diff --git a/README.md b/README.md index 8bad8661..12216e73 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ typing commands or use the inventory. It can also kick players with uncommon lon
  • Username spoofing protection.
  • Countries Whitelist/Blacklist! (countries codes)
  • Built-in AntiBot System!
  • -
  • Passpartu Feature: Admin can login with all account more info here (Deprecated)
  • +
  • ForceLogin Feature: Admins can login with all account via console command!
  • Avoid the "Logged in from another location" message!
  • Session Login!
  • Editable translations and messages!
  • diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 4937fcb1..fc719c3f 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -49,7 +49,6 @@ import fr.xephi.authme.commands.ConverterCommand; import fr.xephi.authme.commands.EmailCommand; import fr.xephi.authme.commands.LoginCommand; import fr.xephi.authme.commands.LogoutCommand; -import fr.xephi.authme.commands.PasspartuCommand; import fr.xephi.authme.commands.RegisterCommand; import fr.xephi.authme.commands.UnregisterCommand; import fr.xephi.authme.converter.Converter; @@ -243,7 +242,6 @@ public class AuthMe extends JavaPlugin { this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); this.getCommand("logout").setExecutor(new LogoutCommand(this)); this.getCommand("unregister").setExecutor(new UnregisterCommand(this)); - this.getCommand("passpartu").setExecutor(new PasspartuCommand(this)); this.getCommand("email").setExecutor(new EmailCommand(this)); this.getCommand("captcha").setExecutor(new CaptchaCommand(this)); this.getCommand("converter").setExecutor(new ConverterCommand(this)); diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index ee20c578..c1975486 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,9 +1,7 @@ package fr.xephi.authme; import java.io.File; -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -14,7 +12,6 @@ import org.bukkit.entity.Player; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.events.AuthMeTeleportEvent; -import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Settings; public class Utils { @@ -23,7 +20,6 @@ public class Utils { private static Utils singleton; int id; public AuthMe plugin; - private static List tokens = new ArrayList(); public Utils(AuthMe plugin) { this.plugin = plugin; @@ -161,40 +157,6 @@ public class Utils { }); } - /* - * Random Token for passpartu - */ - public boolean obtainToken() { - try { - final String token = new RandomString(10).nextString(); - tokens.add(token); - ConsoleLogger.info("[AuthMe] Security passpartu token: " + token); - Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - tokens.remove(token); - } - - }, 600); - return true; - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - /* - * Read Token - */ - public boolean readToken(String inputToken) { - boolean ret = false; - if (tokens.contains(inputToken)) - ret = true; - tokens.remove(inputToken); - return (ret); - } - /* * Used for force player GameMode */ diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 1f6a15ef..10a4e950 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -15,7 +15,6 @@ import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; @@ -71,7 +70,6 @@ public class AdminCommand implements CommandExecutor { 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,19 +78,6 @@ public class AdminCommand implements CommandExecutor { return true; } - if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) { - if (args.length > 1) { - ConsoleLogger.info("[AuthMe] command usage: /authme passpartutoken"); - return true; - } - if (Utils.getInstance().obtainToken()) { - ConsoleLogger.info("[AuthMe] You have 30s to insert this token ingame with /passpartu "); - } else { - ConsoleLogger.info("[AuthMe] Security error on passpartu token, please redo the command."); - } - return true; - } - if (args[0].equalsIgnoreCase("version")) { sender.sendMessage("AuthMe Version: " + AuthMe.getInstance().getDescription().getVersion()); return true; diff --git a/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java b/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java deleted file mode 100644 index 0d7b059e..00000000 --- a/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Messages; - -/** - * - * @author stefano - */ -public class PasspartuCommand implements CommandExecutor { - - private Utils utils = Utils.getInstance(); - public AuthMe plugin; - private Messages m = Messages.getInstance(); - - public PasspartuCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - if (PlayerCache.getInstance().isAuthenticated(sender.getName().toLowerCase())) { - return true; - } - - if ((sender instanceof Player) && args.length == 1) { - if (utils.readToken(args[0])) { - // bypass login! - plugin.management.performLogin((Player) sender, "dontneed", true); - return true; - } - sender.sendMessage("Time is expired or Token is Wrong!"); - return true; - } - sender.sendMessage("usage: /passpartu token"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 2fff82fd..7f7c19c6 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -84,7 +84,7 @@ public class AuthMePlayerListener implements Listener { return; String cmd = msg.split(" ")[0]; - if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register") || cmd.equalsIgnoreCase("/passpartu") || cmd.equalsIgnoreCase("/l") || cmd.equalsIgnoreCase("/reg") || cmd.equalsIgnoreCase("/email") || cmd.equalsIgnoreCase("/captcha")) + if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register") || cmd.equalsIgnoreCase("/l") || cmd.equalsIgnoreCase("/reg") || cmd.equalsIgnoreCase("/email") || cmd.equalsIgnoreCase("/captcha")) return; if (Settings.useEssentialsMotd && cmd.equalsIgnoreCase("/motd")) return; @@ -411,7 +411,7 @@ public class AuthMePlayerListener implements Listener { if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) return; - if (Settings.enablePasspartu && !Settings.countriesBlacklist.isEmpty()) { + if (!Settings.countriesBlacklist.isEmpty()) { String code = plugin.getCountryCode(event.getAddress().getHostAddress()); if (((code == null) || (Settings.countriesBlacklist.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { event.setKickMessage(m.send("country_banned")[0]); diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 6f513f60..6fc1aca6 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -62,7 +62,7 @@ public final class Settings extends YamlConfiguration { isResetInventoryIfCreative, isCachingEnabled, isKickOnWrongPasswordEnabled, getEnablePasswordVerifier, protectInventoryBeforeLogInEnabled, isBackupActivated, - isBackupOnStart, isBackupOnStop, enablePasspartu, isStopEnabled, + isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, useCaptcha, emailRegistration, multiverse, chestshop, bungee, banUnsafeIp, doubleEmailCheck, @@ -187,7 +187,6 @@ public final class Settings extends YamlConfiguration { isBackupOnStart = configFile.getBoolean("BackupSystem.OnServerStart", false); isBackupOnStop = configFile.getBoolean("BackupSystem.OnServeStop", false); backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); - enablePasspartu = configFile.getBoolean("Passpartu.enablePasspartu", false); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); allowCommands = (List) configFile.getList("settings.restrictions.allowCommands"); @@ -200,8 +199,6 @@ public final class Settings extends YamlConfiguration { allowCommands.add("/l"); if (!allowCommands.contains("/reg")) allowCommands.add("/reg"); - if (!allowCommands.contains("/passpartu")) - allowCommands.add("/passpartu"); if (!allowCommands.contains("/email")) allowCommands.add("/email"); if (!allowCommands.contains("/captcha")) @@ -420,8 +417,16 @@ public final class Settings extends YamlConfiguration { } if (contains("Performances.useMultiThreading")) set("Performances.useMultiThreading", null); + if (contains("Performances")) set("Performances", null); + + if (contains("Passpartu.enablePasspartu")) + set("Passpartu.enablePasspartu", null); + + if (contains("Passpartu")) + set("Passpartu", null); + if (!contains("Email.emailWhitelisted")) { set("Email.emailWhitelisted", new ArrayList()); changes = true; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0475c055..b98ce851 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -84,7 +84,6 @@ settings: - /register - /l - /reg - - /passpartu - /email - /captcha # Maximum Registration per IP default: 1 @@ -305,13 +304,6 @@ BackupSystem: OnServerStop: true # Windows only mysql installation Path MysqlWindowsPath: 'C:\\Program Files\\MySQL\\MySQL Server 5.1\\' -Passpartu: - # Enable or Disable Passpartu Feature, - # this feature let Admin Login with all registered - # Account they need, for example inspecting Player that - # is doing shit, they can login without know any - # Player password! More info on How TO - enablePasspartu: false Security: SQLProblem: # Stop the server if we can't contact the sql database diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c0bd7fb4..5028d255 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -22,10 +22,7 @@ commands: usage: /logout unregister: description: unregister your account - usage: /unregister password - passpartu: - description: compare passpartu token - usage: /passpartu token + usage: /unregister password authme: description: AuthMe op commands usage: '/authme reload|register playername password|changepassword playername password|unregister playername|version' @@ -48,7 +45,6 @@ permissions: authme.changepassword: true authme.logout: true authme.unregister: true - authme.passpartu: true authme.l: true authme.reg: true authme.email: true @@ -87,9 +83,6 @@ permissions: authme.email: description: Email default: true - authme.passpartu: - description: passpartu - default: true authme.allow2accounts: description: allow more accounts for same ip default: false From a06f3de35a6a8874b44b6e9579c3b239a522aeda Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 14:49:14 +0200 Subject: [PATCH 034/427] Fixed autopurge with UUIDS --- src/main/java/fr/xephi/authme/AuthMe.java | 14 +++++++------- src/main/java/fr/xephi/authme/DataManager.java | 13 +++++++++++++ src/main/java/fr/xephi/authme/modules/Module.java | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index fc719c3f..f320e5b5 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -250,11 +250,11 @@ public class AuthMe extends JavaPlugin { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } - if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled){ + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); } - if (Settings.reloadSupport) + if (Settings.reloadSupport) { try { int playersOnline = 0; try { @@ -279,9 +279,9 @@ public class AuthMe extends JavaPlugin { } } catch (Exception ex) { } + } - if (Settings.usePurge) - autoPurge(); + autoPurge(); // Download GeoIp.dat file downloadGeoIp(); @@ -545,13 +545,13 @@ public class AuthMe extends JavaPlugin { return; ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); if (Settings.purgeEssentialsFile && this.ess != null) - dataManager.purgeEssentials(cleared); + dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions if (Settings.purgePlayerDat) - dataManager.purgeDat(cleared); + dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC if (Settings.purgeLimitedCreative) dataManager.purgeLimitedCreative(cleared); if (Settings.purgeAntiXray) - dataManager.purgeAntiXray(cleared); + dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) if (Settings.purgePermissions) dataManager.purgePermissions(cleared, permission); } diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 2bcfa17a..072d9741 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -109,6 +109,12 @@ public class DataManager { if (playerFile.exists()) { playerFile.delete(); i++; + } else { + playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); + if (playerFile.exists()) { + playerFile.delete(); + i++; + } } } catch (Exception e) { } @@ -116,6 +122,7 @@ public class DataManager { ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files"); } + @SuppressWarnings("deprecation") public void purgeEssentials(List cleared) { int i = 0; for (String name : cleared) { @@ -124,6 +131,12 @@ public class DataManager { if (playerFile.exists()) { playerFile.delete(); i++; + } else { + playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml"); + if (playerFile.exists()) { + playerFile.delete(); + i++; + } } } catch (Exception e) { } diff --git a/src/main/java/fr/xephi/authme/modules/Module.java b/src/main/java/fr/xephi/authme/modules/Module.java index 779beb65..6011097a 100644 --- a/src/main/java/fr/xephi/authme/modules/Module.java +++ b/src/main/java/fr/xephi/authme/modules/Module.java @@ -13,6 +13,7 @@ public interface Module { public enum ModuleType { MANAGER, MYSQL, + REDIS, ACTIONS, CONVERTERS, EMAILS, From f016d682c51b6796314c29e23b9db2b8240fab63 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 15:33:19 +0200 Subject: [PATCH 035/427] Updated to SpigotApi 1.8.8 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6e16eb03..bacc97b2 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.7 - 1.8.7-R0.1-SNAPSHOT + 1.8.8-R0.1-SNAPSHOT
    From b8a22409828db7b1c4e40cbefd966a675744a864 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 18:44:06 +0200 Subject: [PATCH 036/427] Add error message if unable to generate img --- .../java/fr/xephi/authme/SendMailSSL.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 40056e33..54d2068a 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -82,14 +82,18 @@ public class SendMailSSL { // Generate an image ? File file = null; if (Settings.generateImage) { - ImageGenerator gen = new ImageGenerator(newPass); - file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); - ImageIO.write(gen.generateImage(), "jpg", file); - messageBodyPart = new MimeBodyPart(); - DataSource source = new FileDataSource(file); - messageBodyPart.setDataHandler(new DataHandler(source)); - messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg"); - multipart.addBodyPart(messageBodyPart); + try { + ImageGenerator gen = new ImageGenerator(newPass); + file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); + ImageIO.write(gen.generateImage(), "jpg", file); + messageBodyPart = new MimeBodyPart(); + DataSource source = new FileDataSource(file); + messageBodyPart.setDataHandler(new DataHandler(source)); + messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg"); + multipart.addBodyPart(messageBodyPart); + } catch (Exception e) { + ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); + } } message.setContent(multipart); From 949ebc03bbdeaca53de3f50739a9fe8e565da595 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 21:48:59 +0200 Subject: [PATCH 037/427] Fixed mail API --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bacc97b2..316384fb 100644 --- a/pom.xml +++ b/pom.xml @@ -191,12 +191,13 @@ - javax.mail - javax.mail-api + com.sun.mail + javax.mail 1.5.4 compile + com.maxmind.geoip From 7bfab781a1ab401df24aae09bcc64175e2fb0e69 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Jul 2015 00:47:19 +0200 Subject: [PATCH 038/427] More error messages! --- .../java/fr/xephi/authme/SendMailSSL.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 54d2068a..d7681ade 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -95,16 +95,27 @@ public class SendMailSSL { ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); } } - - message.setContent(multipart); + Transport transport = session.getTransport("smtp"); - transport.connect(smtp, acc, password); + message.setContent(multipart); + + try { + transport.connect(smtp, acc, password); + } catch (Exception e) { + ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recorvery email to " + mail); + if (file != null) + file.delete(); + return; + } transport.sendMessage(message, message.getAllRecipients()); + if (file != null) file.delete(); + } catch (RuntimeException e) { + ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); } catch (Exception e) { - ConsoleLogger.showError("Some error occured while trying to send a mail to " + mail); + ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); } } From fc09fb3a5cdf7ffaad2aca7076d5ae9296a87025 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Jul 2015 23:54:19 +0200 Subject: [PATCH 039/427] Updated plugin.yml --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 2 +- .../java/fr/xephi/authme/process/join/AsyncronousJoin.java | 1 - src/main/resources/plugin.yml | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 7f7c19c6..85962179 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -543,7 +543,7 @@ public class AuthMePlayerListener implements Listener { event.allow(); return; } else { - ConsoleLogger.info("The player " + player.getName() + " wants to join, but the server is full"); + ConsoleLogger.info("The player " + player.getName() + " tryed to join, but the server was full"); event.setKickMessage(m.send("kick_fullserver")[0]); event.setResult(PlayerLoginEvent.Result.KICK_FULL); return; diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 2e72bde4..b184c4a6 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -64,7 +64,6 @@ public class AsyncronousJoin { if (plugin.ess != null && Settings.disableSocialSpy) { try { plugin.ess.getUser(player.getName().toLowerCase()).setSocialSpyEnabled(false); - } catch (Exception e) { } catch (NoSuchMethodError e) { } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5028d255..b52d5794 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,10 +1,10 @@ name: AuthMe author: Xephi59 website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ -description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player. +description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the player. main: fr.xephi.authme.AuthMe version: maven-version -softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn] +softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn] commands: register: description: Register an account @@ -166,4 +166,4 @@ permissions: default: op authme.canbeforced: description: Can this player be forced to login - default: true \ No newline at end of file + default: true From 8bd661848136620de93848633f8040dc53b1ab1e Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 00:14:39 +0200 Subject: [PATCH 040/427] Deprecate this --- src/main/java/fr/xephi/authme/api/API.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index 7d284aad..a5e8d190 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -30,6 +30,7 @@ public class API { * * @return AuthMe instance */ + @Deprecated public static AuthMe hookAuthMe() { if (instance != null) return instance; @@ -41,6 +42,7 @@ public class API { return instance; } + @Deprecated public AuthMe getPlugin() { return instance; } @@ -50,6 +52,7 @@ public class API { * @param player * @return true if player is authenticate */ + @Deprecated public static boolean isAuthenticated(Player player) { return PlayerCache.getInstance().isAuthenticated(player.getName()); } @@ -71,6 +74,7 @@ public class API { * @param player * @return true if player is a npc */ + @Deprecated public boolean isNPC(Player player) { if (instance.getCitizensCommunicator().isNPC(player)) return true; @@ -82,10 +86,12 @@ public class API { * @param player * @return true if the player is unrestricted */ + @Deprecated public static boolean isUnrestricted(Player player) { return Utils.getInstance().isUnrestricted(player); } + @Deprecated public static Location getLastLocation(Player player) { try { PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase()); @@ -102,6 +108,7 @@ public class API { } } + @Deprecated public static void setPlayerInventory(Player player, ItemStack[] content, ItemStack[] armor) { try { @@ -116,6 +123,7 @@ public class API { * @param playerName * @return true if player is registered */ + @Deprecated public static boolean isRegistered(String playerName) { String player = playerName.toLowerCase(); return instance.database.isAuthAvailable(player); @@ -126,6 +134,7 @@ public class API { * playerName, String passwordToCheck * @return true if the password is correct , false else */ + @Deprecated public static boolean checkPassword(String playerName, String passwordToCheck) { if (!isRegistered(playerName)) @@ -146,6 +155,7 @@ public class API { * playerName, String password * @return true if the player is register correctly */ + @Deprecated public static boolean registerPlayer(String playerName, String password) { try { String name = playerName.toLowerCase(); @@ -169,6 +179,7 @@ public class API { * @param Player * player */ + @Deprecated public static void forceLogin(Player player) { instance.management.performLogin(player, "dontneed", true); } From 9c42be39d881f3c1230a65ca67ce07543392f555 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 00:23:30 +0200 Subject: [PATCH 041/427] meta --- .../xephi/authme/cache/backup/FileCache.java | 181 ++++++++---------- 1 file changed, 83 insertions(+), 98 deletions(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index b18ad9c1..cdc5a239 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -22,9 +22,9 @@ import com.comphenix.attribute.Attributes.Operation; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; import fr.xephi.authme.api.API; import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.Utils; public class FileCache { @@ -217,108 +217,93 @@ public class FileCache { boolean op = false; boolean flying = false; - Scanner reader = null; - try { - reader = new Scanner(file); + Scanner reader = new Scanner(file); - int i = 0; - int a = 0; - while (reader.hasNextLine()) { - String line = reader.nextLine(); + int i = 0; + int a = 0; + while (reader.hasNextLine()) { + String line = reader.nextLine(); - if (!line.contains(":")) { - // the fist line represent the player group, - // operator - // status - // and flying status - final String[] playerInfo = line.split(";"); - group = playerInfo[0]; + if (!line.contains(":")) { + // the fist line represent the player group, + // operator + // status + // and flying status + final String[] playerInfo = line.split(";"); + group = playerInfo[0]; - if (Integer.parseInt(playerInfo[1]) == 1) { - op = true; - } else op = false; - if (playerInfo.length > 2) { - if (Integer.parseInt(playerInfo[2]) == 1) - flying = true; - else flying = false; - } - - continue; + if (Integer.parseInt(playerInfo[1]) == 1) { + op = true; + } else op = false; + if (playerInfo.length > 2) { + if (Integer.parseInt(playerInfo[2]) == 1) + flying = true; + else flying = false; } - if (!line.startsWith("i") && !line.startsWith("w")) { - continue; - } - String lores = ""; - String name = ""; - if (line.split("\\*").length > 1) { - lores = line.split("\\*")[1]; - line = line.split("\\*")[0]; - } - if (line.split(";").length > 1) { - name = line.split(";")[1]; - line = line.split(";")[0]; - } - final String[] in = line.split(":"); - // can enchant item? size ofstring in file - 4 all / 2 = - // number - // of enchant - if (in[0].equals("i")) { - stacki[i] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3]))); - if (in.length > 4 && !in[4].isEmpty()) { - for (int k = 4; k < in.length - 1; k++) { - stacki[i].addUnsafeEnchantment(Enchantment.getByName(in[k]), Integer.parseInt(in[k + 1])); - k++; - } - } - try { - ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(stacki[i].getType()); - if (!name.isEmpty()) { - meta.setDisplayName(name); - } - if (!lores.isEmpty()) { - List loreList = new ArrayList(); - for (String s : lores.split("%newline%")) { - loreList.add(s); - } - meta.setLore(loreList); - } - if (meta != null) - stacki[i].setItemMeta(meta); - } catch (Exception e) { - } - i++; - } else { - stacka[a] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3]))); - if (in.length > 4 && !in[4].isEmpty()) { - for (int k = 4; k < in.length - 1; k++) { - stacka[a].addUnsafeEnchantment(Enchantment.getByName(in[k]), Integer.parseInt(in[k + 1])); - k++; - } - } - try { - ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(stacka[a].getType()); - if (!name.isEmpty()) - meta.setDisplayName(name); - if (!lores.isEmpty()) { - List loreList = new ArrayList(); - for (String s : lores.split("%newline%")) { - loreList.add(s); - } - meta.setLore(loreList); - } - if (meta != null) - stacki[i].setItemMeta(meta); - } catch (Exception e) { - } - a++; - } + continue; } - } catch (final Exception e) { - ConsoleLogger.showError("Error on creating a file cache for " + player.getName() + ", maybe wipe inventory..."); - } finally { - if (reader != null) { - reader.close(); + + if (!line.startsWith("i") && !line.startsWith("w")) { + continue; + } + String lores = ""; + String name = ""; + if (line.split("\\*").length > 1) { + lores = line.split("\\*")[1]; + line = line.split("\\*")[0]; + } + if (line.split(";").length > 1) { + name = line.split(";")[1]; + line = line.split(";")[0]; + } + final String[] in = line.split(":"); + // can enchant item? size ofstring in file - 4 all / 2 = + // number + // of enchant + if (in[0].equals("i")) { + stacki[i] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3]))); + if (in.length > 4 && !in[4].isEmpty()) { + for (int k = 4; k < in.length - 1; k++) { + stacki[i].addUnsafeEnchantment(Enchantment.getByName(in[k]), Integer.parseInt(in[k + 1])); + k++; + } + } + ItemMeta meta = stacki[i].getItemMeta(); + if (!name.isEmpty()) { + meta.setDisplayName(name); + } + if (!lores.isEmpty()) { + List loreList = new ArrayList(); + for (String s : lores.split("%newline%")) { + loreList.add(s); + } + meta.setLore(loreList); + } + if (meta != null) + stacki[i].setItemMeta(meta); + i++; + } else { + stacka[a] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3]))); + if (in.length > 4 && !in[4].isEmpty()) { + for (int k = 4; k < in.length - 1; k++) { + stacka[a].addUnsafeEnchantment(Enchantment.getByName(in[k]), Integer.parseInt(in[k + 1])); + k++; + } + } + ItemMeta meta = stacka[a].getItemMeta(); + if (!name.isEmpty()) + meta.setDisplayName(name); + if (!lores.isEmpty()) { + List loreList = new ArrayList(); + for (String s : lores.split("%newline%")) { + loreList.add(s); + } + meta.setLore(loreList); + } + if (meta != null) + stacki[i].setItemMeta(meta); + a++; } } return new DataFileCache(stacki, stacka, group, op, flying); @@ -548,7 +533,7 @@ public class FileCache { file.delete(); } else { file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + player.getName().toLowerCase() + ".cache"); - if(file.isFile()){ + if (file.isFile()) { file.delete(); } else { ConsoleLogger.showError("Failed to remove" + player.getName() + "cache, it doesn't exist!"); From fa831700a2381097e7d301aa2a3684a66975a62e Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 01:11:34 +0200 Subject: [PATCH 042/427] Add bcrypt_2y for new phpbb system --- .../xephi/authme/security/HashAlgorithm.java | 1 + .../authme/security/PasswordSecurity.java | 7 +++++- .../authme/security/crypts/BCRYPT2Y.java | 24 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java diff --git a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java index 10793f5a..a9fd19e5 100644 --- a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java +++ b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java @@ -28,6 +28,7 @@ public enum HashAlgorithm { WORDPRESS(fr.xephi.authme.security.crypts.WORDPRESS.class), ROYALAUTH(fr.xephi.authme.security.crypts.ROYALAUTH.class), CRAZYCRYPT1(fr.xephi.authme.security.crypts.CRAZYCRYPT1.class), + BCRYPT2Y(fr.xephi.authme.security.crypts.BCRYPT2Y.class), CUSTOM(Null.class); Class classe; diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index 3800d8b0..bae32cf3 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -20,7 +20,8 @@ public class PasswordSecurity { private static SecureRandom rnd = new SecureRandom(); public static HashMap userSalt = new HashMap(); - public static String createSalt(int length) throws NoSuchAlgorithmException { + public static String createSalt(int length) + throws NoSuchAlgorithmException { byte[] msg = new byte[40]; rnd.nextBytes(msg); MessageDigest sha1 = MessageDigest.getInstance("SHA1"); @@ -94,6 +95,10 @@ public class PasswordSecurity { salt = createSalt(16); userSalt.put(playerName, salt); break; + case BCRYPT2Y: + salt = createSalt(22); + userSalt.put(playerName, salt); + break; case MD5: case SHA1: case WHIRLPOOL: diff --git a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java new file mode 100644 index 00000000..ad7eb62a --- /dev/null +++ b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java @@ -0,0 +1,24 @@ +package fr.xephi.authme.security.crypts; + +import java.security.NoSuchAlgorithmException; + +public class BCRYPT2Y implements EncryptionMethod { + + @Override + public String getHash(String password, String salt, String name) + throws NoSuchAlgorithmException { + if (salt.length() == 22) + salt = "$2y$10$" + salt; + return (BCRYPT.hashpw(password, salt)); + } + + @Override + public boolean comparePassword(String hash, String password, + String playerName) throws NoSuchAlgorithmException { + String ok = hash.substring(29); + if (ok.length() != 29) + return false; + return hash.equals(getHash(password, ok, playerName)); + } + +} From e889fb580a1b84011849886bc6b5532e240fc2f1 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 01:12:20 +0200 Subject: [PATCH 043/427] We don't need to old it, already done in the hash --- src/main/java/fr/xephi/authme/security/PasswordSecurity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index bae32cf3..bfc2fb2d 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -97,7 +97,6 @@ public class PasswordSecurity { break; case BCRYPT2Y: salt = createSalt(22); - userSalt.put(playerName, salt); break; case MD5: case SHA1: From 1cc131132309feb1247e142b4d5fc18e7453fd70 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 01:57:40 +0200 Subject: [PATCH 044/427] little fix to lowercase issue --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 2 +- src/main/java/fr/xephi/authme/datasource/SQLite.java | 2 +- src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 8a93aa89..4f4f96b5 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -162,7 +162,7 @@ public class MySQL implements DataSource { rs.close(); rs = con.getMetaData().getColumns(null, null, tableName, columnRealName); if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) DEFAULT 'Player' AFTER " + columnLogged + ";"); + st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) NOT NULL DEFAULT 'Player' AFTER " + columnLogged + ";"); } } finally { close(rs); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 7bac1491..27d668e7 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -130,7 +130,7 @@ public class SQLite implements DataSource { rs.close(); rs = con.getMetaData().getColumns(null, null, tableName, columnRealName); if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) DEFAULT 'Player';"); + st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) NOT NULL DEFAULT 'Player';"); } } finally { close(rs); diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 2e72bde4..e6f259bd 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -102,7 +102,7 @@ public class AsyncronousJoin { final Location spawnLoc = plugin.getSpawnLocation(player); if (database.isAuthAvailable(name)) { PlayerAuth auth = database.getAuth(name); - if (!auth.getRealName().equals("Player") && !auth.getRealName().equals(player.getName())) { + if (auth.getRealName() != null && !auth.getRealName().equals("Player") && !auth.getRealName().equals(player.getName())) { final GameMode gM = AuthMePlayerListener.gameMode.get(name); sched.scheduleSyncDelayedTask(plugin, new Runnable() { From f1e17b0bd58b41186f0161f27647a68b9a1da441 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 02:11:29 +0200 Subject: [PATCH 045/427] Update Dependency --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 316384fb..97d39eb4 100644 --- a/pom.xml +++ b/pom.xml @@ -81,7 +81,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.3 + 2.4.1 @@ -202,7 +202,7 @@ com.maxmind.geoip geoip-api - 1.2.14 + 1.2.15 compile From e2af78432a295476397288617498a64c28919405 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Fri, 31 Jul 2015 02:12:44 +0200 Subject: [PATCH 046/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12216e73..871d5442 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - Developers ChatRoom: [![Join the chat at https://gitter.im/Xephi/AuthMeReloaded](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Xephi/AuthMeReloaded?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -- Build status (Travis): [![Build Status](https://travis-ci.org/Xephi/AuthMeReloaded.svg?branch=master)](https://travis-ci.org/Xephi/AuthMeReloaded) +- Build status: [![Build Status](https://travis-ci.org/Xephi/AuthMeReloaded.svg?branch=master)](https://travis-ci.org/Xephi/AuthMeReloaded) [![Dependency Status](https://www.versioneye.com/user/projects/55bab9e8653762002000190a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55bab9e8653762002000190a) - Build status (CircleCI): [CircleCI project Page](https://circleci.com/gh/xephi/AuthMeReloaded) From 28e56cc33e5f3908f665713f54bc418f486854e7 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Fri, 31 Jul 2015 02:15:09 +0200 Subject: [PATCH 047/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 871d5442..b0dfe3f6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ - Build status: [![Build Status](https://travis-ci.org/Xephi/AuthMeReloaded.svg?branch=master)](https://travis-ci.org/Xephi/AuthMeReloaded) [![Dependency Status](https://www.versioneye.com/user/projects/55bab9e8653762002000190a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55bab9e8653762002000190a) -- Build status (CircleCI): [CircleCI project Page](https://circleci.com/gh/xephi/AuthMeReloaded) +- Build status (CircleCI): [![Circle CI](https://circleci.com/gh/Xephi/AuthMeReloaded.svg?style=svg)](https://circleci.com/gh/Xephi/AuthMeReloaded) - Build Server (DEVELOPMENT BUILDS): Xephi's Jenkins From d650f1c3d5dfa106344b54bf3609a7d702e64142 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 31 Jul 2015 02:16:51 +0200 Subject: [PATCH 048/427] Update team --- team.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/team.txt b/team.txt index 21b9cdb4..072c674c 100644 --- a/team.txt +++ b/team.txt @@ -2,7 +2,8 @@ AuthMe-Team: Xephi (Xephi59) - Leader, Main developer darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author -Kloudy - Main developer +Kloudy - Developer +Gnat008 - Developer Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor Trojaner25 - Ticket manager, Basic Developer From fdc85865565b52a901024f07f1dc742823f40820 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 31 Jul 2015 03:04:13 +0200 Subject: [PATCH 049/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0dfe3f6..3e8242a8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - Build status (CircleCI): [![Circle CI](https://circleci.com/gh/Xephi/AuthMeReloaded.svg?style=svg)](https://circleci.com/gh/Xephi/AuthMeReloaded) -- Build Server (DEVELOPMENT BUILDS): Xephi's Jenkins +- Build Server (DEVELOPMENT BUILDS): Xephi's Jenkins - JavaDocs: AuthMe Javadoc From a0e2d900c7a9733a5af8576996c3339bb4e704b5 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 31 Jul 2015 03:23:01 +0200 Subject: [PATCH 050/427] Update pom.xml --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 97d39eb4..7097a679 100644 --- a/pom.xml +++ b/pom.xml @@ -108,6 +108,11 @@ + + com.versioneye + versioneye-maven-plugin + 3.5.1 + From dc2081d5816ee30cbb1c1b953e0191fd60bbfd10 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 31 Jul 2015 03:30:42 +0200 Subject: [PATCH 051/427] Update pom.xml --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index 7097a679..b4301232 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,10 @@ com.versioneye versioneye-maven-plugin 3.5.1 + + 544d0ff9512592562c000003 + > + From d49b3093012d94b66cb5f44a82f3f0b3c4aa5ab6 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 03:31:17 +0200 Subject: [PATCH 052/427] Change the MySQL Connection Pool to HikariCP, so fast ! --- pom.xml | 24 +- src/main/java/fr/xephi/authme/AuthMe.java | 14 +- .../datasource/MiniConnectionPoolManager.java | 427 ------------------ .../fr/xephi/authme/datasource/MySQL.java | 133 ++---- .../fr/xephi/authme/datasource/SQLite.java | 34 -- 5 files changed, 65 insertions(+), 567 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/datasource/MiniConnectionPoolManager.java diff --git a/pom.xml b/pom.xml index 97d39eb4..addea73d 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,8 @@ com.sun.mail:* com.comphenix.attribute:* org.mcstats.*:* + com.zaxxer:* + org.slf4j:* @@ -175,11 +177,27 @@ - mysql - mysql-connector-java - 5.1.36 + org.slf4j + slf4j-simple + 1.7.12 compile + + com.zaxxer + HikariCP + 2.4.0 + compile + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index f320e5b5..99cea4a0 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -249,9 +249,9 @@ public class AuthMe extends JavaPlugin { if (!Settings.isForceSingleSessionEnabled) { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } - + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { - ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); } if (Settings.reloadSupport) { @@ -545,13 +545,17 @@ public class AuthMe extends JavaPlugin { return; ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); if (Settings.purgeEssentialsFile && this.ess != null) - dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions + dataManager.purgeEssentials(cleared); // name to UUID convertion + // needed with latest versions if (Settings.purgePlayerDat) - dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC + dataManager.purgeDat(cleared); // name to UUID convertion needed + // with latest versions of MC if (Settings.purgeLimitedCreative) dataManager.purgeLimitedCreative(cleared); if (Settings.purgeAntiXray) - dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) + dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or + // names... (Actually it purges + // only names!) if (Settings.purgePermissions) dataManager.purgePermissions(cleared, permission); } diff --git a/src/main/java/fr/xephi/authme/datasource/MiniConnectionPoolManager.java b/src/main/java/fr/xephi/authme/datasource/MiniConnectionPoolManager.java deleted file mode 100644 index 5a557f19..00000000 --- a/src/main/java/fr/xephi/authme/datasource/MiniConnectionPoolManager.java +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright 2007-2013 Christian d'Heureuse, Inventec Informatik AG, Zurich, -// Switzerland -// www.source-code.biz, www.inventec.ch/chdh -// -// This module is multi-licensed and may be used under the terms -// of any of the following licenses: -// -// EPL, Eclipse Public License, http://www.eclipse.org/legal -// LGPL, GNU Lesser General Public License, -// http://www.gnu.org/licenses/lgpl.html -// MPL, Mozilla Public License 1.1, http://www.mozilla.org/MPL -// -// Please contact the author if you need another license. -// This module is provided "as is", without warranties of any kind. - -package fr.xephi.authme.datasource; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.concurrent.Semaphore; -import java.util.concurrent.TimeUnit; -import java.util.LinkedList; -import javax.sql.ConnectionEvent; -import javax.sql.ConnectionEventListener; -import javax.sql.ConnectionPoolDataSource; -import javax.sql.PooledConnection; - -/** - * A lightweight standalone JDBC connection pool manager. - * - *

    - * The public methods of this class are thread-safe. - * - *

    - * Home page: www. - * source-code.biz/miniconnectionpoolmanager
    - * Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
    - * Multi-licensed: EPL / LGPL / MPL. - */ -public class MiniConnectionPoolManager { - - private ConnectionPoolDataSource dataSource; - private int maxConnections; - private long timeoutMs; - private PrintWriter logWriter; - private Semaphore semaphore; - private PoolConnectionEventListener poolConnectionEventListener; - - // The following variables must only be accessed within synchronized blocks. - // @GuardedBy("this") could by used in the future. - private LinkedList recycledConnections; // list of - // inactive - // PooledConnections - private int activeConnections; // number of active (open) connections of - // this pool - private boolean isDisposed; // true if this connection pool has been - // disposed - private boolean doPurgeConnection; // flag to purge the connection currently - // beeing closed instead of recycling it - private PooledConnection connectionInTransition; // a PooledConnection which - // is currently within a - // PooledConnection.getConnection() - // call, or null - - /** - * Thrown in {@link #getConnection()} or {@link #getValidConnection()} when - * no free connection becomes available within timeout seconds. - */ - public static class TimeoutException extends RuntimeException { - - private static final long serialVersionUID = 1; - - public TimeoutException() { - super("Timeout while waiting for a free database connection."); - } - - public TimeoutException(String msg) { - super(msg); - } - } - - /** - * Constructs a MiniConnectionPoolManager object with a timeout of 60 - * seconds. - * - * @param dataSource - * the data source for the connections. - * @param maxConnections - * the maximum number of connections. - */ - public MiniConnectionPoolManager(ConnectionPoolDataSource dataSource, - int maxConnections) { - this(dataSource, maxConnections, 60); - } - - /** - * Constructs a MiniConnectionPoolManager object. - * - * @param dataSource - * the data source for the connections. - * @param maxConnections - * the maximum number of connections. - * @param timeout - * the maximum time in seconds to wait for a free connection. - */ - public MiniConnectionPoolManager(ConnectionPoolDataSource dataSource, - int maxConnections, int timeout) { - this.dataSource = dataSource; - this.maxConnections = maxConnections; - this.timeoutMs = timeout * 1000L; - try { - logWriter = dataSource.getLogWriter(); - } catch (SQLException e) { - } - if (maxConnections < 1) { - throw new IllegalArgumentException("Invalid maxConnections value."); - } - semaphore = new Semaphore(maxConnections, true); - recycledConnections = new LinkedList(); - poolConnectionEventListener = new PoolConnectionEventListener(); - } - - /** - * Closes all unused pooled connections. - */ - public synchronized void dispose() throws SQLException { - if (isDisposed) { - return; - } - isDisposed = true; - SQLException e = null; - while (!recycledConnections.isEmpty()) { - PooledConnection pconn = recycledConnections.remove(); - try { - pconn.close(); - } catch (SQLException e2) { - if (e == null) { - e = e2; - } - } - } - if (e != null) { - throw e; - } - } - - /** - * Retrieves a connection from the connection pool. - * - *

    - * If maxConnections connections are already in use, the method - * waits until a connection becomes available or timeout - * seconds elapsed. When the application is finished using the connection, - * it must close it in order to return it to the pool. - * - * @return a new Connection object. - * @throws TimeoutException - * when no connection becomes available within - * timeout seconds. - */ - public Connection getConnection() throws SQLException { - return getConnection2(timeoutMs); - } - - private Connection getConnection2(long timeoutMs) throws SQLException { - // This routine is unsynchronized, because semaphore.tryAcquire() may - // block. - synchronized (this) { - if (isDisposed) { - throw new IllegalStateException("Connection pool has been disposed."); - } - } - try { - if (!semaphore.tryAcquire(timeoutMs, TimeUnit.MILLISECONDS)) { - throw new TimeoutException(); - } - } catch (InterruptedException e) { - throw new RuntimeException("Interrupted while waiting for a database connection.", e); - } - boolean ok = false; - try { - Connection conn = getConnection3(); - ok = true; - return conn; - } finally { - if (!ok) { - semaphore.release(); - } - } - } - - private synchronized Connection getConnection3() throws SQLException { - if (isDisposed) { - throw new IllegalStateException("Connection pool has been disposed."); - } - PooledConnection pconn; - if (!recycledConnections.isEmpty()) { - pconn = recycledConnections.remove(); - } else { - pconn = dataSource.getPooledConnection(); - pconn.addConnectionEventListener(poolConnectionEventListener); - } - Connection conn; - try { - // The JDBC driver may call - // ConnectionEventListener.connectionErrorOccurred() - // from within PooledConnection.getConnection(). To detect this - // within - // disposeConnection(), we temporarily set connectionInTransition. - connectionInTransition = pconn; - activeConnections++; - conn = pconn.getConnection(); - } finally { - connectionInTransition = null; - } - assertInnerState(); - return conn; - } - - /** - * Retrieves a connection from the connection pool and ensures that it is - * valid by calling {@link Connection#isValid(int)}. - * - *

    - * If a connection is not valid, the method tries to get another connection - * until one is valid (or a timeout occurs). - * - *

    - * Pooled connections may become invalid when e.g. the database server is - * restarted. - * - *

    - * This method is slower than {@link #getConnection()} because the JDBC - * driver has to send an extra command to the database server to test the - * connection. - * - *

    - * This method requires Java 1.6 or newer. - * - * @throws TimeoutException - * when no valid connection becomes available within - * timeout seconds. - */ - public Connection getValidConnection() { - long time = System.currentTimeMillis(); - long timeoutTime = time + timeoutMs; - int triesWithoutDelay = getInactiveConnections() + 1; - while (true) { - Connection conn = getValidConnection2(time, timeoutTime); - if (conn != null) { - return conn; - } - triesWithoutDelay--; - if (triesWithoutDelay <= 0) { - triesWithoutDelay = 0; - try { - Thread.sleep(250); - } catch (InterruptedException e) { - throw new RuntimeException("Interrupted while waiting for a valid database connection.", e); - } - } - time = System.currentTimeMillis(); - if (time >= timeoutTime) { - throw new TimeoutException("Timeout while waiting for a valid database connection."); - } - } - } - - private Connection getValidConnection2(long time, long timeoutTime) { - long rtime = Math.max(1, timeoutTime - time); - Connection conn; - try { - conn = getConnection2(rtime); - } catch (SQLException e) { - return null; - } - rtime = timeoutTime - System.currentTimeMillis(); - int rtimeSecs = Math.max(1, (int) ((rtime + 999) / 1000)); - try { - if (conn.isValid(rtimeSecs)) { - return conn; - } - } catch (SQLException e) { - } - // This Exception should never occur. If it nevertheless occurs, it's - // because of an error in the - // JDBC driver which we ignore and assume that the connection is not - // valid. - // When isValid() returns false, the JDBC driver should have already - // called connectionErrorOccurred() - // and the PooledConnection has been removed from the pool, i.e. the - // PooledConnection will - // not be added to recycledConnections when Connection.close() is - // called. - // But to be sure that this works even with a faulty JDBC driver, we - // call purgeConnection(). - purgeConnection(conn); - return null; - } - - // Purges the PooledConnection associated with the passed Connection from - // the connection pool. - private synchronized void purgeConnection(Connection conn) { - try { - doPurgeConnection = true; - // (A potential problem of this program logic is that setting the - // doPurgeConnection flag - // has an effect only if the JDBC driver calls connectionClosed() - // synchronously within - // Connection.close().) - conn.close(); - } catch (SQLException e) { - } - // ignore exception from close() - finally { - doPurgeConnection = false; - } - } - - private synchronized void recycleConnection(PooledConnection pconn) { - if (isDisposed || doPurgeConnection) { - disposeConnection(pconn); - return; - } - if (activeConnections <= 0) { - throw new AssertionError("AuthMeDatabaseError"); - } - activeConnections--; - semaphore.release(); - recycledConnections.add(pconn); - assertInnerState(); - } - - private synchronized void disposeConnection(PooledConnection pconn) { - pconn.removeConnectionEventListener(poolConnectionEventListener); - if (!recycledConnections.remove(pconn) && pconn != connectionInTransition) { - // If the PooledConnection is not in the recycledConnections list - // and is not currently within a PooledConnection.getConnection() - // call, - // we assume that the connection was active. - if (activeConnections <= 0) { - throw new AssertionError("AuthMeDatabaseError"); - } - activeConnections--; - semaphore.release(); - } - closeConnectionAndIgnoreException(pconn); - assertInnerState(); - } - - private void closeConnectionAndIgnoreException(PooledConnection pconn) { - try { - pconn.close(); - } catch (SQLException e) { - log("Error while closing database connection: " + e.toString()); - } - } - - private void log(String msg) { - String s = "MiniConnectionPoolManager: " + msg; - try { - if (logWriter == null) { - System.err.println(s); - } else { - logWriter.println(s); - } - } catch (Exception e) { - } - } - - private synchronized void assertInnerState() { - if (activeConnections < 0) { - throw new AssertionError("AuthMeDatabaseError"); - } - if (activeConnections + recycledConnections.size() > maxConnections) { - throw new AssertionError("AuthMeDatabaseError"); - } - if (activeConnections + semaphore.availablePermits() > maxConnections) { - throw new AssertionError("AuthMeDatabaseError"); - } - } - - private class PoolConnectionEventListener implements - ConnectionEventListener { - - public void connectionClosed(ConnectionEvent event) { - PooledConnection pconn = (PooledConnection) event.getSource(); - recycleConnection(pconn); - } - - public void connectionErrorOccurred(ConnectionEvent event) { - PooledConnection pconn = (PooledConnection) event.getSource(); - disposeConnection(pconn); - } - } - - /** - * Returns the number of active (open) connections of this pool. - * - *

    - * This is the number of Connection objects that have been - * issued by {@link #getConnection()}, for which - * Connection.close() has not yet been called. - * - * @return the number of active connections. - **/ - public synchronized int getActiveConnections() { - return activeConnections; - } - - /** - * Returns the number of inactive (unused) connections in this pool. - * - *

    - * This is the number of internally kept recycled connections, for which - * Connection.close() has been called and which have not yet - * been reused. - * - * @return the number of inactive connections. - **/ - public synchronized int getInactiveConnections() { - return recycledConnections.size(); - } - -} // end class MiniConnectionPoolManager diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 4f4f96b5..b637259e 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -8,13 +8,14 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeoutException; -import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.Settings; @@ -40,7 +41,7 @@ public class MySQL implements DataSource { private String columnID; private String columnLogged; private List columnOthers; - private MiniConnectionPoolManager conPool; + private HikariDataSource ds; private String columnRealName; public MySQL() { @@ -100,15 +101,14 @@ public class MySQL implements DataSource { private synchronized void connect() throws ClassNotFoundException, SQLException, TimeoutException, NumberFormatException { - Class.forName("com.mysql.jdbc.Driver"); - ConsoleLogger.info("MySQL driver loaded"); - MysqlConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource(); - dataSource.setDatabaseName(database); - dataSource.setServerName(host); - dataSource.setPort(Integer.parseInt(port)); - dataSource.setUser(username); - dataSource.setPassword(password); - conPool = new MiniConnectionPoolManager(dataSource, 10); + HikariConfig config = new HikariConfig(); + config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); + config.setUsername(this.username); + config.setPassword(this.password); + config.addDataSourceProperty("cachePrepStmts", "true"); + config.addDataSourceProperty("prepStmtCacheSize", "250"); + config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + ds = new HikariDataSource(config); ConsoleLogger.info("Connection pool ready"); } @@ -185,9 +185,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(rs); close(pst); @@ -238,9 +235,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return null; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return null; } finally { close(rs); close(pst); @@ -451,9 +445,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(pst); close(con); @@ -499,9 +490,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(pst); close(con); @@ -523,9 +511,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(pst); close(con); @@ -545,9 +530,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return 0; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return 0; } finally { close(pst); close(con); @@ -576,9 +558,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); } finally { close(rs); close(pst); @@ -615,9 +594,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(pst); close(con); @@ -641,9 +617,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(pst); close(con); @@ -669,9 +642,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return 0; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return 0; } finally { close(rs); close(pst); @@ -692,9 +662,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(pst); close(con); @@ -718,9 +685,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(pst); close(con); @@ -730,11 +694,8 @@ public class MySQL implements DataSource { @Override public synchronized void close() { - try { - conPool.dispose(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } + if (ds != null) + ds.close(); } @Override @@ -800,9 +761,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); } finally { close(rs); close(pst); @@ -828,9 +786,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); } finally { close(rs); close(pst); @@ -856,9 +811,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); } finally { close(rs); close(pst); @@ -888,7 +840,7 @@ public class MySQL implements DataSource { private synchronized Connection makeSureConnectionIsReady() { Connection con = null; try { - con = conPool.getValidConnection(); + con = ds.getConnection(); } catch (Exception te) { try { con = null; @@ -920,22 +872,31 @@ public class MySQL implements DataSource { AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); } } - if (con == null) - con = conPool.getValidConnection(); + while (con == null) + try { + con = ds.getConnection(); + } catch (SQLException e) { + try { + reconnect(false); + con = ds.getConnection(); + } catch (Exception ex) { + } + } return con; } private synchronized void reconnect(boolean reload) throws ClassNotFoundException, SQLException, TimeoutException { - conPool.dispose(); - Class.forName("com.mysql.jdbc.Driver"); - MysqlConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource(); - dataSource.setDatabaseName(database); - dataSource.setServerName(host); - dataSource.setPort(Integer.parseInt(port)); - dataSource.setUser(username); - dataSource.setPassword(password); - conPool = new MiniConnectionPoolManager(dataSource, 10); + if (ds != null) + ds.close(); + HikariConfig config = new HikariConfig(); + config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); + config.setUsername(this.username); + config.setPassword(this.password); + config.addDataSourceProperty("cachePrepStmts", "true"); + config.addDataSourceProperty("prepStmtCacheSize", "250"); + config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + ds = new HikariDataSource(config); if (!reload) ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!"); } @@ -960,9 +921,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(rs); close(pst); @@ -984,9 +942,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); @@ -1008,9 +963,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); @@ -1031,9 +983,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); @@ -1057,9 +1006,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return result; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return result; } finally { close(pst); close(con); @@ -1080,9 +1026,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); @@ -1133,9 +1076,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return auths; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return auths; } finally { close(pst); close(con); @@ -1187,9 +1127,6 @@ public class MySQL implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return auths; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return auths; } finally { close(pst); close(rs); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 27d668e7..a465ddd7 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -12,7 +12,6 @@ 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.datasource.MiniConnectionPoolManager.TimeoutException; import fr.xephi.authme.settings.Settings; public class SQLite implements DataSource { @@ -436,9 +435,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); } catch (NullPointerException npe) { return new ArrayList(); } finally { @@ -463,9 +459,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); } catch (NullPointerException npe) { return new ArrayList(); } finally { @@ -490,9 +483,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); } catch (NullPointerException npe) { return new ArrayList(); } finally { @@ -535,9 +525,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; } finally { close(rs); close(pst); @@ -556,9 +543,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } @@ -577,9 +561,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } @@ -597,9 +578,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } @@ -620,9 +598,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return result; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return result; } finally { close(pst); } @@ -640,9 +615,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } @@ -674,9 +646,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return auths; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return auths; } finally { close(pst); } @@ -708,9 +677,6 @@ public class SQLite implements DataSource { } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return auths; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return auths; } finally { close(pst); } From ecdfc27a7e1800ff8bde9ef7e482bac9ea243efe Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 31 Jul 2015 03:31:20 +0200 Subject: [PATCH 053/427] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b4301232..05365d10 100644 --- a/pom.xml +++ b/pom.xml @@ -113,7 +113,7 @@ versioneye-maven-plugin 3.5.1 - 544d0ff9512592562c000003 + 55bab9e8653762002000190a > From 6b53afa731f0c248d021e24e1d548481a554eb9f Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 14:07:14 +0200 Subject: [PATCH 054/427] Add failfast and reconnexion --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index b637259e..7ae8b6d5 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -108,6 +108,8 @@ public class MySQL implements DataSource { config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + config.addDataSourceProperty("autoReconnect", true); + config.addDataSourceProperty("initializationFailFast", true); ds = new HikariDataSource(config); ConsoleLogger.info("Connection pool ready"); } @@ -896,6 +898,8 @@ public class MySQL implements DataSource { config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + config.addDataSourceProperty("autoReconnect", true); + config.addDataSourceProperty("initializationFailFast", true); ds = new HikariDataSource(config); if (!reload) ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!"); From 8b9f0ec88254107b10cb57bb2fc5939516921985 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 14:22:07 +0200 Subject: [PATCH 055/427] Custom name to pool --- src/main/java/fr/xephi/authme/AuthMe.java | 9 +++++---- src/main/java/fr/xephi/authme/datasource/MySQL.java | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 99cea4a0..98f335d4 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -166,10 +166,11 @@ public class AuthMe extends JavaPlugin { // Set Console Filter if (Settings.removePassword) { - this.getLogger().setFilter(new ConsoleFilter()); - Bukkit.getLogger().setFilter(new ConsoleFilter()); - Logger.getLogger("Minecraft").setFilter(new ConsoleFilter()); - authmeLogger.setFilter(new ConsoleFilter()); + ConsoleFilter filter = new ConsoleFilter(); + this.getLogger().setFilter(filter); + Bukkit.getLogger().setFilter(filter); + Logger.getLogger("Minecraft").setFilter(filter); + authmeLogger.setFilter(filter); // Set Log4J Filter try { Class.forName("org.apache.logging.log4j.core.Filter"); diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 7ae8b6d5..43433be9 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -105,6 +105,7 @@ public class MySQL implements DataSource { config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); + config.setPoolName("AuthMeMYSQLPool"); config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); @@ -900,6 +901,7 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); config.addDataSourceProperty("initializationFailFast", true); + config.setPoolName("AuthMeMYSQLPool"); ds = new HikariDataSource(config); if (!reload) ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!"); From 84a1227afdc567fcb2283dc28cd798b2fd90f8a1 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 14:32:28 +0200 Subject: [PATCH 056/427] Handle misconnection --- .../java/fr/xephi/authme/datasource/MySQL.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 43433be9..e18ef5bc 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -12,6 +12,7 @@ import java.util.concurrent.TimeoutException; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; +import com.zaxxer.hikari.pool.PoolInitializationException; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; @@ -96,11 +97,21 @@ public class MySQL implements DataSource { if (!Settings.isStopEnabled) AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); return; + } catch (PoolInitializationException e) { + ConsoleLogger.showError(e.getMessage()); + if (Settings.isStopEnabled) { + ConsoleLogger.showError("Can't use MySQL... Please input correct MySQL informations ! SHUTDOWN..."); + AuthMe.getInstance().getServer().shutdown(); + } + if (!Settings.isStopEnabled) + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + return; } } - private synchronized void connect() throws ClassNotFoundException, - SQLException, TimeoutException, NumberFormatException { + private synchronized void connect() + throws ClassNotFoundException, SQLException, TimeoutException, + NumberFormatException, PoolInitializationException { HikariConfig config = new HikariConfig(); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); @@ -889,7 +900,8 @@ public class MySQL implements DataSource { } private synchronized void reconnect(boolean reload) - throws ClassNotFoundException, SQLException, TimeoutException { + throws ClassNotFoundException, SQLException, TimeoutException, + PoolInitializationException { if (ds != null) ds.close(); HikariConfig config = new HikariConfig(); From 4ecbd7b5260206fc0735976a5977b4cc88c5b565 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 14:39:49 +0200 Subject: [PATCH 057/427] Try this way to fix quitloc --- .../authme/process/quit/AsyncronousQuit.java | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index e60d9719..82ff826b 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -46,16 +46,13 @@ public class AsyncronousQuit { return; } - Location loc = player.getLocation(); String ip = plugin.getIP(player); if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) { if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) { - final PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName()); - try { - database.updateQuitLoc(auth); - } catch (NullPointerException npe) { - } + Location loc = player.getLocation(); + PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName()); + database.updateQuitLoc(auth); } PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis(), player.getName()); database.updateSession(auth); @@ -78,19 +75,19 @@ public class AsyncronousQuit { LimboCache.getInstance().deleteLimboPlayer(name); } if (Settings.isSessionsEnabled && !isKick) { - if (Settings.getSessionTimeout != 0){ - BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - PlayerCache.getInstance().removePlayer(name); - if (database.isLogged(name)) - database.setUnlogged(name); - plugin.sessions.remove(name); - } - - }, Settings.getSessionTimeout * 20 * 60); - plugin.sessions.put(name, task); + if (Settings.getSessionTimeout != 0) { + BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + PlayerCache.getInstance().removePlayer(name); + if (database.isLogged(name)) + database.setUnlogged(name); + plugin.sessions.remove(name); + } + + }, Settings.getSessionTimeout * 20 * 60); + plugin.sessions.put(name, task); } } else { PlayerCache.getInstance().removePlayer(name); From 5ed134b172701fa1da748e1dddb55066e34c0436 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 31 Jul 2015 14:55:47 +0200 Subject: [PATCH 058/427] Fix SaveQuitLoc, idk why spigot handle quit player as dead player --- src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 82ff826b..585ab6fa 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -48,7 +48,7 @@ public class AsyncronousQuit { String ip = plugin.getIP(player); - if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) { + if (PlayerCache.getInstance().isAuthenticated(name)) { if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) { Location loc = player.getLocation(); PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName()); From 945b24990a92be13d4a3f1595d6164e5eeb071b7 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 31 Jul 2015 16:26:54 +0200 Subject: [PATCH 059/427] fixed cp property --- 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 e18ef5bc..135d544f 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -121,7 +121,7 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); - config.addDataSourceProperty("initializationFailFast", true); + config.setInitializationFailFast(false); ds = new HikariDataSource(config); ConsoleLogger.info("Connection pool ready"); } @@ -912,7 +912,7 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); - config.addDataSourceProperty("initializationFailFast", true); + config.setInitializationFailFast(false); config.setPoolName("AuthMeMYSQLPool"); ds = new HikariDataSource(config); if (!reload) From 72f0f65beda46144dc15f6353dad5f0c7912a7dc Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 1 Aug 2015 01:05:05 +0200 Subject: [PATCH 060/427] added perworlditems check --- src/main/java/fr/xephi/authme/AuthMe.java | 32 ++++++++++++++++--- .../authme/listener/AuthMeServerListener.java | 4 +-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 98f335d4..7ed3dd9f 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -187,14 +187,17 @@ public class AuthMe extends JavaPlugin { mail = new SendMailSSL(this); // Check Citizens Version - citizensVersion(); + checkCitizens(); // Check Combat Tag Version - combatTag(); + checkCombatTag(); // Check Multiverse checkMultiverse(); + // Check PerWorldInventories Version + checkPerWorldInventories(); + // Check ChestShop checkChestShop(); @@ -354,6 +357,27 @@ public class AuthMe extends JavaPlugin { } } + public void checkPerWorldInventories() { + if (this.getServer().getPluginManager().getPlugin("PerWorldInventories") != null && this.getServer().getPluginManager().getPlugin("PerWorldInventories").isEnabled()) { + try { + String ver = Bukkit.getServer().getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); + try { + double version = Double.valueOf(ver.split(" ")[0]); + if (version < 1.57) + ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + } catch (NumberFormatException nfe) { + try { + double version = Double.valueOf(ver.split("t")[0]); + if (version < 1.57) + ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + } catch (NumberFormatException nfee) { + } + } + } catch (Exception e) { + } + } + } + public void checkMultiverse() { if (!Settings.multiverse) { multiverse = null; @@ -403,7 +427,7 @@ public class AuthMe extends JavaPlugin { } } - public void combatTag() { + public void checkCombatTag() { if (this.getServer().getPluginManager().getPlugin("CombatTag") != null && this.getServer().getPluginManager().getPlugin("CombatTag").isEnabled()) { this.CombatTag = true; } else { @@ -411,7 +435,7 @@ public class AuthMe extends JavaPlugin { } } - public void citizensVersion() { + public void checkCitizens() { if (this.getServer().getPluginManager().getPlugin("Citizens") != null && this.getServer().getPluginManager().getPlugin("Citizens").isEnabled()) this.isCitizensActive = true; else this.isCitizensActive = false; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index f05710e7..4f0b2ed5 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -84,9 +84,9 @@ public class AuthMeServerListener implements Listener { if (pluginName.equalsIgnoreCase("ChestShop")) plugin.checkChestShop(); if (pluginName.equalsIgnoreCase("CombatTag")) - plugin.combatTag(); + plugin.checkCombatTag(); if (pluginName.equalsIgnoreCase("Citizens")) - plugin.citizensVersion(); + plugin.checkCitizens(); if (pluginName.equalsIgnoreCase("Vault")) plugin.checkVault(); } From 62e3bc4f113c92a027a51928843543a6fe85f0e0 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 1 Aug 2015 01:06:42 +0200 Subject: [PATCH 061/427] Fixed non closed reader --- src/main/java/fr/xephi/authme/cache/backup/FileCache.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index cdc5a239..6c4e4be7 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -306,6 +306,8 @@ public class FileCache { a++; } } + if (reader != null) + reader.close(); return new DataFileCache(stacki, stacka, group, op, flying); } else { // NEW METHOD From 30564fad6e3e93c36ca165b0a901021a76ba1609 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 1 Aug 2015 02:57:25 +0200 Subject: [PATCH 062/427] nice fail --- src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java index ad7eb62a..2c1ae57a 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java +++ b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT2Y.java @@ -15,7 +15,7 @@ public class BCRYPT2Y implements EncryptionMethod { @Override public boolean comparePassword(String hash, String password, String playerName) throws NoSuchAlgorithmException { - String ok = hash.substring(29); + String ok = hash.substring(0, 29); if (ok.length() != 29) return false; return hash.equals(getHash(password, ok, playerName)); From 0c201019475deedf6009a059efc45199f6026533 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 1 Aug 2015 03:03:54 +0200 Subject: [PATCH 063/427] Bcrypt only support $2a previously --- src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java index 5cfa87f0..847e9951 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java +++ b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java @@ -395,7 +395,7 @@ public class BCRYPT implements EncryptionMethod { off = 3; else { minor = salt.charAt(2); - if (minor != 'a' || salt.charAt(3) != '$') + if (minor < 'a' || minor > 'z' || salt.charAt(3) != '$') throw new IllegalArgumentException("Invalid salt revision"); off = 4; } From 718591782298f0dd987e4c550969ee5801d0be89 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 1 Aug 2015 03:27:16 +0200 Subject: [PATCH 064/427] fix pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 27decf8b..787116a3 100644 --- a/pom.xml +++ b/pom.xml @@ -116,7 +116,7 @@ 3.5.1 55bab9e8653762002000190a - > + From 1b40907f2976cb06102997f165e9d0fd209306ff Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 1 Aug 2015 03:30:42 +0200 Subject: [PATCH 065/427] Update to Metrics R8-SNAPSHOT --- pom.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 787116a3..a38622dd 100644 --- a/pom.xml +++ b/pom.xml @@ -110,13 +110,13 @@ - + com.versioneye versioneye-maven-plugin 3.5.1 55bab9e8653762002000190a - + @@ -178,6 +178,11 @@ http://ci.xephi.fr/plugin/repository/everything/ + + mcstats-snapshots + http://repo.mcstats.org/content/repositories/snapshots/ + + @@ -236,7 +241,7 @@ org.mcstats.bukkit metrics - R7 + R8-SNAPSHOT compile From 297b3d161f60b5c9c466dc373e63ff4600230b4f Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 1 Aug 2015 03:45:41 +0200 Subject: [PATCH 066/427] Describe the pom for metrics repo --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index a38622dd..ba554889 100644 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,7 @@ http://ci.xephi.fr/plugin/repository/everything/ + mcstats-snapshots http://repo.mcstats.org/content/repositories/snapshots/ @@ -238,6 +239,7 @@ compile + org.mcstats.bukkit metrics From fa7c8be10f2f92dce645274e6327b10589d26a31 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 2 Aug 2015 00:40:00 +0200 Subject: [PATCH 067/427] Try to fix lowercase issue --- src/main/java/fr/xephi/authme/api/API.java | 1 + src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java | 2 +- 2 files changed, 2 insertions(+), 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 a5e8d190..477494a2 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -21,6 +21,7 @@ public class API { public static final String newline = System.getProperty("line.separator"); public static AuthMe instance; + @Deprecated public API(AuthMe instance) { API.instance = instance; } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 9aa30311..a854a689 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -101,7 +101,7 @@ public class AsyncronousJoin { final Location spawnLoc = plugin.getSpawnLocation(player); if (database.isAuthAvailable(name)) { PlayerAuth auth = database.getAuth(name); - if (auth.getRealName() != null && !auth.getRealName().equals("Player") && !auth.getRealName().equals(player.getName())) { + if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { final GameMode gM = AuthMePlayerListener.gameMode.get(name); sched.scheduleSyncDelayedTask(plugin, new Runnable() { From 9be5d3518f56f159b7d0ca693d0f43fa87cc62f7 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 2 Aug 2015 00:56:50 +0200 Subject: [PATCH 068/427] Flatfile don't support lowercase --- src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index a854a689..163b4f47 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -99,7 +99,7 @@ public class AsyncronousJoin { } } final Location spawnLoc = plugin.getSpawnLocation(player); - if (database.isAuthAvailable(name)) { + if (database.getType() != DataSource.DataSourceType.FILE && database.isAuthAvailable(name)) { PlayerAuth auth = database.getAuth(name); if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { final GameMode gM = AuthMePlayerListener.gameMode.get(name); From d10e5b081bb77935d7d6d1a0d084a49e0144d7a8 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 2 Aug 2015 01:14:39 +0200 Subject: [PATCH 069/427] Omfg ... --- src/main/java/fr/xephi/authme/datasource/FlatFile.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 198b1cd5..2b54e4df 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -714,16 +714,22 @@ public class FlatFile implements DataSource { switch (args.length) { case 2: auths.add(new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com", args[0])); + break; case 3: auths.add(new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com", args[0])); + break; case 4: auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", args[0])); + break; case 7: auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "unavailableworld", "your@email.com", args[0])); + break; case 8: auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0])); + break; case 9: auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0])); + break; } } } catch (FileNotFoundException ex) { From bba9273c1cea4248a6ba7047a6f6a4f7195c20bb Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 2 Aug 2015 01:43:19 +0200 Subject: [PATCH 070/427] Update sqlite driver version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ba554889..56f24421 100644 --- a/pom.xml +++ b/pom.xml @@ -218,7 +218,7 @@ org.xerial sqlite-jdbc - 3.8.10.1 + 3.8.11 compile From 7d11434c32f2c52046e37e1f7c38317138610cbc Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sun, 2 Aug 2015 02:47:16 +0200 Subject: [PATCH 071/427] Update pom.xml --- pom.xml | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 56f24421..3a4b7c1a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,18 +11,16 @@ AuthMeReloaded Authentication plugin for CraftBukkit/Spigot! + 2013 http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ + - - UTF-8 - - - 1.7 - 1.7 - - - 1.8.8-R0.1-SNAPSHOT - + + scm:git:https://github.com/Xephi/AuthMeReloaded.git + scm:git:git@github.com:Xephi/AuthMeReloaded.git + http://github.com/Xephi/AuthMeReloaded + HEAD + @@ -35,6 +33,26 @@ https://github.com/Xephi/AuthMeReloaded/issues + + + Apache-2.0 + http://www.apache.org/licenses/LICENSE-2.0 + + + + + UTF-8 + + + 1.7 + 1.7 + + + 1.8.8-R0.1-SNAPSHOT + + AuthMe + + @@ -75,7 +93,7 @@ ${manifest.file} - AuthMe-${project.version} + ${jarPluginName}-${project.version} From acbae36ddf5a961ffcaaddb112db3ce9945dd8cd Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 2 Aug 2015 14:22:34 +0200 Subject: [PATCH 072/427] Spaces in pom + optimizations --- pom.xml | 1114 ++++++++--------- src/main/java/fr/xephi/authme/AuthMe.java | 1 + .../xephi/authme/cache/backup/FileCache.java | 6 +- .../xephi/authme/commands/AdminCommand.java | 3 + 4 files changed, 542 insertions(+), 582 deletions(-) diff --git a/pom.xml b/pom.xml index 3a4b7c1a..57558241 100644 --- a/pom.xml +++ b/pom.xml @@ -1,623 +1,575 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - fr.xephi - authme - 5.0-SNAPSHOT + fr.xephi + authme + 5.0-SNAPSHOT - jar + AuthMeReloaded + Authentication plugin for CraftBukkit/Spigot! + 2013 + http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ + - AuthMeReloaded - Authentication plugin for CraftBukkit/Spigot! - 2013 - http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ - + + scm:git:https://github.com/Xephi/AuthMeReloaded.git + scm:git:git@github.com:Xephi/AuthMeReloaded.git + http://github.com/Xephi/AuthMeReloaded + - - scm:git:https://github.com/Xephi/AuthMeReloaded.git - scm:git:git@github.com:Xephi/AuthMeReloaded.git - http://github.com/Xephi/AuthMeReloaded - HEAD - + + + jenkins + http://ci.xephi.fr/job/AuthMeReloaded/ + - - - jenkins - http://ci.xephi.fr/job/AuthMeReloaded/ - + + GitHub + https://github.com/Xephi/AuthMeReloaded/issues + - - GitHub - https://github.com/Xephi/AuthMeReloaded/issues - + + + Apache-2.0 + http://www.apache.org/licenses/LICENSE-2.0 + + - - - Apache-2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - + + UTF-8 + + 1.7 + + 1.8.8-R0.1-SNAPSHOT + - - UTF-8 + + ${project.name}-${project.version} + + + . + true + ${basedir}/src/main/resources/ + + *.yml + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.7 + ${javaVersion} + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.1 + + + + com.maxmind.geoip:* + javax.mail:* + com.sun.mail:* + com.comphenix.attribute:* + org.mcstats.*:* + com.zaxxer:* + org.slf4j:* + + + + + org.mcstats + fr.xephi.authme + + + + + + package + + shade + + + + + + - - 1.7 - 1.7 + - - 1.8.8-R0.1-SNAPSHOT - - AuthMe - + + + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public + - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - ${maven.compiler.source} - ${maven.compiler.target} - - - - com.google.code.maven-replacer-plugin - replacer - 1.5.3 - - - prepare-package - - replace - - - - - target/classes/plugin.yml - - - maven-version - ${project.version} - - - - - - maven-jar-plugin - 2.6 - - - ${manifest.file} - - ${jarPluginName}-${project.version} - - - - org.apache.maven.plugins - maven-shade-plugin - 2.4.1 - - - - com.maxmind.geoip:* - javax.mail:* - com.sun.mail:* - com.comphenix.attribute:* - org.mcstats.*:* - com.zaxxer:* - org.slf4j:* - - - - - org.mcstats - fr.xephi.authme - - - - - - package - - shade - - - - - - com.versioneye - versioneye-maven-plugin - 3.5.1 - - 55bab9e8653762002000190a - - - - - + + + ess-repo + http://repo.ess3.net/content/groups/public + - + + + citizensapi-repo + http://ci.citizensnpcs.co/plugin/repository/project/CitizensAPI/LastSuccessful/repository + - - - spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public - + + + minelink-thirdparty + http://repo.minelink.net/content/repositories/public + - - - ess-repo - http://repo.ess3.net/content/groups/public - + + + comphenix-snapshots + http://repo.comphenix.net/content/repositories/public + - - - citizensapi-repo - http://ci.citizensnpcs.co/plugin/repository/project/CitizensAPI/LastSuccessful/repository - + + + onarandombox + http://repo.onarandombox.com/content/groups/public + - - - minelink-thirdparty - http://repo.minelink.net/content/repositories/public - + + + vault-repo + http://nexus.theyeticave.net/content/repositories/pub_releases + - - - comphenix-snapshots - http://repo.comphenix.net/content/repositories/public - + + + luricos-releases + http://repo.luricos.de/content/repositories/releases + - - - onarandombox - http://repo.onarandombox.com/content/groups/public - + + + xephi-repo + http://ci.xephi.fr/plugin/repository/everything/ + - - - vault-repo - http://nexus.theyeticave.net/content/repositories/pub_releases - + + + mcstats-snapshots + http://repo.mcstats.org/content/repositories/snapshots/ + - - - luricos-releases - http://repo.luricos.de/content/repositories/releases - + - - - xephi-repo - http://ci.xephi.fr/plugin/repository/everything/ - + - - - mcstats-snapshots - http://repo.mcstats.org/content/repositories/snapshots/ - + - + + + org.slf4j + slf4j-simple + 1.7.12 + compile + + + com.zaxxer + HikariCP + 2.4.0 + compile + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + - + + + org.xerial + sqlite-jdbc + 3.8.11 + compile + - - - - - org.slf4j - slf4j-simple - 1.7.12 - compile - - - com.zaxxer - HikariCP - 2.4.0 - compile - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-simple - - - - - - - org.xerial - sqlite-jdbc - 3.8.11 - compile - - - - - com.sun.mail - javax.mail - 1.5.4 - compile - + + + com.sun.mail + javax.mail + 1.5.4 + compile + - - - com.maxmind.geoip - geoip-api - 1.2.15 - compile - + + + com.maxmind.geoip + geoip-api + 1.2.15 + compile + - - - org.mcstats.bukkit - metrics - R8-SNAPSHOT - compile - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + org.mcstats.bukkit + metrics + R8-SNAPSHOT + compile + + + org.bukkit + bukkit + + + - - - org.spigotmc - spigot-api - ${bukkitVersion} - provided - - - bungeecord-chat - net.md-5 - - - + + + org.bukkit + bukkit + ${bukkitVersion} + provided + - - - com.comphenix.attribute - AttributeStorage - 0.0.2-SNAPSHOT - compile - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + com.comphenix.attribute + AttributeStorage + 0.0.2-SNAPSHOT + compile + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - net.milkbowl.vault - VaultAPI - 1.5 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + net.milkbowl.vault + VaultAPI + 1.5 + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - net.citizensnpcs - citizensapi - 2.0.16-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + net.citizensnpcs + citizensapi + 2.0.16-SNAPSHOT + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - com.onarandombox.multiversecore - Multiverse-Core - 2.5 - jar - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - AllPay - com.fernferret.allpay - - - Vault - net.milkbowl.vault - - - CommandHandler - com.pneumaticraft.commandhandler - - - + + + com.onarandombox.multiversecore + Multiverse-Core + 2.5 + jar + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + AllPay + com.fernferret.allpay + + + Vault + net.milkbowl.vault + + + CommandHandler + com.pneumaticraft.commandhandler + + + - - - net.ess3 - Essentials - 2.14-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + net.ess3 + Essentials + 2.14-SNAPSHOT + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - net.minelink - CombatTagPlus - 1.2.1-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - CombatTagPlusHook - net.minelink - - - CombatTagPlusFactions-v1_6 - net.minelink - - - CombatTagPlusCompat-v1_7_R3 - net.minelink - - - CombatTagPlusFactions-v1_8 - net.minelink - - - CombatTagPlusCompat-v1_7_R4 - net.minelink - - - CombatTagPlusWG-v5 - net.minelink - - - CombatTagPlusWG-v6 - net.minelink - - - CombatTagPlusCompat-API - net.minelink - - - CombatTagPlusFactions-v2_6 - net.minelink - - - CombatTagPlusCompat-v1_8_R3 - net.minelink - - - CombatTagPlusFactions-v2_7 - net.minelink - - - CombatTagPlusCompat-v1_8_R2 - net.minelink - - - CombatTagPlusCompat-v1_8_R1 - net.minelink - - - metrics-lite - org.mcstats.bukkit - - - + + + net.minelink + CombatTagPlus + 1.2.1-SNAPSHOT + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + CombatTagPlusHook + net.minelink + + + CombatTagPlusFactions-v1_6 + net.minelink + + + CombatTagPlusCompat-v1_7_R3 + net.minelink + + + CombatTagPlusFactions-v1_8 + net.minelink + + + CombatTagPlusCompat-v1_7_R4 + net.minelink + + + CombatTagPlusWG-v5 + net.minelink + + + CombatTagPlusWG-v6 + net.minelink + + + CombatTagPlusCompat-API + net.minelink + + + CombatTagPlusFactions-v2_6 + net.minelink + + + CombatTagPlusCompat-v1_8_R3 + net.minelink + + + CombatTagPlusFactions-v2_7 + net.minelink + + + CombatTagPlusCompat-v1_8_R2 + net.minelink + + + CombatTagPlusCompat-v1_8_R1 + net.minelink + + + metrics-lite + org.mcstats.bukkit + + + - - - com.trc202 - CombatTag - 6.2.1-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + com.trc202 + CombatTag + 6.2.1-SNAPSHOT + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - de.luricos.bukkit - xAuth - 2.6 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - updater - net.gravitydevelopment.updater - - - lombok - org.projectlombok - - - EssentialsGroupManager - net.ess3 - - - PermissionsEx - ru.tehkode - - - AccountsClient - com.mojang - - - + + + de.luricos.bukkit + xAuth + 2.6 + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + updater + net.gravitydevelopment.updater + + + lombok + org.projectlombok + + + EssentialsGroupManager + net.ess3 + + + PermissionsEx + ru.tehkode + + + AccountsClient + com.mojang + + + - - - com.acrobot.chestshop - chestshop - 3.8.12 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - Vault - net.milkbowl.vault - - - odditem - info.somethingodd - - - scrollingmenusign - me.desht - - - truezip - de.schlichtherle - - - residence - net.t00thpick1 - - - Heroes - com.herocraftonline.heroes - - - HeroChat - com.dthielke.herochat - - - worldguard - com.sk89q - - - worldedit - com.sk89q - - - lwc - com.griefcraft.lwc - - - js - rhino - - - jchronic - com.sk89q - - - deadbolt - com.daemitus.deadbolt - - - bukkit-classloader-check - com.sk89q.spigot - - - jsr305 - com.google.code.findbugs - - - opencsv - net.sf.opencsv - - - simplechestlock - - com.webkonsept.bukkit.simplechestlock - - - - commandbook - com.sk89q - - - lockette - org.yi.acru.bukkit.lockette - - - + + + com.acrobot.chestshop + chestshop + 3.8.12 + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + Vault + net.milkbowl.vault + + + odditem + info.somethingodd + + + scrollingmenusign + me.desht + + + truezip + de.schlichtherle + + + residence + net.t00thpick1 + + + Heroes + com.herocraftonline.heroes + + + HeroChat + com.dthielke.herochat + + + worldguard + com.sk89q + + + worldedit + com.sk89q + + + lwc + com.griefcraft.lwc + + + js + rhino + + + jchronic + com.sk89q + + + deadbolt + com.daemitus.deadbolt + + + bukkit-classloader-check + com.sk89q.spigot + + + jsr305 + com.google.code.findbugs + + + opencsv + net.sf.opencsv + + + simplechestlock + + com.webkonsept.bukkit.simplechestlock + + + + commandbook + com.sk89q + + + lockette + org.yi.acru.bukkit.lockette + + + - + diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 7ed3dd9f..9cf420a7 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -120,6 +120,7 @@ public class AuthMe extends JavaPlugin { this.database = database; } + @SuppressWarnings("deprecation") @Override public void onEnable() { authme = this; diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 6c4e4be7..2a4b09eb 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -504,7 +504,8 @@ public class FileCache { armours[i] = attributes.getStack(); else armours[i] = item; } - + } catch (final RuntimeException e) { + ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); } catch (final Exception e) { ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); } finally { @@ -513,6 +514,9 @@ public class FileCache { } return new DataFileCache(inv, armours, group, op, flying); } + } catch (RuntimeException e) { + ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); + return null; } catch (Exception e) { ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); return null; diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 10a4e950..7ee7e42c 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -477,6 +477,7 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "error"); return true; } + @SuppressWarnings("deprecation") Player target = Bukkit.getPlayer(name); PlayerCache.getInstance().removePlayer(name); Utils.getInstance().setGroup(name, groupType.UNREGISTERED); @@ -559,6 +560,7 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("Usage: /authme getip "); return true; } + @SuppressWarnings("deprecation") Player player = Bukkit.getPlayer(args[1]); if (player == null) { sender.sendMessage("This player is not actually online"); @@ -574,6 +576,7 @@ public class AdminCommand implements CommandExecutor { return true; } try { + @SuppressWarnings("deprecation") Player player = Bukkit.getPlayer(args[1]); if (player == null || !player.isOnline()) { sender.sendMessage("Player needs to be online!"); From 63e35e455061c081c3f3bcd9ab2b6ac880262e69 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 2 Aug 2015 14:36:03 +0200 Subject: [PATCH 073/427] Fix wrong jar name --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 57558241..725af37c 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ - ${project.name}-${project.version} + AuthMe-${project.version} . From 7d5fc908b5fa106b3c333f42536f15f1b4f100a3 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 2 Aug 2015 14:45:56 +0200 Subject: [PATCH 074/427] Use EssentialsX instead of Essentials --- pom.xml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 725af37c..83f8bdda 100644 --- a/pom.xml +++ b/pom.xml @@ -110,10 +110,10 @@ https://hub.spigotmc.org/nexus/content/groups/public - + ess-repo - http://repo.ess3.net/content/groups/public + https://ci.drtshock.net/plugin/repository/everything @@ -330,17 +330,13 @@ net.ess3 - Essentials - 2.14-SNAPSHOT + EssentialsX + 2.0.1-SNAPSHOT provided - org.bukkit - bukkit - - - org.bukkit - craftbukkit + org.spigotmc + spigot-api From f019be4833135288ea432a3dbece2d79a42aac4c Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Mon, 3 Aug 2015 18:22:52 +0200 Subject: [PATCH 075/427] little fix --- .../authme/process/join/AsyncronousJoin.java | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 163b4f47..94043b9c 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -99,26 +99,28 @@ public class AsyncronousJoin { } } final Location spawnLoc = plugin.getSpawnLocation(player); - if (database.getType() != DataSource.DataSourceType.FILE && database.isAuthAvailable(name)) { - PlayerAuth auth = database.getAuth(name); - if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { - final GameMode gM = AuthMePlayerListener.gameMode.get(name); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { + if (database.isAuthAvailable(name)) { + if (database.getType() != DataSource.DataSourceType.FILE) { + PlayerAuth auth = database.getAuth(name); + if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { + final GameMode gM = AuthMePlayerListener.gameMode.get(name); + sched.scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - if (gM != null) { - AuthMePlayerListener.causeByAuthMe.put(name, true); - player.setGameMode(gM); - AuthMePlayerListener.causeByAuthMe.put(name, false); + @Override + public void run() { + if (gM != null) { + AuthMePlayerListener.causeByAuthMe.put(name, true); + player.setGameMode(gM); + AuthMePlayerListener.causeByAuthMe.put(name, false); + } + player.kickPlayer("You are not the Owner of this account, please try another name!"); + if (Settings.banUnsafeIp) + plugin.getServer().banIP(ip); } - player.kickPlayer("You are not the Owner of this account, please try another name!"); - if (Settings.banUnsafeIp) - plugin.getServer().banIP(ip); - } - }, 1); - return; + }, 1); + return; + } } if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { From 50b41effa65552e7b748162fe88eb3a0aa084887 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Mon, 3 Aug 2015 18:24:20 +0200 Subject: [PATCH 076/427] Fix conversion issue with lower case --- .../java/fr/xephi/authme/converter/ForceFlatToSqlite.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java index 44034a49..f2bbd204 100644 --- a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java @@ -21,8 +21,10 @@ public class ForceFlatToSqlite implements Converter { DataSource sqlite = null; try { sqlite = new SQLite(); - for (PlayerAuth auth : data.getAllAuths()) + for (PlayerAuth auth : data.getAllAuths()) { + auth.setRealName("Player"); sqlite.saveAuth(auth); + } plugin.getSettings().setValue("DataSource.backend", "sqlite"); ConsoleLogger.info("Database successfully converted to sqlite !"); } catch (Exception e) { From c1ffe47468287ace055dcc2e0c1002716b8ddeed Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Mon, 3 Aug 2015 18:37:42 +0200 Subject: [PATCH 077/427] update realName --- .../java/fr/xephi/authme/commands/AdminCommand.java | 12 ++++++++++++ .../fr/xephi/authme/datasource/CacheDataSource.java | 1 + src/main/java/fr/xephi/authme/datasource/MySQL.java | 5 +++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 10a4e950..52fbec31 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -588,6 +588,18 @@ public class AdminCommand implements CommandExecutor { } catch (Exception e) { sender.sendMessage("An error occured while trying to get that player!"); } + } else if (args[0].equalsIgnoreCase("resetname")) { + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + List auths = plugin.database.getAllAuths(); + for (PlayerAuth auth : auths) { + auth.setRealName("Player"); + plugin.database.updateSession(auth); + } + } + }); } else { sender.sendMessage("Usage: /authme reload|register playername password|changepassword playername password|unregister playername"); } diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index fb96bc7c..3d1aa5cc 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -70,6 +70,7 @@ public class CacheDataSource implements DataSource { if (cache.containsKey(auth.getNickname())) { cache.get(auth.getNickname()).setIp(auth.getIp()); cache.get(auth.getNickname()).setLastLogin(auth.getLastLogin()); + cache.get(auth.getNickname()).setRealName(auth.getRealName()); } return true; } diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 135d544f..9509192d 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -517,10 +517,11 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { con = makeSureConnectionIsReady(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=? WHERE LOWER(" + columnName + ")=?;"); + pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=?, " + columnRealName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getIp()); pst.setLong(2, auth.getLastLogin()); - pst.setString(3, auth.getNickname()); + pst.setString(3, auth.getRealName()); + pst.setString(4, auth.getNickname()); pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); From fc97c605290d4329fb7fbff8d1dc92ad1ccde8d9 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Mon, 3 Aug 2015 19:18:30 +0200 Subject: [PATCH 078/427] Update plugin.yml --- src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b52d5794..68aab3b3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,7 +3,7 @@ author: Xephi59 website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the player. main: fr.xephi.authme.AuthMe -version: maven-version +version: ${project.version} softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn] commands: register: From 52b48f71c4e18462580a013026b065825c046593 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Tue, 4 Aug 2015 15:16:59 +0200 Subject: [PATCH 079/427] Update AuthMe.java --- src/main/java/fr/xephi/authme/AuthMe.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 9cf420a7..7ed3dd9f 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -120,7 +120,6 @@ public class AuthMe extends JavaPlugin { this.database = database; } - @SuppressWarnings("deprecation") @Override public void onEnable() { authme = this; From 20c75f19803b8669189449c4c26c61c8be137f21 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Tue, 4 Aug 2015 15:18:45 +0200 Subject: [PATCH 080/427] Update AdminCommand.java --- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index d55df865..52fbec31 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -477,7 +477,6 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "error"); return true; } - @SuppressWarnings("deprecation") Player target = Bukkit.getPlayer(name); PlayerCache.getInstance().removePlayer(name); Utils.getInstance().setGroup(name, groupType.UNREGISTERED); @@ -560,7 +559,6 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("Usage: /authme getip "); return true; } - @SuppressWarnings("deprecation") Player player = Bukkit.getPlayer(args[1]); if (player == null) { sender.sendMessage("This player is not actually online"); @@ -576,7 +574,6 @@ public class AdminCommand implements CommandExecutor { return true; } try { - @SuppressWarnings("deprecation") Player player = Bukkit.getPlayer(args[1]); if (player == null || !player.isOnline()) { sender.sendMessage("Player needs to be online!"); From 253b54da1d535fbe095940998c4216a2ebec0a92 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Mon, 10 Aug 2015 00:06:55 +0200 Subject: [PATCH 081/427] Messages can now be customized more easily --- .../xephi/authme/commands/AdminCommand.java | 2 +- .../authme/listener/AuthMePlayerListener.java | 31 +++++--- .../fr/xephi/authme/settings/Messages.java | 27 ++++--- .../fr/xephi/authme/settings/Settings.java | 71 ++++++------------- src/main/resources/messages_vn.yml | 59 +++++++++++++++ 5 files changed, 119 insertions(+), 71 deletions(-) create mode 100644 src/main/resources/messages_vn.yml diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 52fbec31..28f4519b 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -141,7 +141,7 @@ public class AdminCommand implements CommandExecutor { } YamlConfiguration newConfig = YamlConfiguration.loadConfiguration(newConfigFile); Settings.reloadConfigOptions(newConfig); - m.reLoad(); + m.reloadMessages(); plugin.database.close(); plugin.setupDatabase(); m.send(sender, "reload"); diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 85962179..42e2c8f5 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -428,17 +428,17 @@ public class AuthMePlayerListener implements Listener { } } - if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction){ + if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction) { if (!plugin.database.isAuthAvailable(name)) { event.setKickMessage(m.send("reg_only")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } } - - if (Settings.antiBotInAction){ + + if (Settings.antiBotInAction) { if (!plugin.database.isAuthAvailable(name)) { - event.setKickMessage("AntiBot service in action! Non registered players can't connect until the bot attack stops!"); //Need to add string to messages + event.setKickMessage("AntiBot service in action! You actually need to be registered!"); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } @@ -658,31 +658,40 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInventoryOpen(InventoryOpenEvent event) { if (event.getPlayer() == null) return; - Player player = (Player) event.getPlayer(); + final Player player = (Player) event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) return; - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { return; } - if (!plugin.database.isAuthAvailable(name)) { if (!Settings.isForcedRegistrationEnabled) { return; } } event.setCancelled(true); - player.closeInventory(); + + /* + * @note little hack cause InventoryOpenEvent cannot be cancelled for + * real, cause no packet is send to server by client for the main inv + */ + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + player.closeInventory(); + ; + } + + }, 1); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index 2328d820..75db7b7c 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -12,13 +12,15 @@ import fr.xephi.authme.ConsoleLogger; public class Messages extends CustomConfiguration { private static Messages singleton = null; + private String lang = "en"; - public Messages(File file) { + public Messages(File file, String lang) { super(file); loadDefaults(file); loadFile(); saveDefaults(file); singleton = this; + this.lang = lang; } /** @@ -32,7 +34,7 @@ public class Messages extends CustomConfiguration { InputStream stream = AuthMe.getInstance().getResource(file.getName()); if (stream == null) return; - + setDefaults(YamlConfiguration.loadConfiguration(stream)); } @@ -67,12 +69,14 @@ public class Messages extends CustomConfiguration { } private void loadFile() { - this.load(); - this.save(); + load(); + save(); } public void send(CommandSender sender, String msg) { - String loc = (String) this.get(msg); + if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) + singleton.reloadMessages(); + String loc = (String) singleton.get(msg); if (loc == null) { loc = "Error with Translation files, please contact the admin for verify or update translation"; ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml !"); @@ -83,13 +87,14 @@ public class Messages extends CustomConfiguration { } public String[] send(String msg) { + if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) + singleton.reloadMessages(); String s = null; try { - s = (String) this.get(msg); + s = (String) singleton.get(msg); } catch (Exception e) { } - if (s == null) - { + if (s == null) { ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml !"); String[] loc = new String[1]; loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files"; @@ -109,9 +114,13 @@ public class Messages extends CustomConfiguration { public static Messages getInstance() { if (singleton == null) { - singleton = new Messages(new File(Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml")); + singleton = new Messages(new File(Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); } return singleton; } + public void reloadMessages() { + singleton = new Messages(new File(Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); + } + } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 6fc1aca6..45b4139c 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -22,8 +22,8 @@ import fr.xephi.authme.security.HashAlgorithm; public final class Settings extends YamlConfiguration { - //This is not an option! - public static Boolean antiBotInAction = false; + // This is not an option! + public static Boolean antiBotInAction = false; public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe"; public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache"; @@ -62,17 +62,17 @@ public final class Settings extends YamlConfiguration { isResetInventoryIfCreative, isCachingEnabled, isKickOnWrongPasswordEnabled, getEnablePasswordVerifier, protectInventoryBeforeLogInEnabled, isBackupActivated, - isBackupOnStart, isBackupOnStop, isStopEnabled, - reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, - displayOtherAccounts, useCaptcha, emailRegistration, multiverse, - chestshop, bungee, banUnsafeIp, doubleEmailCheck, - sessionExpireOnIpChange, disableSocialSpy, forceOnlyAfterLogin, - useEssentialsMotd, usePurge, purgePlayerDat, purgeEssentialsFile, - supportOldPassword, purgeLimitedCreative, purgeAntiXray, - purgePermissions, enableProtection, enableAntiBot, recallEmail, - useWelcomeMessage, broadcastWelcomeMessage, forceRegKick, - forceRegLogin, checkVeryGames, delayJoinMessage, noTeleport, - applyBlindEffect, customAttributes, generateImage; + isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, + rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, + useCaptcha, emailRegistration, multiverse, chestshop, bungee, + banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange, + disableSocialSpy, forceOnlyAfterLogin, useEssentialsMotd, usePurge, + purgePlayerDat, purgeEssentialsFile, supportOldPassword, + purgeLimitedCreative, purgeAntiXray, purgePermissions, + enableProtection, enableAntiBot, recallEmail, useWelcomeMessage, + broadcastWelcomeMessage, forceRegKick, forceRegLogin, + checkVeryGames, delayJoinMessage, noTeleport, applyBlindEffect, + customAttributes, generateImage; public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase, @@ -127,7 +127,7 @@ public final class Settings extends YamlConfiguration { @SuppressWarnings("unchecked") public static void loadVariables() { - messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en")); + messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en").toLowerCase()); isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false); isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true); isRegistrationEnabled = configFile.getBoolean("settings.registration.enabled", true); @@ -603,22 +603,20 @@ public final class Settings extends YamlConfiguration { } public static String checkLang(String lang) { - for (messagesLang language : messagesLang.values()) { - if (lang.toLowerCase().contains(language.toString())) { - ConsoleLogger.info("Set Language: " + lang); - return lang; - } + if (new File(MESSAGE_FILE + "_" + lang + ".yml").exists()) { + ConsoleLogger.info("Set Language to: " + lang); + return lang; } - ConsoleLogger.info("Set Default Language: En "); + ConsoleLogger.info("Language file not found for " + lang + ", set to default language: en !"); return "en"; } public static void switchAntiBotMod(boolean mode) { - if (mode){ + if (mode) { isKickNonRegisteredEnabled = true; antiBotInAction = true; - }else{ - isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); + } else { + isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); antiBotInAction = false; } } @@ -684,31 +682,4 @@ public final class Settings extends YamlConfiguration { } return correct; } - - public enum messagesLang { - en, - de, - br, - cz, - pl, - fr, - uk, - ru, - hu, - sk, - es, - fi, - zhtw, - zhhk, - zhcn, - lt, - it, - ko, - pt, - nl, - gl, - bg, - eu, - tr - } } diff --git a/src/main/resources/messages_vn.yml b/src/main/resources/messages_vn.yml new file mode 100644 index 00000000..56efede9 --- /dev/null +++ b/src/main/resources/messages_vn.yml @@ -0,0 +1,59 @@ +unknown_user: '&fNgười chơi không tồn tại trong cơ sở dữ liệu' +unsafe_spawn: '&fNơi thoát server của bạn không an toàn, đang dịch chuyển bạn tới điểm spawn của server' +not_logged_in: '&cChưa đăng nhập!' +reg_voluntarily: '&fBạn có thể đăng kí tài khoản với lệnh + "/register mật-khẩu nhập-lại-mật-khẩu"' +usage_log: '&eSử dụng: /login password' +wrong_pwd: '&cSai mật khẩu' +unregistered: '&cHuỷ đăng kí thành công!' +reg_disabled: '&cHệ thống đăng kí đã bị vô hiệu' +valid_session: '&cPhiên đăng nhập còn tồn tại, bạn không cần nhập mật khẩu' +login: '&cĐăng nhập thành công!' +vb_nonActiv: '&fTài khoản của bạn chưa được kích hoạt, kiểm tra email!' +user_regged: '&cTên đăng nhập này đã được đăng kí' +usage_reg: '&eSử dụng: /register mật-khẩu nhập-lại-mật-khẩu' +max_reg: '&fSố lượng tài khoản ở IP của bạn trong server này đã quá giới hạn cho phép' +no_perm: '&cKhông có quyền' +error: '&fCó lỗi xảy ra; Báo lại cho người điều hành server' +login_msg: '&cĐăng nhập với lệnh "/login mật-khẩu"' +reg_msg: '&cĐăng kí tài khoản với lệnh "/register mật-khẩu nhập-lại-mật-khẩu"' +reg_email_msg: '&cĐăng kí email cho tài khoản với lệnh "/register "' +usage_unreg: '&eSử dụng: /unregister mật-khẩu' +pwd_changed: '&cĐã đổi mật khẩu!' +user_unknown: '&cTài khoản này chưa được đăng kí' +password_error: '&fMật khẩu không khớp' +unvalid_session: '&fPhiên đăng nhập không hồi đáp, vui lòng chờ phiên đăng nhập kết thúc' +reg_only: '&fChỉ cho phép người đã đăng kí! Hãy vào trang http://web-của.bạn/ để đăng kí' +logged_in: '&cĐã đăng nhập!' +logout: '&cThoát đăng nhập thành công' +same_nick: '&fTài khoản đang được người khác sử dụng trong server' +registered: '&cĐăng kí thành công!' +pass_len: '&fMật khẩu của bạn quá ngắn hoặc quá dài' +reload: '&fThiết lập và dữ liệu đã được nạp lại' +timeout: '&fQuá thời gian đăng nhập' +usage_changepassword: '&eSử dụng: /changepassword mật-khẩu-cũ mật-khẩu-mới' +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' +bad_database_email: '[AuthMe] Lệnh /email chỉ hoạt động với cơ sở dữ liệu MySQL và SQLite, + hãy liên hệ điều hành viên của server' +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 ' +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!' +kick_fullserver: '&cXin lỗi, hiện tại server không còn trống slot để bạn có thể vào!' +usage_email_add: '&eSử dụng: /email add ' +usage_email_change: '&eSử dụng: /email change ' +usage_email_recovery: '&eSử dụng: /email recovery ' +new_email_invalid: '[AuthMe] Địa chỉ email mới không hợp lệ!' +old_email_invalid: '[AuthMe] Địa chỉ email cũ không hợp lệ!' +email_invalid: '[AuthMe] Sai địa chỉ email' +email_added: '[AuthMe] Đã thêm địa chỉ email !' +email_confirm: '[AuthMe] Xác nhận email !' +email_changed: '[AuthMe] Đã thay đổi email !' +email_send: '[AuthMe] Đã gửi email khôi phục mật khẩu tới bạn !' +country_banned: 'Rất tiếc, quốc gia của bạn không được phép gia nhập server' +antibot_auto_enabled: '[AuthMe] AntiBot đã được kích hoạt vì lượng người chơi kết nối vượt quá giới hạn!' +antibot_auto_disabled: '[AuthMe] AntiBot tự huỷ kích hoạt sau %m phút, + hi vọng lượng kết nối sẽ giảm bớt' \ No newline at end of file From 31ae90407aac157deddd2106ff2e88da20434328 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Mon, 10 Aug 2015 13:37:59 +0200 Subject: [PATCH 082/427] Update SQLite Driver --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 83f8bdda..a629a91a 100644 --- a/pom.xml +++ b/pom.xml @@ -198,7 +198,7 @@ org.xerial sqlite-jdbc - 3.8.11 + 3.8.11.1 compile From 11db85ac2692d07b8fde51e649aefda41d20d699 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Mon, 10 Aug 2015 22:56:07 +0200 Subject: [PATCH 083/427] Fix LowerCase/Session Stolen issue --- .../java/fr/xephi/authme/DataManager.java | 30 +++++++++++++++++++ .../authme/listener/AuthMePlayerListener.java | 21 ++++++------- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 072d9741..8f9db6d8 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -46,6 +46,8 @@ public class DataManager { return result.get(); } catch (Exception e) { return (null); + } finally { + executor.shutdown(); } } @@ -159,4 +161,32 @@ public class DataManager { } ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " Permissions"); } + + public boolean isOnline(Player player, final String name) { + if (player.isOnline()) + return true; + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future result = executor.submit(new Callable() { + + public synchronized Boolean call() throws Exception { + Boolean result = null; + try { + for (OfflinePlayer op : Bukkit.getOnlinePlayers()) + if (op.getName().equalsIgnoreCase(name)) { + result = true; + break; + } + } catch (Exception e) { + } + return result; + } + }); + try { + return result.get().booleanValue(); + } catch (Exception e) { + return (false); + } finally { + executor.shutdown(); + } + } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 42e2c8f5..8f2f03d1 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -446,21 +446,22 @@ public class AuthMePlayerListener implements Listener { // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player - if (player.isOnline() && Settings.isForceSingleSessionEnabled) { + if (plugin.dataManager.isOnline(player, name) && Settings.isForceSingleSessionEnabled) { event.setKickMessage(m.send("same_nick")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + if (LimboCache.getInstance().hasLimboPlayer(name)) + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - @Override - public void run() { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - Utils.getInstance().addNormal(player, limbo.getGroup()); - LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); + @Override + public void run() { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); + if (player != null && limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { + Utils.getInstance().addNormal(player, limbo.getGroup()); + LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); + } } - } - }); + }); return; } From 5c059bdd4340bc76f3b820ac378c176f37f12506 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Mon, 10 Aug 2015 23:15:29 +0200 Subject: [PATCH 084/427] Move from Join to Login --- .../authme/listener/AuthMePlayerListener.java | 12 ++++++++++ .../authme/process/join/AsyncronousJoin.java | 22 ------------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 8f2f03d1..93b43192 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -44,6 +44,7 @@ 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.cache.limbo.LimboPlayer; +import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; @@ -465,6 +466,17 @@ public class AuthMePlayerListener implements Listener { return; } + if (plugin.database.getType() != DataSource.DataSourceType.FILE) { + PlayerAuth auth = plugin.database.getAuth(name); + if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { + event.setKickMessage(m.send("same_nick")[0]); + event.setResult(PlayerLoginEvent.Result.KICK_OTHER); + if (Settings.banUnsafeIp) + plugin.getServer().banIP(player.getAddress().getAddress().getHostAddress()); + return; + } + } + int min = Settings.getMinNickLength; int max = Settings.getMaxNickLength; String regex = Settings.getNickRegex; diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 94043b9c..d1ef309d 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -100,28 +100,6 @@ public class AsyncronousJoin { } final Location spawnLoc = plugin.getSpawnLocation(player); if (database.isAuthAvailable(name)) { - if (database.getType() != DataSource.DataSourceType.FILE) { - PlayerAuth auth = database.getAuth(name); - if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { - final GameMode gM = AuthMePlayerListener.gameMode.get(name); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - if (gM != null) { - AuthMePlayerListener.causeByAuthMe.put(name, true); - player.setGameMode(gM); - AuthMePlayerListener.causeByAuthMe.put(name, false); - } - player.kickPlayer("You are not the Owner of this account, please try another name!"); - if (Settings.banUnsafeIp) - plugin.getServer().banIP(ip); - } - - }, 1); - return; - } - } if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { From 55fcb9c48c86c945ce07a65554fa169a47c85688 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Wed, 12 Aug 2015 20:18:38 +0200 Subject: [PATCH 085/427] Update LICENSE --- LICENSE | 811 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 642 insertions(+), 169 deletions(-) diff --git a/LICENSE b/LICENSE index 8dada3ed..9cecc1d4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,674 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. - 1. Definitions. + Preamble - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. + The GNU General Public License is a free, copyleft license for +software and other kinds of works. - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. + The precise terms and conditions for copying, distribution and +modification follow. - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. + TERMS AND CONDITIONS - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. + 0. Definitions. - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: + "This License" refers to version 3 of the GNU General Public License. - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. + A "covered work" means either the unmodified Program or a work based +on the Program. - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. + 1. Source Code. - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. - END OF TERMS AND CONDITIONS + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. - APPENDIX: How to apply the Apache License to your work. + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. - Copyright {yyyy} {name of copyright owner} + The Corresponding Source for a work in source code form is that +same work. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + 2. Basic Permissions. - http://www.apache.org/licenses/LICENSE-2.0 + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 455864d14d5944c33f07d8821b35815c04fe3872 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 12 Aug 2015 21:04:04 +0200 Subject: [PATCH 086/427] Fix NPE --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 93b43192..1b585f61 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -466,7 +466,7 @@ public class AuthMePlayerListener implements Listener { return; } - if (plugin.database.getType() != DataSource.DataSourceType.FILE) { + if (plugin.database.isAuthAvailable(name) && plugin.database.getType() != DataSource.DataSourceType.FILE) { PlayerAuth auth = plugin.database.getAuth(name); if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { event.setKickMessage(m.send("same_nick")[0]); From b982ff3c9572844522f02c5eb1a570f4a97eaf85 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 13 Aug 2015 19:25:00 +0200 Subject: [PATCH 087/427] Deprecated the chestshop hook --- src/main/java/fr/xephi/authme/settings/Settings.java | 5 ++++- src/main/resources/config.yml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 45b4139c..9ef82a78 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -227,7 +227,7 @@ public final class Settings extends YamlConfiguration { saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8); getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1); multiverse = configFile.getBoolean("Hooks.multiverse", true); - chestshop = configFile.getBoolean("Hooks.chestshop", true); + chestshop = configFile.getBoolean("Hooks.legacyChestshop", false); bungee = configFile.getBoolean("Hooks.bungeecord", false); getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds"); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); @@ -449,6 +449,9 @@ public final class Settings extends YamlConfiguration { } if (contains("Hooks.notifications")) set("Hooks.notifications", null); + if (contains("Hooks.chestshop")) + set("Hooks.chestshop", null); + set("Hooks.legacyChestshop", false); if (!contains("Email.generateImage")) { set("Email.generateImage", true); changes = true; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b98ce851..89f16d2c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -367,8 +367,8 @@ Email: Hooks: # Do we need to hook with multiverse for spawn checking? multiverse: true - # Do we need to hook with ChestShop for prevent buy or selling ? - chestshop: true + # Do we need to hook with legacy ChestShop < 3.8.13 for prevent buy or selling ? + legacyChestshop: false # Do we need to hook with BungeeCord for get the real Player ip ? bungeecord: false # Do we need to disable Essentials SocialSpy on join ? From 3164c919b3a979a636b4a34734c9609548836320 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 14 Aug 2015 11:26:37 +0200 Subject: [PATCH 088/427] Update pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a629a91a..5f734566 100644 --- a/pom.xml +++ b/pom.xml @@ -32,8 +32,8 @@ - Apache-2.0 - http://www.apache.org/licenses/LICENSE-2.0 + The GNU General Public Licence version 2 (GPLv2) + http://www.gnu.org/licenses/gpl-3.0.html From 7b63c8db9331415e60fe792348992aadbd6efcea Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Fri, 14 Aug 2015 12:29:25 +0200 Subject: [PATCH 089/427] It's version 3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5f734566..2eab1959 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ - The GNU General Public Licence version 2 (GPLv2) + The GNU General Public Licence version 3 (GPLv3) http://www.gnu.org/licenses/gpl-3.0.html From 1ad4865911e3365a1db4caa30f45903df896b358 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Fri, 14 Aug 2015 12:32:04 +0200 Subject: [PATCH 090/427] Need to get the old value --- src/main/java/fr/xephi/authme/settings/Settings.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 9ef82a78..54dcf2c1 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -449,9 +449,12 @@ public final class Settings extends YamlConfiguration { } if (contains("Hooks.notifications")) set("Hooks.notifications", null); - if (contains("Hooks.chestshop")) + boolean useChestShop = false; + if (contains("Hooks.chestshop")) { + useChestShop = getBoolean("Hooks.chestshop"); set("Hooks.chestshop", null); - set("Hooks.legacyChestshop", false); + } + set("Hooks.legacyChestshop", useChestShop); if (!contains("Email.generateImage")) { set("Email.generateImage", true); changes = true; From 835e935886c5518bafda282178c3a273efcf5c52 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 14 Aug 2015 19:35:19 +0200 Subject: [PATCH 091/427] Update team.txt --- team.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/team.txt b/team.txt index 072c674c..634bcee5 100644 --- a/team.txt +++ b/team.txt @@ -2,11 +2,11 @@ AuthMe-Team: Xephi (Xephi59) - Leader, Main developer darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author -Kloudy - Developer -Gnat008 - Developer +Kloudy - Developer (Inactive, Will be avariable soon) Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor -Trojaner25 - Ticket manager, Basic Developer +Gnat008 - Contributor +Trojaner25 - Ticket manager, Basic Developer (Need activation) irobin591 - DE Translator WaterCXubic - ZHHK Translator Bodyash - Russian/Ukrainian translator From 8c8f84ae4a91372ed0b9d4600dd7fc3b63104057 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 15 Aug 2015 19:52:12 +0200 Subject: [PATCH 092/427] Some fixes! Thanks to Koolaid5000 for the forcesinglesession fix idea! :+1: --- .../authme/listener/AuthMePlayerListener.java | 125 ++++++++++++------ 1 file changed, 87 insertions(+), 38 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 1b585f61..1b241052 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -15,14 +15,17 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; @@ -397,6 +400,61 @@ public class AuthMePlayerListener implements Listener { }, 300); } + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerJoin(PlayerJoinEvent e) { + final PlayerJoinEvent event = e; + + if (event.getPlayer() == null) { + return; + } + + // Shedule login task so works after the prelogin + // (Fix found by Koolaid5000) + Bukkit.getScheduler().runTask(plugin, new Runnable(){ + @Override + public void run() { + Player player = event.getPlayer(); + String name = player.getName().toLowerCase(); + + plugin.management.performJoin(player); + + // Remove the join message while the player isn't logging in + if ((Settings.enableProtection || Settings.delayJoinMessage) && name != null && event.getJoinMessage() != null) { + joinMessage.put(name, event.getJoinMessage()); + event.setJoinMessage(null); + } + } + }); + } + + @SuppressWarnings("deprecation") + @EventHandler(priority = EventPriority.HIGHEST) + public void onPreLogin(AsyncPlayerPreLoginEvent event){ + final String name = event.getName().toLowerCase(); + final Player player = Bukkit.getServer().getPlayer(name); + + // Check if forceSingleSession is set to true, so kick player that has + // joined with same nick of online player + if (plugin.dataManager.isOnline(player, name) && Settings.isForceSingleSessionEnabled) { + event.setKickMessage(m.send("same_nick")[0]); + event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); + if (LimboCache.getInstance().hasLimboPlayer(name)) + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); + if (limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { + Utils.getInstance().addNormal(player, limbo.getGroup()); + LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); + } + } + + }); + return; + } + } + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerLogin(PlayerLoginEvent event) { final Player player = event.getPlayer(); @@ -445,27 +503,6 @@ public class AuthMePlayerListener implements Listener { } } - // Check if forceSingleSession is set to true, so kick player that has - // joined with same nick of online player - if (plugin.dataManager.isOnline(player, name) && Settings.isForceSingleSessionEnabled) { - event.setKickMessage(m.send("same_nick")[0]); - event.setResult(PlayerLoginEvent.Result.KICK_OTHER); - if (LimboCache.getInstance().hasLimboPlayer(name)) - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); - if (player != null && limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - Utils.getInstance().addNormal(player, limbo.getGroup()); - LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); - } - } - - }); - return; - } - if (plugin.database.isAuthAvailable(name) && plugin.database.getType() != DataSource.DataSourceType.FILE) { PlayerAuth auth = plugin.database.getAuth(name); if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { @@ -564,23 +601,6 @@ public class AuthMePlayerListener implements Listener { } } - @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerJoin(PlayerJoinEvent event) { - if (event.getPlayer() == null) { - return; - } - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - plugin.management.performJoin(player); - - // Remove the join message while the player isn't logging in - if ((Settings.enableProtection || Settings.delayJoinMessage) && name != null && event.getJoinMessage() != null) { - joinMessage.put(name, event.getJoinMessage()); - event.setJoinMessage(null); - } - } - @EventHandler(priority = EventPriority.MONITOR) public void onPlayerQuit(PlayerQuitEvent event) { if (event.getPlayer() == null) { @@ -736,6 +756,35 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void playerHitPlayerEvent(EntityDamageByEntityEvent event) { + Entity damager = event.getDamager(); + if (!(damager instanceof Player)){ + return; + } + + Player player = (Player) damager; + String name = player.getName().toLowerCase(); + + if (Utils.getInstance().isUnrestricted(player)) { + return; + } + + if (plugin.getCitizensCommunicator().isNPC(player)) { + return; + } + + if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { + return; + } + + if (!plugin.database.isAuthAvailable(name) && !Settings.isForcedRegistrationEnabled) { + return; + } + + event.setCancelled(true); + } + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { if (event.getPlayer() == null) { From c88bad08c080748d58dbd09015aa98ea06467e3f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 15 Aug 2015 21:10:36 +0200 Subject: [PATCH 093/427] added nullcheck --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 1b241052..fda470e6 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -432,6 +432,9 @@ public class AuthMePlayerListener implements Listener { public void onPreLogin(AsyncPlayerPreLoginEvent event){ final String name = event.getName().toLowerCase(); final Player player = Bukkit.getServer().getPlayer(name); + + if (player == null) + return; // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player From 9d950b9b4a7d3c6f1cd02e26017676acace4b0a4 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Thu, 20 Aug 2015 18:39:40 +0200 Subject: [PATCH 094/427] Potential NPE --- .../xephi/authme/process/quit/AsyncronousQuit.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 585ab6fa..40a71247 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -21,7 +21,7 @@ public class AsyncronousQuit { protected AuthMe plugin; protected DataSource database; - protected Player p; + protected Player player; protected Utils utils = Utils.getInstance(); private String name; private ItemStack[] armor = null; @@ -33,7 +33,7 @@ public class AsyncronousQuit { public AsyncronousQuit(Player p, AuthMe plugin, DataSource database, boolean isKick) { - this.p = p; + this.player = p; this.plugin = plugin; this.database = database; this.name = p.getName().toLowerCase(); @@ -41,7 +41,8 @@ public class AsyncronousQuit { } public void process() { - final Player player = p; + if (player == null) + return; if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { return; } @@ -64,7 +65,8 @@ public class AsyncronousQuit { inv = limbo.getInventory(); armor = limbo.getArmour(); } - utils.addNormal(player, limbo.getGroup()); + if (limbo.getGroup() != null && !limbo.getGroup().equals("")) + utils.addNormal(player, limbo.getGroup()); needToChange = true; isOp = limbo.getOperator(); isFlying = limbo.isFlying(); @@ -94,6 +96,7 @@ public class AsyncronousQuit { database.setUnlogged(name); } AuthMePlayerListener.gameMode.remove(name); - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, player, inv, armor, isOp, isFlying, needToChange)); + final Player p = player; + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, p, inv, armor, isOp, isFlying, needToChange)); } } From b84d96360e83c8e44a6d6d1f54e0c243bb421735 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Thu, 20 Aug 2015 18:49:22 +0200 Subject: [PATCH 095/427] TEMP FIX - Catch all Exception instance due to HikariCP thrown --- .../fr/xephi/authme/datasource/MySQL.java | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 9509192d..201e6f14 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -196,7 +196,7 @@ public class MySQL implements DataSource { pst.setString(1, user); rs = pst.executeQuery(); return rs.next(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -246,7 +246,7 @@ public class MySQL implements DataSource { } else { return null; } - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return null; } finally { @@ -456,7 +456,7 @@ public class MySQL implements DataSource { if (rs != null && !rs.isClosed()) rs.close(); } - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -501,7 +501,7 @@ public class MySQL implements DataSource { if (rs != null && !rs.isClosed()) rs.close(); } - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -523,7 +523,7 @@ public class MySQL implements DataSource { pst.setString(3, auth.getRealName()); pst.setString(4, auth.getNickname()); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -542,7 +542,7 @@ public class MySQL implements DataSource { pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + "(); } finally { @@ -606,7 +606,7 @@ public class MySQL implements DataSource { pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, user); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -629,7 +629,7 @@ public class MySQL implements DataSource { pst.setString(4, auth.getWorld()); pst.setString(5, auth.getNickname()); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -654,7 +654,7 @@ public class MySQL implements DataSource { countIp++; } return countIp; - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return 0; } finally { @@ -674,7 +674,7 @@ public class MySQL implements DataSource { pst.setString(1, auth.getEmail()); pst.setString(2, auth.getNickname()); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -697,7 +697,7 @@ public class MySQL implements DataSource { pst.setString(1, auth.getSalt()); pst.setString(2, auth.getNickname()); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -732,7 +732,7 @@ public class MySQL implements DataSource { if (st != null) { try { st.close(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); } } @@ -742,7 +742,7 @@ public class MySQL implements DataSource { if (rs != null) { try { rs.close(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); } } @@ -752,7 +752,7 @@ public class MySQL implements DataSource { if (con != null) { try { con.close(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); } } @@ -773,7 +773,7 @@ public class MySQL implements DataSource { countIp.add(rs.getString(columnName)); } return countIp; - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); } finally { @@ -798,7 +798,7 @@ public class MySQL implements DataSource { countIp.add(rs.getString(columnName)); } return countIp; - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); } finally { @@ -823,7 +823,7 @@ public class MySQL implements DataSource { countEmail.add(rs.getString(columnName)); } return countEmail; - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); } finally { @@ -844,7 +844,7 @@ public class MySQL implements DataSource { pst.setString(1, name); pst.executeUpdate(); } - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); } finally { close(pst); @@ -890,7 +890,7 @@ public class MySQL implements DataSource { while (con == null) try { con = ds.getConnection(); - } catch (SQLException e) { + } catch (Exception e) { try { reconnect(false); con = ds.getConnection(); @@ -937,7 +937,7 @@ public class MySQL implements DataSource { rs = pst.executeQuery(); if (rs.next()) return (rs.getInt(columnLogged) == 1); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -958,7 +958,7 @@ public class MySQL implements DataSource { pst.setInt(1, 1); pst.setString(2, user); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -979,7 +979,7 @@ public class MySQL implements DataSource { pst.setInt(1, 0); pst.setString(2, user); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -999,7 +999,7 @@ public class MySQL implements DataSource { pst.setInt(1, 0); pst.setInt(2, 1); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -1022,7 +1022,7 @@ public class MySQL implements DataSource { if (rs != null && rs.next()) { result = rs.getInt(1); } - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return result; } finally { @@ -1042,7 +1042,7 @@ public class MySQL implements DataSource { pst.setString(1, newone); pst.setString(2, oldone); pst.executeUpdate(); - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -1092,7 +1092,7 @@ public class MySQL implements DataSource { if (pAuth != null) auths.add(pAuth); } - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return auths; } finally { @@ -1143,7 +1143,7 @@ public class MySQL implements DataSource { if (pAuth != null) auths.add(pAuth); } - } catch (SQLException ex) { + } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return auths; } finally { From 86e1b8df7c1c4dc3b6387065fb79e81da11a75fb Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Thu, 20 Aug 2015 18:59:41 +0200 Subject: [PATCH 096/427] Define a max life time of a pool --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 201e6f14..45c9c651 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -121,6 +121,7 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); + config.setMaxLifetime(12000); config.setInitializationFailFast(false); ds = new HikariDataSource(config); ConsoleLogger.info("Connection pool ready"); @@ -914,6 +915,7 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); config.setInitializationFailFast(false); + config.setMaxLifetime(12000); config.setPoolName("AuthMeMYSQLPool"); ds = new HikariDataSource(config); if (!reload) From e1eb22239ac934fa024770c175b39c0698a1d22d Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Thu, 20 Aug 2015 23:29:02 +0200 Subject: [PATCH 097/427] Add Third Party PreLogin Event --- .../events/AuthMeAsyncPreLoginEvent.java | 41 +++++++++++++++++++ .../process/login/AsyncronousLogin.java | 5 +++ 2 files changed, 46 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java diff --git a/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java b/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java new file mode 100644 index 00000000..d93b2114 --- /dev/null +++ b/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java @@ -0,0 +1,41 @@ +package fr.xephi.authme.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * + * This event is call when AuthMe try to teleport a player + * + * @author Xephi59 + */ +public class AuthMeAsyncPreLoginEvent extends Event { + + private Player player; + private boolean canLogin = true; + private static final HandlerList handlers = new HandlerList(); + + public AuthMeAsyncPreLoginEvent(Player player) { + super(true); + this.player = player; + } + + public Player getPlayer() { + return player; + } + + public boolean canLogin() { + return canLogin; + } + + public void setCanLogin(boolean canLogin) { + this.canLogin = canLogin; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + +} diff --git a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java index e7c49af8..302203b7 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java @@ -13,6 +13,7 @@ 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.AuthMeAsyncPreLoginEvent; import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.security.RandomString; @@ -113,6 +114,10 @@ public class AsyncronousLogin { m.send(player, "vb_nonActiv"); return null; } + AuthMeAsyncPreLoginEvent event = new AuthMeAsyncPreLoginEvent(player); + Bukkit.getServer().getPluginManager().callEvent(event); + if (!event.canLogin()) + return null; return pAuth; } From cd0659ac894a1775b5041de0a8561f86c266b412 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Thu, 20 Aug 2015 23:30:31 +0200 Subject: [PATCH 098/427] ahah copy/paste spotted :D --- .../java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java b/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java index d93b2114..1995fbd0 100644 --- a/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java +++ b/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java @@ -6,7 +6,7 @@ import org.bukkit.event.HandlerList; /** * - * This event is call when AuthMe try to teleport a player + * This event is call when a player try to /login * * @author Xephi59 */ From c12e24d0f8d3582e11550c9d334118db4db707bf Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 21 Aug 2015 23:35:44 +0200 Subject: [PATCH 099/427] Added stacktraces to find out what's the problem -_- --- src/main/java/fr/xephi/authme/cache/backup/FileCache.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 2a4b09eb..08eecab9 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -505,8 +505,10 @@ public class FileCache { else armours[i] = item; } } catch (final RuntimeException e) { + e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); } catch (final Exception e) { + e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); } finally { if (reader != null) @@ -515,9 +517,11 @@ public class FileCache { return new DataFileCache(inv, armours, group, op, flying); } } catch (RuntimeException e) { + e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); return null; } catch (Exception e) { + e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); return null; } From c7a711d0b2b20e825d273d78433af44441860f74 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sat, 22 Aug 2015 15:30:17 +0200 Subject: [PATCH 100/427] Add Try/catch to DataSource close --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 7 +++++-- 1 file changed, 5 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 45c9c651..8803c874 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -710,8 +710,11 @@ public class MySQL implements DataSource { @Override public synchronized void close() { - if (ds != null) - ds.close(); + try { + if (ds != null) + ds.close(); + } catch (Exception e) { + } } @Override From 217c217d13031f56f3ada74fcc508de4bcbd0ab3 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 22 Aug 2015 16:34:06 +0200 Subject: [PATCH 101/427] Stuff --- pom.xml | 2 +- .../xephi/authme/cache/backup/FileCache.java | 4 ++++ .../java/fr/xephi/authme/datasource/MySQL.java | 18 ++++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 2eab1959..c5f2e8f6 100644 --- a/pom.xml +++ b/pom.xml @@ -180,7 +180,7 @@ com.zaxxer HikariCP - 2.4.0 + 2.4.1 compile diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 08eecab9..f06b63f0 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -505,9 +505,11 @@ public class FileCache { else armours[i] = item; } } catch (final RuntimeException e) { + //verbose e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); } catch (final Exception e) { + //verbose e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); } finally { @@ -517,10 +519,12 @@ public class FileCache { return new DataFileCache(inv, armours, group, op, flying); } } catch (RuntimeException e) { + // Verbose e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); return null; } catch (Exception e) { + // Verbose e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); return null; diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 45c9c651..b6cfd5a6 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -113,16 +113,19 @@ public class MySQL implements DataSource { throws ClassNotFoundException, SQLException, TimeoutException, NumberFormatException, PoolInitializationException { HikariConfig config = new HikariConfig(); + config.setPoolName("AuthMeMYSQLPool"); + config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); - config.setPoolName("AuthMeMYSQLPool"); config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); - config.setMaxLifetime(12000); - config.setInitializationFailFast(false); + config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable + config.setMaxLifetime(12000); // 12 Sec + config.setIdleTimeout(120000); // 2 Min + config.setMaximumPoolSize(50); // 50 Connections (including idle connections) ds = new HikariDataSource(config); ConsoleLogger.info("Connection pool ready"); } @@ -907,6 +910,8 @@ public class MySQL implements DataSource { if (ds != null) ds.close(); HikariConfig config = new HikariConfig(); + config.setPoolName("AuthMeMYSQLPool"); + config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); @@ -914,9 +919,10 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); - config.setInitializationFailFast(false); - config.setMaxLifetime(12000); - config.setPoolName("AuthMeMYSQLPool"); + config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable + config.setMaxLifetime(12000); // 12 Sec + config.setIdleTimeout(120000); // 2 Min + config.setMaximumPoolSize(50); // 50 Connections (including idle connections) ds = new HikariDataSource(config); if (!reload) ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!"); From be3cdaba88fc5244a4362f26e95dc9661bfd8958 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Mon, 24 Aug 2015 12:09:54 +0200 Subject: [PATCH 102/427] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2eab1959..c5f2e8f6 100644 --- a/pom.xml +++ b/pom.xml @@ -180,7 +180,7 @@ com.zaxxer HikariCP - 2.4.0 + 2.4.1 compile From fa6e048c21a79dec518e7aaeef4a298108dfe291 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 26 Aug 2015 18:55:33 +0200 Subject: [PATCH 103/427] Fix DriverClassName not properly set --- pom.xml | 1059 +++++++++-------- .../fr/xephi/authme/datasource/MySQL.java | 1 + 2 files changed, 533 insertions(+), 527 deletions(-) diff --git a/pom.xml b/pom.xml index 2eab1959..409c7307 100644 --- a/pom.xml +++ b/pom.xml @@ -1,571 +1,576 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - fr.xephi - authme - 5.0-SNAPSHOT + fr.xephi + authme + 5.0-SNAPSHOT - AuthMeReloaded - Authentication plugin for CraftBukkit/Spigot! - 2013 - http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ - + AuthMeReloaded + Authentication plugin for CraftBukkit/Spigot! + 2013 + http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ + - - scm:git:https://github.com/Xephi/AuthMeReloaded.git - scm:git:git@github.com:Xephi/AuthMeReloaded.git - http://github.com/Xephi/AuthMeReloaded - + + scm:git:https://github.com/Xephi/AuthMeReloaded.git + scm:git:git@github.com:Xephi/AuthMeReloaded.git + http://github.com/Xephi/AuthMeReloaded + - - - jenkins - http://ci.xephi.fr/job/AuthMeReloaded/ - + + + jenkins + http://ci.xephi.fr/job/AuthMeReloaded/ + - - GitHub - https://github.com/Xephi/AuthMeReloaded/issues - + + GitHub + https://github.com/Xephi/AuthMeReloaded/issues + - - - The GNU General Public Licence version 3 (GPLv3) - http://www.gnu.org/licenses/gpl-3.0.html - - + + + The GNU General Public Licence version 3 (GPLv3) + http://www.gnu.org/licenses/gpl-3.0.html + + - - UTF-8 - - 1.7 - - 1.8.8-R0.1-SNAPSHOT - + + UTF-8 + + 1.7 + + 1.8.8-R0.1-SNAPSHOT + - - AuthMe-${project.version} - - - . - true - ${basedir}/src/main/resources/ - - *.yml - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - 1.7 - ${javaVersion} - - - - org.apache.maven.plugins - maven-shade-plugin - 2.4.1 - - - - com.maxmind.geoip:* - javax.mail:* - com.sun.mail:* - com.comphenix.attribute:* - org.mcstats.*:* - com.zaxxer:* - org.slf4j:* - - - - - org.mcstats - fr.xephi.authme - - - - - - package - - shade - - - - - - + + AuthMe-${project.version} + + + . + true + ${basedir}/src/main/resources/ + + *.yml + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.7 + ${javaVersion} + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.1 + + + + com.maxmind.geoip:* + javax.mail:* + com.sun.mail:* + com.comphenix.attribute:* + org.mcstats.*:* + com.zaxxer:* + org.slf4j:* + + + + + org.mcstats + fr.xephi.authme + + + + + + package + + shade + + + + + + - + - - - spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public - + + + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public + - - - ess-repo - https://ci.drtshock.net/plugin/repository/everything - + + + ess-repo + https://ci.drtshock.net/plugin/repository/everything + - - - citizensapi-repo - http://ci.citizensnpcs.co/plugin/repository/project/CitizensAPI/LastSuccessful/repository - + + + citizensapi-repo + http://ci.citizensnpcs.co/plugin/repository/project/CitizensAPI/LastSuccessful/repository + - - - minelink-thirdparty - http://repo.minelink.net/content/repositories/public - + + + minelink-thirdparty + http://repo.minelink.net/content/repositories/public + - - - comphenix-snapshots - http://repo.comphenix.net/content/repositories/public - + + + comphenix-snapshots + http://repo.comphenix.net/content/repositories/public + - - - onarandombox - http://repo.onarandombox.com/content/groups/public - + + + onarandombox + http://repo.onarandombox.com/content/groups/public + - - - vault-repo - http://nexus.theyeticave.net/content/repositories/pub_releases - + + + vault-repo + http://nexus.theyeticave.net/content/repositories/pub_releases + - - - luricos-releases - http://repo.luricos.de/content/repositories/releases - + + + luricos-releases + http://repo.luricos.de/content/repositories/releases + - - - xephi-repo - http://ci.xephi.fr/plugin/repository/everything/ - + + + xephi-repo + http://ci.xephi.fr/plugin/repository/everything/ + - - - mcstats-snapshots - http://repo.mcstats.org/content/repositories/snapshots/ - + + + mcstats-snapshots + http://repo.mcstats.org/content/repositories/snapshots/ + - + - + - + - - - org.slf4j - slf4j-simple - 1.7.12 - compile - - - com.zaxxer - HikariCP - 2.4.0 - compile - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-simple - - - + + + mysql + mysql-connector-java + 5.1.36 + + + org.slf4j + slf4j-simple + 1.7.12 + compile + + + com.zaxxer + HikariCP + 2.4.0 + compile + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + - - - org.xerial - sqlite-jdbc - 3.8.11.1 - compile - + + + org.xerial + sqlite-jdbc + 3.8.11.1 + compile + - - - com.sun.mail - javax.mail - 1.5.4 - compile - + + + com.sun.mail + javax.mail + 1.5.4 + compile + - - - com.maxmind.geoip - geoip-api - 1.2.15 - compile - + + + com.maxmind.geoip + geoip-api + 1.2.15 + compile + - - - org.mcstats.bukkit - metrics - R8-SNAPSHOT - compile - - - org.bukkit - bukkit - - - + + + org.mcstats.bukkit + metrics + R8-SNAPSHOT + compile + + + org.bukkit + bukkit + + + - - - org.bukkit - bukkit - ${bukkitVersion} - provided - + + + org.bukkit + bukkit + ${bukkitVersion} + provided + - - - com.comphenix.attribute - AttributeStorage - 0.0.2-SNAPSHOT - compile - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + com.comphenix.attribute + AttributeStorage + 0.0.2-SNAPSHOT + compile + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - net.milkbowl.vault - VaultAPI - 1.5 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + net.milkbowl.vault + VaultAPI + 1.5 + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - net.citizensnpcs - citizensapi - 2.0.16-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + net.citizensnpcs + citizensapi + 2.0.16-SNAPSHOT + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - com.onarandombox.multiversecore - Multiverse-Core - 2.5 - jar - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - AllPay - com.fernferret.allpay - - - Vault - net.milkbowl.vault - - - CommandHandler - com.pneumaticraft.commandhandler - - - + + + com.onarandombox.multiversecore + Multiverse-Core + 2.5 + jar + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + AllPay + com.fernferret.allpay + + + Vault + net.milkbowl.vault + + + CommandHandler + com.pneumaticraft.commandhandler + + + - - - net.ess3 - EssentialsX - 2.0.1-SNAPSHOT - provided - - - org.spigotmc - spigot-api - - - + + + net.ess3 + EssentialsX + 2.0.1-SNAPSHOT + provided + + + org.spigotmc + spigot-api + + + - - - net.minelink - CombatTagPlus - 1.2.1-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - CombatTagPlusHook - net.minelink - - - CombatTagPlusFactions-v1_6 - net.minelink - - - CombatTagPlusCompat-v1_7_R3 - net.minelink - - - CombatTagPlusFactions-v1_8 - net.minelink - - - CombatTagPlusCompat-v1_7_R4 - net.minelink - - - CombatTagPlusWG-v5 - net.minelink - - - CombatTagPlusWG-v6 - net.minelink - - - CombatTagPlusCompat-API - net.minelink - - - CombatTagPlusFactions-v2_6 - net.minelink - - - CombatTagPlusCompat-v1_8_R3 - net.minelink - - - CombatTagPlusFactions-v2_7 - net.minelink - - - CombatTagPlusCompat-v1_8_R2 - net.minelink - - - CombatTagPlusCompat-v1_8_R1 - net.minelink - - - metrics-lite - org.mcstats.bukkit - - - + + + net.minelink + CombatTagPlus + 1.2.1-SNAPSHOT + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + CombatTagPlusHook + net.minelink + + + CombatTagPlusFactions-v1_6 + net.minelink + + + CombatTagPlusCompat-v1_7_R3 + net.minelink + + + CombatTagPlusFactions-v1_8 + net.minelink + + + CombatTagPlusCompat-v1_7_R4 + net.minelink + + + CombatTagPlusWG-v5 + net.minelink + + + CombatTagPlusWG-v6 + net.minelink + + + CombatTagPlusCompat-API + net.minelink + + + CombatTagPlusFactions-v2_6 + net.minelink + + + CombatTagPlusCompat-v1_8_R3 + net.minelink + + + CombatTagPlusFactions-v2_7 + net.minelink + + + CombatTagPlusCompat-v1_8_R2 + net.minelink + + + CombatTagPlusCompat-v1_8_R1 + net.minelink + + + metrics-lite + org.mcstats.bukkit + + + - - - com.trc202 - CombatTag - 6.2.1-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - + + + com.trc202 + CombatTag + 6.2.1-SNAPSHOT + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + - - - de.luricos.bukkit - xAuth - 2.6 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - updater - net.gravitydevelopment.updater - - - lombok - org.projectlombok - - - EssentialsGroupManager - net.ess3 - - - PermissionsEx - ru.tehkode - - - AccountsClient - com.mojang - - - + + + de.luricos.bukkit + xAuth + 2.6 + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + updater + net.gravitydevelopment.updater + + + lombok + org.projectlombok + + + EssentialsGroupManager + net.ess3 + + + PermissionsEx + ru.tehkode + + + AccountsClient + com.mojang + + + - - - com.acrobot.chestshop - chestshop - 3.8.12 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - Vault - net.milkbowl.vault - - - odditem - info.somethingodd - - - scrollingmenusign - me.desht - - - truezip - de.schlichtherle - - - residence - net.t00thpick1 - - - Heroes - com.herocraftonline.heroes - - - HeroChat - com.dthielke.herochat - - - worldguard - com.sk89q - - - worldedit - com.sk89q - - - lwc - com.griefcraft.lwc - - - js - rhino - - - jchronic - com.sk89q - - - deadbolt - com.daemitus.deadbolt - - - bukkit-classloader-check - com.sk89q.spigot - - - jsr305 - com.google.code.findbugs - - - opencsv - net.sf.opencsv - - - simplechestlock - + + + com.acrobot.chestshop + chestshop + 3.8.12 + provided + + + org.bukkit + bukkit + + + org.bukkit + craftbukkit + + + Vault + net.milkbowl.vault + + + odditem + info.somethingodd + + + scrollingmenusign + me.desht + + + truezip + de.schlichtherle + + + residence + net.t00thpick1 + + + Heroes + com.herocraftonline.heroes + + + HeroChat + com.dthielke.herochat + + + worldguard + com.sk89q + + + worldedit + com.sk89q + + + lwc + com.griefcraft.lwc + + + js + rhino + + + jchronic + com.sk89q + + + deadbolt + com.daemitus.deadbolt + + + bukkit-classloader-check + com.sk89q.spigot + + + jsr305 + com.google.code.findbugs + + + opencsv + net.sf.opencsv + + + simplechestlock + com.webkonsept.bukkit.simplechestlock - - - commandbook - com.sk89q - - - lockette - org.yi.acru.bukkit.lockette - - - + + + commandbook + com.sk89q + + + lockette + org.yi.acru.bukkit.lockette + + + - + diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 8803c874..89d9fd85 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -113,6 +113,7 @@ public class MySQL implements DataSource { throws ClassNotFoundException, SQLException, TimeoutException, NumberFormatException, PoolInitializationException { HikariConfig config = new HikariConfig(); + config.setDriverClassName("com.mysql.jdbc.Driver"); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); From 568784a8e19566ea4c2f91600a6e9cab59a85794 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 26 Aug 2015 22:52:23 +0100 Subject: [PATCH 104/427] test new mysql (not working yet) --- .../fr/xephi/authme/datasource/MySQL.java | 270 ++++++++---------- 1 file changed, 117 insertions(+), 153 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index ac11a602..61cf015d 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -8,7 +8,6 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.TimeoutException; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; @@ -45,7 +44,7 @@ public class MySQL implements DataSource { private HikariDataSource ds; private String columnRealName; - public MySQL() { + public MySQL() throws ClassNotFoundException, SQLException, PoolInitializationException { this.host = Settings.getMySQLHost; this.port = Settings.getMySQLPort; this.username = Settings.getMySQLUsername; @@ -67,76 +66,112 @@ public class MySQL implements DataSource { this.columnID = Settings.getMySQLColumnId; this.columnLogged = Settings.getMySQLColumnLogged; this.columnRealName = Settings.getMySQLColumnRealName; + + // Set the connection arguments (and check if connection is ok) try { - this.connect(); - this.setup(); - } catch (ClassNotFoundException e) { - ConsoleLogger.showError(e.getMessage()); + this.setConnectionArguments(); + } catch (ClassNotFoundException ne) { + ConsoleLogger.showError(ne.getMessage()); + ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer! SHUTDOWN..."); + this.close(); if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use MySQL... Please input correct MySQL informations ! SHUTDOWN..."); AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + throw new ClassNotFoundException(ne.getMessage()); + } catch (IllegalArgumentException ae) { // This means that there are problems with the hikaricp pool arguments! + ConsoleLogger.showError(ae.getMessage()); + ConsoleLogger.showError("Invalid database arguments! Please check your configuration!"); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + this.close(); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + throw new IllegalArgumentException(ae); + } catch (PoolInitializationException ie) { // Can't initialize the connection pool! + ConsoleLogger.showError(ie.getMessage()); + ConsoleLogger.showError("Can't connect to the MySql database! Please check your configuration!"); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + this.close(); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + throw new PoolInitializationException(ie); + } + + // Initialize the database + try { + this.setupConnection(); } catch (SQLException e) { ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.showError("Can't initialize the MySQL database... Please check your database settings in the config.yml file! SHUTDOWN..."); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + this.close(); if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use MySQL... Please input correct MySQL informations ! SHUTDOWN..."); AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; - } catch (TimeoutException e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use MySQL... Please input correct MySQL informations ! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) + } else { AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; - } catch (PoolInitializationException e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use MySQL... Please input correct MySQL informations ! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); } - if (!Settings.isStopEnabled) - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; + throw new SQLException(e); } } - private synchronized void connect() - throws ClassNotFoundException, SQLException, TimeoutException, - NumberFormatException, PoolInitializationException { - HikariConfig config = new HikariConfig(); + private synchronized void setConnectionArguments() + throws ClassNotFoundException, IllegalArgumentException { + HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeMYSQLPool"); - config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); - config.setDriverClassName("com.mysql.jdbc.Driver"); + config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); - config.addDataSourceProperty("autoReconnect", true); + config.addDataSourceProperty("autoReconnect", false); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable - config.setMaxLifetime(12000); // 12 Sec - config.setIdleTimeout(120000); // 2 Min + config.setMaxLifetime(60000); // 60 Sec + config.setIdleTimeout(45000); // 45 Sec config.setMaximumPoolSize(50); // 50 Connections (including idle connections) ds = new HikariDataSource(config); - ConsoleLogger.info("Connection pool ready"); + ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } - private synchronized void setup() throws SQLException { + private synchronized void reloadArguments() + throws ClassNotFoundException, IllegalArgumentException { + if (ds != null){ + ds.close(); + } + setConnectionArguments(); + ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!"); + } + + private synchronized Connection getConnection() { + Connection con = null; + while(con == null){ + try { + con = ds.getConnection(); + } catch (SQLException ce) { + return null; + } + } + return con; + } + + private synchronized void setupConnection() throws SQLException { Connection con = null; Statement st = null; ResultSet rs = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); st = con.createStatement(); st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" + columnID + " INTEGER AUTO_INCREMENT," + columnName + " VARCHAR(255) NOT NULL UNIQUE," + columnPassword + " VARCHAR(255) NOT NULL," + columnIp + " VARCHAR(40) NOT NULL DEFAULT '127.0.0.1'," + columnLastLogin + " BIGINT NOT NULL DEFAULT '" + System.currentTimeMillis() + "'," + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT '" + Settings.defaultWorld + "'," + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com'," + columnLogged + " SMALLINT NOT NULL DEFAULT '0'," + "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));"); rs = con.getMetaData().getColumns(null, null, tableName, columnPassword); @@ -188,6 +223,7 @@ public class MySQL implements DataSource { close(st); close(con); } + ConsoleLogger.info("MySQL Setup finished"); } @Override @@ -196,7 +232,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); pst.setString(1, user); rs = pst.executeQuery(); @@ -220,7 +256,7 @@ public class MySQL implements DataSource { PlayerAuth pAuth = null; int id = -1; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); pst.setString(1, user); rs = pst.executeQuery(); @@ -267,7 +303,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); if ((columnSalt == null || columnSalt.isEmpty()) || (auth.getSalt() == null || auth.getSalt().isEmpty())) { pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnRealName + ") VALUES (?,?,?,?,?);"); pst.setString(1, auth.getNickname()); @@ -476,7 +512,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnPassword + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getHash()); pst.setString(2, auth.getNickname()); @@ -521,7 +557,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=?, " + columnRealName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getIp()); pst.setLong(2, auth.getLastLogin()); @@ -543,7 +579,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + " list = new ArrayList(); try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + " countIp = new ArrayList(); try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, auth.getIp()); rs = pst.executeQuery(); @@ -798,7 +834,7 @@ public class MySQL implements DataSource { ResultSet rs = null; List countIp = new ArrayList(); try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, ip); rs = pst.executeQuery(); @@ -823,7 +859,7 @@ public class MySQL implements DataSource { ResultSet rs = null; List countEmail = new ArrayList(); try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); pst.setString(1, email); rs = pst.executeQuery(); @@ -847,7 +883,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { for (String name : banned) { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, name); pst.executeUpdate(); @@ -860,78 +896,6 @@ public class MySQL implements DataSource { } } - private synchronized Connection makeSureConnectionIsReady() { - Connection con = null; - try { - con = ds.getConnection(); - } catch (Exception te) { - try { - con = null; - reconnect(false); - } catch (Exception e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't reconnect to MySQL database... Please check your MySQL informations ! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - } catch (AssertionError ae) { - // Make sure assertionerror is caused by the connectionpoolmanager, - // else re-throw it - if (!ae.getMessage().equalsIgnoreCase("AuthMeDatabaseError")) - throw new AssertionError(ae.getMessage()); - try { - con = null; - reconnect(false); - } catch (Exception e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't reconnect to MySQL database... Please check your MySQL informations ! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - } - while (con == null) - try { - con = ds.getConnection(); - } catch (Exception e) { - try { - reconnect(false); - con = ds.getConnection(); - } catch (Exception ex) { - } - } - return con; - } - - private synchronized void reconnect(boolean reload) - throws ClassNotFoundException, SQLException, TimeoutException, - PoolInitializationException { - if (ds != null) - ds.close(); - HikariConfig config = new HikariConfig(); - config.setPoolName("AuthMeMYSQLPool"); - config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); - config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); - config.setUsername(this.username); - config.setPassword(this.password); - config.addDataSourceProperty("cachePrepStmts", "true"); - config.addDataSourceProperty("prepStmtCacheSize", "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); - config.addDataSourceProperty("autoReconnect", true); - config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable - config.setMaxLifetime(12000); // 12 Sec - config.setIdleTimeout(120000); // 2 Min - config.setMaximumPoolSize(50); // 50 Connections (including idle connections) - ds = new HikariDataSource(config); - if (!reload) - ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!"); - } - @Override public DataSourceType getType() { return DataSourceType.MYSQL; @@ -943,7 +907,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, user); rs = pst.executeQuery(); @@ -965,7 +929,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setInt(1, 1); pst.setString(2, user); @@ -986,7 +950,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; if (user != null) try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setInt(1, 0); pst.setString(2, user); @@ -1006,7 +970,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnLogged + "=?;"); pst.setInt(1, 0); pst.setInt(2, 1); @@ -1028,7 +992,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";"); rs = pst.executeQuery(); if (rs != null && rs.next()) { @@ -1049,7 +1013,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, newone); pst.setString(2, oldone); @@ -1071,7 +1035,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); rs = pst.executeQuery(); while (rs.next()) { @@ -1122,7 +1086,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = makeSureConnectionIsReady(); + con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); rs = pst.executeQuery(); while (rs.next()) { From 7c9298f096c31b20f370c07c8eac76f3775acca7 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 27 Aug 2015 00:21:53 +0100 Subject: [PATCH 105/427] More unstuble stuff! (Now it compiles) --- src/main/java/fr/xephi/authme/AuthMe.java | 17 +- .../xephi/authme/commands/AdminCommand.java | 36 +- .../authme/datasource/SQLite_HIKARI.java | 342 ++++++++++-------- .../xephi/authme/modules/ModuleManager.java | 6 +- 4 files changed, 248 insertions(+), 153 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 7ed3dd9f..131991dc 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -10,6 +10,7 @@ import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.net.URLConnection; +import java.sql.SQLException; import java.util.Calendar; import java.util.Collection; import java.util.Date; @@ -34,6 +35,7 @@ import org.mcstats.Metrics; import com.earth2me.essentials.Essentials; import com.maxmind.geoip.LookupService; import com.onarandombox.MultiverseCore.MultiverseCore; +import com.zaxxer.hikari.pool.PoolInitializationException; import fr.xephi.authme.api.API; import fr.xephi.authme.api.NewAPI; @@ -214,7 +216,18 @@ public class AuthMe extends JavaPlugin { else ConsoleLogger.showError("Error while performing the backup!"); } - setupDatabase(); + try { + setupDatabase(); + } catch (ClassNotFoundException nfe) { + ConsoleLogger.showError("Fatal error occurred! Authme initialization ABORTED!"); + return; + } catch (SQLException sqle) { + ConsoleLogger.showError("Fatal error occurred! Authme initialization ABORTED!"); + return; + } catch (PoolInitializationException pie) { + ConsoleLogger.showError("Fatal error occurred! Authme initialization ABORTED!"); + return; + } dataManager = new DataManager(this); @@ -800,7 +813,7 @@ public class AuthMe extends JavaPlugin { return realIP; } - public void setupDatabase() { + public void setupDatabase() throws ClassNotFoundException, PoolInitializationException, SQLException { /* * Backend MYSQL - FILE - SQLITE */ diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 28f4519b..25e77322 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.security.NoSuchAlgorithmException; +import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -22,6 +23,8 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; +import com.zaxxer.hikari.pool.PoolInitializationException; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -143,7 +146,38 @@ public class AdminCommand implements CommandExecutor { Settings.reloadConfigOptions(newConfig); m.reloadMessages(); plugin.database.close(); - plugin.setupDatabase(); + + try { + plugin.setupDatabase(); + } catch (ClassNotFoundException nfe) { + ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + return false; + } catch (SQLException sqle) { + ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + return false; + } catch (PoolInitializationException pie) { + ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + return false; + } + m.send(sender, "reload"); } else if (args[0].equalsIgnoreCase("lastlogin")) { if (args.length != 2) { diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 6f1350e3..767a5da7 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -1,6 +1,5 @@ package fr.xephi.authme.datasource; -import java.io.EOFException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -8,10 +7,10 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; -import java.util.Properties; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; +import com.zaxxer.hikari.pool.PoolInitializationException; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; @@ -38,7 +37,7 @@ public class SQLite_HIKARI implements DataSource { private String columnLogged; private String columnRealName; - public SQLite_HIKARI() { + public SQLite_HIKARI() throws ClassNotFoundException, SQLException, PoolInitializationException { this.database = Settings.getMySQLDatabase; this.tableName = Settings.getMySQLTablename; this.columnName = Settings.getMySQLColumnName; @@ -56,65 +55,127 @@ public class SQLite_HIKARI implements DataSource { this.columnLogged = Settings.getMySQLColumnLogged; this.columnRealName = Settings.getMySQLColumnRealName; + // Set the connection arguments (and check if connection is ok) try { - this.connect(); - this.setup(); - } catch (ClassNotFoundException e) { - ConsoleLogger.showError(e.getMessage()); + this.setConnectionArguments(); + } catch (ClassNotFoundException ne) { + ConsoleLogger.showError(ne.getMessage()); + ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer! SHUTDOWN..."); + this.close(); if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use SQLITE... ! SHUTDOWN..."); AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + throw new ClassNotFoundException(ne.getMessage()); + } catch (IllegalArgumentException ae) { // This means that there are problems with the hikaricp pool arguments! + ConsoleLogger.showError(ae.getMessage()); + ConsoleLogger.showError("Invalid database arguments! Please check your configuration!"); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + this.close(); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + throw new IllegalArgumentException(ae); + } catch (PoolInitializationException ie) { // Can't initialize the connection pool! + ConsoleLogger.showError(ie.getMessage()); + ConsoleLogger.showError("Can't connect to the SQLite database! Please check your configuration!"); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + this.close(); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + throw new PoolInitializationException(ie); + } + + // Initialize the database + try { + this.setupConnection(); } catch (SQLException e) { ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.showError("Can't initialize the MySQL database... Please check your database settings in the config.yml file! SHUTDOWN..."); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + this.close(); if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use SQLITE... ! SHUTDOWN..."); AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; - } catch (EOFException e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use SQLITE... ! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) + } else { AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; + } + throw new SQLException(e); } } - private Connection getConnection() throws SQLException, EOFException { - return this.ds.getConnection(); + @Override + public DataSourceType getType() { + return DataSourceType.SQLITE; } - private synchronized void connect() - throws ClassNotFoundException, SQLException, EOFException { - /* - * Class.forName("org.sqlite.JDBC"); ConsoleLogger.info( - * "SQLite driver loaded"); this.con = - * DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database - * + ".db"); - */ - Properties props = new Properties(); - props.setProperty("dataSourceClassName", "org.sqlite.SQLiteDataSource"); - HikariConfig config = new HikariConfig(props); - config.setPoolName("AuthMeSQLiteLPool"); + private synchronized void setConnectionArguments() + throws ClassNotFoundException, IllegalArgumentException { + HikariConfig config = new HikariConfig(); + config.setPoolName("AuthMeSQLitePool"); + config.setDataSourceClassName("org.sqlite.SQLiteDataSource"); + config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); + config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable + config.setConnectionTestQuery("SELECT 1"); + config.setMaxLifetime(60000); // 60 Sec + config.setIdleTimeout(45000); // 45 Sec + config.setMaximumPoolSize(50); // 50 Connections (including idle connections) ds = new HikariDataSource(config); - ConsoleLogger.info("Connection pool ready"); + ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } - private synchronized void setup() throws SQLException, EOFException { + private synchronized Connection getRawConnection() { + Connection con = null; + while(con == null){ + try { + con = ds.getConnection(); + } catch (SQLException ce) { + return null; + } + } + return con; + } + + private synchronized Connection getConnection() { + Connection con; + con = getRawConnection(); + if(con == null){ + ds.close(); + ConsoleLogger.showError("Database connection is LOST! SHUTDOWN..."); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + } + return con; + } + + private synchronized void setupConnection() throws SQLException { Connection con = null; Statement st = null; ResultSet rs = null; try { - con = getConnection(); + con = getRawConnection(); + if(con == null){ + ds.close(); + if (Settings.isStopEnabled) { + ConsoleLogger.showError("Can't connect to the SQLite database... Please check your database settings in the config.yml file! SHUTDOWN..."); + AuthMe.getInstance().getServer().shutdown(); + } else { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + return; + } st = con.createStatement(); st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" + columnID + " INTEGER AUTO_INCREMENT," + columnName + " VARCHAR(255) NOT NULL UNIQUE," + columnPassword + " VARCHAR(255) NOT NULL," + columnIp + " VARCHAR(40) NOT NULL," + columnLastLogin + " BIGINT," + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT '" + Settings.defaultWorld + "'," + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com'," + "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));"); rs = con.getMetaData().getColumns(null, null, tableName, columnPassword); @@ -166,14 +227,6 @@ public class SQLite_HIKARI implements DataSource { ConsoleLogger.info("SQLite Setup finished"); } - private void close(Connection con) { - try { - if (con != null) - con.close(); - } catch (Exception e) { - } - } - @Override public synchronized boolean isAuthAvailable(String user) { Connection con = null; @@ -185,7 +238,7 @@ public class SQLite_HIKARI implements DataSource { pst.setString(1, user); rs = pst.executeQuery(); return rs.next(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -218,7 +271,7 @@ public class SQLite_HIKARI implements DataSource { } else { return null; } - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return null; } finally { @@ -230,8 +283,8 @@ public class SQLite_HIKARI implements DataSource { @Override public synchronized boolean saveAuth(PlayerAuth auth) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); if (columnSalt.isEmpty() && auth.getSalt().isEmpty()) { @@ -252,7 +305,7 @@ public class SQLite_HIKARI implements DataSource { pst.setString(6, auth.getRealName()); pst.executeUpdate(); } - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -272,7 +325,7 @@ public class SQLite_HIKARI implements DataSource { pst.setString(1, auth.getHash()); pst.setString(2, auth.getNickname()); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -294,7 +347,7 @@ public class SQLite_HIKARI implements DataSource { pst.setString(3, auth.getRealName()); pst.setString(4, auth.getNickname()); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -313,7 +366,7 @@ public class SQLite_HIKARI implements DataSource { pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + "(); } finally { @@ -349,14 +402,14 @@ public class SQLite_HIKARI implements DataSource { @Override public synchronized boolean removeAuth(String user) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnName + "=?;"); pst.setString(1, user); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -368,8 +421,8 @@ public class SQLite_HIKARI implements DataSource { @Override public boolean updateQuitLoc(PlayerAuth auth) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + lastlocX + "=?, " + lastlocY + "=?, " + lastlocZ + "=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;"); @@ -379,7 +432,7 @@ public class SQLite_HIKARI implements DataSource { pst.setString(4, auth.getWorld()); pst.setString(5, auth.getNickname()); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -391,9 +444,9 @@ public class SQLite_HIKARI implements DataSource { @Override public int getIps(String ip) { + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; int countIp = 0; try { con = getConnection(); @@ -404,7 +457,7 @@ public class SQLite_HIKARI implements DataSource { countIp++; } return countIp; - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return 0; } finally { @@ -416,15 +469,15 @@ public class SQLite_HIKARI implements DataSource { @Override public boolean updateEmail(PlayerAuth auth) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnEmail + "=? WHERE " + columnName + "=?;"); pst.setString(1, auth.getEmail()); pst.setString(2, auth.getNickname()); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -447,7 +500,7 @@ public class SQLite_HIKARI implements DataSource { pst.setString(1, auth.getSalt()); pst.setString(2, auth.getNickname()); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -457,56 +510,11 @@ public class SQLite_HIKARI implements DataSource { return true; } - @Override - public synchronized void close() { - try { - if (ds != null) - ds.close(); - } catch (Exception e) { - } - } - - @Override - public void reload() { - try { - connect(); - setup(); - } catch (Exception e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't reconnect to SQLite database... SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - } - - private void close(Statement st) { - if (st != null) { - try { - st.close(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - - private void close(ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - @Override public List getAllAuthsByName(PlayerAuth auth) { + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; List countIp = new ArrayList(); try { con = getConnection(); @@ -517,11 +525,11 @@ public class SQLite_HIKARI implements DataSource { countIp.add(rs.getString(columnName)); } return countIp; - } catch (NullPointerException ex) { - return new ArrayList(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); + } catch (NullPointerException npe) { + return new ArrayList(); } finally { close(rs); close(pst); @@ -531,9 +539,9 @@ public class SQLite_HIKARI implements DataSource { @Override public List getAllAuthsByIp(String ip) { + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; List countIp = new ArrayList(); try { con = getConnection(); @@ -544,11 +552,11 @@ public class SQLite_HIKARI implements DataSource { countIp.add(rs.getString(columnName)); } return countIp; - } catch (NullPointerException ex) { - return new ArrayList(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); + } catch (NullPointerException npe) { + return new ArrayList(); } finally { close(rs); close(pst); @@ -558,9 +566,9 @@ public class SQLite_HIKARI implements DataSource { @Override public List getAllAuthsByEmail(String email) { + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; List countEmail = new ArrayList(); try { con = getConnection(); @@ -571,11 +579,11 @@ public class SQLite_HIKARI implements DataSource { countEmail.add(rs.getString(columnName)); } return countEmail; - } catch (NullPointerException ex) { - return new ArrayList(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return new ArrayList(); + } catch (NullPointerException npe) { + return new ArrayList(); } finally { close(rs); close(pst); @@ -585,8 +593,8 @@ public class SQLite_HIKARI implements DataSource { @Override public void purgeBanned(List banned) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); for (String name : banned) { @@ -594,7 +602,7 @@ public class SQLite_HIKARI implements DataSource { pst.setString(1, name); pst.executeUpdate(); } - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); } finally { close(pst); @@ -602,16 +610,11 @@ public class SQLite_HIKARI implements DataSource { } } - @Override - public DataSourceType getType() { - return DataSourceType.SQLITE; - } - @Override public boolean isLogged(String user) { + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); @@ -619,7 +622,7 @@ public class SQLite_HIKARI implements DataSource { rs = pst.executeQuery(); if (rs.next()) return (rs.getInt(columnLogged) == 1); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { @@ -632,15 +635,15 @@ public class SQLite_HIKARI implements DataSource { @Override public void setLogged(String user) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setInt(1, 1); pst.setString(2, user); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -652,8 +655,8 @@ public class SQLite_HIKARI implements DataSource { @Override public void setUnlogged(String user) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; if (user != null) try { con = getConnection(); @@ -661,7 +664,7 @@ public class SQLite_HIKARI implements DataSource { pst.setInt(1, 0); pst.setString(2, user); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -673,15 +676,15 @@ public class SQLite_HIKARI implements DataSource { @Override public void purgeLogged() { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnLogged + "=?;"); pst.setInt(1, 0); pst.setInt(2, 1); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -693,10 +696,10 @@ public class SQLite_HIKARI implements DataSource { @Override public int getAccountsRegistered() { - int result = 0; + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; + int result = 0; try { con = getConnection(); pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";"); @@ -704,7 +707,7 @@ public class SQLite_HIKARI implements DataSource { if (rs != null && rs.next()) { result = rs.getInt(1); } - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return result; } finally { @@ -716,15 +719,15 @@ public class SQLite_HIKARI implements DataSource { @Override public void updateName(String oldone, String newone) { - PreparedStatement pst = null; Connection con = null; + PreparedStatement pst = null; try { con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE " + columnName + "=?;"); pst.setString(1, newone); pst.setString(2, oldone); pst.executeUpdate(); - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return; } finally { @@ -736,10 +739,10 @@ public class SQLite_HIKARI implements DataSource { @Override public List getAllAuths() { - List auths = new ArrayList(); + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; + List auths = new ArrayList(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); @@ -758,7 +761,7 @@ public class SQLite_HIKARI implements DataSource { if (pAuth != null) auths.add(pAuth); } - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return auths; } finally { @@ -770,10 +773,10 @@ public class SQLite_HIKARI implements DataSource { @Override public List getLoggedPlayers() { - List auths = new ArrayList(); + Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - Connection con = null; + List auths = new ArrayList(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); @@ -792,7 +795,7 @@ public class SQLite_HIKARI implements DataSource { if (pAuth != null) auths.add(pAuth); } - } catch (Exception ex) { + } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); return auths; } finally { @@ -801,4 +804,47 @@ public class SQLite_HIKARI implements DataSource { } return auths; } + + @Override + public void reload() { + } + + @Override + public synchronized void close() { + try { + if (ds != null) + ds.close(); + } catch (Exception e) { + } + } + + private void close(Statement st) { + if (st != null) { + try { + st.close(); + } catch (Exception ex) { + ConsoleLogger.showError(ex.getMessage()); + } + } + } + + private void close(ResultSet rs) { + if (rs != null) { + try { + rs.close(); + } catch (Exception ex) { + ConsoleLogger.showError(ex.getMessage()); + } + } + } + + private void close(Connection con) { + if (con != null) { + try { + con.close(); + } catch (Exception ex) { + ConsoleLogger.showError(ex.getMessage()); + } + } + } } diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index fc1d07f6..25c750b3 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -48,9 +48,11 @@ public class ModuleManager implements Module { @Override public boolean load() { File dir = new File(plugin.getDataFolder() + File.separator + "modules"); - if (dir == null || !dir.exists() || !dir.isDirectory() || dir.listFiles() == null || dir.listFiles().length <= 0) + String[] files = dir.list(); + if (files == null || files.length == 0){ return false; - for (File pathToJar : dir.listFiles()) { + } + for (File pathToJar : dir.listFiles()) { // FindBugs: "possible null pointers" O_o ? JarFile jarFile = null; try { jarFile = new JarFile(pathToJar); From 1e52cd0c30e23c63bd8c683828686f17127896d9 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 27 Aug 2015 00:39:54 +0100 Subject: [PATCH 106/427] Changed to HikariCP-Log4j --- .../HikariCP-Log4J-2.4.2-SNAPSHOT.jar | Bin 0 -> 125868 bytes .../HikariCP-Log4J-2.4.2-SNAPSHOT.pom | 443 ++++++++++++++++++ pom.xml | 30 +- 3 files changed, 454 insertions(+), 19 deletions(-) create mode 100644 localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.jar create mode 100644 localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom diff --git a/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.jar b/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..4d9c1be988b81e0dacbb271ec60a81e13dd1714a GIT binary patch literal 125868 zcmbSy1CVCHmS)+u?JnEuvTglk+y2Y8x@^0u%eHM>UG6fvw%^Re&g|RW*?4;+ZrqH> zJm=nwb5BNo=lfDg790Wt1O^5MM63%>66C*J7$6WJ^5SYD4AKe`O!6WM(h}mTYK-y{ ze}PMNxVmjH?9D<3 zOR25z9)5ny^|`)t;?K{H6|s7UEjA8nt>$%-JB)&M&!ZDS0mWy7VZQ8`@oL&{Gt9z1 z4+{|o`r&sKLmEc>o@5Bx=+XIEJtW(vumFQhR$nLbnl$aYvd6MOUy4_~`KzjS88bUL z&%C+-CGl|!yMXT}9Ip@;%0NKZO>1@J3fpq!vS=xFq@*wEDnG0aQ$2SAJxl@pIU8|X zP#2UeRy1S*+l68v4DL!He~tBLmi>+WQWO3VsdvTXn@E8?t$dN(_B@VLZv!@+wue@j zWYrpaL{?cM{;PbtY=UX`;!NqcXCYAJ5L<1bdws3?R2?o#MyrJR?PJG>tM_0lSIT@( z5vt#2oUt7FE_)gVmWV|Zrd#Z_n%N^$y^$88);?07*mz_Wv!(O8*I_N53aq(TUOQc? zB8=0vEpv|0F$Qz zc=L*bwU@I7XFs{an&ID!EXQq8z+Wack)KsJgl4)yXv#^S-MnP)(epK^d0E8zZu6onfPsJ%LW6)P{a^C}_HT~-&%6NtI}jS?A6fI)?%%HeyCL%5{{Lxc2XHsD zXZlyn@&0#n69+p+Z-A$#ne)HoiT1zsBxPj-aJKrc#31Kj!EXI8Ip+FT96SE~ct>Xk zM>A(vD>E0w2@&`pW(<(McmLtOromE3SfZitP|86Pr)561%Ns|>18_+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&4KU}@TyzLSs!E#{_-;mxO-@JJ>%5` zSb6{r-P}dXZrsYE;9zGBvNQk}m9+p#0+o?&)4i$?YjP@pTm|U<=A?wM_3zPtmi)(| z9qWe1VRwItZENN1a${@y!QU&kUuhVOjvG>S2Npmd0leg z%kz}hhY%2=!1kBshHg?%euMqrRVJ|Eb9VU|8eCDE`CCT*Jz(t6H~Dc_*?1T7SF_0< z#`|kW`TtP9q0=ASlrx)5s|H$)iUgQfEYn2`_V29KH_#%}g|3n~b3$oU= z1wyug^$W-XSdITiVSK~;W3s3~4HXRt2!-FJpz5=@L?F9cHBVVucO?kt}SNgwW0J_<&l7m%qy}mB> z4cvIc+j0NNZNO%|UZ3wKva{Lk$p7RpKMwCVSMHHOor<5=n|}n1T=#0Qc-Kp=-5h%- zZU?zmPwi%{zaP=B*Wdz|ZTq`vIo>Mbb@bmAar=?%dJ(0Y=O_8j|BCE4MZSLIx?b4_ z82hg^6}NxG_4Aky-l1Nv+j7%ao_gGldcBs&uO>k-^7R5Hz>)8@mi6*qBHvO4=DKFU zOxKHY+_b{ktAEP`OzMA^J-SvNM{fbWd`>^tBW zyB;DB>~yZRz{>xD@z*5R<7jX0e7;xTO7fq0r(0w1e^lP}=){|T%2WT(EVs_LU@cvb zsk^xpk!kv8=wAdo{wVwP=&+jv$Ibta;DAM33Gsh)q*fCE literal 0 HcmV?d00001 diff --git a/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom b/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom new file mode 100644 index 00000000..4479ed0f --- /dev/null +++ b/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom @@ -0,0 +1,443 @@ + + 4.0.0 + + com.zaxxer + HikariCP-Log4j + 2.4.2-SNAPSHOT + bundle + + HikariCP-Log4J + Ultimate JDBC Connection Pool [Log4j Version] + https://github.com/brettwooldridge/HikariCP + + + Zaxxer.com + https://github.com/brettwooldridge + + + + scm:git:git@github.com:brettwooldridge/HikariCP.git + scm:git:git@github.com:brettwooldridge/HikariCP.git + git@github.com:brettwooldridge/HikariCP.git + HEAD + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + Brett Wooldridge + brett.wooldridge@gmail.com + + + + + UTF-8 + 4.3.9.Final + 3.18.2-GA + 0.11.4.1 + 3.1.2 + 1.10.19 + 4.5.0 + 2.4.1 + 1.7.12 + 2.5.3 + 5.0.0 + 2.3 + + + + org.sonatype.oss + oss-parent + 7 + + + + + org.slf4j + slf4j-api + ${slf4j.version} + compile + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} + compile + true + + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + compile + true + + + org.mockito + mockito-all + ${mockito.version} + test + + + org.javassist + javassist + ${javassist.version} + true + + + org.hibernate + hibernate-core + ${hibernate.version} + provided + true + + + io.dropwizard.metrics + metrics-core + ${metrics.version} + provided + true + + + io.dropwizard.metrics + metrics-healthchecks + ${metrics.version} + provided + true + + + simple-jndi + simple-jndi + ${jndi.version} + test + + + + + javax.inject + javax.inject + 1 + test + + + org.apache.felix + org.apache.felix.framework + ${felix.version} + test + + + org.ops4j.pax.exam + pax-exam-container-native + ${pax.exam.version} + test + + + org.ops4j.pax.exam + pax-exam-junit4 + ${pax.exam.version} + test + + + org.ops4j.pax.exam + pax-exam-link-mvn + ${pax.exam.version} + test + + + org.ops4j.pax.url + pax-url-aether + ${pax.url.version} + test + + + org.ops4j.pax.url + pax-url-reference + ${pax.url.version} + test + + + + + ${project.name}-${project.version} + + + + org.codehaus.mojo + exec-maven-plugin + 1.4.0 + + + compile + + + java + + + + + com.zaxxer.hikari.proxy.JavassistProxyFactory + + + + + org.jacoco + jacoco-maven-plugin + 0.7.4.201502262128 + + + + pre-unit-test + + prepare-agent + + + + ${project.build.directory}/coverage-reports/jacoco.exec + + surefireArgLine + + **/com/zaxxer/hikari/proxy/** + **/com/zaxxer/hikari/metrics/** + + + + + + post-unit-test + test + + report + + + + ${project.build.directory}/coverage-reports/jacoco.exec + + ${project.reporting.outputDirectory}/jacoco + + **/com/zaxxer/hikari/proxy/** + **/com/zaxxer/hikari/metrics/** + + + + + + + + org.apache.felix + maven-bundle-plugin + ${felix.bundle.plugin.version} + true + + + HikariCP + + com.zaxxer.hikari, + com.zaxxer.hikari.hibernate, + com.zaxxer.hikari.metrics + + com.zaxxer.hikari.* + <_exportcontents> + com.zaxxer.hikari.pool, + com.zaxxer.hikari.util, + com.zaxxer.hikari.proxy + + + javax.management, + javax.naming, + javax.naming.spi, + javax.sql, + javax.sql.rowset, + javax.sql.rowset.serial, + javax.sql.rowset.spi, + com.codahale.metrics;resolution:=optional, + com.codahale.metrics.health;resolution:=optional, + org.slf4j;version="[1.6,2)", + org.hibernate;resolution:=optional, + org.hibernate.cfg;resolution:=optional, + org.hibernate.engine.jdbc.connections.spi;resolution:=optional, + org.hibernate.service;resolution:=optional, + org.hibernate.service.spi;resolution:=optional + + ${project.groupId}.${project.artifactId} + * + + + + + + + manifest + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + true + + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-release-plugin + 2.5 + + true + HikariCP-@{project.version} + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + + ${surefireArgLine} + + ${skip.unit.tests} + + + + + org.apache.maven.plugins + maven-source-plugin + 2.4 + + + true + + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + public + + true + 1024m + + + + bundle-sources + package + + jar + + + + + + + + + + + coverage + + + + org.eluder.coveralls + coveralls-maven-plugin + 3.1.0 + + + coveralls + verify + + jacoco + + false + + + + + + + + + release-sign-artifacts + + + performRelease + true + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + + + felix + + true + + pax.exam.framework + felix + + + + felix + none + + + + org.apache.felix + org.apache.felix.framework + ${felix.version} + test + + + + + diff --git a/pom.xml b/pom.xml index e02a3bae..f3b276c1 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,6 @@ com.comphenix.attribute:* org.mcstats.*:* com.zaxxer:* - org.slf4j:* @@ -164,6 +163,12 @@ http://repo.mcstats.org/content/repositories/snapshots/ + + + local-repo + file://${basedir}/localrepo + + @@ -171,21 +176,10 @@ - - mysql - mysql-connector-java - 5.1.36 - - - org.slf4j - slf4j-simple - 1.7.12 - compile - com.zaxxer - HikariCP - 2.4.1 + HikariCP-Log4j + 2.4.2-SNAPSHOT compile @@ -193,8 +187,8 @@ slf4j-api - org.slf4j - slf4j-simple + org.apache.logging.log4j + log4j-core @@ -557,9 +551,7 @@ simplechestlock - - com.webkonsept.bukkit.simplechestlock - + com.webkonsept.bukkit.simplechestlock commandbook From eec7a7f575f3eec4d7428274ecf67a23ed1b7be4 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Thu, 27 Aug 2015 23:28:12 +0200 Subject: [PATCH 107/427] Add SALTEDSHA512 Encryption --- .../xephi/authme/security/HashAlgorithm.java | 1 + .../authme/security/PasswordSecurity.java | 9 ++++-- .../authme/security/crypts/SALTEDSHA512.java | 32 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/security/crypts/SALTEDSHA512.java diff --git a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java index a9fd19e5..312b6df0 100644 --- a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java +++ b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java @@ -29,6 +29,7 @@ public enum HashAlgorithm { ROYALAUTH(fr.xephi.authme.security.crypts.ROYALAUTH.class), CRAZYCRYPT1(fr.xephi.authme.security.crypts.CRAZYCRYPT1.class), BCRYPT2Y(fr.xephi.authme.security.crypts.BCRYPT2Y.class), + SALTEDSHA512(fr.xephi.authme.security.crypts.SALTEDSHA512.class), CUSTOM(Null.class); Class classe; diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index bfc2fb2d..305b89b6 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -96,7 +96,12 @@ public class PasswordSecurity { userSalt.put(playerName, salt); break; case BCRYPT2Y: - salt = createSalt(22); + salt = createSalt(16); + userSalt.put(playerName, salt); + break; + case SALTEDSHA512: + salt = createSalt(32); + userSalt.put(playerName, salt); break; case MD5: case SHA1: @@ -165,7 +170,7 @@ public class PasswordSecurity { PlayerAuth nAuth = AuthMe.getInstance().database.getAuth(playerName); if (nAuth != null) { nAuth.setHash(getHash(Settings.getPasswordHash, password, playerName)); - nAuth.setSalt(userSalt.get(playerName)); + nAuth.setSalt(userSalt.containsKey(playerName) ? userSalt.get(playerName) : ""); AuthMe.getInstance().database.updatePassword(nAuth); AuthMe.getInstance().database.updateSalt(nAuth); } diff --git a/src/main/java/fr/xephi/authme/security/crypts/SALTEDSHA512.java b/src/main/java/fr/xephi/authme/security/crypts/SALTEDSHA512.java new file mode 100644 index 00000000..0050dd73 --- /dev/null +++ b/src/main/java/fr/xephi/authme/security/crypts/SALTEDSHA512.java @@ -0,0 +1,32 @@ +package fr.xephi.authme.security.crypts; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import fr.xephi.authme.AuthMe; + +public class SALTEDSHA512 implements EncryptionMethod { + + @Override + public String getHash(String password, String salt, String name) + throws NoSuchAlgorithmException { + return getSHA512(password + salt); + } + + @Override + public boolean comparePassword(String hash, String password, + String playerName) throws NoSuchAlgorithmException { + String salt = AuthMe.getInstance().database.getAuth(playerName).getSalt(); + return hash.equals(getHash(password, salt, "")); + } + + private static String getSHA512(String message) + throws NoSuchAlgorithmException { + MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); + sha512.reset(); + sha512.update(message.getBytes()); + byte[] digest = sha512.digest(); + return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest)); + } +} From e33ebb7379011d449dcf79237e33b2d591ad06a0 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 28 Aug 2015 00:16:26 +0200 Subject: [PATCH 108/427] Change some custom event to let them be async --- .../xephi/authme/commands/AdminCommand.java | 67 +++++++++++-------- .../fr/xephi/authme/events/CustomEvent.java | 8 +++ .../events/FirstSpawnTeleportEvent.java | 1 + .../events/PasswordEncryptionEvent.java | 1 + .../authme/events/ProtectInventoryEvent.java | 1 + .../authme/events/ResetInventoryEvent.java | 1 + .../authme/events/RestoreInventoryEvent.java | 8 +++ .../authme/events/StoreInventoryEvent.java | 3 +- .../authme/process/join/AsyncronousJoin.java | 59 ++++++++-------- .../logout/ProcessSyncronousPlayerLogout.java | 8 +-- .../authme/process/quit/AsyncronousQuit.java | 10 +++ .../quit/ProcessSyncronousPlayerQuit.java | 10 +-- 12 files changed, 103 insertions(+), 74 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 28f4519b..cdcbf997 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -47,8 +47,8 @@ public class AdminCommand implements CommandExecutor { } @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { + public boolean onCommand(final CommandSender sender, Command cmnd, + String label, String[] args) { if (args.length == 0) { sender.sendMessage("Usage:"); sender.sendMessage("/authme reload - Reload the config"); @@ -434,34 +434,43 @@ public class AdminCommand implements CommandExecutor { return true; } } - try { - String name = args[1].toLowerCase(); - String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name); - PlayerAuth auth = null; - if (PlayerCache.getInstance().isAuthenticated(name)) { - auth = PlayerCache.getInstance().getAuth(name); - } else if (plugin.database.isAuthAvailable(name)) { - auth = plugin.database.getAuth(name); + final String name = args[1].toLowerCase(); + final String raw = args[2]; + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + String hash; + try { + hash = PasswordSecurity.getHash(Settings.getPasswordHash, raw, name); + } catch (NoSuchAlgorithmException e) { + m.send(sender, "error"); + return; + } + PlayerAuth auth = null; + if (PlayerCache.getInstance().isAuthenticated(name)) { + auth = PlayerCache.getInstance().getAuth(name); + } else if (plugin.database.isAuthAvailable(name)) { + auth = plugin.database.getAuth(name); + } + if (auth == null) { + m.send(sender, "unknown_user"); + return; + } + auth.setHash(hash); + if (PasswordSecurity.userSalt.containsKey(name)) { + auth.setSalt(PasswordSecurity.userSalt.get(name)); + plugin.database.updateSalt(auth); + } + if (!plugin.database.updatePassword(auth)) { + m.send(sender, "error"); + return; + } + sender.sendMessage("pwd_changed"); + ConsoleLogger.info(name + "'s password changed"); } - if (auth == null) { - m.send(sender, "unknown_user"); - return true; - } - auth.setHash(hash); - if (PasswordSecurity.userSalt.containsKey(name)) { - auth.setSalt(PasswordSecurity.userSalt.get(name)); - plugin.database.updateSalt(auth); - } - if (!plugin.database.updatePassword(auth)) { - m.send(sender, "error"); - return true; - } - sender.sendMessage("pwd_changed"); - ConsoleLogger.info(args[1] + "'s password changed"); - } catch (NoSuchAlgorithmException ex) { - ConsoleLogger.showError(ex.getMessage()); - m.send(sender, "error"); - } + + }); return true; } else if (args[0].equalsIgnoreCase("unregister") || args[0].equalsIgnoreCase("unreg") || args[0].equalsIgnoreCase("del")) { if (args.length != 2) { diff --git a/src/main/java/fr/xephi/authme/events/CustomEvent.java b/src/main/java/fr/xephi/authme/events/CustomEvent.java index 22742996..5be14710 100644 --- a/src/main/java/fr/xephi/authme/events/CustomEvent.java +++ b/src/main/java/fr/xephi/authme/events/CustomEvent.java @@ -13,6 +13,14 @@ public class CustomEvent extends Event implements Cancellable { private boolean isCancelled; private static final HandlerList handlers = new HandlerList(); + public CustomEvent() { + super(false); + } + + public CustomEvent(boolean b) { + super(b); + } + public HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java b/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java index 079a4614..e4061460 100644 --- a/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java +++ b/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java @@ -16,6 +16,7 @@ public class FirstSpawnTeleportEvent extends CustomEvent { private Location from; public FirstSpawnTeleportEvent(Player player, Location from, Location to) { + super(true); this.player = player; this.from = from; this.to = to; diff --git a/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java b/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java index 9f6ea007..4e5a0f5c 100644 --- a/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java +++ b/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java @@ -22,6 +22,7 @@ public class PasswordEncryptionEvent extends Event { private String playerName = ""; public PasswordEncryptionEvent(EncryptionMethod method, String playerName) { + super(true); this.method = method; this.playerName = playerName; } diff --git a/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java b/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java index eebf6f4a..10d5636b 100644 --- a/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java @@ -20,6 +20,7 @@ public class ProtectInventoryEvent extends CustomEvent { public ProtectInventoryEvent(Player player, ItemStack[] storedinventory, ItemStack[] storedarmor) { + super(true); this.player = player; this.storedinventory = storedinventory; this.storedarmor = storedarmor; diff --git a/src/main/java/fr/xephi/authme/events/ResetInventoryEvent.java b/src/main/java/fr/xephi/authme/events/ResetInventoryEvent.java index 84fbe206..5c7b622e 100644 --- a/src/main/java/fr/xephi/authme/events/ResetInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/ResetInventoryEvent.java @@ -13,6 +13,7 @@ public class ResetInventoryEvent extends CustomEvent { private Player player; public ResetInventoryEvent(Player player) { + super(true); this.player = player; } diff --git a/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java index f51499a9..c2c36ba4 100644 --- a/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java @@ -22,6 +22,14 @@ public class RestoreInventoryEvent extends CustomEvent { this.armor = armor; } + public RestoreInventoryEvent(Player player, ItemStack[] inventory, + ItemStack[] armor, boolean b) { + super(b); + this.player = player; + this.inventory = inventory; + this.armor = armor; + } + public ItemStack[] getInventory() { return this.inventory; } diff --git a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java index 78507524..c91523d8 100644 --- a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java @@ -28,8 +28,7 @@ public class StoreInventoryEvent extends CustomEvent { try { this.inventory = fileCache.readCache(player).getInventory(); this.armor = fileCache.readCache(player).getArmour(); - } catch (Exception e) - { + } catch (Exception e) { this.inventory = player.getInventory().getContents(); this.armor = player.getInventory().getArmorContents(); } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index d1ef309d..3a3e8e1f 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -6,6 +6,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitScheduler; @@ -176,25 +177,27 @@ public class AsyncronousJoin { } if (Settings.protectInventoryBeforeLogInEnabled) { - sched.scheduleSyncDelayedTask(plugin, new Runnable() { + try { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); + ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); + plugin.getServer().getPluginManager().callEvent(ev); + if (ev.isCancelled()) { + if (!Settings.noConsoleSpam) + ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); + } else { + final ItemStack[] inv = ev.getEmptyArmor(); + final ItemStack[] armor = ev.getEmptyArmor(); + sched.scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - try { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); - ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); - plugin.getServer().getPluginManager().callEvent(ev); - if (ev.isCancelled()) { - if (!Settings.noConsoleSpam) - ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); - } else { - plugin.api.setPlayerInventory(player, ev.getEmptyInventory(), ev.getEmptyArmor()); + @Override + public void run() { + plugin.api.setPlayerInventory(player, inv, armor); } - } catch (NullPointerException ex) { - } - } - }); + }); + } + } catch (NullPointerException ex) { + } } String[] msg; if (Settings.emailRegistration) { @@ -262,21 +265,21 @@ public class AsyncronousJoin { else { if (Spawn.getInstance().getFirstSpawn() == null || Spawn.getInstance().getFirstSpawn().getWorld() == null) return false; - final Location loc = Spawn.getInstance().getFirstSpawn(); - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), Spawn.getInstance().getFirstSpawn()); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { + final Location fLoc = tpEvent.getTo(); + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), loc); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { - player.teleport(tpEvent.getTo()); + @Override + public void run() { + player.teleport(fLoc); } - } - } - }); + }); + } + } return true; } } diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index f926c694..4cac3864 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -56,13 +56,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable { player.setFlying(true); } // Player is now logout... Time to fire event ! - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); - } - }); + Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); m.send(player, "logout"); ConsoleLogger.info(player.getDisplayName() + " logged out"); } diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 40a71247..dd84fdc8 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -13,6 +13,7 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.datasource.DataSource; +import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.settings.Settings; @@ -97,6 +98,15 @@ public class AsyncronousQuit { } AuthMePlayerListener.gameMode.remove(name); final Player p = player; + RestoreInventoryEvent ev = new RestoreInventoryEvent(player, inv, armor, true); + Bukkit.getPluginManager().callEvent(ev); + if (ev.isCancelled()) { + inv = null; + armor = null; + } else { + inv = ev.getInventory(); + armor = ev.getArmor(); + } Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, p, inv, armor, isOp, isFlying, needToChange)); } } diff --git a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java index b21a78bf..48813409 100644 --- a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.settings.Settings; public class ProcessSyncronousPlayerQuit implements Runnable { @@ -32,13 +31,8 @@ public class ProcessSyncronousPlayerQuit implements Runnable { @Override public void run() { - if (inv != null && armor != null) { - RestoreInventoryEvent ev = new RestoreInventoryEvent(player, inv, armor); - player.getServer().getPluginManager().callEvent(ev); - if (!ev.isCancelled()) { - plugin.api.setPlayerInventory(player, ev.getInventory(), ev.getArmor()); - } - } + if (inv != null && armor != null) + plugin.api.setPlayerInventory(player, inv, armor); if (needToChange) { player.setOp(isOp); if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) { From 3bcaa3f12b34102718a00e92b12654b5538963cb Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 28 Aug 2015 00:16:49 +0200 Subject: [PATCH 109/427] Change to minimum lifeTime --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 89d9fd85..1588ac6b 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -122,7 +122,7 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", true); - config.setMaxLifetime(12000); + config.setMaxLifetime(30000); config.setInitializationFailFast(false); ds = new HikariDataSource(config); ConsoleLogger.info("Connection pool ready"); From fc484c4948791ac846ed2698b6260ef46681c064 Mon Sep 17 00:00:00 2001 From: "Making GitHub Delicious." Date: Thu, 3 Sep 2015 07:56:41 -0600 Subject: [PATCH 110/427] add waffle.io badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3e8242a8..5f537345 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Stories in Ready](https://badge.waffle.io/Xephi/AuthMeReloaded.png?label=ready&title=Ready)](https://waffle.io/Xephi/AuthMeReloaded)

    The most used authentication plugin for CraftBukkit/Spigot!


    From 028c70945ef90a9cf245a4cf05fbf763b04f1f5e Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Thu, 3 Sep 2015 15:58:18 +0200 Subject: [PATCH 111/427] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f537345..54b66aa1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Stories in Ready](https://badge.waffle.io/Xephi/AuthMeReloaded.png?label=ready&title=Ready)](https://waffle.io/Xephi/AuthMeReloaded)

    The most used authentication plugin for CraftBukkit/Spigot!


    @@ -10,6 +9,8 @@ - Build status (CircleCI): [![Circle CI](https://circleci.com/gh/Xephi/AuthMeReloaded.svg?style=svg)](https://circleci.com/gh/Xephi/AuthMeReloaded) +- Issue Tracking : [![Stories in Ready](https://badge.waffle.io/Xephi/AuthMeReloaded.png?label=ready&title=Ready)](https://waffle.io/Xephi/AuthMeReloaded) + - Build Server (DEVELOPMENT BUILDS):
    Xephi's Jenkins - JavaDocs: AuthMe Javadoc From 3963a27c27b85d56def652618e617da67d5d6461 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Fri, 4 Sep 2015 10:59:55 +0200 Subject: [PATCH 112/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 54b66aa1..2f12855f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - Build status (CircleCI): [![Circle CI](https://circleci.com/gh/Xephi/AuthMeReloaded.svg?style=svg)](https://circleci.com/gh/Xephi/AuthMeReloaded) -- Issue Tracking : [![Stories in Ready](https://badge.waffle.io/Xephi/AuthMeReloaded.png?label=ready&title=Ready)](https://waffle.io/Xephi/AuthMeReloaded) +- 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 From 6545ad3aea4b3b9a35a3af33817852189d76bcac Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 4 Sep 2015 19:49:33 +0200 Subject: [PATCH 113/427] slf4j log4j implementation enhancement --- pom.xml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pom.xml b/pom.xml index f3b276c1..390d04ee 100644 --- a/pom.xml +++ b/pom.xml @@ -176,6 +176,32 @@ + + org.slf4j + slf4j-api + 1.7.12 + compile + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.0.3 + compile + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + compile + true + + com.zaxxer HikariCP-Log4j From 1f66a7474d5cf5f83295bfe98415329bc873dcf6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 5 Sep 2015 00:45:48 +0200 Subject: [PATCH 114/427] Stuff! + HikariCP Log4J --- .../HikariCP-Log4J-2.4.2-SNAPSHOT.jar | Bin 125868 -> 0 bytes .../HikariCP-Log4J-2.4.2-SNAPSHOT.pom | 443 ------------------ pom.xml | 69 ++- .../java/fr/xephi/authme/DataManager.java | 11 +- .../fr/xephi/authme/settings/Messages.java | 13 +- .../fr/xephi/authme/settings/Settings.java | 2 +- .../resources/{ => messages}/messages_bg.yml | 0 .../resources/{ => messages}/messages_br.yml | 0 .../resources/{ => messages}/messages_cz.yml | 0 .../resources/{ => messages}/messages_de.yml | 0 .../resources/{ => messages}/messages_en.yml | 0 .../resources/{ => messages}/messages_es.yml | 0 .../resources/{ => messages}/messages_eu.yml | 0 .../resources/{ => messages}/messages_fi.yml | 0 .../resources/{ => messages}/messages_fr.yml | 0 .../resources/{ => messages}/messages_gl.yml | 0 .../resources/{ => messages}/messages_hu.yml | 0 .../resources/{ => messages}/messages_it.yml | 0 .../resources/{ => messages}/messages_ko.yml | 0 .../resources/{ => messages}/messages_lt.yml | 0 .../resources/{ => messages}/messages_nl.yml | 0 .../resources/{ => messages}/messages_pl.yml | 0 .../resources/{ => messages}/messages_pt.yml | 0 .../resources/{ => messages}/messages_ru.yml | 116 ++--- .../resources/{ => messages}/messages_sk.yml | 0 .../resources/{ => messages}/messages_tr.yml | 0 .../resources/{ => messages}/messages_uk.yml | 0 .../resources/{ => messages}/messages_vn.yml | 116 ++--- .../{ => messages}/messages_zhcn.yml | Bin .../{ => messages}/messages_zhhk.yml | 122 ++--- .../{ => messages}/messages_zhtw.yml | 122 ++--- 31 files changed, 279 insertions(+), 735 deletions(-) delete mode 100644 localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.jar delete mode 100644 localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom rename src/main/resources/{ => messages}/messages_bg.yml (100%) rename src/main/resources/{ => messages}/messages_br.yml (100%) rename src/main/resources/{ => messages}/messages_cz.yml (100%) rename src/main/resources/{ => messages}/messages_de.yml (100%) rename src/main/resources/{ => messages}/messages_en.yml (100%) rename src/main/resources/{ => messages}/messages_es.yml (100%) rename src/main/resources/{ => messages}/messages_eu.yml (100%) rename src/main/resources/{ => messages}/messages_fi.yml (100%) rename src/main/resources/{ => messages}/messages_fr.yml (100%) rename src/main/resources/{ => messages}/messages_gl.yml (100%) rename src/main/resources/{ => messages}/messages_hu.yml (100%) rename src/main/resources/{ => messages}/messages_it.yml (100%) rename src/main/resources/{ => messages}/messages_ko.yml (100%) rename src/main/resources/{ => messages}/messages_lt.yml (100%) rename src/main/resources/{ => messages}/messages_nl.yml (100%) rename src/main/resources/{ => messages}/messages_pl.yml (100%) rename src/main/resources/{ => messages}/messages_pt.yml (100%) rename src/main/resources/{ => messages}/messages_ru.yml (98%) rename src/main/resources/{ => messages}/messages_sk.yml (100%) rename src/main/resources/{ => messages}/messages_tr.yml (100%) rename src/main/resources/{ => messages}/messages_uk.yml (100%) rename src/main/resources/{ => messages}/messages_vn.yml (97%) rename src/main/resources/{ => messages}/messages_zhcn.yml (100%) rename src/main/resources/{ => messages}/messages_zhhk.yml (98%) rename src/main/resources/{ => messages}/messages_zhtw.yml (98%) diff --git a/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.jar b/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.jar deleted file mode 100644 index 4d9c1be988b81e0dacbb271ec60a81e13dd1714a..0000000000000000000000000000000000000000 GIT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_0< z#`|kW`TtP9q0=ASlrx)5s|H$)iUgQfEYn2`_V29KH_#%}g|3n~b3$oU= z1wyug^$W-XSdITiVSK~;W3s3~4HXRt2!-FJpz5=@L?F9cHBVVucO?kt}SNgwW0J_<&l7m%qy}mB> z4cvIc+j0NNZNO%|UZ3wKva{Lk$p7RpKMwCVSMHHOor<5=n|}n1T=#0Qc-Kp=-5h%- zZU?zmPwi%{zaP=B*Wdz|ZTq`vIo>Mbb@bmAar=?%dJ(0Y=O_8j|BCE4MZSLIx?b4_ z82hg^6}NxG_4Aky-l1Nv+j7%ao_gGldcBs&uO>k-^7R5Hz>)8@mi6*qBHvO4=DKFU zOxKHY+_b{ktAEP`OzMA^J-SvNM{fbWd`>^tBW zyB;DB>~yZRz{>xD@z*5R<7jX0e7;xTO7fq0r(0w1e^lP}=){|T%2WT(EVs_LU@cvb zsk^xpk!kv8=wAdo{wVwP=&+jv$Ibta;DAM33Gsh)q*fCE diff --git a/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom b/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom deleted file mode 100644 index 4479ed0f..00000000 --- a/localrepo/com/zaxxer/HikariCP-Log4j/2.4.2-SNAPSHOT/HikariCP-Log4J-2.4.2-SNAPSHOT.pom +++ /dev/null @@ -1,443 +0,0 @@ - - 4.0.0 - - com.zaxxer - HikariCP-Log4j - 2.4.2-SNAPSHOT - bundle - - HikariCP-Log4J - Ultimate JDBC Connection Pool [Log4j Version] - https://github.com/brettwooldridge/HikariCP - - - Zaxxer.com - https://github.com/brettwooldridge - - - - scm:git:git@github.com:brettwooldridge/HikariCP.git - scm:git:git@github.com:brettwooldridge/HikariCP.git - git@github.com:brettwooldridge/HikariCP.git - HEAD - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - Brett Wooldridge - brett.wooldridge@gmail.com - - - - - UTF-8 - 4.3.9.Final - 3.18.2-GA - 0.11.4.1 - 3.1.2 - 1.10.19 - 4.5.0 - 2.4.1 - 1.7.12 - 2.5.3 - 5.0.0 - 2.3 - - - - org.sonatype.oss - oss-parent - 7 - - - - - org.slf4j - slf4j-api - ${slf4j.version} - compile - - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} - compile - true - - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - compile - true - - - org.mockito - mockito-all - ${mockito.version} - test - - - org.javassist - javassist - ${javassist.version} - true - - - org.hibernate - hibernate-core - ${hibernate.version} - provided - true - - - io.dropwizard.metrics - metrics-core - ${metrics.version} - provided - true - - - io.dropwizard.metrics - metrics-healthchecks - ${metrics.version} - provided - true - - - simple-jndi - simple-jndi - ${jndi.version} - test - - - - - javax.inject - javax.inject - 1 - test - - - org.apache.felix - org.apache.felix.framework - ${felix.version} - test - - - org.ops4j.pax.exam - pax-exam-container-native - ${pax.exam.version} - test - - - org.ops4j.pax.exam - pax-exam-junit4 - ${pax.exam.version} - test - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${pax.exam.version} - test - - - org.ops4j.pax.url - pax-url-aether - ${pax.url.version} - test - - - org.ops4j.pax.url - pax-url-reference - ${pax.url.version} - test - - - - - ${project.name}-${project.version} - - - - org.codehaus.mojo - exec-maven-plugin - 1.4.0 - - - compile - - - java - - - - - com.zaxxer.hikari.proxy.JavassistProxyFactory - - - - - org.jacoco - jacoco-maven-plugin - 0.7.4.201502262128 - - - - pre-unit-test - - prepare-agent - - - - ${project.build.directory}/coverage-reports/jacoco.exec - - surefireArgLine - - **/com/zaxxer/hikari/proxy/** - **/com/zaxxer/hikari/metrics/** - - - - - - post-unit-test - test - - report - - - - ${project.build.directory}/coverage-reports/jacoco.exec - - ${project.reporting.outputDirectory}/jacoco - - **/com/zaxxer/hikari/proxy/** - **/com/zaxxer/hikari/metrics/** - - - - - - - - org.apache.felix - maven-bundle-plugin - ${felix.bundle.plugin.version} - true - - - HikariCP - - com.zaxxer.hikari, - com.zaxxer.hikari.hibernate, - com.zaxxer.hikari.metrics - - com.zaxxer.hikari.* - <_exportcontents> - com.zaxxer.hikari.pool, - com.zaxxer.hikari.util, - com.zaxxer.hikari.proxy - - - javax.management, - javax.naming, - javax.naming.spi, - javax.sql, - javax.sql.rowset, - javax.sql.rowset.serial, - javax.sql.rowset.spi, - com.codahale.metrics;resolution:=optional, - com.codahale.metrics.health;resolution:=optional, - org.slf4j;version="[1.6,2)", - org.hibernate;resolution:=optional, - org.hibernate.cfg;resolution:=optional, - org.hibernate.engine.jdbc.connections.spi;resolution:=optional, - org.hibernate.service;resolution:=optional, - org.hibernate.service.spi;resolution:=optional - - ${project.groupId}.${project.artifactId} - * - - - - - - - manifest - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - true - - 1.7 - 1.7 - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5 - - true - HikariCP-@{project.version} - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18.1 - - - ${surefireArgLine} - - ${skip.unit.tests} - - - - - org.apache.maven.plugins - maven-source-plugin - 2.4 - - - true - - - - attach-sources - - jar - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - public - - true - 1024m - - - - bundle-sources - package - - jar - - - - - - - - - - - coverage - - - - org.eluder.coveralls - coveralls-maven-plugin - 3.1.0 - - - coveralls - verify - - jacoco - - false - - - - - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - - - - - felix - - true - - pax.exam.framework - felix - - - - felix - none - - - - org.apache.felix - org.apache.felix.framework - ${felix.version} - test - - - - - diff --git a/pom.xml b/pom.xml index 390d04ee..a924c7f5 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,14 @@ *.yml + + ./messages/ + false + ${basedir}/src/main/resources/messages/ + + *.yml + + @@ -74,12 +82,13 @@ - com.maxmind.geoip:* - javax.mail:* - com.sun.mail:* - com.comphenix.attribute:* - org.mcstats.*:* - com.zaxxer:* + org.slf4j:slf4j-api + org.apache.logging.log4j:log4j-slf4j-impl + com.zaxxer:HikariCP + com.maxmind.geoip:geoip-api + com.sun.mail:javax.mail + com.comphenix.attribute:AttributeStorage + org.mcstats.bukkit:metrics @@ -163,10 +172,10 @@ http://repo.mcstats.org/content/repositories/snapshots/ - + - local-repo - file://${basedir}/localrepo + hikaricp-log4j-releases + http://nexus-sgdc3.rhcloud.com/nexus/content/repositories/hikaricp-log4j-releases/ @@ -175,37 +184,11 @@ - - - org.slf4j - slf4j-api - 1.7.12 - compile - - - org.apache.logging.log4j - log4j-slf4j-impl - 2.0.3 - compile - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - compile - true - - + com.zaxxer - HikariCP-Log4j - 2.4.2-SNAPSHOT + HikariCP-Log4J + 2.4.1 compile @@ -219,7 +202,7 @@ - + org.xerial sqlite-jdbc @@ -227,7 +210,13 @@ compile - + + + javax.mail + javax.mail-api + 1.5.4 + compile + com.sun.mail javax.mail diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 8f9db6d8..472a29e8 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -134,10 +134,13 @@ public class DataManager { playerFile.delete(); i++; } else { - playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml"); - if (playerFile.exists()) { - playerFile.delete(); - i++; + try { + playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml"); + if (playerFile.exists()) { + playerFile.delete(); + i++; + } + } catch (Exception e) { // Don't do nothing if the method getUniqueId() isn't avariable ( MC version < 1.7.5 ) } } } catch (Exception e) { diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index 75db7b7c..1845d739 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -1,12 +1,9 @@ package fr.xephi.authme.settings; import java.io.File; -import java.io.InputStream; - import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; -import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; public class Messages extends CustomConfiguration { @@ -29,13 +26,11 @@ public class Messages extends CustomConfiguration { * @param filename * The filename to open */ - @SuppressWarnings("deprecation") public final void loadDefaults(File file) { - InputStream stream = AuthMe.getInstance().getResource(file.getName()); - if (stream == null) - return; - - setDefaults(YamlConfiguration.loadConfiguration(stream)); + if(file.isFile()){ + setDefaults(YamlConfiguration.loadConfiguration(file)); + } + return; } /** diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 54dcf2c1..41fbaff7 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -28,7 +28,7 @@ public final class Settings extends YamlConfiguration { public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe"; public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache"; public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db"; - public static final String MESSAGE_FILE = Settings.PLUGIN_FOLDER + File.separator + "messages"; + public static final String MESSAGE_FILE = Settings.PLUGIN_FOLDER + File.separator + "messages" + File.separator + "messages"; public static final String SETTINGS_FILE = Settings.PLUGIN_FOLDER + File.separator + "config.yml"; public static List allowCommands = null; public static List getJoinPermissions = null; diff --git a/src/main/resources/messages_bg.yml b/src/main/resources/messages/messages_bg.yml similarity index 100% rename from src/main/resources/messages_bg.yml rename to src/main/resources/messages/messages_bg.yml diff --git a/src/main/resources/messages_br.yml b/src/main/resources/messages/messages_br.yml similarity index 100% rename from src/main/resources/messages_br.yml rename to src/main/resources/messages/messages_br.yml diff --git a/src/main/resources/messages_cz.yml b/src/main/resources/messages/messages_cz.yml similarity index 100% rename from src/main/resources/messages_cz.yml rename to src/main/resources/messages/messages_cz.yml diff --git a/src/main/resources/messages_de.yml b/src/main/resources/messages/messages_de.yml similarity index 100% rename from src/main/resources/messages_de.yml rename to src/main/resources/messages/messages_de.yml diff --git a/src/main/resources/messages_en.yml b/src/main/resources/messages/messages_en.yml similarity index 100% rename from src/main/resources/messages_en.yml rename to src/main/resources/messages/messages_en.yml diff --git a/src/main/resources/messages_es.yml b/src/main/resources/messages/messages_es.yml similarity index 100% rename from src/main/resources/messages_es.yml rename to src/main/resources/messages/messages_es.yml diff --git a/src/main/resources/messages_eu.yml b/src/main/resources/messages/messages_eu.yml similarity index 100% rename from src/main/resources/messages_eu.yml rename to src/main/resources/messages/messages_eu.yml diff --git a/src/main/resources/messages_fi.yml b/src/main/resources/messages/messages_fi.yml similarity index 100% rename from src/main/resources/messages_fi.yml rename to src/main/resources/messages/messages_fi.yml diff --git a/src/main/resources/messages_fr.yml b/src/main/resources/messages/messages_fr.yml similarity index 100% rename from src/main/resources/messages_fr.yml rename to src/main/resources/messages/messages_fr.yml diff --git a/src/main/resources/messages_gl.yml b/src/main/resources/messages/messages_gl.yml similarity index 100% rename from src/main/resources/messages_gl.yml rename to src/main/resources/messages/messages_gl.yml diff --git a/src/main/resources/messages_hu.yml b/src/main/resources/messages/messages_hu.yml similarity index 100% rename from src/main/resources/messages_hu.yml rename to src/main/resources/messages/messages_hu.yml diff --git a/src/main/resources/messages_it.yml b/src/main/resources/messages/messages_it.yml similarity index 100% rename from src/main/resources/messages_it.yml rename to src/main/resources/messages/messages_it.yml diff --git a/src/main/resources/messages_ko.yml b/src/main/resources/messages/messages_ko.yml similarity index 100% rename from src/main/resources/messages_ko.yml rename to src/main/resources/messages/messages_ko.yml diff --git a/src/main/resources/messages_lt.yml b/src/main/resources/messages/messages_lt.yml similarity index 100% rename from src/main/resources/messages_lt.yml rename to src/main/resources/messages/messages_lt.yml diff --git a/src/main/resources/messages_nl.yml b/src/main/resources/messages/messages_nl.yml similarity index 100% rename from src/main/resources/messages_nl.yml rename to src/main/resources/messages/messages_nl.yml diff --git a/src/main/resources/messages_pl.yml b/src/main/resources/messages/messages_pl.yml similarity index 100% rename from src/main/resources/messages_pl.yml rename to src/main/resources/messages/messages_pl.yml diff --git a/src/main/resources/messages_pt.yml b/src/main/resources/messages/messages_pt.yml similarity index 100% rename from src/main/resources/messages_pt.yml rename to src/main/resources/messages/messages_pt.yml diff --git a/src/main/resources/messages_ru.yml b/src/main/resources/messages/messages_ru.yml similarity index 98% rename from src/main/resources/messages_ru.yml rename to src/main/resources/messages/messages_ru.yml index 536dc479..4a6a2bf1 100644 --- a/src/main/resources/messages_ru.yml +++ b/src/main/resources/messages/messages_ru.yml @@ -1,58 +1,58 @@ -unknown_user: '&fПользователь не найден в Базе Данных' -unsafe_spawn: '&eВаше расположение перед выходом было опасным - вы перенесены на спавн' -not_logged_in: '&cВы еще не вошли!' -reg_voluntarily: '&aЧтобы зарегистрироваться введите: &5/reg ПАРОЛЬ ПОВТОР_ПАРОЛЯ' -usage_log: '&eСинтаксис: &d/l ПАРОЛЬ &eили &d/login ПАРОЛЬ' -wrong_pwd: '&4Неправильный пароль!' -unregistered: '&6Вы успешно удалили свой аккаунт!' -reg_disabled: '&4Регистрация отключена' -valid_session: '&aСессия открыта' -login: '&2Вы успешно вошли!' -vb_nonActiv: '&6Ваш аккаунт еще не активирован! Проверьте вашу почту!' -user_regged: '&4Такой игрок уже зарегистрирован' -usage_reg: '&4Использование: &5/reg ПАРОЛЬ ПОВТОР_ПАРОЛЯ' -max_reg: '&4Вы превысили макс количество регистраций на ваш IP' -no_perm: '&4Недостаточно прав' -error: '&4Произошла ошибка. Свяжитесь с администратором' -login_msg: '&4Авторизация: &5/l ПАРОЛЬ' -reg_msg: '&4Регистрация: &5/reg ПАРОЛЬ ПОВТОР_ПАРОЛЯ' -password_error_nick: '&fВы не можете использовать ваш ник в роли пароля' -password_error_unsafe: '&fВы не можете использовать небезопасный пароль' -reg_email_msg: '&4Регистрация: &5/reg EMAIL ПОВТОР_EMAIL' -usage_unreg: '&4Использование: &5/unregister ПАРОЛЬ' -pwd_changed: '&2Пароль изменен!' -user_unknown: '&4Такой игрок не зарегистрирован' -password_error: '&4Пароль не совпадает' -invalid_session: '&4Сессия некорректна. Дождитесь, пока она закончится' -reg_only: '&4Только для зарегистрированных! Посетите http://сайт_сервера.com/register/ для регистрации' -logged_in: '&4Вы уже авторизированы!' -logout: '&2Вы успешно вышли' -same_nick: '&4Такой игрок уже играет на сервере' -registered: '&2Успешная регистрация!' -pass_len: '&4Твой пароль либо слишком длинный, либо слишком короткий' -reload: '&6Конфигурация и база данных перезагружены' -timeout: '&4Время для авторизации истекло' -usage_changepassword: '&4Использование: &5/changepassword СТАРЫЙ_ПАРОЛЬ НОВЫЙ_ПАРОЛЬ' -name_len: '&4Ваш логин слишком длинный или слишком короткий' -regex: '&4Ваш логин содержит запрещенные символы. Разрешенные символы: REG_EX' -add_email: '&4Добавьте свой email: &5/email add ВАШ_EMAIL ВАШ_EMAIL' -bad_database_email: '&4[AuthMe] Команда &5/email&4 доступна только при работе с MySQL или SQLite. Обратититесь к администрации сервера' -recovery_email: '&4Забыли пароль? Используйте &5/email recovery ВАШ_EMAIL' -usage_captcha: '&4Вы должны ввести код, используйте: &5/captcha ' -wrong_captcha: '&4Неверный код, используйте: &5/captcha THE_CAPTCHA' -valid_captcha: '&2Вы успешно ввели код!' -kick_forvip: '&6VIP игрок зашел на переполненный сервер!' -kick_fullserver: '&4Сервер переполнен!' -usage_email_add: '&4Использование: &5/email add ВАШ_EMAIL ПОВТОР_EMAIL' -usage_email_change: '&4Использование: &5/email change СТАРЫЙ_EMAIL НОВЫЙ_EMAIL' -usage_email_recovery: '&4Использование: /email recovery EMAIL' -new_email_invalid: '[AuthMe] Недействительный новый email!' -old_email_invalid: '[AuthMe] Недействительный старый email!' -email_invalid: '[AuthMe] Недействительный email' -email_added: '[AuthMe] Email добавлен!' -email_confirm: '[AuthMe] Подтвердите ваш Email!' -email_changed: '[AuthMe] Email изменен!' -email_send: '[AuthMe] Письмо с инструкциями для восстановления было отправлено на ваш Email!' -country_banned: 'Вход с IP-адресов вашей страны воспрещен на этом сервере' -antibot_auto_enabled: '[AuthMe] AntiBot-режим автоматически включен из-за большого количества входов!' -antibot_auto_disabled: '[AuthMe] AntiBot-режим автоматичски отключен после %m мин. Надеюсь атака закончилась' +unknown_user: '&fПользователь не найден в Базе Данных' +unsafe_spawn: '&eВаше расположение перед выходом было опасным - вы перенесены на спавн' +not_logged_in: '&cВы еще не вошли!' +reg_voluntarily: '&aЧтобы зарегистрироваться введите: &5/reg ПАРОЛЬ ПОВТОР_ПАРОЛЯ' +usage_log: '&eСинтаксис: &d/l ПАРОЛЬ &eили &d/login ПАРОЛЬ' +wrong_pwd: '&4Неправильный пароль!' +unregistered: '&6Вы успешно удалили свой аккаунт!' +reg_disabled: '&4Регистрация отключена' +valid_session: '&aСессия открыта' +login: '&2Вы успешно вошли!' +vb_nonActiv: '&6Ваш аккаунт еще не активирован! Проверьте вашу почту!' +user_regged: '&4Такой игрок уже зарегистрирован' +usage_reg: '&4Использование: &5/reg ПАРОЛЬ ПОВТОР_ПАРОЛЯ' +max_reg: '&4Вы превысили макс количество регистраций на ваш IP' +no_perm: '&4Недостаточно прав' +error: '&4Произошла ошибка. Свяжитесь с администратором' +login_msg: '&4Авторизация: &5/l ПАРОЛЬ' +reg_msg: '&4Регистрация: &5/reg ПАРОЛЬ ПОВТОР_ПАРОЛЯ' +password_error_nick: '&fВы не можете использовать ваш ник в роли пароля' +password_error_unsafe: '&fВы не можете использовать небезопасный пароль' +reg_email_msg: '&4Регистрация: &5/reg EMAIL ПОВТОР_EMAIL' +usage_unreg: '&4Использование: &5/unregister ПАРОЛЬ' +pwd_changed: '&2Пароль изменен!' +user_unknown: '&4Такой игрок не зарегистрирован' +password_error: '&4Пароль не совпадает' +invalid_session: '&4Сессия некорректна. Дождитесь, пока она закончится' +reg_only: '&4Только для зарегистрированных! Посетите http://сайт_сервера.com/register/ для регистрации' +logged_in: '&4Вы уже авторизированы!' +logout: '&2Вы успешно вышли' +same_nick: '&4Такой игрок уже играет на сервере' +registered: '&2Успешная регистрация!' +pass_len: '&4Твой пароль либо слишком длинный, либо слишком короткий' +reload: '&6Конфигурация и база данных перезагружены' +timeout: '&4Время для авторизации истекло' +usage_changepassword: '&4Использование: &5/changepassword СТАРЫЙ_ПАРОЛЬ НОВЫЙ_ПАРОЛЬ' +name_len: '&4Ваш логин слишком длинный или слишком короткий' +regex: '&4Ваш логин содержит запрещенные символы. Разрешенные символы: REG_EX' +add_email: '&4Добавьте свой email: &5/email add ВАШ_EMAIL ВАШ_EMAIL' +bad_database_email: '&4[AuthMe] Команда &5/email&4 доступна только при работе с MySQL или SQLite. Обратититесь к администрации сервера' +recovery_email: '&4Забыли пароль? Используйте &5/email recovery ВАШ_EMAIL' +usage_captcha: '&4Вы должны ввести код, используйте: &5/captcha ' +wrong_captcha: '&4Неверный код, используйте: &5/captcha THE_CAPTCHA' +valid_captcha: '&2Вы успешно ввели код!' +kick_forvip: '&6VIP игрок зашел на переполненный сервер!' +kick_fullserver: '&4Сервер переполнен!' +usage_email_add: '&4Использование: &5/email add ВАШ_EMAIL ПОВТОР_EMAIL' +usage_email_change: '&4Использование: &5/email change СТАРЫЙ_EMAIL НОВЫЙ_EMAIL' +usage_email_recovery: '&4Использование: /email recovery EMAIL' +new_email_invalid: '[AuthMe] Недействительный новый email!' +old_email_invalid: '[AuthMe] Недействительный старый email!' +email_invalid: '[AuthMe] Недействительный email' +email_added: '[AuthMe] Email добавлен!' +email_confirm: '[AuthMe] Подтвердите ваш Email!' +email_changed: '[AuthMe] Email изменен!' +email_send: '[AuthMe] Письмо с инструкциями для восстановления было отправлено на ваш Email!' +country_banned: 'Вход с IP-адресов вашей страны воспрещен на этом сервере' +antibot_auto_enabled: '[AuthMe] AntiBot-режим автоматически включен из-за большого количества входов!' +antibot_auto_disabled: '[AuthMe] AntiBot-режим автоматичски отключен после %m мин. Надеюсь атака закончилась' diff --git a/src/main/resources/messages_sk.yml b/src/main/resources/messages/messages_sk.yml similarity index 100% rename from src/main/resources/messages_sk.yml rename to src/main/resources/messages/messages_sk.yml diff --git a/src/main/resources/messages_tr.yml b/src/main/resources/messages/messages_tr.yml similarity index 100% rename from src/main/resources/messages_tr.yml rename to src/main/resources/messages/messages_tr.yml diff --git a/src/main/resources/messages_uk.yml b/src/main/resources/messages/messages_uk.yml similarity index 100% rename from src/main/resources/messages_uk.yml rename to src/main/resources/messages/messages_uk.yml diff --git a/src/main/resources/messages_vn.yml b/src/main/resources/messages/messages_vn.yml similarity index 97% rename from src/main/resources/messages_vn.yml rename to src/main/resources/messages/messages_vn.yml index 56efede9..1722385a 100644 --- a/src/main/resources/messages_vn.yml +++ b/src/main/resources/messages/messages_vn.yml @@ -1,59 +1,59 @@ -unknown_user: '&fNgười chơi không tồn tại trong cơ sở dữ liệu' -unsafe_spawn: '&fNơi thoát server của bạn không an toàn, đang dịch chuyển bạn tới điểm spawn của server' -not_logged_in: '&cChưa đăng nhập!' -reg_voluntarily: '&fBạn có thể đăng kí tài khoản với lệnh - "/register mật-khẩu nhập-lại-mật-khẩu"' -usage_log: '&eSử dụng: /login password' -wrong_pwd: '&cSai mật khẩu' -unregistered: '&cHuỷ đăng kí thành công!' -reg_disabled: '&cHệ thống đăng kí đã bị vô hiệu' -valid_session: '&cPhiên đăng nhập còn tồn tại, bạn không cần nhập mật khẩu' -login: '&cĐăng nhập thành công!' -vb_nonActiv: '&fTài khoản của bạn chưa được kích hoạt, kiểm tra email!' -user_regged: '&cTên đăng nhập này đã được đăng kí' -usage_reg: '&eSử dụng: /register mật-khẩu nhập-lại-mật-khẩu' -max_reg: '&fSố lượng tài khoản ở IP của bạn trong server này đã quá giới hạn cho phép' -no_perm: '&cKhông có quyền' -error: '&fCó lỗi xảy ra; Báo lại cho người điều hành server' -login_msg: '&cĐăng nhập với lệnh "/login mật-khẩu"' -reg_msg: '&cĐăng kí tài khoản với lệnh "/register mật-khẩu nhập-lại-mật-khẩu"' -reg_email_msg: '&cĐăng kí email cho tài khoản với lệnh "/register "' -usage_unreg: '&eSử dụng: /unregister mật-khẩu' -pwd_changed: '&cĐã đổi mật khẩu!' -user_unknown: '&cTài khoản này chưa được đăng kí' -password_error: '&fMật khẩu không khớp' -unvalid_session: '&fPhiên đăng nhập không hồi đáp, vui lòng chờ phiên đăng nhập kết thúc' -reg_only: '&fChỉ cho phép người đã đăng kí! Hãy vào trang http://web-của.bạn/ để đăng kí' -logged_in: '&cĐã đăng nhập!' -logout: '&cThoát đăng nhập thành công' -same_nick: '&fTài khoản đang được người khác sử dụng trong server' -registered: '&cĐăng kí thành công!' -pass_len: '&fMật khẩu của bạn quá ngắn hoặc quá dài' -reload: '&fThiết lập và dữ liệu đã được nạp lại' -timeout: '&fQuá thời gian đăng nhập' -usage_changepassword: '&eSử dụng: /changepassword mật-khẩu-cũ mật-khẩu-mới' -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' -bad_database_email: '[AuthMe] Lệnh /email chỉ hoạt động với cơ sở dữ liệu MySQL và SQLite, - hãy liên hệ điều hành viên của server' -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 ' -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!' -kick_fullserver: '&cXin lỗi, hiện tại server không còn trống slot để bạn có thể vào!' -usage_email_add: '&eSử dụng: /email add ' -usage_email_change: '&eSử dụng: /email change ' -usage_email_recovery: '&eSử dụng: /email recovery ' -new_email_invalid: '[AuthMe] Địa chỉ email mới không hợp lệ!' -old_email_invalid: '[AuthMe] Địa chỉ email cũ không hợp lệ!' -email_invalid: '[AuthMe] Sai địa chỉ email' -email_added: '[AuthMe] Đã thêm địa chỉ email !' -email_confirm: '[AuthMe] Xác nhận email !' -email_changed: '[AuthMe] Đã thay đổi email !' -email_send: '[AuthMe] Đã gửi email khôi phục mật khẩu tới bạn !' -country_banned: 'Rất tiếc, quốc gia của bạn không được phép gia nhập server' -antibot_auto_enabled: '[AuthMe] AntiBot đã được kích hoạt vì lượng người chơi kết nối vượt quá giới hạn!' -antibot_auto_disabled: '[AuthMe] AntiBot tự huỷ kích hoạt sau %m phút, +unknown_user: '&fNgười chơi không tồn tại trong cơ sở dữ liệu' +unsafe_spawn: '&fNơi thoát server của bạn không an toàn, đang dịch chuyển bạn tới điểm spawn của server' +not_logged_in: '&cChưa đăng nhập!' +reg_voluntarily: '&fBạn có thể đăng kí tài khoản với lệnh + "/register mật-khẩu nhập-lại-mật-khẩu"' +usage_log: '&eSử dụng: /login password' +wrong_pwd: '&cSai mật khẩu' +unregistered: '&cHuỷ đăng kí thành công!' +reg_disabled: '&cHệ thống đăng kí đã bị vô hiệu' +valid_session: '&cPhiên đăng nhập còn tồn tại, bạn không cần nhập mật khẩu' +login: '&cĐăng nhập thành công!' +vb_nonActiv: '&fTài khoản của bạn chưa được kích hoạt, kiểm tra email!' +user_regged: '&cTên đăng nhập này đã được đăng kí' +usage_reg: '&eSử dụng: /register mật-khẩu nhập-lại-mật-khẩu' +max_reg: '&fSố lượng tài khoản ở IP của bạn trong server này đã quá giới hạn cho phép' +no_perm: '&cKhông có quyền' +error: '&fCó lỗi xảy ra; Báo lại cho người điều hành server' +login_msg: '&cĐăng nhập với lệnh "/login mật-khẩu"' +reg_msg: '&cĐăng kí tài khoản với lệnh "/register mật-khẩu nhập-lại-mật-khẩu"' +reg_email_msg: '&cĐăng kí email cho tài khoản với lệnh "/register "' +usage_unreg: '&eSử dụng: /unregister mật-khẩu' +pwd_changed: '&cĐã đổi mật khẩu!' +user_unknown: '&cTài khoản này chưa được đăng kí' +password_error: '&fMật khẩu không khớp' +unvalid_session: '&fPhiên đăng nhập không hồi đáp, vui lòng chờ phiên đăng nhập kết thúc' +reg_only: '&fChỉ cho phép người đã đăng kí! Hãy vào trang http://web-của.bạn/ để đăng kí' +logged_in: '&cĐã đăng nhập!' +logout: '&cThoát đăng nhập thành công' +same_nick: '&fTài khoản đang được người khác sử dụng trong server' +registered: '&cĐăng kí thành công!' +pass_len: '&fMật khẩu của bạn quá ngắn hoặc quá dài' +reload: '&fThiết lập và dữ liệu đã được nạp lại' +timeout: '&fQuá thời gian đăng nhập' +usage_changepassword: '&eSử dụng: /changepassword mật-khẩu-cũ mật-khẩu-mới' +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' +bad_database_email: '[AuthMe] Lệnh /email chỉ hoạt động với cơ sở dữ liệu MySQL và SQLite, + hãy liên hệ điều hành viên của server' +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 ' +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!' +kick_fullserver: '&cXin lỗi, hiện tại server không còn trống slot để bạn có thể vào!' +usage_email_add: '&eSử dụng: /email add ' +usage_email_change: '&eSử dụng: /email change ' +usage_email_recovery: '&eSử dụng: /email recovery ' +new_email_invalid: '[AuthMe] Địa chỉ email mới không hợp lệ!' +old_email_invalid: '[AuthMe] Địa chỉ email cũ không hợp lệ!' +email_invalid: '[AuthMe] Sai địa chỉ email' +email_added: '[AuthMe] Đã thêm địa chỉ email !' +email_confirm: '[AuthMe] Xác nhận email !' +email_changed: '[AuthMe] Đã thay đổi email !' +email_send: '[AuthMe] Đã gửi email khôi phục mật khẩu tới bạn !' +country_banned: 'Rất tiếc, quốc gia của bạn không được phép gia nhập server' +antibot_auto_enabled: '[AuthMe] AntiBot đã được kích hoạt vì lượng người chơi kết nối vượt quá giới hạn!' +antibot_auto_disabled: '[AuthMe] AntiBot tự huỷ kích hoạt sau %m phút, hi vọng lượng kết nối sẽ giảm bớt' \ No newline at end of file diff --git a/src/main/resources/messages_zhcn.yml b/src/main/resources/messages/messages_zhcn.yml similarity index 100% rename from src/main/resources/messages_zhcn.yml rename to src/main/resources/messages/messages_zhcn.yml diff --git a/src/main/resources/messages_zhhk.yml b/src/main/resources/messages/messages_zhhk.yml similarity index 98% rename from src/main/resources/messages_zhhk.yml rename to src/main/resources/messages/messages_zhhk.yml index 173fb46c..d66f1003 100644 --- a/src/main/resources/messages_zhhk.yml +++ b/src/main/resources/messages/messages_zhhk.yml @@ -1,61 +1,61 @@ -# Translator: uSoc_lifehome (http://lifeho.me) # -# Translator: WaterXCubic # -# -------------------------------------------- # -unknown_user: '&8[&6Τt&8] &fΤƨäsbƮwC' -unsafe_spawn: '&8[&6Τt&8] &fAnXmwA{bNǰeA쭫IC' -not_logged_in: '&8[&6Τt&8] &cA٨SnJ I' -reg_voluntarily: '&8[&6Τt&8] &fAiHϥγoӪOӵUG m /register <бKX> n' -usage_log: '&8[&6Τt&8] &cΪkG m /login n' -wrong_pwd: '&8[&6Τt&8] &cAJF~KXC' -unregistered: '&8[&6Τt&8] &cAw\|UOC' -reg_disabled: '&8[&6Τt&8] &cAwsaUC' -valid_session: '&8[&6Τt&8] &b I ڰOoAAw^ӡ' -login: '&8[&6Τt&8] &cA\nJFC' -password_error_nick: '&fAiHϥΧAWrKX!' -password_error_unsafe: '&fAiHϥΤwKX' -vb_nonActiv: '&8[&6Τt&8] &fAb٨SgLql I' -user_regged: '&8[&6Τt&8] &cΤWwgULFC' -usage_reg: '&8[&6Τt&8] &cΪkG m /register <бKX> n' -max_reg: '&8[&6Τt&8] &fAIPa}wFUƤWC' -no_perm: '&8[&6Τt&8] &bAiH CraftingHK aʬ줤dݻC' -error: '&8[&6Τt&8] &foͿ~AлP޲zpC' -login_msg: '&8[&6Τt&8] &cШϥγoӫOӵnJG m /login n' -reg_msg: '&8[&6Τt&8] &cШϥγoӪOӵUG m /register <бKX> n' -reg_email_msg: '&8[&6Τt&8] &cШϥγoӪOӵUG m /register <йql> n' -usage_unreg: '&8[&6Τt&8] &cΪkG m /unregister n' -pwd_changed: '&8[&6Τt&8] &cA\󴫤FAKX I' -user_unknown: '&8[&6Τt&8] &cΤWSwnOơC' -password_error: '&8[&6Τt&8] &fKXŦXC' -invalid_session: '&8[&6Τt&8] &fnJqƤwlaAеݵnJqC' -reg_only: '&8[&6Τt&8] &fwU|AХ https://www.example.com/ UC' -logged_in: '&8[&6Τt&8] &cAwgnJLFC' -logout: '&8[&6Τt&8] &bA\nXFC' -same_nick: '&8[&6Τt&8] &fPWawbCC' -registered: '&8[&6Τt&8] &bA\UFC' -pass_len: '&8[&6Τt&8] &fAKXäŦXWwסC' -reload: '&8[&6Τt&8] &bnJtγ]wθƮwsJC' -timeout: '&8[&6Τt&8] &fnJOɡC' -usage_changepassword: '&8[&6Τt&8] &fΪkG m /changepassword <±KX> n' -name_len: '&8[&6Τt&8] &cAΤWŦXWwסC' -regex: '&8[&6Τt&8] &cAΤWte\ršCHU\rG REG_EX' -add_email: '&8[&6Τt&8] &bЬAbߧYK[qla}G m /email add <йqla}> n' -bad_database_email: '&8[&6Τt&8] OuAΩϥMySQLSQLiteAC' -recovery_email: '&8[&6Τt&8] &cѰOKX H ШϥγoӪOӧsKXG m /email recovery n' -usage_captcha: '&8[&6Τt&8] &cΪkG m /captcha n' -wrong_captcha: '&8[&6Τt&8] &cAJF~ҽXAШϥ m /captcha <ҽX> n AJC' -valid_captcha: '&8[&6Τt&8] &cAҿJҽXOLĪ I' -kick_forvip: '&c]VIPanJFAC' -kick_fullserver: '&cpI ]AHFAҥHAثenJAC' -usage_email_add: '&8[&6Τt&8] &fΪkG m /email add <йql> n' -usage_email_change: '&8[&6Τt&8] &fΪkG m /email change <¹ql> n' -usage_email_recovery: '&8[&6Τt&8] &fΪkG m /email recovery n' -new_email_invalid: '&8[&6Τt&8] AҶgsqla}äTC' -old_email_invalid: '&8[&6Τt&8] AҶg¹qla}äTC' -email_invalid: '&8[&6Τt&8] AҶgqla}äTC' -email_added: '&8[&6Τt&8] w[JAqla}OC' -email_confirm: '&8[&6Τt&8] ЭпJAqla}C' -email_changed: '&8[&6Τt&8] Aqla}OwC' -email_send: '&8[&6Τt&8] ѰOKXHwHXAЬdC' -country_banned: '&8[&6Τt&8] AwAaѹCAȡC' -antibot_auto_enabled: '&8[&6Τt&8] H{Ǥw]{ɤjqM`suӱҥΡC' -antibot_auto_disabled: '&8[&6Τt&8] H{ˬd줣`sƤw֡Aé %m ᰱB@C' +# Translator: uSoc_lifehome (http://lifeho.me) # +# Translator: WaterXCubic # +# -------------------------------------------- # +unknown_user: '&8[&6Τt&8] &fΤƨäsbƮwC' +unsafe_spawn: '&8[&6Τt&8] &fAnXmwA{bNǰeA쭫IC' +not_logged_in: '&8[&6Τt&8] &cA٨SnJ I' +reg_voluntarily: '&8[&6Τt&8] &fAiHϥγoӪOӵUG m /register <бKX> n' +usage_log: '&8[&6Τt&8] &cΪkG m /login n' +wrong_pwd: '&8[&6Τt&8] &cAJF~KXC' +unregistered: '&8[&6Τt&8] &cAw\|UOC' +reg_disabled: '&8[&6Τt&8] &cAwsaUC' +valid_session: '&8[&6Τt&8] &b I ڰOoAAw^ӡ' +login: '&8[&6Τt&8] &cA\nJFC' +password_error_nick: '&fAiHϥΧAWrKX!' +password_error_unsafe: '&fAiHϥΤwKX' +vb_nonActiv: '&8[&6Τt&8] &fAb٨SgLql I' +user_regged: '&8[&6Τt&8] &cΤWwgULFC' +usage_reg: '&8[&6Τt&8] &cΪkG m /register <бKX> n' +max_reg: '&8[&6Τt&8] &fAIPa}wFUƤWC' +no_perm: '&8[&6Τt&8] &bAiH CraftingHK aʬ줤dݻC' +error: '&8[&6Τt&8] &foͿ~AлP޲zpC' +login_msg: '&8[&6Τt&8] &cШϥγoӫOӵnJG m /login n' +reg_msg: '&8[&6Τt&8] &cШϥγoӪOӵUG m /register <бKX> n' +reg_email_msg: '&8[&6Τt&8] &cШϥγoӪOӵUG m /register <йql> n' +usage_unreg: '&8[&6Τt&8] &cΪkG m /unregister n' +pwd_changed: '&8[&6Τt&8] &cA\󴫤FAKX I' +user_unknown: '&8[&6Τt&8] &cΤWSwnOơC' +password_error: '&8[&6Τt&8] &fKXŦXC' +invalid_session: '&8[&6Τt&8] &fnJqƤwlaAеݵnJqC' +reg_only: '&8[&6Τt&8] &fwU|AХ https://www.example.com/ UC' +logged_in: '&8[&6Τt&8] &cAwgnJLFC' +logout: '&8[&6Τt&8] &bA\nXFC' +same_nick: '&8[&6Τt&8] &fPWawbCC' +registered: '&8[&6Τt&8] &bA\UFC' +pass_len: '&8[&6Τt&8] &fAKXäŦXWwסC' +reload: '&8[&6Τt&8] &bnJtγ]wθƮwsJC' +timeout: '&8[&6Τt&8] &fnJOɡC' +usage_changepassword: '&8[&6Τt&8] &fΪkG m /changepassword <±KX> n' +name_len: '&8[&6Τt&8] &cAΤWŦXWwסC' +regex: '&8[&6Τt&8] &cAΤWte\ršCHU\rG REG_EX' +add_email: '&8[&6Τt&8] &bЬAbߧYK[qla}G m /email add <йqla}> n' +bad_database_email: '&8[&6Τt&8] OuAΩϥMySQLSQLiteAC' +recovery_email: '&8[&6Τt&8] &cѰOKX H ШϥγoӪOӧsKXG m /email recovery n' +usage_captcha: '&8[&6Τt&8] &cΪkG m /captcha n' +wrong_captcha: '&8[&6Τt&8] &cAJF~ҽXAШϥ m /captcha <ҽX> n AJC' +valid_captcha: '&8[&6Τt&8] &cAҿJҽXOLĪ I' +kick_forvip: '&c]VIPanJFAC' +kick_fullserver: '&cpI ]AHFAҥHAثenJAC' +usage_email_add: '&8[&6Τt&8] &fΪkG m /email add <йql> n' +usage_email_change: '&8[&6Τt&8] &fΪkG m /email change <¹ql> n' +usage_email_recovery: '&8[&6Τt&8] &fΪkG m /email recovery n' +new_email_invalid: '&8[&6Τt&8] AҶgsqla}äTC' +old_email_invalid: '&8[&6Τt&8] AҶg¹qla}äTC' +email_invalid: '&8[&6Τt&8] AҶgqla}äTC' +email_added: '&8[&6Τt&8] w[JAqla}OC' +email_confirm: '&8[&6Τt&8] ЭпJAqla}C' +email_changed: '&8[&6Τt&8] Aqla}OwC' +email_send: '&8[&6Τt&8] ѰOKXHwHXAЬdC' +country_banned: '&8[&6Τt&8] AwAaѹCAȡC' +antibot_auto_enabled: '&8[&6Τt&8] H{Ǥw]{ɤjqM`suӱҥΡC' +antibot_auto_disabled: '&8[&6Τt&8] H{ˬd줣`sƤw֡Aé %m ᰱB@C' diff --git a/src/main/resources/messages_zhtw.yml b/src/main/resources/messages/messages_zhtw.yml similarity index 98% rename from src/main/resources/messages_zhtw.yml rename to src/main/resources/messages/messages_zhtw.yml index 6668976e..5091f841 100644 --- a/src/main/resources/messages_zhtw.yml +++ b/src/main/resources/messages/messages_zhtw.yml @@ -1,62 +1,62 @@ -# Translator: MineWolf50 -# Last Time Edit : 2015 / 7 / 14 , A.M.10:14 -# = = = = = = = = = = = = = = = = = = = = = = = # -unknown_user: "&b【AuthMe】&6沒有在資料庫內找到該玩家。" -unsafe_spawn: '&b【AuthMe】&6你登出的地點不安全,已傳送你到安全的地點。' -not_logged_in: '&b【AuthMe】&6你還沒有登入!' -reg_voluntarily: '&b【AuthMe】&6使用 &c"/register <密碼> <確認密碼>" &6來註冊你的暱稱' -usage_log: '&b【AuthMe】&6用法: &c"/login <密碼>"' -wrong_pwd: '&b【AuthMe】&6密碼錯誤!' -unregistered: '&b【AuthMe】&6你已經成功取消註冊。' -reg_disabled: '&b【AuthMe】&6已關閉註冊功能' -password_error_nick: '&b【AuthMe】&6你不可以用你的 ID ( 名稱 ) 來當作密碼 !' -password_error_unsafe: '&b【AuthMe】&6你不可以使用這個不安全的密碼' -valid_session: '&b【AuthMe】&6你已經成功登入!' -login: '&b【AuthMe】&6密碼正確,你已成功登入!' -vb_nonActiv: '&b【AuthMe】&6你的帳號還沒有經過驗證! 檢查看看你的電子信箱 (Email) 吧!' -user_regged: '&b【AuthMe】&6這個帳號已經被註冊過了!' -usage_reg: '&b【AuthMe】&6用法: &c"/register <密碼> <確認密碼>"' -max_reg: '&b【AuthMe】&6你的 IP 位置所註冊的帳號數量已經達到最大。' -no_perm: '&b【AuthMe】&6你沒有使用該指令的權限。' -error: '&b【AuthMe】&6發生錯誤,請聯繫管理員' -login_msg: '&b【AuthMe】&6請使用 &c"/login <密碼>" &6來登入。' -reg_msg: '&b【AuthMe】&6請使用 "&c/register <密碼> <確認密碼>" 來註冊。' -reg_email_msg: '&b【AuthMe】&6請使用 &c"/register <重複Email>" 來註冊' -usage_unreg: '&b【AuthMe】&6用法: &c"/unregister <密碼>"' -pwd_changed: '&b【AuthMe】&6密碼變更成功!' -user_unknown: '&b【AuthMe】&6這個帳號還沒有註冊過' -password_error: '&b【AuthMe】&6兩次輸入的密碼不一致!' -invalid_session: '&b【AuthMe】&6憑證日期不相符!' -reg_only: '&b【AuthMe】&6請到下列網站 :「 http://example.com 」 進行註冊' -logged_in: '&b【AuthMe】&6你已經登入了!' -logout: '&b【AuthMe】&6你已成功登出' -same_nick: '&b【AuthMe】&6有同樣帳號的玩家在線上!' -registered: '&b【AuthMe】&6你已成功註冊' -pass_len: '&b【AuthMe】&6你的密碼 超過最大字數 / 小於最小字數' -reload: '&b【AuthMe】&6已重新讀取設定檔及資料庫' -timeout: '&b【AuthMe】&6超過登入時間,請稍後再試一次' -usage_changepassword: '&b【AuthMe】&6用法: &c"/changepassword <舊密碼> <新密碼>"' -name_len: '&b【AuthMe】&6你的暱稱 太長 / 太短 了!' -regex: '&b【AuthMe】&6暱稱裡包含不能使用的字符' -add_email: '&b【AuthMe】&6請使用 &c"/email add <你的Email> <再次輸入你的Email>" &6來添加 Email' -bad_database_email: '&b【AuthMe】&6此指令只適用於有使用MySQL和SQLite的伺服器。' -recovery_email: '&b【AuthMe】&6忘記密碼了嗎? 使用 &c"/email recovery <你的Email>"' -usage_captcha: '&b【AuthMe】&6請用 &c"/captcha " &6來輸入你的驗證碼' -wrong_captcha: '&b【AuthMe】&6錯誤的驗證碼' -valid_captcha: '&b【AuthMe】&6驗證碼無效!' -kick_forvip: '&b【AuthMe】&6你已經被請出。&c原因 : 有 VIP 玩家登入伺服器' -kick_fullserver: '&b【AuthMe】&6伺服器已經滿了,請等等再試一次' -usage_email_add: '&b【AuthMe】&6用法: &c"/email add <你的Email> <重複Email>"' -usage_email_change: '&b【AuthMe】&6用法: &c"/email change <舊的Email> <新的Email>"' -usage_email_recovery: '&b【AuthMe】&6用法: &c"/email recovery <你的Email>"' -new_email_invalid: '&b【AuthMe】&6新的Email無效!' -old_email_invalid: '&b【AuthMe】&6舊的Email無效!' -email_invalid: '&b【AuthMe】&6無效的Email!' -email_added: '&b【AuthMe】&6已添加Email!' -email_confirm: '&b【AuthMe】&6請驗證你的Email!' -email_changed: '&b【AuthMe】&6Email已變更!' -email_send: '&b【AuthMe】&6已經送出重設密碼要求至你的Email , 請查收。' -email_exists: '&b【AuthMe】&6這個帳戶已經有設定電子郵件了' -country_banned: '&b【AuthMe】&6你所在的地區無法進入此伺服器' -antibot_auto_enabled: '&b【AuthMe】&6AntiBotMod已自動啟用!' +# Translator: MineWolf50 +# Last Time Edit : 2015 / 7 / 14 , A.M.10:14 +# = = = = = = = = = = = = = = = = = = = = = = = # +unknown_user: "&b【AuthMe】&6沒有在資料庫內找到該玩家。" +unsafe_spawn: '&b【AuthMe】&6你登出的地點不安全,已傳送你到安全的地點。' +not_logged_in: '&b【AuthMe】&6你還沒有登入!' +reg_voluntarily: '&b【AuthMe】&6使用 &c"/register <密碼> <確認密碼>" &6來註冊你的暱稱' +usage_log: '&b【AuthMe】&6用法: &c"/login <密碼>"' +wrong_pwd: '&b【AuthMe】&6密碼錯誤!' +unregistered: '&b【AuthMe】&6你已經成功取消註冊。' +reg_disabled: '&b【AuthMe】&6已關閉註冊功能' +password_error_nick: '&b【AuthMe】&6你不可以用你的 ID ( 名稱 ) 來當作密碼 !' +password_error_unsafe: '&b【AuthMe】&6你不可以使用這個不安全的密碼' +valid_session: '&b【AuthMe】&6你已經成功登入!' +login: '&b【AuthMe】&6密碼正確,你已成功登入!' +vb_nonActiv: '&b【AuthMe】&6你的帳號還沒有經過驗證! 檢查看看你的電子信箱 (Email) 吧!' +user_regged: '&b【AuthMe】&6這個帳號已經被註冊過了!' +usage_reg: '&b【AuthMe】&6用法: &c"/register <密碼> <確認密碼>"' +max_reg: '&b【AuthMe】&6你的 IP 位置所註冊的帳號數量已經達到最大。' +no_perm: '&b【AuthMe】&6你沒有使用該指令的權限。' +error: '&b【AuthMe】&6發生錯誤,請聯繫管理員' +login_msg: '&b【AuthMe】&6請使用 &c"/login <密碼>" &6來登入。' +reg_msg: '&b【AuthMe】&6請使用 "&c/register <密碼> <確認密碼>" 來註冊。' +reg_email_msg: '&b【AuthMe】&6請使用 &c"/register <重複Email>" 來註冊' +usage_unreg: '&b【AuthMe】&6用法: &c"/unregister <密碼>"' +pwd_changed: '&b【AuthMe】&6密碼變更成功!' +user_unknown: '&b【AuthMe】&6這個帳號還沒有註冊過' +password_error: '&b【AuthMe】&6兩次輸入的密碼不一致!' +invalid_session: '&b【AuthMe】&6憑證日期不相符!' +reg_only: '&b【AuthMe】&6請到下列網站 :「 http://example.com 」 進行註冊' +logged_in: '&b【AuthMe】&6你已經登入了!' +logout: '&b【AuthMe】&6你已成功登出' +same_nick: '&b【AuthMe】&6有同樣帳號的玩家在線上!' +registered: '&b【AuthMe】&6你已成功註冊' +pass_len: '&b【AuthMe】&6你的密碼 超過最大字數 / 小於最小字數' +reload: '&b【AuthMe】&6已重新讀取設定檔及資料庫' +timeout: '&b【AuthMe】&6超過登入時間,請稍後再試一次' +usage_changepassword: '&b【AuthMe】&6用法: &c"/changepassword <舊密碼> <新密碼>"' +name_len: '&b【AuthMe】&6你的暱稱 太長 / 太短 了!' +regex: '&b【AuthMe】&6暱稱裡包含不能使用的字符' +add_email: '&b【AuthMe】&6請使用 &c"/email add <你的Email> <再次輸入你的Email>" &6來添加 Email' +bad_database_email: '&b【AuthMe】&6此指令只適用於有使用MySQL和SQLite的伺服器。' +recovery_email: '&b【AuthMe】&6忘記密碼了嗎? 使用 &c"/email recovery <你的Email>"' +usage_captcha: '&b【AuthMe】&6請用 &c"/captcha " &6來輸入你的驗證碼' +wrong_captcha: '&b【AuthMe】&6錯誤的驗證碼' +valid_captcha: '&b【AuthMe】&6驗證碼無效!' +kick_forvip: '&b【AuthMe】&6你已經被請出。&c原因 : 有 VIP 玩家登入伺服器' +kick_fullserver: '&b【AuthMe】&6伺服器已經滿了,請等等再試一次' +usage_email_add: '&b【AuthMe】&6用法: &c"/email add <你的Email> <重複Email>"' +usage_email_change: '&b【AuthMe】&6用法: &c"/email change <舊的Email> <新的Email>"' +usage_email_recovery: '&b【AuthMe】&6用法: &c"/email recovery <你的Email>"' +new_email_invalid: '&b【AuthMe】&6新的Email無效!' +old_email_invalid: '&b【AuthMe】&6舊的Email無效!' +email_invalid: '&b【AuthMe】&6無效的Email!' +email_added: '&b【AuthMe】&6已添加Email!' +email_confirm: '&b【AuthMe】&6請驗證你的Email!' +email_changed: '&b【AuthMe】&6Email已變更!' +email_send: '&b【AuthMe】&6已經送出重設密碼要求至你的Email , 請查收。' +email_exists: '&b【AuthMe】&6這個帳戶已經有設定電子郵件了' +country_banned: '&b【AuthMe】&6你所在的地區無法進入此伺服器' +antibot_auto_enabled: '&b【AuthMe】&6AntiBotMod已自動啟用!' antibot_auto_disabled: '&b【AuthMe】&6AntiBotMod將會於 &c%m &6分鐘後自動關閉' \ No newline at end of file From d13f8fc512245c674cf9d3445c47b2577ef83195 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 5 Sep 2015 00:50:08 +0200 Subject: [PATCH 115/427] Fix build xD --- pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a924c7f5..e13f330e 100644 --- a/pom.xml +++ b/pom.xml @@ -82,9 +82,7 @@ - org.slf4j:slf4j-api - org.apache.logging.log4j:log4j-slf4j-impl - com.zaxxer:HikariCP + com.zaxxer:HikariCP-Log4J com.maxmind.geoip:geoip-api com.sun.mail:javax.mail com.comphenix.attribute:AttributeStorage From 78d6b9cc6baa1631ebc58e3cc9f359b12b6116b7 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 5 Sep 2015 12:40:36 +0200 Subject: [PATCH 116/427] Ok, it's too complex to use the log4j implementation xD --- pom.xml | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index e13f330e..cecb3117 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,8 @@ - com.zaxxer:HikariCP-Log4J + com.zaxxer:HikariCP + org.slf4j:slf4j-simple com.maxmind.geoip:geoip-api com.sun.mail:javax.mail com.comphenix.attribute:AttributeStorage @@ -172,8 +173,8 @@ - hikaricp-log4j-releases - http://nexus-sgdc3.rhcloud.com/nexus/content/repositories/hikaricp-log4j-releases/ + hikaricp-log4j-releases + http://nexus-sgdc3.rhcloud.com/nexus/content/repositories/hikaricp-log4j-releases/ @@ -185,19 +186,9 @@ com.zaxxer - HikariCP-Log4J + HikariCP 2.4.1 compile - - - org.slf4j - slf4j-api - - - org.apache.logging.log4j - log4j-core - - From 3926faeb35c4379591bdf17a4b682720b547f6c1 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 6 Sep 2015 13:51:35 +0200 Subject: [PATCH 117/427] Fix Hikari timeouts --- pom.xml | 5 +++++ src/main/java/fr/xephi/authme/datasource/MySQL.java | 6 +++--- src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index cecb3117..7182eff4 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,11 @@ http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ + + AuthMe-Team + https://github.com/AuthMe-Team + + scm:git:https://github.com/Xephi/AuthMeReloaded.git scm:git:git@github.com:Xephi/AuthMeReloaded.git diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 73f730ad..24e37dbc 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -138,9 +138,9 @@ public class MySQL implements DataSource { config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", false); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable - config.setMaxLifetime(60000); // 60 Sec - config.setIdleTimeout(45000); // 45 Sec - config.setMaximumPoolSize(50); // 50 Connections (including idle connections) + config.setMaxLifetime(180000); // 3 Min + config.setIdleTimeout(60000); // 1 Min + config.setMaximumPoolSize(50); // 50 (including idle connections) ds = new HikariDataSource(config); ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 767a5da7..2b6ea386 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -126,9 +126,9 @@ public class SQLite_HIKARI implements DataSource { config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable config.setConnectionTestQuery("SELECT 1"); - config.setMaxLifetime(60000); // 60 Sec - config.setIdleTimeout(45000); // 45 Sec - config.setMaximumPoolSize(50); // 50 Connections (including idle connections) + config.setMaxLifetime(180000); // 3 Min + config.setIdleTimeout(60000); // 1 Min + config.setMaximumPoolSize(50); // 50 (including idle connections) ds = new HikariDataSource(config); ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } From 7f9d641fe3d6814a49869fa7044c22edaa846ee2 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 6 Sep 2015 14:16:57 +0200 Subject: [PATCH 118/427] Fix hikari logger --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index 7182eff4..b34222f3 100644 --- a/pom.xml +++ b/pom.xml @@ -89,6 +89,7 @@ com.zaxxer:HikariCP org.slf4j:slf4j-simple + org.slf4j:slf4j-api com.maxmind.geoip:geoip-api com.sun.mail:javax.mail com.comphenix.attribute:AttributeStorage @@ -195,6 +196,18 @@ 2.4.1 compile + + org.slf4j + slf4j-api + 1.7.12 + compile + + + org.slf4j + slf4j-simple + 1.7.12 + compile + From 200ff01cd9d8e2931cba7c620d6ce379273599f3 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 6 Sep 2015 22:24:23 +0700 Subject: [PATCH 119/427] never return null, just throw exception. --- src/main/java/fr/xephi/authme/AuthMe.java | 7 ++- .../java/fr/xephi/authme/ConsoleLogger.java | 7 ++- .../xephi/authme/datasource/DataSource.java | 5 +-- .../fr/xephi/authme/datasource/MySQL.java | 43 ++++++++----------- 4 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 131991dc..9f7834ab 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -626,9 +626,8 @@ public class AuthMe extends JavaPlugin { if (multiverse != null && Settings.multiverse) { try { return multiverse.getMVWorldManager().getMVWorld(world).getSpawnLocation(); - } catch (NullPointerException npe) { - } catch (ClassCastException cce) { - } catch (NoClassDefFoundError ncdfe) { + } catch (Exception e) { + e.printStackTrace(); } } return null; @@ -792,7 +791,7 @@ public class AuthMe extends JavaPlugin { /** * Get Player real IP through VeryGames method * - * @param Player + * @param player * player */ @Deprecated diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index 3a73ab5c..010b6619 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -1,5 +1,8 @@ package fr.xephi.authme; +import fr.xephi.authme.settings.Settings; +import org.bukkit.Bukkit; + import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; @@ -8,10 +11,6 @@ import java.text.DateFormat; import java.util.Calendar; import java.util.logging.Logger; -import org.bukkit.Bukkit; - -import fr.xephi.authme.settings.Settings; - public class ConsoleLogger { private static final Logger log = Logger.getLogger("AuthMe"); diff --git a/src/main/java/fr/xephi/authme/datasource/DataSource.java b/src/main/java/fr/xephi/authme/datasource/DataSource.java index ef445dc4..41dc8923 100644 --- a/src/main/java/fr/xephi/authme/datasource/DataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/DataSource.java @@ -1,13 +1,12 @@ package fr.xephi.authme.datasource; -import java.util.List; - import fr.xephi.authme.cache.auth.PlayerAuth; +import java.util.List; + public interface DataSource { public enum DataSourceType { - MYSQL, FILE, SQLITE diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 24e37dbc..15e5eb8e 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -1,24 +1,18 @@ package fr.xephi.authme.datasource; -import java.sql.Blob; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.pool.PoolInitializationException; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.Settings; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; + public class MySQL implements DataSource { private String host; @@ -43,6 +37,7 @@ public class MySQL implements DataSource { private List columnOthers; private HikariDataSource ds; private String columnRealName; + private Connection connection; public MySQL() throws ClassNotFoundException, SQLException, PoolInitializationException { this.host = Settings.getMySQLHost; @@ -135,35 +130,30 @@ public class MySQL implements DataSource { config.setPassword(this.password); config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); config.addDataSourceProperty("autoReconnect", false); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable config.setMaxLifetime(180000); // 3 Min config.setIdleTimeout(60000); // 1 Min - config.setMaximumPoolSize(50); // 50 (including idle connections) + config.setMaximumPoolSize(50); // 50 (including idle connections) ds = new HikariDataSource(config); ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } private synchronized void reloadArguments() throws ClassNotFoundException, IllegalArgumentException { - if (ds != null){ + if (ds != null) { ds.close(); } setConnectionArguments(); ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!"); } - private synchronized Connection getConnection() { - Connection con = null; - while(con == null){ - try { - con = ds.getConnection(); - } catch (SQLException ce) { - return null; - } + private synchronized Connection getConnection() throws SQLException { + if (connection == null || connection.isClosed()) { + connection = ds.getConnection(); } - return con; + return connection; } private synchronized void setupConnection() throws SQLException { @@ -268,7 +258,8 @@ public class MySQL implements DataSource { if (!columnSalt.isEmpty()) { if (!columnGroup.isEmpty()) pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), 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), rs.getString(columnRealName)); - else pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); + else + pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } else { pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } @@ -1047,7 +1038,8 @@ public class MySQL implements DataSource { if (!columnSalt.isEmpty()) { if (!columnGroup.isEmpty()) pAuth = 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), rs.getString(columnRealName)); - else pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); + else + pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } else { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } @@ -1098,7 +1090,8 @@ public class MySQL implements DataSource { if (!columnSalt.isEmpty()) { if (!columnGroup.isEmpty()) pAuth = 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), rs.getString(columnRealName)); - else pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); + else + pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } else { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } From 495dd35b4848f1585858b62e3b2711d3f9dbb22d Mon Sep 17 00:00:00 2001 From: DmitryRendov Date: Sun, 6 Sep 2015 20:28:25 +0000 Subject: [PATCH 120/427] Updated PBKDF2 hasher to support Django 1.7+ --- .../xephi/authme/security/crypts/CryptPBKDF2.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java index e6fb9bc5..426b36ee 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java @@ -4,17 +4,18 @@ import java.security.NoSuchAlgorithmException; import fr.xephi.authme.security.pbkdf2.PBKDF2Engine; import fr.xephi.authme.security.pbkdf2.PBKDF2Parameters; +import javax.xml.bind.DatatypeConverter; public class CryptPBKDF2 implements EncryptionMethod { @Override public String getHash(String password, String salt, String name) throws NoSuchAlgorithmException { - String result = "pbkdf2_sha256$10000$" + salt + "$"; - PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000); + String result = "pbkdf2_sha256$15000$" + salt + "$"; + PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000); PBKDF2Engine engine = new PBKDF2Engine(params); - - return result + String.valueOf(engine.deriveKey(password, 64)); + + return result + String.valueOf(DatatypeConverter.printBase64Binary(engine.deriveKey(password, 32))); } @Override @@ -22,8 +23,8 @@ public class CryptPBKDF2 implements EncryptionMethod { String playerName) throws NoSuchAlgorithmException { String[] line = hash.split("\\$"); String salt = line[2]; - String derivedKey = line[3]; - PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000, derivedKey.getBytes()); + byte[] derivedKey = DatatypeConverter.parseBase64Binary(line[3]); + PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000, derivedKey); PBKDF2Engine engine = new PBKDF2Engine(params); return engine.verifyKey(password); } From 7c2649abf51ed388805d89b4b2541454a27c4189 Mon Sep 17 00:00:00 2001 From: DmitryRendov Date: Sun, 6 Sep 2015 20:32:58 +0000 Subject: [PATCH 121/427] Fix --- src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java index 426b36ee..7e672ea7 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java @@ -14,7 +14,7 @@ public class CryptPBKDF2 implements EncryptionMethod { String result = "pbkdf2_sha256$15000$" + salt + "$"; PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000); PBKDF2Engine engine = new PBKDF2Engine(params); - + return result + String.valueOf(DatatypeConverter.printBase64Binary(engine.deriveKey(password, 32))); } From 395a514778b3afd7bd67c656c2345f5c1a6352b9 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Mon, 7 Sep 2015 12:33:24 +0200 Subject: [PATCH 122/427] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2f12855f..02e6a9d3 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,10 @@ typing commands or use the inventory. It can also kick players with uncommon lon EUR: USD:

    +#####Sponsor +GameHosting.it is leader in Italy in Game Server Provider. With its own DataCenter offers Anti-DDoS solutions at affordable prices. Game Server of Minecraft based on Multicraft are equipped with the latest technology in hardware. +[![GameHosting](http://www.gamehosting.it/images/bn3.png)](http://www.gamehosting.it) + #####Credits

    Team members: Xephi(Main Developer, Author), Maxetto(Contributor) and sgdc3(Contributor)

    Credit for old version of the plugin to: d4rkwarriors, fabe1337 , Whoami2 and pomo4ka

    From 1e9d7f879aad97c8f89f58f3c00644b37309b23c Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Mon, 7 Sep 2015 12:35:49 +0200 Subject: [PATCH 123/427] Sponsor --- src/main/java/fr/xephi/authme/AuthMe.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 7ed3dd9f..08ab36a5 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -295,6 +295,7 @@ public class AuthMe extends JavaPlugin { // Sponsor message ConsoleLogger.info("AuthMe hooks perfectly with the VERYGAMES server hosting!"); + ConsoleLogger.info("AuthMe builds are available on jenkins, thanks to our sponsor GameHosting.it - leader in Italy in Game Server Provider"); ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " correctly enabled!"); } From 8ec497a5e832459161426be79850fbee77552203 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Mon, 7 Sep 2015 13:25:40 +0200 Subject: [PATCH 124/427] Update AuthMe.java --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 7a817213..5e6e2cc0 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -308,7 +308,7 @@ public class AuthMe extends JavaPlugin { // Sponsor message ConsoleLogger.info("AuthMe hooks perfectly with the VERYGAMES server hosting!"); - ConsoleLogger.info("AuthMe builds are available on jenkins, thanks to our sponsor GameHosting.it - leader in Italy in Game Server Provider"); + ConsoleLogger.info("Development builds are available on our jenkins, thanks to our sponsor GameHosting.it - leader in Italy as Game Server Provider"); ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " correctly enabled!"); } From 0bab99b2fdf2fd92a21429fcc3e0d8cd2ac94480 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Mon, 7 Sep 2015 13:29:22 +0200 Subject: [PATCH 125/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02e6a9d3..3f12a0cc 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ EUR:

    #####Sponsor -GameHosting.it is leader in Italy in Game Server Provider. With its own DataCenter offers Anti-DDoS solutions at affordable prices. Game Server of Minecraft based on Multicraft are equipped with the latest technology in hardware. +GameHosting.it is leader in Italy as Game Server Provider. With its own DataCenter offers Anti-DDoS solutions at affordable prices. Game Server of Minecraft based on Multicraft are equipped with the latest technology in hardware. [![GameHosting](http://www.gamehosting.it/images/bn3.png)](http://www.gamehosting.it) #####Credits From 84b5dcc62583f0827988413c74d95931b3f6fa4c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 7 Sep 2015 14:05:50 +0200 Subject: [PATCH 126/427] Cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 3 +- .../fr/xephi/authme/datasource/MySQL.java | 10 +--- .../authme/datasource/SQLite_HIKARI.java | 55 ++++++++----------- 3 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 131991dc..353c9619 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -231,8 +231,9 @@ public class AuthMe extends JavaPlugin { dataManager = new DataManager(this); - // Setup API + // Setup the new API api = new NewAPI(this); + // Old deprecated API new API(this); // Setup Management diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 24e37dbc..594d489f 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -154,15 +154,9 @@ public class MySQL implements DataSource { ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!"); } - private synchronized Connection getConnection() { + private synchronized Connection getConnection() throws SQLException { Connection con = null; - while(con == null){ - try { - con = ds.getConnection(); - } catch (SQLException ce) { - return null; - } - } + con = ds.getConnection(); return con; } diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 2b6ea386..9ac80055 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -100,7 +100,7 @@ public class SQLite_HIKARI implements DataSource { this.setupConnection(); } catch (SQLException e) { ConsoleLogger.showError(e.getMessage()); - ConsoleLogger.showError("Can't initialize the MySQL database... Please check your database settings in the config.yml file! SHUTDOWN..."); + ConsoleLogger.showError("Can't initialize the SQLite database... Please check your database settings in the config.yml file! SHUTDOWN..."); ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); this.close(); if (Settings.isStopEnabled) { @@ -133,30 +133,18 @@ public class SQLite_HIKARI implements DataSource { ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } - private synchronized Connection getRawConnection() { - Connection con = null; - while(con == null){ - try { - con = ds.getConnection(); - } catch (SQLException ce) { - return null; - } + private synchronized void reloadArguments() + throws ClassNotFoundException, IllegalArgumentException { + if (ds != null){ + ds.close(); } - return con; + setConnectionArguments(); + ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!"); } - private synchronized Connection getConnection() { - Connection con; - con = getRawConnection(); - if(con == null){ - ds.close(); - ConsoleLogger.showError("Database connection is LOST! SHUTDOWN..."); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - } + private synchronized Connection getConnection() throws SQLException { + Connection con = null; + con = ds.getConnection(); return con; } @@ -165,17 +153,7 @@ public class SQLite_HIKARI implements DataSource { Statement st = null; ResultSet rs = null; try { - con = getRawConnection(); - if(con == null){ - ds.close(); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't connect to the SQLite database... Please check your database settings in the config.yml file! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - return; - } + con = getConnection(); st = con.createStatement(); st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" + columnID + " INTEGER AUTO_INCREMENT," + columnName + " VARCHAR(255) NOT NULL UNIQUE," + columnPassword + " VARCHAR(255) NOT NULL," + columnIp + " VARCHAR(40) NOT NULL," + columnLastLogin + " BIGINT," + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT '" + Settings.defaultWorld + "'," + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com'," + "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));"); rs = con.getMetaData().getColumns(null, null, tableName, columnPassword); @@ -807,6 +785,17 @@ public class SQLite_HIKARI implements DataSource { @Override public void reload() { + try { + reloadArguments(); + } catch (Exception e) { + ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.showError("Can't reconnect to SQLite database... Please check your SQLite informations ! SHUTDOWN..."); + if (Settings.isStopEnabled) { + AuthMe.getInstance().getServer().shutdown(); + } + if (!Settings.isStopEnabled) + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } } @Override From 65bb488f4cee61a60167f17bc723098867e68991 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 7 Sep 2015 14:30:56 +0200 Subject: [PATCH 127/427] PBKDF2DJANGO Hash --- .../xephi/authme/commands/AdminCommand.java | 3 ++ .../xephi/authme/security/HashAlgorithm.java | 1 + .../authme/security/crypts/CryptPBKDF2.java | 13 ++++---- .../security/crypts/CryptPBKDF2Django.java | 32 +++++++++++++++++++ src/main/resources/config.yml | 2 +- 5 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 1cc04829..76269f8f 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -520,6 +520,7 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "error"); return true; } + @SuppressWarnings("deprecation") Player target = Bukkit.getPlayer(name); PlayerCache.getInstance().removePlayer(name); Utils.getInstance().setGroup(name, groupType.UNREGISTERED); @@ -602,6 +603,7 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("Usage: /authme getip "); return true; } + @SuppressWarnings("deprecation") Player player = Bukkit.getPlayer(args[1]); if (player == null) { sender.sendMessage("This player is not actually online"); @@ -617,6 +619,7 @@ public class AdminCommand implements CommandExecutor { return true; } try { + @SuppressWarnings("deprecation") Player player = Bukkit.getPlayer(args[1]); if (player == null || !player.isOnline()) { sender.sendMessage("Player needs to be online!"); diff --git a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java index 312b6df0..935c9c1c 100644 --- a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java +++ b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java @@ -25,6 +25,7 @@ public enum HashAlgorithm { SHA512(fr.xephi.authme.security.crypts.SHA512.class), DOUBLEMD5(fr.xephi.authme.security.crypts.DOUBLEMD5.class), PBKDF2(fr.xephi.authme.security.crypts.CryptPBKDF2.class), + PBKDF2DJANGO(fr.xephi.authme.security.crypts.CryptPBKDF2Django.class), WORDPRESS(fr.xephi.authme.security.crypts.WORDPRESS.class), ROYALAUTH(fr.xephi.authme.security.crypts.ROYALAUTH.class), CRAZYCRYPT1(fr.xephi.authme.security.crypts.CRAZYCRYPT1.class), diff --git a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java index 7e672ea7..2914e47c 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2.java @@ -4,18 +4,17 @@ import java.security.NoSuchAlgorithmException; import fr.xephi.authme.security.pbkdf2.PBKDF2Engine; import fr.xephi.authme.security.pbkdf2.PBKDF2Parameters; -import javax.xml.bind.DatatypeConverter; public class CryptPBKDF2 implements EncryptionMethod { @Override public String getHash(String password, String salt, String name) throws NoSuchAlgorithmException { - String result = "pbkdf2_sha256$15000$" + salt + "$"; - PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000); + String result = "pbkdf2_sha256$10000$" + salt + "$"; + PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000); PBKDF2Engine engine = new PBKDF2Engine(params); - return result + String.valueOf(DatatypeConverter.printBase64Binary(engine.deriveKey(password, 32))); + return result + String.valueOf(engine.deriveKey(password, 64)); } @Override @@ -23,10 +22,10 @@ public class CryptPBKDF2 implements EncryptionMethod { String playerName) throws NoSuchAlgorithmException { String[] line = hash.split("\\$"); String salt = line[2]; - byte[] derivedKey = DatatypeConverter.parseBase64Binary(line[3]); - PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000, derivedKey); + String derivedKey = line[3]; + PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000, derivedKey.getBytes()); PBKDF2Engine engine = new PBKDF2Engine(params); return engine.verifyKey(password); } -} +} \ No newline at end of file diff --git a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java new file mode 100644 index 00000000..fc998664 --- /dev/null +++ b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java @@ -0,0 +1,32 @@ +package fr.xephi.authme.security.crypts; + +import java.security.NoSuchAlgorithmException; + +import fr.xephi.authme.security.pbkdf2.PBKDF2Engine; +import fr.xephi.authme.security.pbkdf2.PBKDF2Parameters; +import javax.xml.bind.DatatypeConverter; + +public class CryptPBKDF2Django implements EncryptionMethod { + + @Override + public String getHash(String password, String salt, String name) + throws NoSuchAlgorithmException { + String result = "pbkdf2_sha256$15000$" + salt + "$"; + PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000); + PBKDF2Engine engine = new PBKDF2Engine(params); + + return result + String.valueOf(DatatypeConverter.printBase64Binary(engine.deriveKey(password, 32))); + } + + @Override + public boolean comparePassword(String hash, String password, + String playerName) throws NoSuchAlgorithmException { + String[] line = hash.split("\\$"); + String salt = line[2]; + byte[] derivedKey = DatatypeConverter.parseBase64Binary(line[3]); + PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000, derivedKey); + PBKDF2Engine engine = new PBKDF2Engine(params); + return engine.verifyKey(password); + } + +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 89f16d2c..768ce22f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -200,7 +200,7 @@ settings: # possible values: MD5, SHA1, SHA256, WHIRLPOOL, XAUTH, MD5VB, PHPBB, # PLAINTEXT ( unhashed password), # MYBB, IPB3, PHPFUSION, SMF, XENFORO, SALTED2MD5, JOOMLA, BCRYPT, WBB3, SHA512, - # DOUBLEMD5, PBKDF2, WORDPRESS, ROYALAUTH, CUSTOM(for developpers only) + # DOUBLEMD5, PBKDF2, PBKDF2DJANGO, WORDPRESS, ROYALAUTH, CUSTOM(for developpers only) passwordHash: SHA256 # salt length for the SALTED2MD5 MD5(MD5(password)+salt) doubleMD5SaltLength: 8 From 7a82bb7ba8366c27d4c3f33105d62f70d59dbbed Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Mon, 7 Sep 2015 15:41:22 +0200 Subject: [PATCH 128/427] Update team.txt --- team.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/team.txt b/team.txt index 634bcee5..e5ac3a1a 100644 --- a/team.txt +++ b/team.txt @@ -3,6 +3,7 @@ AuthMe-Team: Xephi (Xephi59) - Leader, Main developer darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author Kloudy - Developer (Inactive, Will be avariable soon) +DNx5 - Developer Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor Gnat008 - Contributor From 90c7187babc32b4f38a1a4b77c390e2aea199f66 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 7 Sep 2015 23:28:15 +0700 Subject: [PATCH 129/427] run task async, fix #200 --- .../commands/ChangePasswordCommand.java | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java index 7577a202..0b50da50 100644 --- a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java @@ -25,8 +25,8 @@ public class ChangePasswordCommand implements CommandExecutor { } @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { + public boolean onCommand(final CommandSender sender, Command cmnd, String label, + final String[] args) { if (!(sender instanceof Player)) { return true; } @@ -36,8 +36,8 @@ public class ChangePasswordCommand implements CommandExecutor { return true; } - Player player = (Player) sender; - String name = player.getName().toLowerCase(); + final Player player = (Player) sender; + final String name = player.getName().toLowerCase(); if (!PlayerCache.getInstance().isAuthenticated(name)) { m.send(player, "not_logged_in"); return true; @@ -67,30 +67,35 @@ public class ChangePasswordCommand implements CommandExecutor { return true; } } - try { - String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, args[1], name); + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + try { + String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, args[1], name); - if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(name); - auth.setHash(hashnew); - if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) - auth.setSalt(PasswordSecurity.userSalt.get(name)); - else auth.setSalt(""); - if (!plugin.database.updatePassword(auth)) { - m.send(player, "error"); - return true; + if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { + PlayerAuth auth = PlayerCache.getInstance().getAuth(name); + auth.setHash(hashnew); + if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) + auth.setSalt(PasswordSecurity.userSalt.get(name)); + else auth.setSalt(""); + if (!plugin.database.updatePassword(auth)) { + m.send(player, "error"); + return; + } + plugin.database.updateSalt(auth); + PlayerCache.getInstance().updatePlayer(auth); + m.send(player, "pwd_changed"); + ConsoleLogger.info(player.getName() + " changed his password"); + } else { + m.send(player, "wrong_pwd"); + } + } catch (NoSuchAlgorithmException ex) { + ConsoleLogger.showError(ex.getMessage()); + m.send(sender, "error"); } - plugin.database.updateSalt(auth); - PlayerCache.getInstance().updatePlayer(auth); - m.send(player, "pwd_changed"); - ConsoleLogger.info(player.getName() + " changed his password"); - } else { - m.send(player, "wrong_pwd"); } - } catch (NoSuchAlgorithmException ex) { - ConsoleLogger.showError(ex.getMessage()); - m.send(sender, "error"); - } + }); return true; } } From c0eb15ee49b26bce18be0a78487d4df325691699 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 7 Sep 2015 20:38:29 +0200 Subject: [PATCH 130/427] Cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 14 +++++++++++--- src/main/java/fr/xephi/authme/ConsoleLogger.java | 2 +- .../fr/xephi/authme/datasource/DataSource.java | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index ff8a6bab..38a485fc 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -61,6 +61,7 @@ import fr.xephi.authme.datasource.DatabaseCalls; import fr.xephi.authme.datasource.FlatFile; import fr.xephi.authme.datasource.MySQL; import fr.xephi.authme.datasource.SQLite; +import fr.xephi.authme.datasource.SQLite_HIKARI; import fr.xephi.authme.listener.AuthMeBlockListener; import fr.xephi.authme.listener.AuthMeChestShopListener; import fr.xephi.authme.listener.AuthMeEntityListener; @@ -307,9 +308,10 @@ public class AuthMe extends JavaPlugin { // Start Email recall task if needed recallEmail(); - // Sponsor message + // Sponsor messages ConsoleLogger.info("AuthMe hooks perfectly with the VERYGAMES server hosting!"); - ConsoleLogger.info("Development builds are available on our jenkins, thanks to our sponsor GameHosting.it - leader in Italy as Game Server Provider"); + ConsoleLogger.info("Development builds are available on our jenkins, thanks to f14stelt."); + ConsoleLogger.info("Do you want a good gameserver? Look at our sponsor GameHosting.it leader in Italy as Game Server Provider!"); ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " correctly enabled!"); } @@ -816,7 +818,7 @@ public class AuthMe extends JavaPlugin { public void setupDatabase() throws ClassNotFoundException, PoolInitializationException, SQLException { /* - * Backend MYSQL - FILE - SQLITE + * Backend MYSQL - FILE - SQLITE - SQLITEHIKARI */ switch (Settings.getDataSource) { case FILE: @@ -831,6 +833,12 @@ public class AuthMe extends JavaPlugin { if (b >= 4000) ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + b + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); break; + case SQLITEHIKARI: + database = new SQLite_HIKARI(); + final int b2 = database.getAccountsRegistered(); + if (b2 >= 8000) + ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + b2 + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); + break; } if (Settings.isCachingEnabled) { diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index 010b6619..84cad338 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -33,7 +33,7 @@ public class ConsoleLogger { public static void showError(String message) { if (AuthMe.getInstance().isEnabled()) { - log.warning("[AuthMe] ERROR: " + message); + log.warning("[AuthMe] " + message); if (Settings.useLogging) { Calendar date = Calendar.getInstance(); final String actually = "[" + DateFormat.getDateInstance().format(date.getTime()) + ", " + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + "] ERROR : " + message; diff --git a/src/main/java/fr/xephi/authme/datasource/DataSource.java b/src/main/java/fr/xephi/authme/datasource/DataSource.java index 41dc8923..4592ec56 100644 --- a/src/main/java/fr/xephi/authme/datasource/DataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/DataSource.java @@ -9,7 +9,8 @@ public interface DataSource { public enum DataSourceType { MYSQL, FILE, - SQLITE + SQLITE, + SQLITEHIKARI } boolean isAuthAvailable(String user); From cbca79f1a431c23b1cf4ed405941f6984cb1db36 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Tue, 8 Sep 2015 11:43:32 +0200 Subject: [PATCH 131/427] Fix bad async call --- .../fr/xephi/authme/events/PasswordEncryptionEvent.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java b/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java index 4e5a0f5c..2f055bfd 100644 --- a/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java +++ b/src/main/java/fr/xephi/authme/events/PasswordEncryptionEvent.java @@ -10,9 +10,9 @@ import fr.xephi.authme.security.crypts.EncryptionMethod; * This event is called when we need to compare or get an hash password, for set * a custom EncryptionMethod *

    - * + * * @see fr.xephi.authme.security.crypts.EncryptionMethod - * + * * @author Xephi59 */ public class PasswordEncryptionEvent extends Event { @@ -22,7 +22,7 @@ public class PasswordEncryptionEvent extends Event { private String playerName = ""; public PasswordEncryptionEvent(EncryptionMethod method, String playerName) { - super(true); + super(false); this.method = method; this.playerName = playerName; } From e2b3c51cabed4beac60bb6fc22b7ed112042c64b Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Tue, 8 Sep 2015 16:49:47 +0200 Subject: [PATCH 132/427] Update MySQL.java --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index a12bc3d2..9ffbf64e 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -124,7 +124,8 @@ public class MySQL implements DataSource { throws ClassNotFoundException, IllegalArgumentException { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeMYSQLPool"); - config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); + config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"); + config.setDriverClassName("com.mysql.jdbc.Driver"); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); From c1d56d5ee52286870ff7c1ba363b99f9d5e8e881 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 8 Sep 2015 17:33:52 +0200 Subject: [PATCH 133/427] Fix hikari for mysql and sqlite --- src/main/java/fr/xephi/authme/PerformBackup.java | 5 ++--- src/main/java/fr/xephi/authme/datasource/MySQL.java | 1 - src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index 71a69f04..556ece3c 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -35,13 +35,12 @@ public class PerformBackup { switch (Settings.getDataSource) { case FILE: return FileBackup("auths.db"); - case MYSQL: return MySqlBackup(); - case SQLITE: return FileBackup(Settings.getMySQLDatabase + ".db"); - + case SQLITEHIKARI: + return FileBackup(Settings.getMySQLDatabase + ".db"); } return false; diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 9ffbf64e..e477ea4d 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -37,7 +37,6 @@ public class MySQL implements DataSource { private List columnOthers; private HikariDataSource ds; private String columnRealName; - private Connection connection; public MySQL() throws ClassNotFoundException, SQLException, PoolInitializationException { this.host = Settings.getMySQLHost; diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 9ac80055..602dec5f 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -122,7 +122,8 @@ public class SQLite_HIKARI implements DataSource { throws ClassNotFoundException, IllegalArgumentException { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeSQLitePool"); - config.setDataSourceClassName("org.sqlite.SQLiteDataSource"); + config.setDriverClassName("org.sqlite.JDBC"); + config.setDataSourceClassName("org.sqlite.javax.SQLiteConnectionPoolDataSource"); config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable config.setConnectionTestQuery("SELECT 1"); From 46002b95e32b419d5137f76e35ed6069af6db9ed Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 8 Sep 2015 18:12:31 +0200 Subject: [PATCH 134/427] Cleanup --- src/main/java/fr/xephi/authme/modules/ModuleManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index 25c750b3..87dabc53 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -48,11 +48,11 @@ public class ModuleManager implements Module { @Override public boolean load() { File dir = new File(plugin.getDataFolder() + File.separator + "modules"); - String[] files = dir.list(); - if (files == null || files.length == 0){ + File[] files = dir.listFiles(); + if (files == null) { return false; } - for (File pathToJar : dir.listFiles()) { // FindBugs: "possible null pointers" O_o ? + for (File pathToJar : files) { JarFile jarFile = null; try { jarFile = new JarFile(pathToJar); From afeb359b73e684f97922f20752f9ad5362a1f924 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Wed, 9 Sep 2015 01:28:27 +0700 Subject: [PATCH 135/427] cleanup & improvements --- src/main/java/fr/xephi/authme/AuthMe.java | 128 +++++------------- .../java/fr/xephi/authme/ConsoleLogger.java | 4 + src/main/java/fr/xephi/authme/Utils.java | 39 ++++-- src/main/java/fr/xephi/authme/api/NewAPI.java | 12 +- .../xephi/authme/cache/backup/FileCache.java | 98 +++++--------- .../xephi/authme/cache/limbo/LimboCache.java | 9 +- .../commands/ChangePasswordCommand.java | 53 ++------ .../authme/listener/AuthMePlayerListener.java | 15 +- .../xephi/authme/task/ChangePasswordTask.java | 55 ++++++++ 9 files changed, 169 insertions(+), 244 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/task/ChangePasswordTask.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index ff8a6bab..71d7c7e8 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -79,7 +79,7 @@ import net.milkbowl.vault.permission.Permission; public class AuthMe extends JavaPlugin { - public DataSource database = null; + public DataSource database; private Settings settings; private Messages m; public OtherAccounts otherAccounts; @@ -177,9 +177,7 @@ public class AuthMe extends JavaPlugin { try { Class.forName("org.apache.logging.log4j.core.Filter"); setLog4JFilter(); - } catch (ClassNotFoundException e) { - ConsoleLogger.info("You're using Minecraft 1.6.x or older, Log4J support will be disabled"); - } catch (NoClassDefFoundError e) { + } catch (ClassNotFoundException | NoClassDefFoundError e) { ConsoleLogger.info("You're using Minecraft 1.6.x or older, Log4J support will be disabled"); } } @@ -218,13 +216,8 @@ public class AuthMe extends JavaPlugin { try { setupDatabase(); - } catch (ClassNotFoundException nfe) { - ConsoleLogger.showError("Fatal error occurred! Authme initialization ABORTED!"); - return; - } catch (SQLException sqle) { - ConsoleLogger.showError("Fatal error occurred! Authme initialization ABORTED!"); - return; - } catch (PoolInitializationException pie) { + } catch (ClassNotFoundException | SQLException | PoolInitializationException ex) { + ConsoleLogger.writeStackTrace(ex); ConsoleLogger.showError("Fatal error occurred! Authme initialization ABORTED!"); return; } @@ -274,25 +267,18 @@ public class AuthMe extends JavaPlugin { if (Settings.reloadSupport) { try { - int playersOnline = 0; - try { - if (Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).getReturnType() == Collection.class) - playersOnline = ((Collection) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).size(); - else playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).length; - } catch (Exception ex) { - } - if (playersOnline < 1) { - try { + int playersOnline = Utils.getOnlinePlayers().length; + if (database != null) { + if (playersOnline < 1) { database.purgeLogged(); - } catch (NullPointerException npe) { - } - } else { - for (PlayerAuth auth : database.getLoggedPlayers()) { - if (auth == null) - continue; - auth.setLastLogin(new Date().getTime()); - database.updateSession(auth); - PlayerCache.getInstance().addPlayer(auth); + } else { + for (PlayerAuth auth : database.getLoggedPlayers()) { + if (auth == null) + continue; + auth.setLastLogin(new Date().getTime()); + database.updateSession(auth); + PlayerCache.getInstance().addPlayer(auth); + } } } } catch (Exception ex) { @@ -398,38 +384,27 @@ public class AuthMe extends JavaPlugin { multiverse = null; return; } - if (this.getServer().getPluginManager().getPlugin("Multiverse-Core") != null && this.getServer().getPluginManager().getPlugin("Multiverse-Core").isEnabled()) { + if (this.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) { try { multiverse = (MultiverseCore) this.getServer().getPluginManager().getPlugin("Multiverse-Core"); ConsoleLogger.info("Hooked correctly with Multiverse-Core"); - } catch (NullPointerException npe) { - multiverse = null; - } catch (ClassCastException cce) { - multiverse = null; - } catch (NoClassDefFoundError ncdfe) { - multiverse = null; + } catch (Exception | NoClassDefFoundError ignored) { } - } else { - multiverse = null; } } public void checkEssentials() { - if (this.getServer().getPluginManager().getPlugin("Essentials") != null && this.getServer().getPluginManager().getPlugin("Essentials").isEnabled()) { + if (this.getServer().getPluginManager().isPluginEnabled("Essentials")) { try { ess = (Essentials) this.getServer().getPluginManager().getPlugin("Essentials"); ConsoleLogger.info("Hooked correctly with Essentials"); - } catch (NullPointerException npe) { - ess = null; - } catch (ClassCastException cce) { - ess = null; - } catch (NoClassDefFoundError ncdfe) { + } catch (Exception | NoClassDefFoundError e) { ess = null; } } else { ess = null; } - if (this.getServer().getPluginManager().getPlugin("EssentialsSpawn") != null && this.getServer().getPluginManager().getPlugin("EssentialsSpawn").isEnabled()) { + if (this.getServer().getPluginManager().isPluginEnabled("EssentialsSpawn")) { try { essentialsSpawn = new EssSpawn().getLocation(); ConsoleLogger.info("Hooked correctly with EssentialsSpawn"); @@ -443,42 +418,24 @@ public class AuthMe extends JavaPlugin { } public void checkCombatTag() { - if (this.getServer().getPluginManager().getPlugin("CombatTag") != null && this.getServer().getPluginManager().getPlugin("CombatTag").isEnabled()) { - this.CombatTag = true; - } else { - this.CombatTag = false; - } + this.CombatTag = this.getServer().getPluginManager().isPluginEnabled("CombatTag"); } public void checkCitizens() { - if (this.getServer().getPluginManager().getPlugin("Citizens") != null && this.getServer().getPluginManager().getPlugin("Citizens").isEnabled()) - this.isCitizensActive = true; - else this.isCitizensActive = false; + this.isCitizensActive = this.getServer().getPluginManager().isPluginEnabled("Citizens"); } @Override public void onDisable() { - int playersOnline = 0; - try { - if (Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).getReturnType() == Collection.class) - playersOnline = ((Collection) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).size(); - else playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).length; - } catch (NoSuchMethodException ex) { - } // can never happen - catch (InvocationTargetException ex) { - } // can also never happen - catch (IllegalAccessException ex) { - } // can still never happen - if (playersOnline != 0) - for (Player player : Bukkit.getOnlinePlayers()) { + Player[] players = Utils.getOnlinePlayers(); + if (players != null) { + for (Player player : players) { this.savePlayer(player); } + } if (database != null) { - try { - database.close(); - } catch (Exception e) { - } + database.close(); } if (Settings.isBackupActivated && Settings.isBackupOnStop) { @@ -495,11 +452,8 @@ public class AuthMe extends JavaPlugin { } public void savePlayer(Player player) { - try { - if ((citizens.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) { - return; - } - } catch (Exception e) { + if ((citizens.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) { + return; } try { String name = player.getName().toLowerCase(); @@ -509,7 +463,7 @@ public class AuthMe extends JavaPlugin { } if (LimboCache.getInstance().hasLimboPlayer(name)) { LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); - if (Settings.protectInventoryBeforeLogInEnabled.booleanValue()) { + if (Settings.protectInventoryBeforeLogInEnabled) { player.getInventory().setArmorContents(limbo.getArmour()); player.getInventory().setContents(limbo.getInventory()); } @@ -728,18 +682,8 @@ public class AuthMe extends JavaPlugin { } public String replaceAllInfos(String message, Player player) { - int playersOnline = 0; - try { - if (Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).getReturnType() == Collection.class) - playersOnline = ((Collection) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).size(); - else playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).length; - } catch (NoSuchMethodException ex) { - } // can never happen - catch (InvocationTargetException ex) { - } // can also never happen - catch (IllegalAccessException ex) { - } // can still never happen try { + int playersOnline = Utils.getOnlinePlayers().length; message = message.replace("&", "\u00a7"); message = message.replace("{PLAYER}", player.getName()); message = message.replace("{ONLINE}", "" + playersOnline); @@ -774,9 +718,7 @@ public class AuthMe extends JavaPlugin { if (ip.equalsIgnoreCase(getIP(player)) && database.isLogged(player.getName().toLowerCase()) && !player.getName().equalsIgnoreCase(name)) count++; } - if (count >= Settings.getMaxLoginPerIp) - return true; - return false; + return count >= Settings.getMaxLoginPerIp; } public boolean hasJoinedIp(String name, String ip) { @@ -785,14 +727,12 @@ public class AuthMe extends JavaPlugin { if (ip.equalsIgnoreCase(getIP(player)) && !player.getName().equalsIgnoreCase(name)) count++; } - if (count >= Settings.getMaxJoinPerIp) - return true; - return false; + return count >= Settings.getMaxJoinPerIp; } /** * Get Player real IP through VeryGames method - * + * * @param player * player */ diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index 010b6619..f455f916 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -1,5 +1,6 @@ package fr.xephi.authme; +import com.google.common.base.Throwables; import fr.xephi.authme.settings.Settings; import org.bukkit.Bukkit; @@ -59,4 +60,7 @@ public class ConsoleLogger { } } + public static void writeStackTrace(Exception ex){ + writeLog(Throwables.getStackTraceAsString(ex)); + } } diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index c1975486..39d5bf55 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,18 +1,19 @@ package fr.xephi.authme; -import java.io.File; -import java.util.Iterator; - +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; +import fr.xephi.authme.events.AuthMeTeleportEvent; +import fr.xephi.authme.settings.Settings; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.events.AuthMeTeleportEvent; -import fr.xephi.authme.settings.Settings; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; +import java.util.Iterator; public class Utils { @@ -130,7 +131,7 @@ public class Utils { } public void packCoords(double x, double y, double z, String w, - final Player pl) { + final Player pl) { World theWorld; if (w.equals("unavailableworld")) { theWorld = pl.getWorld(); @@ -171,13 +172,13 @@ public class Utils { NOTLOGGEDIN, LOGGEDIN } - - public static void purgeDirectory(File file){ + + public static void purgeDirectory(File file) { String files[] = file.list(); - if (files != null && files.length != 0){ + if (files != null && files.length != 0) { for (String temp : files) { File fileDelete = new File(file, temp); - if (fileDelete.isDirectory()){ + if (fileDelete.isDirectory()) { purgeDirectory(fileDelete); fileDelete.delete(); } else { @@ -186,4 +187,18 @@ public class Utils { } } } + + public static Player[] getOnlinePlayers() { + Player[] players = null; + try { + if (Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).getReturnType() == Collection.class) { + players = (Player[]) ((Collection) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null)).toArray(); + } else { + players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null)); + } + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { + // can never happen + } + return players; + } } diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index a632ea60..48ce0705 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -70,9 +70,7 @@ public class NewAPI { * @return true if player is a npc */ public boolean isNPC(Player player) { - if (plugin.getCitizensCommunicator().isNPC(player)) - return true; - return CombatTagComunicator.isNPC(player); + return plugin.getCitizensCommunicator().isNPC(player) || CombatTagComunicator.isNPC(player); } /** @@ -89,8 +87,7 @@ public class NewAPI { PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase()); if (auth != null) { - Location loc = new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ()); - return loc; + return new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ()); } else { return null; } @@ -152,10 +149,7 @@ public class NewAPI { return false; } PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com"); - if (!plugin.database.saveAuth(auth)) { - return false; - } - return true; + return plugin.database.saveAuth(auth); } catch (NoSuchAlgorithmException ex) { return false; } diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index f06b63f0..3a3e7cbd 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -2,11 +2,7 @@ package fr.xephi.authme.cache.backup; import java.io.File; import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Scanner; -import java.util.UUID; +import java.util.*; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -44,9 +40,7 @@ public class FileCache { return; try { path = player.getUniqueId().toString(); - } catch (Exception e) { - path = player.getName().toLowerCase(); - } catch (Error e) { + } catch (Exception | Error e) { path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); @@ -109,22 +103,19 @@ public class FileCache { if (Settings.customAttributes) { try { Attributes attributes = new Attributes(item); - if (attributes != null) { - Iterator iter = attributes.values().iterator(); - Attribute a = null; - while (iter.hasNext()) { - Attribute b = iter.next(); - if (a != null && a == b) - break; - a = b; - if (a != null) { - if (a.getName() != null && a.getAttributeType() != null && a.getOperation() != null && a.getUUID() != null) - writer.write("attribute=" + a.getName() + ";" + a.getAttributeType().getMinecraftId() + ";" + a.getAmount() + ";" + a.getOperation().getId() + ";" + a.getUUID().toString()); - } + Iterator iter = attributes.values().iterator(); + Attribute a = null; + while (iter.hasNext()) { + Attribute b = iter.next(); + if (a != null && a == b) + break; + a = b; + if (a != null) { + if (a.getName() != null && a.getAttributeType() != null && a.getOperation() != null && a.getUUID() != null) + writer.write("attribute=" + a.getName() + ";" + a.getAttributeType().getMinecraftId() + ";" + a.getAmount() + ";" + a.getOperation().getId() + ";" + a.getUUID().toString()); } } - } catch (Exception e) { - } catch (Error e) { + } catch (Exception | Error e) { } } } else { @@ -172,14 +163,13 @@ public class FileCache { if (Settings.customAttributes) { try { Attributes attributes = new Attributes(item); - if (attributes != null) - while (attributes.values().iterator().hasNext()) { - Attribute a = attributes.values().iterator().next(); - if (a != null) { - if (a.getName() != null && a.getAttributeType() != null && a.getOperation() != null && a.getUUID() != null && a.getAttributeType().getMinecraftId() != null) - writer.write("attribute=" + a.getName() + ";" + a.getAttributeType().getMinecraftId() + ";" + a.getAmount() + ";" + a.getOperation().getId() + ";" + a.getUUID().toString()); - } + while (attributes.values().iterator().hasNext()) { + Attribute a = attributes.values().iterator().next(); + if (a != null) { + if (a.getName() != null && a.getAttributeType() != null && a.getOperation() != null && a.getUUID() != null && a.getAttributeType().getMinecraftId() != null) + writer.write("attribute=" + a.getName() + ";" + a.getAttributeType().getMinecraftId() + ";" + a.getAmount() + ";" + a.getOperation().getId() + ";" + a.getUUID().toString()); } + } } catch (Exception e) { } } @@ -197,9 +187,7 @@ public class FileCache { String path = ""; try { path = player.getUniqueId().toString(); - } catch (Exception e) { - path = player.getName().toLowerCase(); - } catch (Error e) { + } catch (Exception | Error e) { path = player.getName().toLowerCase(); } try { @@ -232,13 +220,9 @@ public class FileCache { final String[] playerInfo = line.split(";"); group = playerInfo[0]; - if (Integer.parseInt(playerInfo[1]) == 1) { - op = true; - } else op = false; + op = Integer.parseInt(playerInfo[1]) == 1; if (playerInfo.length > 2) { - if (Integer.parseInt(playerInfo[2]) == 1) - flying = true; - else flying = false; + flying = Integer.parseInt(playerInfo[2]) == 1; } continue; @@ -275,9 +259,7 @@ public class FileCache { } if (!lores.isEmpty()) { List loreList = new ArrayList(); - for (String s : lores.split("%newline%")) { - loreList.add(s); - } + Collections.addAll(loreList, lores.split("%newline%")); meta.setLore(loreList); } if (meta != null) @@ -296,9 +278,7 @@ public class FileCache { meta.setDisplayName(name); if (!lores.isEmpty()) { List loreList = new ArrayList(); - for (String s : lores.split("%newline%")) { - loreList.add(s); - } + Collections.addAll(loreList, lores.split("%newline%")); meta.setLore(loreList); } if (meta != null) @@ -348,14 +328,13 @@ public class FileCache { Attributes attributes = null; count = 1; boolean v = true; - while (reader.hasNextLine() && v == true) { + while (reader.hasNextLine() && v) { String line = reader.nextLine(); switch (count) { case 1: item = new ItemStack(Material.getMaterial(line)); if (item.getType() == Material.AIR) v = false; - meta = item.getItemMeta(); count++; continue; case 2: @@ -379,8 +358,7 @@ public class FileCache { if (line.startsWith("lore=")) { line = line.substring(5); List lore = new ArrayList(); - for (String s : line.split("%newline%")) - lore.add(s); + Collections.addAll(lore, line.split("%newline%")); meta.setLore(lore); item.setItemMeta(meta); continue; @@ -430,7 +408,7 @@ public class FileCache { Attributes attributes = null; count = 1; boolean v = true; - while (reader.hasNextLine() && v == true) { + while (reader.hasNextLine() && v) { String line = reader.nextLine(); switch (count) { case 1: @@ -460,9 +438,8 @@ public class FileCache { } if (line.startsWith("lore=")) { line = line.substring(5); - List lore = new ArrayList(); - for (String s : line.split("%newline%")) - lore.add(s); + List lore = new ArrayList<>(); + Collections.addAll(lore, line.split("%newline%")); meta.setLore(lore); item.setItemMeta(meta); continue; @@ -504,10 +481,6 @@ public class FileCache { armours[i] = attributes.getStack(); else armours[i] = item; } - } catch (final RuntimeException e) { - //verbose - e.printStackTrace(); - ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); } catch (final Exception e) { //verbose e.printStackTrace(); @@ -518,11 +491,6 @@ public class FileCache { } return new DataFileCache(inv, armours, group, op, flying); } - } catch (RuntimeException e) { - // Verbose - e.printStackTrace(); - ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); - return null; } catch (Exception e) { // Verbose e.printStackTrace(); @@ -535,9 +503,7 @@ public class FileCache { String path = ""; try { path = player.getUniqueId().toString(); - } catch (Exception e) { - path = player.getName().toLowerCase(); - } catch (Error e) { + } catch (Exception | Error e) { path = player.getName().toLowerCase(); } try { @@ -562,9 +528,7 @@ public class FileCache { String path = ""; try { path = player.getUniqueId().toString(); - } catch (Exception e) { - path = player.getName().toLowerCase(); - } catch (Error e) { + } catch (Exception | Error e) { path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index 2c3d89be..96185c2e 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -53,6 +53,7 @@ public class LimboCache { operator = playerData.readCache(player).getOperator(); flying = playerData.readCache(player).isFlying(); } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); ConsoleLogger.showError("Some error on reading cache of " + name); } } else { @@ -65,12 +66,8 @@ public class LimboCache { inv = null; arm = null; } - if (player.isOp()) - operator = true; - else operator = false; - if (player.isFlying()) - flying = true; - else flying = false; + operator = player.isOp(); + flying = player.isFlying(); if (plugin.permission != null) { try { playerGroup = plugin.permission.getPrimaryGroup(player); diff --git a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java index 0b50da50..6d3c1f2f 100644 --- a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java @@ -1,20 +1,15 @@ package fr.xephi.authme.commands; -import java.security.NoSuchAlgorithmException; - +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.task.ChangePasswordTask; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -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.security.PasswordSecurity; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; - public class ChangePasswordCommand implements CommandExecutor { private Messages m = Messages.getInstance(); @@ -25,8 +20,8 @@ public class ChangePasswordCommand implements CommandExecutor { } @Override - public boolean onCommand(final CommandSender sender, Command cmnd, String label, - final String[] args) { + public boolean onCommand(CommandSender sender, Command cmnd, String label, + String[] args) { if (!(sender instanceof Player)) { return true; } @@ -36,8 +31,8 @@ public class ChangePasswordCommand implements CommandExecutor { return true; } - final Player player = (Player) sender; - final String name = player.getName().toLowerCase(); + Player player = (Player) sender; + String name = player.getName().toLowerCase(); if (!PlayerCache.getInstance().isAuthenticated(name)) { m.send(player, "not_logged_in"); return true; @@ -67,35 +62,7 @@ public class ChangePasswordCommand implements CommandExecutor { return true; } } - plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { - @Override - public void run() { - try { - String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, args[1], name); - - if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(name); - auth.setHash(hashnew); - if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) - auth.setSalt(PasswordSecurity.userSalt.get(name)); - else auth.setSalt(""); - if (!plugin.database.updatePassword(auth)) { - m.send(player, "error"); - return; - } - plugin.database.updateSalt(auth); - PlayerCache.getInstance().updatePlayer(auth); - m.send(player, "pwd_changed"); - ConsoleLogger.info(player.getName() + " changed his password"); - } else { - m.send(player, "wrong_pwd"); - } - } catch (NoSuchAlgorithmException ex) { - ConsoleLogger.showError(ex.getMessage()); - m.send(sender, "error"); - } - } - }); + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, args[0])); return true; } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index fda470e6..6ffde849 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -575,17 +575,7 @@ public class AuthMePlayerListener implements Listener { return; } - int playersOnline = 0; - try { - if (Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).getReturnType() == Collection.class) - playersOnline = ((Collection) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).size(); - else playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).length; - } catch (NoSuchMethodException ex) { - } // can never happen - catch (InvocationTargetException ex) { - } // can also never happen - catch (IllegalAccessException ex) { - } // can still never happen + int playersOnline = Utils.getOnlinePlayers().length; if (playersOnline > plugin.getServer().getMaxPlayers()) { event.allow(); return; @@ -625,13 +615,12 @@ public class AuthMePlayerListener implements Listener { return; } - Player player = event.getPlayer(); - if ((!Settings.isForceSingleSessionEnabled) && (event.getReason().contains(m.getString("same_nick")))) { event.setCancelled(true); return; } + Player player = event.getPlayer(); plugin.management.performQuit(player, true); } diff --git a/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java b/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java new file mode 100644 index 00000000..c9cb72d6 --- /dev/null +++ b/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java @@ -0,0 +1,55 @@ +package fr.xephi.authme.task; + +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.security.PasswordSecurity; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.entity.Player; + +import java.security.NoSuchAlgorithmException; + +public class ChangePasswordTask implements Runnable { + + private final AuthMe plugin; + private final Player player; + private String password; + + public ChangePasswordTask(AuthMe plugin, Player player, String password) { + this.plugin = plugin; + this.player = player; + this.password = password; + } + + @Override + public void run() { + Messages m = Messages.getInstance(); + try { + String name = player.getName().toLowerCase(); + String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); + if (PasswordSecurity.comparePasswordWithHash(password, PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { + PlayerAuth auth = PlayerCache.getInstance().getAuth(name); + auth.setHash(hashnew); + if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) + auth.setSalt(PasswordSecurity.userSalt.get(name)); + else auth.setSalt(""); + if (!plugin.database.updatePassword(auth)) { + m.send(player, "error"); + return; + } + plugin.database.updateSalt(auth); + PlayerCache.getInstance().updatePlayer(auth); + m.send(player, "pwd_changed"); + ConsoleLogger.info(player.getName() + " changed his password"); + } else { + m.send(player, "wrong_pwd"); + } + } catch (NoSuchAlgorithmException ex) { + ConsoleLogger.showError(ex.getMessage()); + m.send(player, "error"); + } + } +} + From 08c77b64839de6ae390a24b36199a31642250e68 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 9 Sep 2015 20:21:45 +0200 Subject: [PATCH 136/427] Cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index a199d25d..7748ebd7 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -243,7 +243,9 @@ public class AuthMe extends JavaPlugin { pm.registerEvents(new AuthMeBlockListener(this), this); pm.registerEvents(new AuthMeEntityListener(this), this); pm.registerEvents(new AuthMeServerListener(this), this); - if (ChestShop != 0) { + + // Legacy chestshop hook + if (ChestShop != 0 && ChestShop < 3.813) { pm.registerEvents(new AuthMeChestShopListener(this), this); ConsoleLogger.info("Hooked successfully with ChestShop!"); } From 08d72785b4a0796d879da8e21b164b9d83ffe26a Mon Sep 17 00:00:00 2001 From: DNx5 Date: Thu, 10 Sep 2015 13:29:11 +0700 Subject: [PATCH 137/427] improve inventory cache method --- .../xephi/authme/cache/backup/FileCache.java | 651 ++++++------------ .../xephi/authme/cache/limbo/LimboCache.java | 28 +- .../authme/events/StoreInventoryEvent.java | 14 +- .../process/logout/AsyncronousLogout.java | 3 +- 4 files changed, 214 insertions(+), 482 deletions(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 3a3e7cbd..3e119ba6 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -1,498 +1,233 @@ package fr.xephi.authme.cache.backup; -import java.io.File; -import java.io.FileWriter; -import java.util.*; - -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import com.comphenix.attribute.Attributes; -import com.comphenix.attribute.Attributes.Attribute; -import com.comphenix.attribute.Attributes.Attribute.Builder; -import com.comphenix.attribute.Attributes.AttributeType; -import com.comphenix.attribute.Attributes.Operation; - +import com.google.common.io.BaseEncoding; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.api.API; -import fr.xephi.authme.settings.Settings; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.util.io.BukkitObjectInputStream; +import org.bukkit.util.io.BukkitObjectOutputStream; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Scanner; public class FileCache { + private final File cacheDir; private AuthMe plugin; public FileCache(AuthMe plugin) { this.plugin = plugin; - final File file = new File(plugin.getDataFolder() + File.separator + "cache"); - if (!file.exists()) - file.mkdir(); + cacheDir = new File(plugin.getDataFolder() + File.separator + "cache"); + if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { + ConsoleLogger.showError("Failed to create cache directory."); + } } public void createCache(Player player, DataFileCache playerData, - String group, boolean operator, boolean flying) { - String path = ""; - if (player == null) + String group, boolean operator, boolean flying) { + if (player == null) { return; + } + + String path; try { path = player.getUniqueId().toString(); } catch (Exception | Error e) { path = player.getName().toLowerCase(); } - File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); - if (!file.getParentFile().exists()) - file.getParentFile().mkdirs(); - if (file.exists()) { + File playerDir = new File(cacheDir, path); + if (!playerDir.exists() && !playerDir.isDirectory() && !playerDir.mkdir()) { return; } - FileWriter writer = null; - try { - file.createNewFile(); + File datafile = new File(playerDir, "playerdatas.cache"); + if (datafile.exists()) { + return; + } - writer = new FileWriter(file); + FileWriter writer; + try { + datafile.createNewFile(); + writer = new FileWriter(datafile); writer.write(group + API.newline); writer.write(String.valueOf(operator) + API.newline); writer.write(String.valueOf(flying) + API.newline); writer.close(); - - file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "inventory"); - - file.mkdirs(); - ItemStack[] inv = playerData.getInventory(); - for (int i = 0; i < inv.length; i++) { - ItemStack item = inv[i]; - file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "inventory" + File.separator + i + ".cache"); - file.createNewFile(); - writer = new FileWriter(file); - if (item != null) { - if (item.getType() == Material.AIR) { - writer.write("AIR"); - writer.close(); - continue; - } - writer.write(item.getType().name() + API.newline); - writer.write(item.getDurability() + API.newline); - writer.write(item.getAmount() + API.newline); - writer.flush(); - if (item.hasItemMeta()) { - ItemMeta meta = item.getItemMeta(); - if (meta.hasDisplayName()) - writer.write("name=" + meta.getDisplayName() + API.newline); - if (meta.hasLore()) { - String lores = ""; - for (String lore : meta.getLore()) - lores = lore + "%newline%"; - writer.write("lore=" + lores + API.newline); - } - if (meta.hasEnchants()) { - for (Enchantment ench : meta.getEnchants().keySet()) { - writer.write("metaenchant=" + ench.getName() + ":" + meta.getEnchants().get(ench) + API.newline); - } - } - writer.flush(); - } - for (Enchantment ench : item.getEnchantments().keySet()) { - writer.write("enchant=" + ench.getName() + ":" + item.getEnchantments().get(ench) + API.newline); - } - if (Settings.customAttributes) { - try { - Attributes attributes = new Attributes(item); - Iterator iter = attributes.values().iterator(); - Attribute a = null; - while (iter.hasNext()) { - Attribute b = iter.next(); - if (a != null && a == b) - break; - a = b; - if (a != null) { - if (a.getName() != null && a.getAttributeType() != null && a.getOperation() != null && a.getUUID() != null) - writer.write("attribute=" + a.getName() + ";" + a.getAttributeType().getMinecraftId() + ";" + a.getAmount() + ";" + a.getOperation().getId() + ";" + a.getUUID().toString()); - } - } - } catch (Exception | Error e) { - } - } - } else { - writer.write("AIR"); - } - writer.close(); - } - - file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "armours"); - if (!file.getParentFile().exists()) - file.getParentFile().mkdirs(); - file.mkdirs(); - - ItemStack[] armors = playerData.getArmour(); - for (int i = 0; i < armors.length; i++) { - ItemStack item = armors[i]; - file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "armours" + File.separator + i + ".cache"); - file.createNewFile(); - writer = new FileWriter(file); - if (item != null) { - if (item.getType() == Material.AIR) { - writer.write("AIR"); - writer.close(); - continue; - } - writer.write(item.getType().name() + API.newline); - writer.write(item.getDurability() + API.newline); - writer.write(item.getAmount() + API.newline); - writer.flush(); - if (item.hasItemMeta()) { - ItemMeta meta = item.getItemMeta(); - if (meta.hasDisplayName()) - writer.write("name=" + meta.getDisplayName() + API.newline); - if (meta.hasLore()) { - String lores = ""; - for (String lore : meta.getLore()) - lores = lore + "%newline%"; - writer.write("lore=" + lores + API.newline); - } - writer.flush(); - } - for (Enchantment ench : item.getEnchantments().keySet()) { - writer.write("enchant=" + ench.getName() + ":" + item.getEnchantments().get(ench) + API.newline); - } - if (Settings.customAttributes) { - try { - Attributes attributes = new Attributes(item); - while (attributes.values().iterator().hasNext()) { - Attribute a = attributes.values().iterator().next(); - if (a != null) { - if (a.getName() != null && a.getAttributeType() != null && a.getOperation() != null && a.getUUID() != null && a.getAttributeType().getMinecraftId() != null) - writer.write("attribute=" + a.getName() + ";" + a.getAttributeType().getMinecraftId() + ";" + a.getAmount() + ";" + a.getOperation().getId() + ";" + a.getUUID().toString()); - } - } - } catch (Exception e) { - } - } - } else { - writer.write("AIR" + API.newline); - } - writer.close(); - } - } catch (final Exception e) { - ConsoleLogger.showError("Some error on creating file cache..."); + } catch (IOException e) { + e.printStackTrace(); } + + BaseEncoding base64 = BaseEncoding.base64(); + + File invDir = new File(playerDir, "inventory"); + if (!invDir.isDirectory() && !invDir.mkdir()) + return; + + ItemStack[] inv = playerData.getInventory(); + for (int i = 0; i < inv.length; i++) { + ItemStack item = inv[i]; + if (item == null) { + item = new ItemStack(Material.AIR); + } + if (item.getType() == Material.SKULL_ITEM) { + SkullMeta meta = (SkullMeta) item.getItemMeta(); + if (meta.hasOwner() && (meta.getOwner() == null || meta.getOwner().isEmpty())) { + item.setItemMeta(plugin.getServer().getItemFactory().getItemMeta(Material.SKULL_ITEM)); + } + } + + try { + File cacheFile = new File(invDir, i + ".cache"); + if (!cacheFile.isFile() && !cacheFile.createNewFile()) { + continue; + } + writer = new FileWriter(cacheFile); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos); + objectOut.writeObject(item); + objectOut.close(); + writer.write(base64.encode(baos.toByteArray())); + writer.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + File armourDir = new File(cacheDir, path + File.separator + "armours"); + if (!armourDir.isDirectory() && !armourDir.mkdir()) + return; + + ItemStack[] armors = playerData.getArmour(); + for (int i = 0; i < armors.length; i++) { + ItemStack item = armors[i]; + if (item == null) { + item = new ItemStack(Material.AIR); + } + if (item.getType() == Material.SKULL_ITEM) { + SkullMeta meta = (SkullMeta) item.getItemMeta(); + if (meta.hasOwner() && (meta.getOwner() == null || meta.getOwner().isEmpty())) { + item.setItemMeta(plugin.getServer().getItemFactory().getItemMeta(Material.SKULL_ITEM)); + } + } + + try { + File cacheFile = new File(armourDir, i + ".cache"); + if (!cacheFile.isFile() && !cacheFile.createNewFile()) { + continue; + } + writer = new FileWriter(cacheFile); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos); + objectOut.writeObject(item); + objectOut.close(); + writer.write(base64.encode(baos.toByteArray())); + writer.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } public DataFileCache readCache(Player player) { - String path = ""; + if (player == null) { + return null; + } + + String path; try { path = player.getUniqueId().toString(); } catch (Exception | Error e) { path = player.getName().toLowerCase(); } + + File playerDir = new File(cacheDir, path); + if (!playerDir.exists() && !playerDir.isDirectory()) { + return null; + } + try { - File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); - String playername = player.getName().toLowerCase(); - if (!file.exists()) { - // OLD METHOD - file = new File("cache/" + playername + ".cache"); - ItemStack[] stacki = new ItemStack[36]; - ItemStack[] stacka = new ItemStack[4]; - if (!file.exists()) { - return new DataFileCache(stacki, stacka); - } - String group = null; - boolean op = false; - boolean flying = false; + File datafile = new File(playerDir, "playerdatas.cache"); + if (!datafile.exists() || !datafile.isFile()) { + return null; + } + ItemStack[] inv = new ItemStack[36]; + ItemStack[] armours = new ItemStack[4]; + String group = null; + boolean op = false; + boolean flying = false; - Scanner reader = new Scanner(file); - - int i = 0; - int a = 0; + Scanner reader; + try { + reader = new Scanner(datafile); + int count = 1; while (reader.hasNextLine()) { String line = reader.nextLine(); - - if (!line.contains(":")) { - // the fist line represent the player group, - // operator - // status - // and flying status - final String[] playerInfo = line.split(";"); - group = playerInfo[0]; - - op = Integer.parseInt(playerInfo[1]) == 1; - if (playerInfo.length > 2) { - flying = Integer.parseInt(playerInfo[2]) == 1; - } - - continue; - } - - if (!line.startsWith("i") && !line.startsWith("w")) { - continue; - } - String lores = ""; - String name = ""; - if (line.split("\\*").length > 1) { - lores = line.split("\\*")[1]; - line = line.split("\\*")[0]; - } - if (line.split(";").length > 1) { - name = line.split(";")[1]; - line = line.split(";")[0]; - } - final String[] in = line.split(":"); - // can enchant item? size ofstring in file - 4 all / 2 = - // number - // of enchant - if (in[0].equals("i")) { - stacki[i] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3]))); - if (in.length > 4 && !in[4].isEmpty()) { - for (int k = 4; k < in.length - 1; k++) { - stacki[i].addUnsafeEnchantment(Enchantment.getByName(in[k]), Integer.parseInt(in[k + 1])); - k++; - } - } - ItemMeta meta = stacki[i].getItemMeta(); - if (!name.isEmpty()) { - meta.setDisplayName(name); - } - if (!lores.isEmpty()) { - List loreList = new ArrayList(); - Collections.addAll(loreList, lores.split("%newline%")); - meta.setLore(loreList); - } - if (meta != null) - stacki[i].setItemMeta(meta); - i++; - } else { - stacka[a] = new ItemStack(Material.getMaterial(in[1]), Integer.parseInt(in[2]), Short.parseShort((in[3]))); - if (in.length > 4 && !in[4].isEmpty()) { - for (int k = 4; k < in.length - 1; k++) { - stacka[a].addUnsafeEnchantment(Enchantment.getByName(in[k]), Integer.parseInt(in[k + 1])); - k++; - } - } - ItemMeta meta = stacka[a].getItemMeta(); - if (!name.isEmpty()) - meta.setDisplayName(name); - if (!lores.isEmpty()) { - List loreList = new ArrayList(); - Collections.addAll(loreList, lores.split("%newline%")); - meta.setLore(loreList); - } - if (meta != null) - stacki[i].setItemMeta(meta); - a++; + switch (count) { + case 1: + group = line; + break; + case 2: + op = Boolean.parseBoolean(line); + break; + case 3: + flying = Boolean.parseBoolean(line); + break; + default: + break; } + count++; } - if (reader != null) - reader.close(); - return new DataFileCache(stacki, stacka, group, op, flying); - } else { - // NEW METHOD - ItemStack[] inv = new ItemStack[36]; - ItemStack[] armours = new ItemStack[4]; - String group = null; - boolean op = false; - boolean flying = false; - - Scanner reader = null; - try { - reader = new Scanner(file); - - int count = 1; - while (reader.hasNextLine()) { - String line = reader.nextLine(); - switch (count) { - case 1: - group = line; - break; - case 2: - op = Boolean.parseBoolean(line); - break; - case 3: - flying = Boolean.parseBoolean(line); - break; - default: - break; - } - count++; - } - if (reader != null) - reader.close(); - for (int i = 0; i < inv.length; i++) { - reader = new Scanner(new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "inventory" + File.separator + i + ".cache")); - ItemStack item = new ItemStack(Material.AIR); - ItemMeta meta = item.getItemMeta(); - Attributes attributes = null; - count = 1; - boolean v = true; - while (reader.hasNextLine() && v) { - String line = reader.nextLine(); - switch (count) { - case 1: - item = new ItemStack(Material.getMaterial(line)); - if (item.getType() == Material.AIR) - v = false; - count++; - continue; - case 2: - item.setDurability((short) Integer.parseInt(line)); - count++; - continue; - case 3: - item.setAmount(Integer.parseInt(line)); - count++; - continue; - default: - break; - } - meta = item.getItemMeta(); - if (line.startsWith("name=")) { - line = line.substring(5); - meta.setDisplayName(line); - item.setItemMeta(meta); - continue; - } - if (line.startsWith("lore=")) { - line = line.substring(5); - List lore = new ArrayList(); - Collections.addAll(lore, line.split("%newline%")); - meta.setLore(lore); - item.setItemMeta(meta); - continue; - } - if (line.startsWith("enchant=")) { - line = line.substring(8); - item.addEnchantment(Enchantment.getByName(line.split(":")[0]), Integer.parseInt(line.split(":")[1])); - continue; - } - if (Settings.customAttributes) { - if (line.startsWith("attribute=")) { - if (attributes == null) - attributes = new Attributes(item); - try { - line = line.substring(10); - String[] args = line.split(";"); - if (args.length != 5) - continue; - String name = args[0]; - AttributeType type = AttributeType.fromId(args[1]); - double amount = Double.parseDouble(args[2]); - Operation operation = Operation.fromId(Integer.parseInt(args[3])); - UUID uuid = UUID.fromString(args[4]); - Builder build = Attribute.newBuilder(); - build.amount(amount); - build.operation(operation); - build.type(type); - build.name(name); - build.uuid(uuid); - attributes.add(build.build()); - } catch (Exception e) { - } - } - } - count++; - } - if (reader != null) - reader.close(); - if (Settings.customAttributes && attributes != null) - inv[i] = attributes.getStack(); - else inv[i] = item; - } - for (int i = 0; i < armours.length; i++) { - reader = new Scanner(new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "armours" + File.separator + i + ".cache")); - ItemStack item = new ItemStack(Material.AIR); - ItemMeta meta = null; - Attributes attributes = null; - count = 1; - boolean v = true; - while (reader.hasNextLine() && v) { - String line = reader.nextLine(); - switch (count) { - case 1: - item = new ItemStack(Material.getMaterial(line)); - if (item.getType() == Material.AIR) - v = false; - meta = item.getItemMeta(); - count++; - continue; - case 2: - item.setDurability((short) Integer.parseInt(line)); - count++; - continue; - case 3: - item.setAmount(Integer.parseInt(line)); - count++; - continue; - default: - break; - } - meta = item.getItemMeta(); - if (line.startsWith("name=")) { - line = line.substring(5); - meta.setDisplayName(line); - item.setItemMeta(meta); - continue; - } - if (line.startsWith("lore=")) { - line = line.substring(5); - List lore = new ArrayList<>(); - Collections.addAll(lore, line.split("%newline%")); - meta.setLore(lore); - item.setItemMeta(meta); - continue; - } - if (line.startsWith("enchant=")) { - line = line.substring(8); - item.addEnchantment(Enchantment.getByName(line.split(":")[0]), Integer.parseInt(line.split(":")[1])); - } - if (Settings.customAttributes) { - if (line.startsWith("attribute=")) { - if (attributes == null) - attributes = new Attributes(item); - try { - line = line.substring(10); - String[] args = line.split(";"); - if (args.length != 5) - continue; - String name = args[0]; - AttributeType type = AttributeType.fromId(args[1]); - double amount = Double.parseDouble(args[2]); - Operation operation = Operation.fromId(Integer.parseInt(args[3])); - UUID uuid = UUID.fromString(args[4]); - Builder build = Attribute.newBuilder(); - build.amount(amount); - build.operation(operation); - build.type(type); - build.name(name); - build.uuid(uuid); - attributes.add(build.build()); - } catch (Exception e) { - } - } - } - count++; - } - if (reader != null) - reader.close(); - if (attributes != null) - armours[i] = attributes.getStack(); - else armours[i] = item; - } - } catch (final Exception e) { - //verbose - e.printStackTrace(); - ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); - } finally { - if (reader != null) - reader.close(); - } - return new DataFileCache(inv, armours, group, op, flying); + reader.close(); + } catch (Exception e) { + e.printStackTrace(); } + + BaseEncoding base64 = BaseEncoding.base64(); + + File invDir = new File(playerDir, "inventory"); + for (int i = 0; i < inv.length; i++) { + byte[] bytes = Files.readAllBytes(Paths.get(invDir.getPath(), i + ".cache")); + String encodedItem = new String(bytes); + bytes = base64.decode(encodedItem); + ByteArrayInputStream baos = new ByteArrayInputStream(bytes); + BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); + ItemStack item = (ItemStack) objectIn.readObject(); + objectIn.close(); + if (item == null) { + inv[i] = new ItemStack(Material.AIR); + } else { + inv[i] = item; + } + } + + File armourDir = new File(playerDir, "armours"); + for (int i = 0; i < armours.length; i++) { + byte[] bytes = Files.readAllBytes(Paths.get(armourDir.getPath(), i + ".cache")); + String encodedItem = new String(bytes); + bytes = base64.decode(encodedItem); + ByteArrayInputStream baos = new ByteArrayInputStream(bytes); + BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); + ItemStack item = (ItemStack) objectIn.readObject(); + objectIn.close(); + if (item == null) { + armours[i] = new ItemStack(Material.AIR); + } else { + armours[i] = item; + } + } + + return new DataFileCache(inv, armours, group, op, flying); + } catch (Exception e) { - // Verbose e.printStackTrace(); ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); return null; @@ -500,23 +235,23 @@ public class FileCache { } public void removeCache(Player player) { - String path = ""; + String path; try { path = player.getUniqueId().toString(); } catch (Exception | Error e) { path = player.getName().toLowerCase(); } try { - File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path); + File file = new File(cacheDir, path); if (file.list() != null) { Utils.purgeDirectory(file); - file.delete(); + if (!file.delete()) { + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache."); + } } else { - file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + player.getName().toLowerCase() + ".cache"); - if (file.isFile()) { - file.delete(); - } else { - ConsoleLogger.showError("Failed to remove" + player.getName() + "cache, it doesn't exist!"); + file = new File(cacheDir, player.getName().toLowerCase() + ".cache"); + if (file.isFile() && !file.delete()) { + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache."); } } } catch (Exception e) { @@ -525,15 +260,15 @@ public class FileCache { } public boolean doesCacheExist(Player player) { - String path = ""; + String path; try { path = player.getUniqueId().toString(); } catch (Exception | Error e) { path = player.getName().toLowerCase(); } - File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); + File file = new File(cacheDir, path + File.separator + "playerdatas.cache"); if (!file.exists()) { - file = new File("cache/" + player.getName().toLowerCase() + ".cache"); + file = new File(cacheDir, player.getName().toLowerCase() + ".cache"); } return file.exists(); diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index 96185c2e..6f745024 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -1,19 +1,19 @@ package fr.xephi.authme.cache.limbo; -import java.util.concurrent.ConcurrentHashMap; - +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.backup.DataFileCache; +import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.events.ResetInventoryEvent; +import fr.xephi.authme.events.StoreInventoryEvent; +import fr.xephi.authme.settings.Settings; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.cache.backup.FileCache; -import fr.xephi.authme.events.ResetInventoryEvent; -import fr.xephi.authme.events.StoreInventoryEvent; -import fr.xephi.authme.settings.Settings; +import java.util.concurrent.ConcurrentHashMap; public class LimboCache { @@ -48,13 +48,11 @@ public class LimboCache { inv = null; arm = null; } - try { - playerGroup = playerData.readCache(player).getGroup(); - operator = playerData.readCache(player).getOperator(); - flying = playerData.readCache(player).isFlying(); - } catch (Exception e) { - ConsoleLogger.writeStackTrace(e); - ConsoleLogger.showError("Some error on reading cache of " + name); + DataFileCache cache = playerData.readCache(player); + if (cache != null) { + playerGroup = cache.getGroup(); + operator = cache.getOperator(); + flying = cache.isFlying(); } } else { StoreInventoryEvent event = new StoreInventoryEvent(player); diff --git a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java index c91523d8..66911d18 100644 --- a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java @@ -1,12 +1,11 @@ package fr.xephi.authme.events; +import fr.xephi.authme.cache.backup.DataFileCache; +import fr.xephi.authme.cache.backup.FileCache; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import fr.xephi.authme.cache.backup.FileCache; - /** - * * This event is call just before write inventory content to cache * * @author Xephi59 @@ -25,10 +24,11 @@ public class StoreInventoryEvent extends CustomEvent { public StoreInventoryEvent(Player player, FileCache fileCache) { this.player = player; - try { - this.inventory = fileCache.readCache(player).getInventory(); - this.armor = fileCache.readCache(player).getArmour(); - } catch (Exception e) { + DataFileCache cache = fileCache.readCache(player); + if (cache != null) { + this.inventory = cache.getInventory(); + this.armor = cache.getArmour(); + } else { this.inventory = player.getInventory().getContents(); this.armor = player.getInventory().getArmorContents(); } diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index d9931171..366e72d4 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -85,8 +85,7 @@ public class AsyncronousLogout { // create cache file for handling lost of inventories on unlogged in // status DataFileCache playerData = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour()); - if (playerData != null) - playerBackup.createCache(player, playerData, LimboCache.getInstance().getLimboPlayer(name).getGroup(), LimboCache.getInstance().getLimboPlayer(name).getOperator(), LimboCache.getInstance().getLimboPlayer(name).isFlying()); + playerBackup.createCache(player, playerData, LimboCache.getInstance().getLimboPlayer(name).getGroup(), LimboCache.getInstance().getLimboPlayer(name).getOperator(), LimboCache.getInstance().getLimboPlayer(name).isFlying()); } sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin)); } From d4cf7390819278166a3435e47145face86d32f2d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 10 Sep 2015 19:56:33 +0200 Subject: [PATCH 138/427] Fix hikari --- src/main/java/fr/xephi/authme/AuthMe.java | 1 - .../fr/xephi/authme/datasource/MySQL.java | 1 - .../authme/datasource/SQLite_HIKARI.java | 3 +-- .../authme/listener/AuthMePlayerListener.java | 2 -- src/main/resources/config.yml | 26 +++---------------- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 7748ebd7..7257d4d5 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -7,7 +7,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.net.URLConnection; import java.sql.SQLException; diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index e477ea4d..f30b7656 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -124,7 +124,6 @@ public class MySQL implements DataSource { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeMYSQLPool"); config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"); - config.setDriverClassName("com.mysql.jdbc.Driver"); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 602dec5f..0a9eac07 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -115,14 +115,13 @@ public class SQLite_HIKARI implements DataSource { @Override public DataSourceType getType() { - return DataSourceType.SQLITE; + return DataSourceType.SQLITEHIKARI; } private synchronized void setConnectionArguments() throws ClassNotFoundException, IllegalArgumentException { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeSQLitePool"); - config.setDriverClassName("org.sqlite.JDBC"); config.setDataSourceClassName("org.sqlite.javax.SQLiteConnectionPoolDataSource"); config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 6ffde849..cffd6850 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -3,10 +3,8 @@ package fr.xephi.authme.listener; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.PatternSyntaxException; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 768ce22f..dda0cb84 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -39,26 +39,6 @@ DataSource: mySQLlastlocWorld: world # Column for RealName mySQLRealName: realname -GroupOptions: - # if you want to set up a particulary Permission Group for - # users that arent registered yet. Pay attention this option - # is casesensitive! - # Example: UnregisteredPlayerGroup: GuestUser - UnregisteredPlayerGroup: '' - # Same as UnregisteredGroup if u want to set a switch - # between unregistered and registered player group - # set the group name below - RegisteredPlayerGroup: '' - # with this option you can add specified permission onJoin - # like for example LoginBonus from another plugins, AuthMe - # will check onJoin if player has that permissions in his Group - # if true it add a temporany permissions to that user. This Field - # is needed beacuse AuthMe switch all unlogged players on a - # specified restricted Permission Group, so plugins that will use - # some particolary permissions on join doesnt work, without - # compiling option below! - Permissions: - PermissionsOnJoin: [] settings: sessions: # Do you want to enable session? When enabled @@ -290,10 +270,10 @@ ExternalBoardOptions: # WordPress prefix defined during WordPress installation process wordpressTablePrefix: 'wp_' permission: - # take care with this options, if u dont want + # Take care with this options, if you dont want # to use Vault and Group Switching of - # AuthMe for unloggedIn players put False - # below, default is true. + # AuthMe for unloggedIn players put true + # below, default is false. EnablePermissionCheck: false BackupSystem: # Enable or Disable Automatic Backup From c485a58036373f2d871574ae6932dc5b642d2ea8 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sat, 12 Sep 2015 11:53:30 +0200 Subject: [PATCH 139/427] Update MySQL.java --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index f30b7656..ee58973f 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -123,7 +123,7 @@ public class MySQL implements DataSource { throws ClassNotFoundException, IllegalArgumentException { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeMYSQLPool"); - config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"); + config.setDriverClassName("com.mysql.jdbc.Driver"); config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); From 023e64c8d59a14340e72824c38517be9cb742121 Mon Sep 17 00:00:00 2001 From: DmitryRendov Date: Sun, 13 Sep 2015 09:48:11 +0000 Subject: [PATCH 140/427] Fixed PBKDF2DJANGO hash map --- src/main/java/fr/xephi/authme/security/PasswordSecurity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index 305b89b6..548bef12 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -85,6 +85,7 @@ public class PasswordSecurity { salt = BCRYPT.gensalt(8); userSalt.put(playerName, salt); break; + case PBKDF2DJANGO: case PBKDF2: salt = createSalt(12); userSalt.put(playerName, salt); From d8c2a2511612fe4e21915ec4a7752b801540fa2b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 12:25:12 +0200 Subject: [PATCH 141/427] Working sqlitehikari! ;D --- src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java | 3 +-- src/main/resources/config.yml | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 0a9eac07..de91d2bb 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -122,9 +122,8 @@ public class SQLite_HIKARI implements DataSource { throws ClassNotFoundException, IllegalArgumentException { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeSQLitePool"); - config.setDataSourceClassName("org.sqlite.javax.SQLiteConnectionPoolDataSource"); + config.setDriverClassName("org.sqlite.JDBC"); config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); - config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable config.setConnectionTestQuery("SELECT 1"); config.setMaxLifetime(180000); // 3 Min config.setIdleTimeout(60000); // 1 Min diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index dda0cb84..d66c5a14 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,5 +1,6 @@ DataSource: - # Can be set to: sqlite, mysql + # Can be set to: sqlite, sqlitehikari, mysql + # sqlitehikari should be more fast than normal sqlite but it's an experimental feature! backend: sqlite # Enable database caching caching: true From 76b4f62e79fc2d316715beae6060ae683735dc15 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 15:01:22 +0200 Subject: [PATCH 142/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 476 ++++++++++-------- .../java/fr/xephi/authme/PerformBackup.java | 3 +- .../authme/listener/AuthMeServerListener.java | 2 +- .../fr/xephi/authme/settings/Settings.java | 4 +- 4 files changed, 271 insertions(+), 214 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 7257d4d5..2f6c6367 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -93,7 +93,7 @@ public class AuthMe extends JavaPlugin { public boolean isCitizensActive = false; public SendMailSSL mail = null; public boolean CombatTag = false; - public double ChestShop = 0; + public boolean legacyChestShop = false; public boolean BungeeCord = false; public Essentials ess; public NewAPI api; @@ -110,6 +110,10 @@ public class AuthMe extends JavaPlugin { public DataManager dataManager; public ConcurrentHashMap sessions = new ConcurrentHashMap(); + public static AuthMe getInstance() { + return authme; + } + public Settings getSettings() { return settings; } @@ -122,12 +126,35 @@ public class AuthMe extends JavaPlugin { this.database = database; } + public void setMessages(Messages m) { + this.m = m; + } + + public Messages getMessages() { + return m; + } + + public CitizensCommunicator getCitizensCommunicator() { + return citizens; + } + @Override public void onEnable() { + server = getServer(); + PluginManager pm = server.getPluginManager(); + authme = this; - authmeLogger.setParent(this.getLogger()); + m = Messages.getInstance(); + otherAccounts = OtherAccounts.getInstance(); + + // TODOs + // TODO: split the plugin in more modules + // TODO: remove vault as hard dependency + + // Load settings and custom configurations + // TODO: new configuration style (more files) try { settings = new Settings(this); } catch (Exception e) { @@ -136,6 +163,16 @@ public class AuthMe extends JavaPlugin { return; } + // Configuration Security Warnings + if (!Settings.isForceSingleSessionEnabled) { + ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); + } + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { + ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + } + + // Start the metrics service + // TODO: add a setting to disable metrics try { Metrics metrics = new Metrics(this); metrics.start(); @@ -145,27 +182,6 @@ public class AuthMe extends JavaPlugin { ConsoleLogger.showError("Can't start Metrics! The plugin will work anyway..."); } - citizens = new CitizensCommunicator(this); - - if (Settings.enableAntiBot) { - Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { - - @Override - public void run() { - delayedAntiBot = false; - } - }, 2400); - } - - m = Messages.getInstance(); - - otherAccounts = OtherAccounts.getInstance(); - - server = getServer(); - - // Find Permissions - checkVault(); - // Set Console Filter if (Settings.removePassword) { ConsoleFilter filter = new ConsoleFilter(); @@ -182,11 +198,30 @@ public class AuthMe extends JavaPlugin { } } - // Load MailApi - if (!Settings.getmailAccount.isEmpty() && !Settings.getmailPassword.isEmpty()) + // AntiBot delay + if (Settings.enableAntiBot) { + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + + @Override + public void run() { + delayedAntiBot = false; + } + }, 2400); + } + + // Download GeoIp.dat file + downloadGeoIp(); + + // Load MailApi if needed + if (!Settings.getmailAccount.isEmpty() && !Settings.getmailPassword.isEmpty()) { mail = new SendMailSSL(this); + } + + // Find Permissions + checkVault(); // Check Citizens Version + citizens = new CitizensCommunicator(this); checkCitizens(); // Check Combat Tag Version @@ -204,69 +239,50 @@ public class AuthMe extends JavaPlugin { // Check Essentials checkEssentials(); - /* - * Back style on start if avalaible - */ + // Do backup on start if enabled if (Settings.isBackupActivated && Settings.isBackupOnStart) { - Boolean Backup = new PerformBackup(this).DoBackup(); - if (Backup) + // Do backup and check return value! + if (new PerformBackup(this).DoBackup()){ ConsoleLogger.info("Backup performed correctly"); - else ConsoleLogger.showError("Error while performing the backup!"); + } else { + ConsoleLogger.showError("Error while performing the backup!"); + } } + // Connect to the database and setup tables try { setupDatabase(); } catch (ClassNotFoundException | SQLException | PoolInitializationException ex) { ConsoleLogger.writeStackTrace(ex); - ConsoleLogger.showError("Fatal error occurred! Authme initialization ABORTED!"); + ConsoleLogger.showError("Fatal error occurred during database connection! Authme initialization ABORTED!"); + stopOrUnload(); return; } + // Set the DataManager dataManager = new DataManager(this); // Setup the new API api = new NewAPI(this); - // Old deprecated API + // Setup the old deprecated API new API(this); // Setup Management management = new Management(this); - PluginManager pm = getServer().getPluginManager(); + // Bungeecord hook if (Settings.bungee) { Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this)); } - pm.registerEvents(new AuthMePlayerListener(this), this); - pm.registerEvents(new AuthMeBlockListener(this), this); - pm.registerEvents(new AuthMeEntityListener(this), this); - pm.registerEvents(new AuthMeServerListener(this), this); - // Legacy chestshop hook - if (ChestShop != 0 && ChestShop < 3.813) { + if (legacyChestShop) { pm.registerEvents(new AuthMeChestShopListener(this), this); ConsoleLogger.info("Hooked successfully with ChestShop!"); } - this.getCommand("authme").setExecutor(new AdminCommand(this)); - this.getCommand("register").setExecutor(new RegisterCommand(this)); - this.getCommand("login").setExecutor(new LoginCommand(this)); - this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); - this.getCommand("logout").setExecutor(new LogoutCommand(this)); - this.getCommand("unregister").setExecutor(new UnregisterCommand(this)); - this.getCommand("email").setExecutor(new EmailCommand(this)); - this.getCommand("captcha").setExecutor(new CaptchaCommand(this)); - this.getCommand("converter").setExecutor(new ConverterCommand(this)); - - if (!Settings.isForceSingleSessionEnabled) { - ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); - } - - if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { - ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); - } - + // Reload support hook if (Settings.reloadSupport) { try { int playersOnline = Utils.getOnlinePlayers().length; @@ -287,10 +303,25 @@ public class AuthMe extends JavaPlugin { } } - autoPurge(); + // Register events + pm.registerEvents(new AuthMePlayerListener(this), this); + pm.registerEvents(new AuthMeBlockListener(this), this); + pm.registerEvents(new AuthMeEntityListener(this), this); + pm.registerEvents(new AuthMeServerListener(this), this); - // Download GeoIp.dat file - downloadGeoIp(); + // Register commands + this.getCommand("authme").setExecutor(new AdminCommand(this)); + this.getCommand("register").setExecutor(new RegisterCommand(this)); + this.getCommand("login").setExecutor(new LoginCommand(this)); + this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); + this.getCommand("logout").setExecutor(new LogoutCommand(this)); + this.getCommand("unregister").setExecutor(new UnregisterCommand(this)); + this.getCommand("email").setExecutor(new EmailCommand(this)); + this.getCommand("captcha").setExecutor(new CaptchaCommand(this)); + this.getCommand("converter").setExecutor(new ConverterCommand(this)); + + // Purge on start if enabled + autoPurge(); // Start Email recall task if needed recallEmail(); @@ -300,9 +331,97 @@ public class AuthMe extends JavaPlugin { ConsoleLogger.info("Development builds are available on our jenkins, thanks to f14stelt."); ConsoleLogger.info("Do you want a good gameserver? Look at our sponsor GameHosting.it leader in Italy as Game Server Provider!"); + // Successful message ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " correctly enabled!"); } + @Override + public void onDisable() { + // Save player data + Player[] players = Utils.getOnlinePlayers(); + if (players != null) { + for (Player player : players) { + this.savePlayer(player); + } + } + + // Close the database + if (database != null) { + database.close(); + } + + // Do backup on stop if enabled + if (Settings.isBackupActivated && Settings.isBackupOnStop) { + Boolean Backup = new PerformBackup(this).DoBackup(); + if (Backup) + ConsoleLogger.info("Backup performed correctly."); + else ConsoleLogger.showError("Error while performing the backup!"); + } + + // Disabled correctly + ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " disabled!"); + } + + // Stop/unload the server/plugin as defined in the configuration + public void stopOrUnload(){ + if (Settings.isStopEnabled) { + ConsoleLogger.showError("THE SERVER IS GOING TO SHUTDOWN AS DEFINED IN THE CONFIGURATION!"); + AuthMe.getInstance().getServer().shutdown(); + } else { + server.getPluginManager().disablePlugin(AuthMe.getInstance()); + } + } + + // Show the exception message and stop/unload the server/plugin as defined in the configuration + public void stopOrUnload(Exception e){ + ConsoleLogger.showError(e.getMessage()); + stopOrUnload(); + } + + // Initialize and setup the database + public void setupDatabase() throws ClassNotFoundException, PoolInitializationException, SQLException { + // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI + int accounts = 0; + switch (Settings.getDataSource) { + case FILE: + database = new FlatFile(); + break; + case MYSQL: + database = new MySQL(); + break; + case SQLITE: + database = new SQLite(); + accounts = database.getAccountsRegistered(); + if (accounts >= 4000) + ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); + break; + case SQLITEHIKARI: + database = new SQLite_HIKARI(); + accounts = database.getAccountsRegistered(); + if (accounts >= 8000) + ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); + break; + } + + if (Settings.isCachingEnabled) { + database = new CacheDataSource(this, database); + } + + database = new DatabaseCalls(database); + + if (Settings.getDataSource == DataSource.DataSourceType.FILE) { + Converter converter = new ForceFlatToSqlite(database, this); + try { + Thread t = new Thread(converter); + t.start(); + } catch (Exception e) { + } + ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated, next time server starts up, it will be changed to SQLite... Conversion will be started Asynchronously, it will not drop down your performance !"); + ConsoleLogger.showError("If you want to keep FlatFile, set file again into config at backend, but this message and this change will appear again at the next restart"); + } + } + + // Set the console filter to remove the passwords private void setLog4JFilter() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { @@ -314,9 +433,10 @@ public class AuthMe extends JavaPlugin { }); } + // Check the presence of the Vault plugin and a permissions provider public void checkVault() { - if (this.getServer().getPluginManager().getPlugin("Vault") != null && this.getServer().getPluginManager().getPlugin("Vault").isEnabled()) { - RegisteredServiceProvider permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); + if (server.getPluginManager().getPlugin("Vault").isEnabled()) { + RegisteredServiceProvider permissionProvider = server.getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); if (permissionProvider != null) { permission = permissionProvider.getProvider(); ConsoleLogger.info("Vault detected, hooking with the " + permission.getName() + " permissions system..."); @@ -328,86 +448,86 @@ public class AuthMe extends JavaPlugin { } } + // Check the version of the ChestShop plugin public void checkChestShop() { - if (!Settings.chestshop) { - this.ChestShop = 0; - return; - } - if (this.getServer().getPluginManager().getPlugin("ChestShop") != null && this.getServer().getPluginManager().getPlugin("ChestShop").isEnabled()) { + if (Settings.legacyChestShop && server.getPluginManager().getPlugin("ChestShop").isEnabled()) { try { - String ver = com.Acrobot.ChestShop.ChestShop.getVersion(); + String rawver = com.Acrobot.ChestShop.ChestShop.getVersion(); + double version = 0; try { - double version = Double.valueOf(ver.split(" ")[0]); - if (version >= 3.50) { - this.ChestShop = version; - } else { - ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); - } + version = Double.valueOf(rawver.split(" ")[0]); } catch (NumberFormatException nfe) { try { - double version = Double.valueOf(ver.split("t")[0]); - if (version >= 3.50) { - this.ChestShop = version; - } else { - ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); - } + version = Double.valueOf(rawver.split("t")[0]); } catch (NumberFormatException nfee) { + legacyChestShop = false; + return; } } + if (version >= 3.813){ + return; + } + if (version < 3.50) { + ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); + return; + } + legacyChestShop = true; } catch (Exception e) { } } else { - this.ChestShop = 0; + legacyChestShop = false; } } + // Check PerWorldInventories version public void checkPerWorldInventories() { - if (this.getServer().getPluginManager().getPlugin("PerWorldInventories") != null && this.getServer().getPluginManager().getPlugin("PerWorldInventories").isEnabled()) { + if (server.getPluginManager().getPlugin("PerWorldInventories").isEnabled()) { try { - String ver = Bukkit.getServer().getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); + double version = 0; + String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); try { - double version = Double.valueOf(ver.split(" ")[0]); - if (version < 1.57) - ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + version = Double.valueOf(ver.split(" ")[0]); } catch (NumberFormatException nfe) { try { - double version = Double.valueOf(ver.split("t")[0]); - if (version < 1.57) - ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + version = Double.valueOf(ver.split("t")[0]); } catch (NumberFormatException nfee) { } } + if (version < 1.57){ + ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + } } catch (Exception e) { - } + } } } + // Get the Multiverse plugin public void checkMultiverse() { - if (!Settings.multiverse) { - multiverse = null; - return; - } - if (this.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) { + if (Settings.multiverse && this.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) { try { - multiverse = (MultiverseCore) this.getServer().getPluginManager().getPlugin("Multiverse-Core"); + multiverse = (MultiverseCore) server.getPluginManager().getPlugin("Multiverse-Core"); ConsoleLogger.info("Hooked correctly with Multiverse-Core"); } catch (Exception | NoClassDefFoundError ignored) { + multiverse = null; } + } else { + multiverse = null; } } + // Get the Essentials plugin public void checkEssentials() { - if (this.getServer().getPluginManager().isPluginEnabled("Essentials")) { + if (server.getPluginManager().isPluginEnabled("Essentials")) { try { - ess = (Essentials) this.getServer().getPluginManager().getPlugin("Essentials"); + ess = (Essentials) server.getPluginManager().getPlugin("Essentials"); ConsoleLogger.info("Hooked correctly with Essentials"); - } catch (Exception | NoClassDefFoundError e) { + } catch (Exception | NoClassDefFoundError ingnored) { ess = null; } } else { ess = null; } - if (this.getServer().getPluginManager().isPluginEnabled("EssentialsSpawn")) { + if (server.getPluginManager().isPluginEnabled("EssentialsSpawn")) { try { essentialsSpawn = new EssSpawn().getLocation(); ConsoleLogger.info("Hooked correctly with EssentialsSpawn"); @@ -420,40 +540,35 @@ public class AuthMe extends JavaPlugin { } } + // Check the presence of CombatTag public void checkCombatTag() { this.CombatTag = this.getServer().getPluginManager().isPluginEnabled("CombatTag"); } + // Check if Citizens is active public void checkCitizens() { this.isCitizensActive = this.getServer().getPluginManager().isPluginEnabled("Citizens"); } - @Override - public void onDisable() { - Player[] players = Utils.getOnlinePlayers(); - if (players != null) { - for (Player player : players) { - this.savePlayer(player); - } + // Check if a player/command sender have a permission + public boolean authmePermissible(Player player, String perm) { + if (player.hasPermission(perm)) { + return true; + } else if (permission != null) { + return permission.playerHas(player, perm); } - - if (database != null) { - database.close(); + return false; + } + public boolean authmePermissible(CommandSender sender, String perm) { + if (sender.hasPermission(perm)) { + return true; + } else if (permission != null) { + return permission.has(sender, perm); } - - if (Settings.isBackupActivated && Settings.isBackupOnStop) { - Boolean Backup = new PerformBackup(this).DoBackup(); - if (Backup) - ConsoleLogger.info("Backup performed correctly."); - else ConsoleLogger.showError("Error while performing the backup!"); - } - ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " disabled!"); - } - - public static AuthMe getInstance() { - return authme; + return false; } + // Save Player Data public void savePlayer(Player player) { if ((citizens.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) { return; @@ -470,8 +585,9 @@ public class AuthMe extends JavaPlugin { player.getInventory().setArmorContents(limbo.getArmour()); player.getInventory().setContents(limbo.getInventory()); } - if (!Settings.noTeleport) + if (!Settings.noTeleport) { player.teleport(limbo.getLoc()); + } this.utils.addNormal(player, limbo.getGroup()); player.setOp(limbo.getOperator()); limbo.getTimeoutTaskId().cancel(); @@ -487,18 +603,7 @@ public class AuthMe extends JavaPlugin { } } - public CitizensCommunicator getCitizensCommunicator() { - return citizens; - } - - public void setMessages(Messages m) { - this.m = m; - } - - public Messages getMessages() { - return m; - } - + // Select the player to kick when a vip player join the server when full public Player generateKickPlayer(Collection collection) { Player player = null; for (Player p : collection) { @@ -510,24 +615,7 @@ public class AuthMe extends JavaPlugin { return player; } - public boolean authmePermissible(Player player, String perm) { - if (player.hasPermission(perm)) - return true; - else if (permission != null) { - return permission.playerHas(player, perm); - } - return false; - } - - public boolean authmePermissible(CommandSender sender, String perm) { - if (sender.hasPermission(perm)) - return true; - else if (permission != null) { - return permission.has(sender, perm); - } - return false; - } - + // Purge inactive players from the database, as defined in the configuration private void autoPurge() { if (!Settings.usePurge) { return; @@ -536,27 +624,26 @@ public class AuthMe extends JavaPlugin { calendar.add(Calendar.DATE, -(Settings.purgeDelay)); long until = calendar.getTimeInMillis(); List cleared = database.autoPurgeDatabase(until); - if (cleared == null) + if (cleared == null) { return; - if (cleared.isEmpty()) + } + if (cleared.isEmpty()){ return; + } ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); if (Settings.purgeEssentialsFile && this.ess != null) - dataManager.purgeEssentials(cleared); // name to UUID convertion - // needed with latest versions + dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions if (Settings.purgePlayerDat) - dataManager.purgeDat(cleared); // name to UUID convertion needed - // with latest versions of MC + dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC if (Settings.purgeLimitedCreative) dataManager.purgeLimitedCreative(cleared); if (Settings.purgeAntiXray) - dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or - // names... (Actually it purges - // only names!) + dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) if (Settings.purgePermissions) dataManager.purgePermissions(cleared, permission); } + // Return the spawn location of a player public Location getSpawnLocation(Player player) { World world = player.getWorld(); String[] spawnPriority = Settings.spawnPriority.split(","); @@ -572,15 +659,18 @@ public class AuthMe extends JavaPlugin { if (s.equalsIgnoreCase("authme") && getAuthMeSpawn(player) != null) spawnLoc = getAuthMeSpawn(player); } - if (spawnLoc == null) + if (spawnLoc == null) { spawnLoc = world.getSpawnLocation(); + } return spawnLoc; } + // Return the default spawnpoint of a world private Location getDefaultSpawn(World world) { return world.getSpawnLocation(); } + // Return the multiverse spawnpoint of a world private Location getMultiverseSpawn(World world) { if (multiverse != null && Settings.multiverse) { try { @@ -592,20 +682,26 @@ public class AuthMe extends JavaPlugin { return null; } + // Return the essentials spawnpoint private Location getEssentialsSpawn() { - if (essentialsSpawn != null) + if (essentialsSpawn != null){ return essentialsSpawn; + } return null; } + // Return the authme soawnpoint private Location getAuthMeSpawn(Player player) { - if ((!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) && (Spawn.getInstance().getFirstSpawn() != null)) + if ((!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) && (Spawn.getInstance().getFirstSpawn() != null)) { return Spawn.getInstance().getFirstSpawn(); - if (Spawn.getInstance().getSpawn() != null) + } + if (Spawn.getInstance().getSpawn() != null) { return Spawn.getInstance().getSpawn(); + } return player.getWorld().getSpawnLocation(); } + // Download GeoIp data public void downloadGeoIp() { ConsoleLogger.info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, available at http://www.maxmind.com"); File file = new File(getDataFolder(), "GeoIP.dat"); @@ -617,8 +713,9 @@ public class AuthMe extends JavaPlugin { conn.setConnectTimeout(10000); conn.connect(); InputStream input = conn.getInputStream(); - if (url.endsWith(".gz")) + if (url.endsWith(".gz")) { input = new GZIPInputStream(input); + } OutputStream output = new FileOutputStream(file); byte[] buffer = new byte[2048]; int length = input.read(buffer); @@ -633,6 +730,8 @@ public class AuthMe extends JavaPlugin { } } + // TODO: Need to review the code below! + public String getCountryCode(String ip) { try { if (ls == null) @@ -757,46 +856,5 @@ public class AuthMe extends JavaPlugin { return realIP; } - public void setupDatabase() throws ClassNotFoundException, PoolInitializationException, SQLException { - /* - * Backend MYSQL - FILE - SQLITE - SQLITEHIKARI - */ - switch (Settings.getDataSource) { - case FILE: - database = new FlatFile(); - break; - case MYSQL: - database = new MySQL(); - break; - case SQLITE: - database = new SQLite(); - final int b = database.getAccountsRegistered(); - if (b >= 4000) - ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + b + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); - break; - case SQLITEHIKARI: - database = new SQLite_HIKARI(); - final int b2 = database.getAccountsRegistered(); - if (b2 >= 8000) - ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + b2 + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); - break; - } - if (Settings.isCachingEnabled) { - database = new CacheDataSource(this, database); - } - - database = new DatabaseCalls(database); - - if (Settings.getDataSource == DataSource.DataSourceType.FILE) { - Converter converter = new ForceFlatToSqlite(database, this); - try { - Thread t = new Thread(converter); - t.start(); - } catch (Exception e) { - } - ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated, next time server starts up, it will be changed to SQLite... Conversion will be started Asynchronously, it will not drop down your performance !"); - ConsoleLogger.showError("If you want to keep FlatFile, set file again into config at backend, but this message and this change will appear again at the next restart"); - } - } } diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index 556ece3c..72ae2faf 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -37,9 +37,8 @@ public class PerformBackup { return FileBackup("auths.db"); case MYSQL: return MySqlBackup(); - case SQLITE: - return FileBackup(Settings.getMySQLDatabase + ".db"); case SQLITEHIKARI: + case SQLITE: return FileBackup(Settings.getMySQLDatabase + ".db"); } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 4f0b2ed5..b6d161f7 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -57,7 +57,7 @@ public class AuthMeServerListener implements Listener { return; } if (pluginName.equalsIgnoreCase("ChestShop")) { - plugin.ChestShop = 0; + plugin.legacyChestShop = false; ConsoleLogger.info("ChestShop has been disabled, unhook!"); } if (pluginName.equalsIgnoreCase("CombatTag")) { diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 41fbaff7..cd915903 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -64,7 +64,7 @@ public final class Settings extends YamlConfiguration { protectInventoryBeforeLogInEnabled, isBackupActivated, isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, - useCaptcha, emailRegistration, multiverse, chestshop, bungee, + useCaptcha, emailRegistration, multiverse, legacyChestShop, bungee, banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange, disableSocialSpy, forceOnlyAfterLogin, useEssentialsMotd, usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword, @@ -227,7 +227,7 @@ public final class Settings extends YamlConfiguration { saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8); getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1); multiverse = configFile.getBoolean("Hooks.multiverse", true); - chestshop = configFile.getBoolean("Hooks.legacyChestshop", false); + legacyChestShop = configFile.getBoolean("Hooks.legacyChestshop", false); bungee = configFile.getBoolean("Hooks.bungeecord", false); getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds"); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); From 3cbc7ab18fffced6d0eea5e389b95777a60e6be4 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 15:18:22 +0200 Subject: [PATCH 143/427] should fix item usage issue --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index cffd6850..e260bc63 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -651,7 +651,7 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onPlayerInteract(PlayerInteractEvent event) { if (event.getPlayer() == null) return; @@ -675,8 +675,9 @@ public class AuthMePlayerListener implements Listener { return; } } - if (event.getClickedBlock() != null && event.getClickedBlock().getType() != Material.AIR) + if (event.getClickedBlock() != null){ event.setUseInteractedBlock(org.bukkit.event.Event.Result.DENY); + } event.setUseItemInHand(org.bukkit.event.Event.Result.DENY); event.setCancelled(true); } From 1994683e47e3819b231639be7fdf7d6ef7fab1a3 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sun, 13 Sep 2015 15:30:40 +0200 Subject: [PATCH 144/427] Update team.txt --- team.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/team.txt b/team.txt index e5ac3a1a..bb264888 100644 --- a/team.txt +++ b/team.txt @@ -1,13 +1,19 @@ AuthMe-Team: +Active staff: Xephi (Xephi59) - Leader, Main developer -darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author -Kloudy - Developer (Inactive, Will be avariable soon) -DNx5 - Developer Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor -Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor +DNx5 - Developer +CryLegend - Contributor, AuthMeBridge Developer (Need activation) + +External Contributors: Gnat008 - Contributor -Trojaner25 - Ticket manager, Basic Developer (Need activation) + +Inactive staff: +Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor (Inactive) +darkwarriors (d4rkwarriors) - Original AuthMeReloaded Author (Inactive) + +Translators: irobin591 - DE Translator WaterCXubic - ZHHK Translator Bodyash - Russian/Ukrainian translator From 680717dbca27dea5057553fb5ad4c904a8678021 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 16:28:41 +0200 Subject: [PATCH 145/427] Fix --- src/main/java/fr/xephi/authme/AuthMe.java | 27 +++++++++++-------- .../authme/listener/AuthMePlayerListener.java | 1 - 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 2f6c6367..b19c1cb4 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -140,19 +140,22 @@ public class AuthMe extends JavaPlugin { @Override public void onEnable() { + + // TODO: split the plugin in more modules + // TODO: remove vault as hard dependency + server = getServer(); PluginManager pm = server.getPluginManager(); - authme = this; + // Setup the Logger authmeLogger.setParent(this.getLogger()); - m = Messages.getInstance(); + // Set the Instance + authme = this; + + // Setup otherAccounts file otherAccounts = OtherAccounts.getInstance(); - // TODOs - // TODO: split the plugin in more modules - // TODO: remove vault as hard dependency - // Load settings and custom configurations // TODO: new configuration style (more files) try { @@ -162,7 +165,6 @@ public class AuthMe extends JavaPlugin { this.getServer().shutdown(); return; } - // Configuration Security Warnings if (!Settings.isForceSingleSessionEnabled) { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); @@ -171,6 +173,9 @@ public class AuthMe extends JavaPlugin { ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); } + // Setup messages + m = Messages.getInstance(); + // Start the metrics service // TODO: add a setting to disable metrics try { @@ -435,7 +440,7 @@ public class AuthMe extends JavaPlugin { // Check the presence of the Vault plugin and a permissions provider public void checkVault() { - if (server.getPluginManager().getPlugin("Vault").isEnabled()) { + if (server.getPluginManager().isPluginEnabled("Vault")) { RegisteredServiceProvider permissionProvider = server.getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); if (permissionProvider != null) { permission = permissionProvider.getProvider(); @@ -450,7 +455,7 @@ public class AuthMe extends JavaPlugin { // Check the version of the ChestShop plugin public void checkChestShop() { - if (Settings.legacyChestShop && server.getPluginManager().getPlugin("ChestShop").isEnabled()) { + if (Settings.legacyChestShop && server.getPluginManager().isPluginEnabled("ChestShop")) { try { String rawver = com.Acrobot.ChestShop.ChestShop.getVersion(); double version = 0; @@ -481,7 +486,7 @@ public class AuthMe extends JavaPlugin { // Check PerWorldInventories version public void checkPerWorldInventories() { - if (server.getPluginManager().getPlugin("PerWorldInventories").isEnabled()) { + if (server.getPluginManager().isPluginEnabled("PerWorldInventories")) { try { double version = 0; String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); @@ -503,7 +508,7 @@ public class AuthMe extends JavaPlugin { // Get the Multiverse plugin public void checkMultiverse() { - if (Settings.multiverse && this.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) { + if (Settings.multiverse && server.getPluginManager().isPluginEnabled("Multiverse-Core")) { try { multiverse = (MultiverseCore) server.getPluginManager().getPlugin("Multiverse-Core"); ConsoleLogger.info("Hooked correctly with Multiverse-Core"); diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index e260bc63..00f051c7 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -12,7 +12,6 @@ import java.util.regex.PatternSyntaxException; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; From 851eab2fd051a9c0d707cf691df782731a394de7 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 13 Sep 2015 21:56:42 +0700 Subject: [PATCH 146/427] cleanup Utils.java --- src/main/java/fr/xephi/authme/Utils.java | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 39d5bf55..2d5b3e19 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -12,6 +12,7 @@ import org.bukkit.entity.Player; import java.io.File; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Collection; import java.util.Iterator; @@ -19,8 +20,7 @@ public class Utils { private String currentGroup; private static Utils singleton; - int id; - public AuthMe plugin; + public final AuthMe plugin; public Utils(AuthMe plugin) { this.plugin = plugin; @@ -112,11 +112,7 @@ public class Utils { } public boolean isUnrestricted(Player player) { - if (!Settings.isAllowRestrictedIp) - return false; - if (Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) - return false; - return (Settings.getUnrestrictedName.contains(player.getName())); + return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName())); } public static Utils getInstance() { @@ -125,9 +121,7 @@ public class Utils { } private boolean useGroupSystem() { - if (Settings.isPermissionCheckEnabled && !Settings.getUnloggedinGroup.isEmpty()) - return true; - return false; + return Settings.isPermissionCheckEnabled && !Settings.getUnloggedinGroup.isEmpty(); } public void packCoords(double x, double y, double z, String w, @@ -189,15 +183,17 @@ public class Utils { } public static Player[] getOnlinePlayers() { - Player[] players = null; + Player[] players; try { - if (Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).getReturnType() == Collection.class) { - players = (Player[]) ((Collection) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null)).toArray(); + Method m = Bukkit.class.getMethod("getOnlinePlayers"); + if (m.getReturnType() == Collection.class) { + players = (Player[]) ((Collection) m.invoke(null)).toArray(); } else { - players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null)); + players = ((Player[]) m.invoke(null)); } } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { // can never happen + players = null; } return players; } From f297609818d0df2b37a4daa9349f47e02344a527 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 17:07:02 +0200 Subject: [PATCH 147/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index b19c1cb4..26046e61 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -79,36 +79,36 @@ import net.milkbowl.vault.permission.Permission; public class AuthMe extends JavaPlugin { - public DataSource database; - private Settings settings; - private Messages m; - public OtherAccounts otherAccounts; public static Server server; public static Logger authmeLogger = Logger.getLogger("AuthMe"); public static AuthMe authme; - public Permission permission; + public Management management; + public NewAPI api; private Utils utils = Utils.getInstance(); + public SendMailSSL mail = null; + private Settings settings; + private Messages m; + public DataManager dataManager; + public DataSource database; private FileCache playerBackup = new FileCache(this); + public OtherAccounts otherAccounts; + public Permission permission; + public Essentials ess; + public Location essentialsSpawn; + public MultiverseCore multiverse = null; + public LookupService ls = null; public CitizensCommunicator citizens; public boolean isCitizensActive = false; - public SendMailSSL mail = null; public boolean CombatTag = false; public boolean legacyChestShop = false; public boolean BungeeCord = false; - public Essentials ess; - public NewAPI api; - public Management management; + public boolean antibotMod = false; + public boolean delayedAntiBot = true; + public ConcurrentHashMap sessions = new ConcurrentHashMap(); public ConcurrentHashMap captcha = new ConcurrentHashMap(); public ConcurrentHashMap cap = new ConcurrentHashMap(); public ConcurrentHashMap realIp = new ConcurrentHashMap(); - public MultiverseCore multiverse = null; - public Location essentialsSpawn; - public LookupService ls = null; - public boolean antibotMod = false; - public boolean delayedAntiBot = true; protected static String vgUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; - public DataManager dataManager; - public ConcurrentHashMap sessions = new ConcurrentHashMap(); public static AuthMe getInstance() { return authme; From 576ff59fcd344512a082a47a5039aaf19c0229cb Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 13 Sep 2015 22:08:18 +0700 Subject: [PATCH 148/427] replace cache with Json --- src/main/java/fr/xephi/authme/AuthMe.java | 4 +- .../xephi/authme/cache/backup/FileCache.java | 277 ------------------ .../xephi/authme/cache/backup/JsonCache.java | 206 +++++++++++++ .../xephi/authme/cache/limbo/LimboCache.java | 6 +- .../authme/commands/UnregisterCommand.java | 6 +- .../authme/events/StoreInventoryEvent.java | 6 +- .../authme/process/join/AsyncronousJoin.java | 6 +- .../login/ProcessSyncronousPlayerLogin.java | 6 +- .../process/logout/AsyncronousLogout.java | 6 +- 9 files changed, 226 insertions(+), 297 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/cache/backup/FileCache.java create mode 100644 src/main/java/fr/xephi/authme/cache/backup/JsonCache.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index b19c1cb4..ff4ed6c1 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -40,7 +40,7 @@ import fr.xephi.authme.api.API; import fr.xephi.authme.api.NewAPI; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.commands.AdminCommand; @@ -88,7 +88,7 @@ public class AuthMe extends JavaPlugin { public static AuthMe authme; public Permission permission; private Utils utils = Utils.getInstance(); - private FileCache playerBackup = new FileCache(this); + private JsonCache playerBackup = new JsonCache(this); public CitizensCommunicator citizens; public boolean isCitizensActive = false; public SendMailSSL mail = null; diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java deleted file mode 100644 index 3e119ba6..00000000 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ /dev/null @@ -1,277 +0,0 @@ -package fr.xephi.authme.cache.backup; - -import com.google.common.io.BaseEncoding; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -import fr.xephi.authme.api.API; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.util.io.BukkitObjectInputStream; -import org.bukkit.util.io.BukkitObjectOutputStream; - -import java.io.*; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Scanner; - -public class FileCache { - - private final File cacheDir; - private AuthMe plugin; - - public FileCache(AuthMe plugin) { - this.plugin = plugin; - cacheDir = new File(plugin.getDataFolder() + File.separator + "cache"); - if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { - ConsoleLogger.showError("Failed to create cache directory."); - } - } - - public void createCache(Player player, DataFileCache playerData, - String group, boolean operator, boolean flying) { - if (player == null) { - return; - } - - String path; - try { - path = player.getUniqueId().toString(); - } catch (Exception | Error e) { - path = player.getName().toLowerCase(); - } - - File playerDir = new File(cacheDir, path); - if (!playerDir.exists() && !playerDir.isDirectory() && !playerDir.mkdir()) { - return; - } - - File datafile = new File(playerDir, "playerdatas.cache"); - if (datafile.exists()) { - return; - } - - FileWriter writer; - try { - datafile.createNewFile(); - writer = new FileWriter(datafile); - writer.write(group + API.newline); - writer.write(String.valueOf(operator) + API.newline); - writer.write(String.valueOf(flying) + API.newline); - writer.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - BaseEncoding base64 = BaseEncoding.base64(); - - File invDir = new File(playerDir, "inventory"); - if (!invDir.isDirectory() && !invDir.mkdir()) - return; - - ItemStack[] inv = playerData.getInventory(); - for (int i = 0; i < inv.length; i++) { - ItemStack item = inv[i]; - if (item == null) { - item = new ItemStack(Material.AIR); - } - if (item.getType() == Material.SKULL_ITEM) { - SkullMeta meta = (SkullMeta) item.getItemMeta(); - if (meta.hasOwner() && (meta.getOwner() == null || meta.getOwner().isEmpty())) { - item.setItemMeta(plugin.getServer().getItemFactory().getItemMeta(Material.SKULL_ITEM)); - } - } - - try { - File cacheFile = new File(invDir, i + ".cache"); - if (!cacheFile.isFile() && !cacheFile.createNewFile()) { - continue; - } - writer = new FileWriter(cacheFile); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos); - objectOut.writeObject(item); - objectOut.close(); - writer.write(base64.encode(baos.toByteArray())); - writer.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - File armourDir = new File(cacheDir, path + File.separator + "armours"); - if (!armourDir.isDirectory() && !armourDir.mkdir()) - return; - - ItemStack[] armors = playerData.getArmour(); - for (int i = 0; i < armors.length; i++) { - ItemStack item = armors[i]; - if (item == null) { - item = new ItemStack(Material.AIR); - } - if (item.getType() == Material.SKULL_ITEM) { - SkullMeta meta = (SkullMeta) item.getItemMeta(); - if (meta.hasOwner() && (meta.getOwner() == null || meta.getOwner().isEmpty())) { - item.setItemMeta(plugin.getServer().getItemFactory().getItemMeta(Material.SKULL_ITEM)); - } - } - - try { - File cacheFile = new File(armourDir, i + ".cache"); - if (!cacheFile.isFile() && !cacheFile.createNewFile()) { - continue; - } - writer = new FileWriter(cacheFile); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos); - objectOut.writeObject(item); - objectOut.close(); - writer.write(base64.encode(baos.toByteArray())); - writer.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - } - - public DataFileCache readCache(Player player) { - if (player == null) { - return null; - } - - String path; - try { - path = player.getUniqueId().toString(); - } catch (Exception | Error e) { - path = player.getName().toLowerCase(); - } - - File playerDir = new File(cacheDir, path); - if (!playerDir.exists() && !playerDir.isDirectory()) { - return null; - } - - try { - File datafile = new File(playerDir, "playerdatas.cache"); - if (!datafile.exists() || !datafile.isFile()) { - return null; - } - ItemStack[] inv = new ItemStack[36]; - ItemStack[] armours = new ItemStack[4]; - String group = null; - boolean op = false; - boolean flying = false; - - Scanner reader; - try { - reader = new Scanner(datafile); - int count = 1; - while (reader.hasNextLine()) { - String line = reader.nextLine(); - switch (count) { - case 1: - group = line; - break; - case 2: - op = Boolean.parseBoolean(line); - break; - case 3: - flying = Boolean.parseBoolean(line); - break; - default: - break; - } - count++; - } - reader.close(); - } catch (Exception e) { - e.printStackTrace(); - } - - BaseEncoding base64 = BaseEncoding.base64(); - - File invDir = new File(playerDir, "inventory"); - for (int i = 0; i < inv.length; i++) { - byte[] bytes = Files.readAllBytes(Paths.get(invDir.getPath(), i + ".cache")); - String encodedItem = new String(bytes); - bytes = base64.decode(encodedItem); - ByteArrayInputStream baos = new ByteArrayInputStream(bytes); - BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); - ItemStack item = (ItemStack) objectIn.readObject(); - objectIn.close(); - if (item == null) { - inv[i] = new ItemStack(Material.AIR); - } else { - inv[i] = item; - } - } - - File armourDir = new File(playerDir, "armours"); - for (int i = 0; i < armours.length; i++) { - byte[] bytes = Files.readAllBytes(Paths.get(armourDir.getPath(), i + ".cache")); - String encodedItem = new String(bytes); - bytes = base64.decode(encodedItem); - ByteArrayInputStream baos = new ByteArrayInputStream(bytes); - BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); - ItemStack item = (ItemStack) objectIn.readObject(); - objectIn.close(); - if (item == null) { - armours[i] = new ItemStack(Material.AIR); - } else { - armours[i] = item; - } - } - - return new DataFileCache(inv, armours, group, op, flying); - - } catch (Exception e) { - e.printStackTrace(); - ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming..."); - return null; - } - } - - public void removeCache(Player player) { - String path; - try { - path = player.getUniqueId().toString(); - } catch (Exception | Error e) { - path = player.getName().toLowerCase(); - } - try { - File file = new File(cacheDir, path); - if (file.list() != null) { - Utils.purgeDirectory(file); - if (!file.delete()) { - ConsoleLogger.showError("Failed to remove" + player.getName() + "cache."); - } - } else { - file = new File(cacheDir, player.getName().toLowerCase() + ".cache"); - if (file.isFile() && !file.delete()) { - ConsoleLogger.showError("Failed to remove" + player.getName() + "cache."); - } - } - } catch (Exception e) { - ConsoleLogger.showError("Failed to remove" + player.getName() + "cache :/"); - } - } - - public boolean doesCacheExist(Player player) { - String path; - try { - path = player.getUniqueId().toString(); - } catch (Exception | Error e) { - path = player.getName().toLowerCase(); - } - File file = new File(cacheDir, path + File.separator + "playerdatas.cache"); - if (!file.exists()) { - file = new File(cacheDir, player.getName().toLowerCase() + ".cache"); - } - - return file.exists(); - } - -} diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java new file mode 100644 index 00000000..25db2afb --- /dev/null +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -0,0 +1,206 @@ +package fr.xephi.authme.cache.backup; + +import com.google.common.io.BaseEncoding; +import com.google.gson.*; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.util.io.BukkitObjectInputStream; +import org.bukkit.util.io.BukkitObjectOutputStream; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class JsonCache { + + private final Gson gson; + private final AuthMe plugin; + private final File cacheDir; + + public JsonCache(AuthMe plugin) { + this.plugin = plugin; + cacheDir = new File(plugin.getDataFolder() + File.separator + "cache"); + if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { + ConsoleLogger.showError("Failed to create cache directory."); + } + gson = new GsonBuilder() + .registerTypeAdapter(DataFileCache.class, new PlayerDataSerializer()) + .registerTypeAdapter(DataFileCache.class, new PlayerDataDeserializer()) + .setPrettyPrinting() + .create(); + } + + public void createCache(Player player, DataFileCache playerData) { + if (player == null) { + return; + } + + String path; + try { + path = player.getUniqueId().toString(); + } catch (Exception | Error e) { + path = player.getName().toLowerCase(); + } + + File file = new File(cacheDir, path + File.separator + "cache.json"); + if (file.exists()) { + return; + } + if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { + return; + } + + try { + String data = gson.toJson(playerData); + Files.write(Paths.get(file.getPath()), data.getBytes()); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public DataFileCache readCache(Player player) { + String path; + try { + path = player.getUniqueId().toString(); + } catch (Exception | Error e) { + path = player.getName().toLowerCase(); + } + + File file = new File(cacheDir, path + File.separator + "cache.json"); + try { + byte[] bytes = Files.readAllBytes(Paths.get(file.getPath())); + String str = new String(bytes); + return gson.fromJson(str, DataFileCache.class); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + private class PlayerDataSerializer implements JsonSerializer { + @Override + public JsonElement serialize(DataFileCache dataFileCache, Type type, JsonSerializationContext jsonSerializationContext) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("group", dataFileCache.getGroup()); + jsonObject.addProperty("operator", dataFileCache.getOperator()); + jsonObject.addProperty("flying", dataFileCache.isFlying()); + + JsonArray arr; + ItemStack[] contents; + + // inventory + contents = dataFileCache.getInventory(); + arr = new JsonArray(); + putItems(contents, arr); + + // armour + contents = dataFileCache.getArmour(); + arr = new JsonArray(); + putItems(contents, arr); + jsonObject.add("armour", arr); + + return jsonObject; + } + + private void putItems(ItemStack[] contents, JsonArray target) { + for (ItemStack item : contents) { + if (item == null) { + item = new ItemStack(Material.AIR); + } + JsonObject val = new JsonObject(); + if (item.getType() == Material.SKULL_ITEM) { + SkullMeta meta = (SkullMeta) item.getItemMeta(); + if (meta.hasOwner() && (meta.getOwner() == null || meta.getOwner().isEmpty())) { + item.setItemMeta(plugin.getServer().getItemFactory().getItemMeta(Material.SKULL_ITEM)); + } + } + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos); + objectOut.writeObject(item); + objectOut.close(); + val.addProperty("item", BaseEncoding.base64().encode(baos.toByteArray())); + } catch (IOException e) { + e.printStackTrace(); + continue; + } + target.add(val); + } + } + } + + private class PlayerDataDeserializer implements JsonDeserializer { + @Override + public DataFileCache deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { + JsonObject jsonObject = jsonElement.getAsJsonObject(); + String group = jsonObject.get("group").getAsString(); + boolean operator = jsonObject.get("operator").getAsBoolean(); + boolean flying = jsonObject.get("flying").getAsBoolean(); + + JsonArray arr; + + arr = jsonObject.get("inventory").getAsJsonArray(); + ItemStack[] inv = getItems(arr); + + arr = jsonObject.get("armour").getAsJsonArray(); + ItemStack[] armour = getItems(arr); + + return new DataFileCache(inv, armour, group, operator, flying); + } + + private ItemStack[] getItems(JsonArray arr) { + ItemStack[] contents = new ItemStack[arr.size()]; + for (int i = 0; i < arr.size(); i++) { + JsonObject item = arr.get(i).getAsJsonObject(); + String encoded = item.get("item").getAsString(); + byte[] decoded = BaseEncoding.base64().decode(encoded); + try { + ByteArrayInputStream baos = new ByteArrayInputStream(decoded); + BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); + contents[i] = (ItemStack) objectIn.readObject(); + objectIn.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return contents; + } + } + + public void removeCache(Player player) { + String path; + try { + path = player.getUniqueId().toString(); + } catch (Exception | Error e) { + path = player.getName().toLowerCase(); + } + File file = new File(cacheDir, path + File.separator + "cache.json"); + if (file.exists()) { + Utils.purgeDirectory(file); + if (!file.delete()) { + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache."); + } + } + } + + public boolean doesCacheExist(Player player) { + String path; + try { + path = player.getUniqueId().toString(); + } catch (Exception | Error e) { + path = player.getName().toLowerCase(); + } + File file = new File(cacheDir, path + File.separator + "cache.json"); + return file.exists(); + } + +} diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index 6f745024..b158a8cc 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -3,7 +3,7 @@ package fr.xephi.authme.cache.limbo; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.backup.DataFileCache; -import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.events.ResetInventoryEvent; import fr.xephi.authme.events.StoreInventoryEvent; import fr.xephi.authme.settings.Settings; @@ -19,13 +19,13 @@ public class LimboCache { private volatile static LimboCache singleton = null; public ConcurrentHashMap cache; - private FileCache playerData; + private JsonCache playerData; public AuthMe plugin; private LimboCache(AuthMe plugin) { this.plugin = plugin; this.cache = new ConcurrentHashMap(); - this.playerData = new FileCache(plugin); + this.playerData = new JsonCache(plugin); } public void addLimboPlayer(Player player) { diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 1361656d..57e65303 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -18,7 +18,7 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.security.PasswordSecurity; @@ -31,11 +31,11 @@ public class UnregisterCommand implements CommandExecutor { private Messages m = Messages.getInstance(); public AuthMe plugin; - private FileCache playerCache; + private JsonCache playerCache; public UnregisterCommand(AuthMe plugin) { this.plugin = plugin; - this.playerCache = new FileCache(plugin); + this.playerCache = new JsonCache(plugin); } @Override diff --git a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java index 66911d18..e8a78806 100644 --- a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java @@ -1,7 +1,7 @@ package fr.xephi.authme.events; import fr.xephi.authme.cache.backup.DataFileCache; -import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.cache.backup.JsonCache; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -22,9 +22,9 @@ public class StoreInventoryEvent extends CustomEvent { this.armor = player.getInventory().getArmorContents(); } - public StoreInventoryEvent(Player player, FileCache fileCache) { + public StoreInventoryEvent(Player player, JsonCache jsonCache) { this.player = player; - DataFileCache cache = fileCache.readCache(player); + DataFileCache cache = jsonCache.readCache(player); if (cache != null) { this.inventory = cache.getInventory(); this.armor = cache.getArmour(); diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 3a3e8e1f..c0cd93d7 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -19,7 +19,7 @@ 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.backup.DataFileCache; -import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.datasource.DataSource; @@ -42,13 +42,13 @@ public class AsyncronousJoin { protected String name; private Utils utils = Utils.getInstance(); private Messages m = Messages.getInstance(); - private FileCache playerBackup; + private JsonCache playerBackup; public AsyncronousJoin(Player player, AuthMe plugin, DataSource database) { this.player = player; this.plugin = plugin; this.database = database; - this.playerBackup = new FileCache(plugin); + this.playerBackup = new JsonCache(plugin); this.name = player.getName().toLowerCase(); } diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 276a8c23..acb1f832 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -11,7 +11,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.datasource.DataSource; @@ -31,7 +31,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { private AuthMe plugin; private DataSource database; private PluginManager pm; - private FileCache playerCache; + private JsonCache playerCache; public ProcessSyncronousPlayerLogin(Player player, AuthMe plugin, DataSource data) { @@ -42,7 +42,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { this.name = player.getName().toLowerCase(); this.limbo = LimboCache.getInstance().getLimboPlayer(name); this.auth = database.getAuth(name); - this.playerCache = new FileCache(plugin); + this.playerCache = new JsonCache(plugin); } public LimboPlayer getLimbo() { diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index 366e72d4..a665a229 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -10,7 +10,7 @@ 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.backup.DataFileCache; -import fr.xephi.authme.cache.backup.FileCache; +import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.events.AuthMeTeleportEvent; @@ -26,7 +26,7 @@ public class AsyncronousLogout { protected boolean canLogout = true; private Messages m = Messages.getInstance(); private Utils utils = Utils.getInstance(); - private FileCache playerBackup; + private JsonCache playerBackup; public AsyncronousLogout(Player player, AuthMe plugin, DataSource database) { @@ -34,7 +34,7 @@ public class AsyncronousLogout { this.plugin = plugin; this.database = database; this.name = player.getName().toLowerCase(); - this.playerBackup = new FileCache(plugin); + this.playerBackup = new JsonCache(plugin); } private void preLogout() { From b0fc123229e6ff401def79d4a77ed220364ef2cd Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 13 Sep 2015 22:10:41 +0700 Subject: [PATCH 149/427] replace cache with Json --- src/main/java/fr/xephi/authme/AuthMe.java | 141 +++++++++------------- 1 file changed, 58 insertions(+), 83 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 26046e61..e7ad1c89 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -1,23 +1,31 @@ package fr.xephi.authme; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.URL; -import java.net.URLConnection; -import java.sql.SQLException; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; -import java.util.zip.GZIPInputStream; - +import com.earth2me.essentials.Essentials; +import com.maxmind.geoip.LookupService; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.zaxxer.hikari.pool.PoolInitializationException; +import fr.xephi.authme.api.API; +import fr.xephi.authme.api.NewAPI; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.cache.backup.JsonCache; +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; +import fr.xephi.authme.commands.*; +import fr.xephi.authme.converter.Converter; +import fr.xephi.authme.converter.ForceFlatToSqlite; +import fr.xephi.authme.datasource.*; +import fr.xephi.authme.listener.*; +import fr.xephi.authme.plugin.manager.BungeeCordMessage; +import fr.xephi.authme.plugin.manager.CitizensCommunicator; +import fr.xephi.authme.plugin.manager.CombatTagComunicator; +import fr.xephi.authme.plugin.manager.EssSpawn; +import fr.xephi.authme.process.Management; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.OtherAccounts; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.settings.Spawn; +import net.milkbowl.vault.permission.Permission; import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -31,51 +39,17 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; import org.mcstats.Metrics; -import com.earth2me.essentials.Essentials; -import com.maxmind.geoip.LookupService; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.zaxxer.hikari.pool.PoolInitializationException; - -import fr.xephi.authme.api.API; -import fr.xephi.authme.api.NewAPI; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.backup.FileCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.commands.AdminCommand; -import fr.xephi.authme.commands.CaptchaCommand; -import fr.xephi.authme.commands.ChangePasswordCommand; -import fr.xephi.authme.commands.ConverterCommand; -import fr.xephi.authme.commands.EmailCommand; -import fr.xephi.authme.commands.LoginCommand; -import fr.xephi.authme.commands.LogoutCommand; -import fr.xephi.authme.commands.RegisterCommand; -import fr.xephi.authme.commands.UnregisterCommand; -import fr.xephi.authme.converter.Converter; -import fr.xephi.authme.converter.ForceFlatToSqlite; -import fr.xephi.authme.datasource.CacheDataSource; -import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.datasource.DatabaseCalls; -import fr.xephi.authme.datasource.FlatFile; -import fr.xephi.authme.datasource.MySQL; -import fr.xephi.authme.datasource.SQLite; -import fr.xephi.authme.datasource.SQLite_HIKARI; -import fr.xephi.authme.listener.AuthMeBlockListener; -import fr.xephi.authme.listener.AuthMeChestShopListener; -import fr.xephi.authme.listener.AuthMeEntityListener; -import fr.xephi.authme.listener.AuthMePlayerListener; -import fr.xephi.authme.listener.AuthMeServerListener; -import fr.xephi.authme.plugin.manager.BungeeCordMessage; -import fr.xephi.authme.plugin.manager.CitizensCommunicator; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; -import fr.xephi.authme.plugin.manager.EssSpawn; -import fr.xephi.authme.process.Management; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.OtherAccounts; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.settings.Spawn; -import net.milkbowl.vault.permission.Permission; +import java.io.*; +import java.net.URL; +import java.net.URLConnection; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; +import java.util.zip.GZIPInputStream; public class AuthMe extends JavaPlugin { @@ -90,7 +64,8 @@ public class AuthMe extends JavaPlugin { private Messages m; public DataManager dataManager; public DataSource database; - private FileCache playerBackup = new FileCache(this); + + private JsonCache playerBackup = new JsonCache(this); public OtherAccounts otherAccounts; public Permission permission; public Essentials ess; @@ -246,11 +221,11 @@ public class AuthMe extends JavaPlugin { // Do backup on start if enabled if (Settings.isBackupActivated && Settings.isBackupOnStart) { - // Do backup and check return value! - if (new PerformBackup(this).DoBackup()){ + // Do backup and check return value! + if (new PerformBackup(this).DoBackup()) { ConsoleLogger.info("Backup performed correctly"); } else { - ConsoleLogger.showError("Error while performing the backup!"); + ConsoleLogger.showError("Error while performing the backup!"); } } @@ -342,7 +317,7 @@ public class AuthMe extends JavaPlugin { @Override public void onDisable() { - // Save player data + // Save player data Player[] players = Utils.getOnlinePlayers(); if (players != null) { for (Player player : players) { @@ -368,7 +343,7 @@ public class AuthMe extends JavaPlugin { } // Stop/unload the server/plugin as defined in the configuration - public void stopOrUnload(){ + public void stopOrUnload() { if (Settings.isStopEnabled) { ConsoleLogger.showError("THE SERVER IS GOING TO SHUTDOWN AS DEFINED IN THE CONFIGURATION!"); AuthMe.getInstance().getServer().shutdown(); @@ -378,7 +353,7 @@ public class AuthMe extends JavaPlugin { } // Show the exception message and stop/unload the server/plugin as defined in the configuration - public void stopOrUnload(Exception e){ + public void stopOrUnload(Exception e) { ConsoleLogger.showError(e.getMessage()); stopOrUnload(); } @@ -386,7 +361,7 @@ public class AuthMe extends JavaPlugin { // Initialize and setup the database public void setupDatabase() throws ClassNotFoundException, PoolInitializationException, SQLException { // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI - int accounts = 0; + int accounts = 0; switch (Settings.getDataSource) { case FILE: database = new FlatFile(); @@ -469,8 +444,8 @@ public class AuthMe extends JavaPlugin { return; } } - if (version >= 3.813){ - return; + if (version >= 3.813) { + return; } if (version < 3.50) { ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); @@ -488,7 +463,7 @@ public class AuthMe extends JavaPlugin { public void checkPerWorldInventories() { if (server.getPluginManager().isPluginEnabled("PerWorldInventories")) { try { - double version = 0; + double version = 0; String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); try { version = Double.valueOf(ver.split(" ")[0]); @@ -498,11 +473,11 @@ public class AuthMe extends JavaPlugin { } catch (NumberFormatException nfee) { } } - if (version < 1.57){ + if (version < 1.57) { ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); - } + } } catch (Exception e) { - } + } } } @@ -513,10 +488,10 @@ public class AuthMe extends JavaPlugin { multiverse = (MultiverseCore) server.getPluginManager().getPlugin("Multiverse-Core"); ConsoleLogger.info("Hooked correctly with Multiverse-Core"); } catch (Exception | NoClassDefFoundError ignored) { - multiverse = null; + multiverse = null; } } else { - multiverse = null; + multiverse = null; } } @@ -564,6 +539,7 @@ public class AuthMe extends JavaPlugin { } return false; } + public boolean authmePermissible(CommandSender sender, String perm) { if (sender.hasPermission(perm)) { return true; @@ -632,7 +608,7 @@ public class AuthMe extends JavaPlugin { if (cleared == null) { return; } - if (cleared.isEmpty()){ + if (cleared.isEmpty()) { return; } ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); @@ -689,7 +665,7 @@ public class AuthMe extends JavaPlugin { // Return the essentials spawnpoint private Location getEssentialsSpawn() { - if (essentialsSpawn != null){ + if (essentialsSpawn != null) { return essentialsSpawn; } return null; @@ -840,8 +816,7 @@ public class AuthMe extends JavaPlugin { /** * Get Player real IP through VeryGames method * - * @param player - * player + * @param player player */ @Deprecated public String getVeryGamesIP(Player player) { From e85d8acc24ac7645b6904a967b4cc521672dffe8 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 13 Sep 2015 22:40:19 +0700 Subject: [PATCH 150/427] refactor, --- src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java | 2 +- .../java/fr/xephi/authme/process/logout/AsyncronousLogout.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index c0cd93d7..b1db6afe 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -134,7 +134,7 @@ public class AsyncronousJoin { LimboCache.getInstance().updateLimboPlayer(player); try { DataFileCache dataFile = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour()); - playerBackup.createCache(player, dataFile, LimboCache.getInstance().getLimboPlayer(name).getGroup(), LimboCache.getInstance().getLimboPlayer(name).getOperator(), LimboCache.getInstance().getLimboPlayer(name).isFlying()); + playerBackup.createCache(player, dataFile); } catch (Exception e) { ConsoleLogger.showError("Error on creating an inventory cache for " + name + ", maybe inventory wipe in preparation..."); } diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index a665a229..f1dde587 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -85,7 +85,7 @@ public class AsyncronousLogout { // create cache file for handling lost of inventories on unlogged in // status DataFileCache playerData = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour()); - playerBackup.createCache(player, playerData, LimboCache.getInstance().getLimboPlayer(name).getGroup(), LimboCache.getInstance().getLimboPlayer(name).getOperator(), LimboCache.getInstance().getLimboPlayer(name).isFlying()); + playerBackup.createCache(player, playerData); } sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin)); } From 7458224ada0480f8ac389497d8e6aab9693ff621 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 13 Sep 2015 23:41:28 +0700 Subject: [PATCH 151/427] Enhance mainclass --- src/main/java/fr/xephi/authme/AuthMe.java | 210 ++++++++---------- src/main/java/fr/xephi/authme/Utils.java | 41 ++-- .../authme/listener/AuthMePlayerListener.java | 2 +- 3 files changed, 121 insertions(+), 132 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index e7ad1c89..0c9c5749 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -71,7 +71,7 @@ public class AuthMe extends JavaPlugin { public Essentials ess; public Location essentialsSpawn; public MultiverseCore multiverse = null; - public LookupService ls = null; + public LookupService lookupService = null; public CitizensCommunicator citizens; public boolean isCitizensActive = false; public boolean CombatTag = false; @@ -79,10 +79,10 @@ public class AuthMe extends JavaPlugin { public boolean BungeeCord = false; public boolean antibotMod = false; public boolean delayedAntiBot = true; - public ConcurrentHashMap sessions = new ConcurrentHashMap(); - public ConcurrentHashMap captcha = new ConcurrentHashMap(); - public ConcurrentHashMap cap = new ConcurrentHashMap(); - public ConcurrentHashMap realIp = new ConcurrentHashMap(); + public ConcurrentHashMap sessions = new ConcurrentHashMap<>(); + public ConcurrentHashMap captcha = new ConcurrentHashMap<>(); + public ConcurrentHashMap cap = new ConcurrentHashMap<>(); + public ConcurrentHashMap realIp = new ConcurrentHashMap<>(); protected static String vgUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; public static AuthMe getInstance() { @@ -264,22 +264,19 @@ public class AuthMe extends JavaPlugin { // Reload support hook if (Settings.reloadSupport) { - try { - int playersOnline = Utils.getOnlinePlayers().length; - if (database != null) { - if (playersOnline < 1) { - database.purgeLogged(); - } else { - for (PlayerAuth auth : database.getLoggedPlayers()) { - if (auth == null) - continue; - auth.setLastLogin(new Date().getTime()); - database.updateSession(auth); - PlayerCache.getInstance().addPlayer(auth); - } + int playersOnline = Utils.getOnlinePlayers().size(); + if (database != null) { + if (playersOnline < 1) { + database.purgeLogged(); + } else { + for (PlayerAuth auth : database.getLoggedPlayers()) { + if (auth == null) + continue; + auth.setLastLogin(new Date().getTime()); + database.updateSession(auth); + PlayerCache.getInstance().addPlayer(auth); } } - } catch (Exception ex) { } } @@ -318,7 +315,7 @@ public class AuthMe extends JavaPlugin { @Override public void onDisable() { // Save player data - Player[] players = Utils.getOnlinePlayers(); + Collection players = Utils.getOnlinePlayers(); if (players != null) { for (Player player : players) { this.savePlayer(player); @@ -361,7 +358,7 @@ public class AuthMe extends JavaPlugin { // Initialize and setup the database public void setupDatabase() throws ClassNotFoundException, PoolInitializationException, SQLException { // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI - int accounts = 0; + int accounts; switch (Settings.getDataSource) { case FILE: database = new FlatFile(); @@ -391,11 +388,7 @@ public class AuthMe extends JavaPlugin { if (Settings.getDataSource == DataSource.DataSourceType.FILE) { Converter converter = new ForceFlatToSqlite(database, this); - try { - Thread t = new Thread(converter); - t.start(); - } catch (Exception e) { - } + getServer().getScheduler().runTaskAsynchronously(this, converter); ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated, next time server starts up, it will be changed to SQLite... Conversion will be started Asynchronously, it will not drop down your performance !"); ConsoleLogger.showError("If you want to keep FlatFile, set file again into config at backend, but this message and this change will appear again at the next restart"); } @@ -431,29 +424,26 @@ public class AuthMe extends JavaPlugin { // Check the version of the ChestShop plugin public void checkChestShop() { if (Settings.legacyChestShop && server.getPluginManager().isPluginEnabled("ChestShop")) { + String rawver = com.Acrobot.ChestShop.ChestShop.getVersion(); + double version; try { - String rawver = com.Acrobot.ChestShop.ChestShop.getVersion(); - double version = 0; + version = Double.valueOf(rawver.split(" ")[0]); + } catch (NumberFormatException nfe) { try { - version = Double.valueOf(rawver.split(" ")[0]); - } catch (NumberFormatException nfe) { - try { - version = Double.valueOf(rawver.split("t")[0]); - } catch (NumberFormatException nfee) { - legacyChestShop = false; - return; - } - } - if (version >= 3.813) { + version = Double.valueOf(rawver.split("t")[0]); + } catch (NumberFormatException nfee) { + legacyChestShop = false; return; } - if (version < 3.50) { - ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); - return; - } - legacyChestShop = true; - } catch (Exception e) { } + if (version >= 3.813) { + return; + } + if (version < 3.50) { + ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); + return; + } + legacyChestShop = true; } else { legacyChestShop = false; } @@ -462,21 +452,18 @@ public class AuthMe extends JavaPlugin { // Check PerWorldInventories version public void checkPerWorldInventories() { if (server.getPluginManager().isPluginEnabled("PerWorldInventories")) { + double version = 0; + String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); try { - double version = 0; - String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); + version = Double.valueOf(ver.split(" ")[0]); + } catch (NumberFormatException nfe) { try { - version = Double.valueOf(ver.split(" ")[0]); - } catch (NumberFormatException nfe) { - try { - version = Double.valueOf(ver.split("t")[0]); - } catch (NumberFormatException nfee) { - } + version = Double.valueOf(ver.split("t")[0]); + } catch (NumberFormatException ignore) { } - if (version < 1.57) { - ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); - } - } catch (Exception e) { + } + if (version < 1.57) { + ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); } } } @@ -554,34 +541,31 @@ public class AuthMe extends JavaPlugin { if ((citizens.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) { return; } - try { - String name = player.getName().toLowerCase(); - if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead() && Settings.isSaveQuitLocationEnabled) { - final PlayerAuth auth = new PlayerAuth(player.getName().toLowerCase(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), player.getWorld().getName(), player.getName()); - database.updateQuitLoc(auth); - } - if (LimboCache.getInstance().hasLimboPlayer(name)) { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); - if (Settings.protectInventoryBeforeLogInEnabled) { - player.getInventory().setArmorContents(limbo.getArmour()); - player.getInventory().setContents(limbo.getInventory()); - } - if (!Settings.noTeleport) { - player.teleport(limbo.getLoc()); - } - this.utils.addNormal(player, limbo.getGroup()); - player.setOp(limbo.getOperator()); - limbo.getTimeoutTaskId().cancel(); - LimboCache.getInstance().deleteLimboPlayer(name); - if (this.playerBackup.doesCacheExist(player)) { - this.playerBackup.removeCache(player); - } - } - PlayerCache.getInstance().removePlayer(name); - database.setUnlogged(name); - player.saveData(); - } catch (Exception ex) { + String name = player.getName().toLowerCase(); + if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead() && Settings.isSaveQuitLocationEnabled) { + final PlayerAuth auth = new PlayerAuth(player.getName().toLowerCase(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), player.getWorld().getName(), player.getName()); + database.updateQuitLoc(auth); } + if (LimboCache.getInstance().hasLimboPlayer(name)) { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); + if (Settings.protectInventoryBeforeLogInEnabled) { + player.getInventory().setArmorContents(limbo.getArmour()); + player.getInventory().setContents(limbo.getInventory()); + } + if (!Settings.noTeleport) { + player.teleport(limbo.getLoc()); + } + this.utils.addNormal(player, limbo.getGroup()); + player.setOp(limbo.getOperator()); + limbo.getTimeoutTaskId().cancel(); + LimboCache.getInstance().deleteLimboPlayer(name); + if (this.playerBackup.doesCacheExist(player)) { + this.playerBackup.removeCache(player); + } + } + PlayerCache.getInstance().removePlayer(name); + database.setUnlogged(name); + player.saveData(); } // Select the player to kick when a vip player join the server when full @@ -686,8 +670,12 @@ public class AuthMe extends JavaPlugin { public void downloadGeoIp() { ConsoleLogger.info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, available at http://www.maxmind.com"); File file = new File(getDataFolder(), "GeoIP.dat"); - if (!file.exists()) { - try { + try { + if (file.exists()) { + if (lookupService == null) { + lookupService = new LookupService(file); + } + } else { String url = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"; URL downloadUrl = new URL(url); URLConnection conn = downloadUrl.openConnection(); @@ -706,35 +694,26 @@ public class AuthMe extends JavaPlugin { } output.close(); input.close(); - } catch (Exception e) { } + } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); } } // TODO: Need to review the code below! public String getCountryCode(String ip) { - try { - if (ls == null) - ls = new LookupService(new File(getDataFolder(), "GeoIP.dat")); - String code = ls.getCountry(ip).getCode(); - if (code != null && !code.isEmpty()) - return code; - } catch (Exception e) { + if (lookupService != null) { + return lookupService.getCountry(ip).getCode(); } - return null; + return "--"; } public String getCountryName(String ip) { - try { - if (ls == null) - ls = new LookupService(new File(getDataFolder(), "GeoIP.dat")); - String code = ls.getCountry(ip).getName(); - if (code != null && !code.isEmpty()) - return code; - } catch (Exception e) { + if (lookupService != null) { + return lookupService.getCountry(ip).getName(); } - return null; + return "N/A"; } public void switchAntiBotMod(boolean mode) { @@ -765,20 +744,17 @@ public class AuthMe extends JavaPlugin { } public String replaceAllInfos(String message, Player player) { - try { - int playersOnline = Utils.getOnlinePlayers().length; - message = message.replace("&", "\u00a7"); - message = message.replace("{PLAYER}", player.getName()); - message = message.replace("{ONLINE}", "" + playersOnline); - message = message.replace("{MAXPLAYERS}", "" + this.getServer().getMaxPlayers()); - message = message.replace("{IP}", getIP(player)); - message = message.replace("{LOGINS}", "" + PlayerCache.getInstance().getLogged()); - message = message.replace("{WORLD}", player.getWorld().getName()); - message = message.replace("{SERVER}", this.getServer().getServerName()); - message = message.replace("{VERSION}", this.getServer().getBukkitVersion()); - message = message.replace("{COUNTRY}", this.getCountryName(getIP(player))); - } catch (Exception e) { - } + int playersOnline = Utils.getOnlinePlayers().size(); + message = message.replace("&", "\u00a7"); + message = message.replace("{PLAYER}", player.getName()); + message = message.replace("{ONLINE}", "" + playersOnline); + message = message.replace("{MAXPLAYERS}", "" + this.getServer().getMaxPlayers()); + message = message.replace("{IP}", getIP(player)); + message = message.replace("{LOGINS}", "" + PlayerCache.getInstance().getLogged()); + message = message.replace("{WORLD}", player.getWorld().getName()); + message = message.replace("{SERVER}", this.getServer().getServerName()); + message = message.replace("{VERSION}", this.getServer().getBukkitVersion()); + message = message.replace("{COUNTRY}", this.getCountryName(getIP(player))); return message; } @@ -831,7 +807,7 @@ public class AuthMe extends JavaPlugin { if (inputLine != null && !inputLine.isEmpty() && !inputLine.equalsIgnoreCase("error") && !inputLine.contains("error")) { realIP = inputLine; } - } catch (Exception e) { + } catch (Exception ignored) { } return realIP; } diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 2d5b3e19..7d4e9b77 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -11,21 +11,32 @@ import org.bukkit.World; import org.bukkit.entity.Player; import java.io.File; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; public class Utils { + private static boolean getOnlinePlayersIsCollection; private String currentGroup; private static Utils singleton; + private static Method getOnlinePlayers; public final AuthMe plugin; public Utils(AuthMe plugin) { this.plugin = plugin; } + static { + try { + Method m = Bukkit.class.getDeclaredMethod("getOnlinePlayers"); + getOnlinePlayersIsCollection = m.getReturnType() == Collection.class; + } catch (Exception ignored) { + } + } + public void setGroup(Player player, groupType group) { setGroup(player.getName(), group); } @@ -182,19 +193,21 @@ public class Utils { } } - public static Player[] getOnlinePlayers() { - Player[] players; - try { - Method m = Bukkit.class.getMethod("getOnlinePlayers"); - if (m.getReturnType() == Collection.class) { - players = (Player[]) ((Collection) m.invoke(null)).toArray(); - } else { - players = ((Player[]) m.invoke(null)); - } - } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { - // can never happen - players = null; + public static Collection getOnlinePlayers() { + if (getOnlinePlayersIsCollection) { + return Bukkit.getOnlinePlayers(); } - return players; + try { + if (getOnlinePlayers == null) { + getOnlinePlayers = Bukkit.class.getMethod("getOnlinePlayers"); + } + Object obj = getOnlinePlayers.invoke(null); + if (obj instanceof Collection) { + return (Collection) obj; + } + return Arrays.asList((Player[]) obj); + } catch (Exception ignored) { + } + return Collections.emptyList(); } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 00f051c7..2e506a40 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -572,7 +572,7 @@ public class AuthMePlayerListener implements Listener { return; } - int playersOnline = Utils.getOnlinePlayers().length; + int playersOnline = Utils.getOnlinePlayers().size(); if (playersOnline > plugin.getServer().getMaxPlayers()) { event.allow(); return; From 355c04c361c15412636794f89735c0b340d9e304 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 00:19:37 +0700 Subject: [PATCH 152/427] prevent eating food --- .../authme/listener/AuthMePlayerListener.java | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 2e506a40..3f2dfc2c 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -21,21 +21,7 @@ import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; -import org.bukkit.event.player.PlayerBedEnterEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerGameModeChangeEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerKickEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.*; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; @@ -407,7 +393,7 @@ public class AuthMePlayerListener implements Listener { // Shedule login task so works after the prelogin // (Fix found by Koolaid5000) - Bukkit.getScheduler().runTask(plugin, new Runnable(){ + Bukkit.getScheduler().runTask(plugin, new Runnable() { @Override public void run() { Player player = event.getPlayer(); @@ -421,7 +407,7 @@ public class AuthMePlayerListener implements Listener { event.setJoinMessage(null); } } - }); + }); } @SuppressWarnings("deprecation") @@ -429,7 +415,7 @@ public class AuthMePlayerListener implements Listener { public void onPreLogin(AsyncPlayerPreLoginEvent event){ final String name = event.getName().toLowerCase(); final Player player = Bukkit.getServer().getPlayer(name); - + if (player == null) return; @@ -440,7 +426,7 @@ public class AuthMePlayerListener implements Listener { event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); if (LimboCache.getInstance().hasLimboPlayer(name)) Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - + @Override public void run() { LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); @@ -449,7 +435,7 @@ public class AuthMePlayerListener implements Listener { LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); } } - + }); return; } @@ -681,6 +667,35 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } + @EventHandler(priority = EventPriority.NORMAL) + public void onPlayerConsumeItem(PlayerItemConsumeEvent event) { + if (event.getPlayer() == null) + return; + + Player player = event.getPlayer(); + String name = player.getName().toLowerCase(); + + if (Utils.getInstance().isUnrestricted(player)) { + return; + } + + if (plugin.getCitizensCommunicator().isNPC(player)) { + return; + } + + if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { + return; + } + + if (!plugin.database.isAuthAvailable(name)) { + if (!Settings.isForcedRegistrationEnabled) { + return; + } + } + + event.setCancelled(true); + } + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInventoryOpen(InventoryOpenEvent event) { if (event.getPlayer() == null) From b1b441fac24d6569e291ea3446b587cea6a5a293 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 19:58:54 +0200 Subject: [PATCH 153/427] cleanup --- src/main/java/fr/xephi/authme/Utils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 7d4e9b77..d92a753c 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -193,7 +193,8 @@ public class Utils { } } - public static Collection getOnlinePlayers() { + @SuppressWarnings("unchecked") + public static Collection getOnlinePlayers() { if (getOnlinePlayersIsCollection) { return Bukkit.getOnlinePlayers(); } @@ -203,7 +204,7 @@ public class Utils { } Object obj = getOnlinePlayers.invoke(null); if (obj instanceof Collection) { - return (Collection) obj; + return (Collection) obj; } return Arrays.asList((Player[]) obj); } catch (Exception ignored) { From c0e75dbbd28de82cc123ec431d1a914965b02539 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 20:01:55 +0200 Subject: [PATCH 154/427] fix tabulation --- .../process/register/ProcessSyncronousEmailRegister.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index 96a200c2..9da83002 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -39,12 +39,12 @@ public class ProcessSyncronousEmailRegister implements Runnable { BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0 && limbo != null) { - limbo.getTimeoutTaskId().cancel(); + limbo.getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); limbo.setTimeoutTaskId(id); } if (limbo != null){ - limbo.getMessageTaskId().cancel(); + limbo.getMessageTaskId().cancel(); BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); limbo.setMessageTaskId(nwMsg); } From e11a1e9b09490b0fc1ced428d55232f69fa87976 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 13 Sep 2015 20:03:28 +0200 Subject: [PATCH 155/427] damn --- src/main/java/fr/xephi/authme/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index d92a753c..563a76f6 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -194,7 +194,7 @@ public class Utils { } @SuppressWarnings("unchecked") - public static Collection getOnlinePlayers() { + public static Collection getOnlinePlayers() { if (getOnlinePlayersIsCollection) { return Bukkit.getOnlinePlayers(); } From f60604c86c35b904da64addda6e25973321d4ac5 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 01:21:33 +0700 Subject: [PATCH 156/427] run admin register task async. --- .../xephi/authme/commands/AdminCommand.java | 105 +++++++++--------- .../process/register/AsyncronousRegister.java | 8 +- .../authme/security/PasswordSecurity.java | 10 +- .../fr/xephi/authme/settings/Messages.java | 5 +- 4 files changed, 61 insertions(+), 67 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 76269f8f..3e396150 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -1,30 +1,6 @@ package fr.xephi.authme.commands; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.security.NoSuchAlgorithmException; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - import com.zaxxer.hikari.pool.PoolInitializationException; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -39,6 +15,28 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.security.NoSuchAlgorithmException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; public class AdminCommand implements CommandExecutor { @@ -51,7 +49,7 @@ public class AdminCommand implements CommandExecutor { @Override public boolean onCommand(final CommandSender sender, Command cmnd, - String label, String[] args) { + String label, String[] args) { if (args.length == 0) { sender.sendMessage("Usage:"); sender.sendMessage("/authme reload - Reload the config"); @@ -289,13 +287,13 @@ public class AdminCommand implements CommandExecutor { }); return true; } - } else - if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) { + } else if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) { if (args.length != 3) { sender.sendMessage("Usage: /authme register "); return true; } - String lowpass = args[2].toLowerCase(); + final String name = args[1].toLowerCase(); + final 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(sender, "password_error"); return true; @@ -314,27 +312,32 @@ public class AdminCommand implements CommandExecutor { return true; } } - try { - String name = args[1].toLowerCase(); - if (plugin.database.isAuthAvailable(name)) { - m.send(sender, "user_regged"); - return true; + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + try { + if (plugin.database.isAuthAvailable(name)) { + m.send(sender, "user_regged"); + return; + } + String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name); + 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(""); + if (!plugin.database.saveAuth(auth)) { + m.send(sender, "error"); + return; + } + m.send(sender, "registered"); + ConsoleLogger.info(name + " registered"); + } catch (NoSuchAlgorithmException ex) { + ConsoleLogger.showError(ex.getMessage()); + m.send(sender, "error"); + } + } - String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name); - 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(""); - if (!plugin.database.saveAuth(auth)) { - m.send(sender, "error"); - return true; - } - m.send(sender, "registered"); - ConsoleLogger.info(args[1] + " registered"); - } catch (NoSuchAlgorithmException ex) { - ConsoleLogger.showError(ex.getMessage()); - m.send(sender, "error"); - } + }); return true; } else if (args[0].equalsIgnoreCase("getemail")) { if (args.length != 2) { @@ -443,8 +446,7 @@ 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 "); return true; @@ -555,8 +557,7 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "unregistered"); ConsoleLogger.info(args[1] + " unregistered"); return true; - } else - if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) { + } else if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) { if (args.length != 2) { sender.sendMessage("Usage: /authme purgelastpos "); return true; 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 72f14459..255c696d 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java @@ -112,7 +112,7 @@ public class AsyncronousRegister { return; } } - PlayerAuth auth = null; + PlayerAuth auth; try { final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, player.getName()); @@ -130,12 +130,11 @@ public class AsyncronousRegister { plugin.mail.main(auth, password); ProcessSyncronousEmailRegister syncronous = new ProcessSyncronousEmailRegister(player, plugin); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous); - return; } protected void passwordRegister() { - PlayerAuth auth = null; - String hash = ""; + PlayerAuth auth; + String hash; try { hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); } catch (NoSuchAlgorithmException e) { @@ -159,6 +158,5 @@ public class AsyncronousRegister { plugin.otherAccounts.addPlayer(player.getUniqueId()); ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous); - return; } } diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index 548bef12..3cc83cfc 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -18,7 +18,7 @@ import fr.xephi.authme.settings.Settings; public class PasswordSecurity { private static SecureRandom rnd = new SecureRandom(); - public static HashMap userSalt = new HashMap(); + public static HashMap userSalt = new HashMap<>(); public static String createSalt(int length) throws NoSuchAlgorithmException { @@ -37,9 +37,7 @@ public class PasswordSecurity { if (alg != HashAlgorithm.CUSTOM) method = (EncryptionMethod) alg.getclasse().newInstance(); else method = null; - } catch (InstantiationException e) { - throw new NoSuchAlgorithmException("Problem with this hash algorithm"); - } catch (IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException e) { throw new NoSuchAlgorithmException("Problem with this hash algorithm"); } String salt = ""; @@ -135,9 +133,7 @@ public class PasswordSecurity { if (algo != HashAlgorithm.CUSTOM) method = (EncryptionMethod) algo.getclasse().newInstance(); else method = null; - } catch (InstantiationException e) { - throw new NoSuchAlgorithmException("Problem with this hash algorithm"); - } catch (IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException e) { throw new NoSuchAlgorithmException("Problem with this hash algorithm"); } PasswordEncryptionEvent event = new PasswordEncryptionEvent(method, playerName); diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index 1845d739..197ddae5 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -23,14 +23,13 @@ public class Messages extends CustomConfiguration { /** * Loads a file from the plugin jar and sets as default * - * @param filename + * @param file * The filename to open */ public final void loadDefaults(File file) { if(file.isFile()){ setDefaults(YamlConfiguration.loadConfiguration(file)); } - return; } /** @@ -101,7 +100,7 @@ public class Messages extends CustomConfiguration { for (a = 0; a < i; a++) { loc[a] = ((String) this.get(msg)).split("&n")[a].replace("&", "\u00a7"); } - if (loc == null || loc.length == 0) { + if (loc.length == 0) { loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files"; } return loc; From b4124bc46dac4c632eece90d8d5fdcf6ef938dbf Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 01:42:31 +0700 Subject: [PATCH 157/427] cleanup Listeners. --- .../authme/listener/AuthMeBlockListener.java | 11 ++- .../listener/AuthMeChestShopListener.java | 10 +-- .../authme/listener/AuthMeEntityListener.java | 18 ++-- .../authme/listener/AuthMePlayerListener.java | 83 ++++++++----------- .../authme/listener/AuthMeServerListener.java | 9 +- 5 files changed, 53 insertions(+), 78 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index c6bf45ed..d6c64582 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -1,15 +1,14 @@ package fr.xephi.authme.listener; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.settings.Settings; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; public class AuthMeBlockListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java index c26f1886..bafa9c4c 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java @@ -1,17 +1,15 @@ package fr.xephi.authme.listener; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; - import com.Acrobot.ChestShop.Events.PreTransactionEvent; import com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.settings.Settings; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; public class AuthMeChestShopListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index db4bf5f6..16238133 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -1,22 +1,16 @@ package fr.xephi.authme.listener; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityInteractEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.FoodLevelChangeEvent; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.settings.Settings; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.*; public class AuthMeEntityListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 3f2dfc2c..e98de7e5 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -1,14 +1,16 @@ package fr.xephi.authme.listener; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.PatternSyntaxException; - +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +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.cache.limbo.LimboPlayer; +import fr.xephi.authme.datasource.DataSource; +import fr.xephi.authme.plugin.manager.CombatTagComunicator; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -23,26 +25,23 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.*; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -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.cache.limbo.LimboPlayer; -import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.PatternSyntaxException; public class AuthMePlayerListener implements Listener { - public static ConcurrentHashMap gameMode = new ConcurrentHashMap(); - public static ConcurrentHashMap joinMessage = new ConcurrentHashMap(); + public static ConcurrentHashMap gameMode = new ConcurrentHashMap<>(); + public static ConcurrentHashMap joinMessage = new ConcurrentHashMap<>(); private Messages m = Messages.getInstance(); public AuthMe plugin; - public static ConcurrentHashMap causeByAuthMe = new ConcurrentHashMap(); - private List antibot = new ArrayList(); + public static ConcurrentHashMap causeByAuthMe = new ConcurrentHashMap<>(); + private List antibot = new ArrayList<>(); public AuthMePlayerListener(AuthMe plugin) { this.plugin = plugin; @@ -115,7 +114,6 @@ public class AuthMePlayerListener implements Listener { if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { event.setCancelled(true); - return; } } @@ -152,7 +150,6 @@ public class AuthMePlayerListener implements Listener { if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { event.setCancelled(true); - return; } } @@ -189,7 +186,6 @@ public class AuthMePlayerListener implements Listener { if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { event.setCancelled(true); - return; } } @@ -226,7 +222,6 @@ public class AuthMePlayerListener implements Listener { if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { event.setCancelled(true); - return; } } @@ -264,7 +259,6 @@ public class AuthMePlayerListener implements Listener { if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { event.setCancelled(true); - return; } } @@ -299,7 +293,6 @@ public class AuthMePlayerListener implements Listener { if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { event.setCancelled(true); - return; } } @@ -345,7 +338,6 @@ public class AuthMePlayerListener implements Listener { } if ((spawn.distance(player.getLocation()) > radius)) { event.getPlayer().teleport(spawn); - return; } } } @@ -402,7 +394,7 @@ public class AuthMePlayerListener implements Listener { plugin.management.performJoin(player); // Remove the join message while the player isn't logging in - if ((Settings.enableProtection || Settings.delayJoinMessage) && name != null && event.getJoinMessage() != null) { + if ((Settings.enableProtection || Settings.delayJoinMessage) && event.getJoinMessage() != null) { joinMessage.put(name, event.getJoinMessage()); event.setJoinMessage(null); } @@ -412,7 +404,7 @@ public class AuthMePlayerListener implements Listener { @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST) - public void onPreLogin(AsyncPlayerPreLoginEvent event){ + public void onPreLogin(AsyncPlayerPreLoginEvent event) { final String name = event.getName().toLowerCase(); final Player player = Bukkit.getServer().getPlayer(name); @@ -437,7 +429,6 @@ public class AuthMePlayerListener implements Listener { } }); - return; } } @@ -539,14 +530,14 @@ public class AuthMePlayerListener implements Listener { if (event.getResult() == PlayerLoginEvent.Result.ALLOWED) { checkAntiBotMod(player); if (Settings.bungee) { - final ByteArrayOutputStream b = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(b); - try { + final ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); out.writeUTF("IP"); + player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray()); } catch (IOException e) { + ConsoleLogger.writeStackTrace(e); } - player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray()); } return; } @@ -561,18 +552,15 @@ public class AuthMePlayerListener implements Listener { int playersOnline = Utils.getOnlinePlayers().size(); if (playersOnline > plugin.getServer().getMaxPlayers()) { event.allow(); - return; } else { final Player pl = plugin.generateKickPlayer(plugin.getServer().getOnlinePlayers()); if (pl != null) { pl.kickPlayer(m.send("kick_forvip")[0]); event.allow(); - return; } else { ConsoleLogger.info("The player " + player.getName() + " tryed to join, but the server was full"); event.setKickMessage(m.send("kick_fullserver")[0]); event.setResult(PlayerLoginEvent.Result.KICK_FULL); - return; } } } @@ -660,7 +648,7 @@ public class AuthMePlayerListener implements Listener { return; } } - if (event.getClickedBlock() != null){ + if (event.getClickedBlock() != null) { event.setUseInteractedBlock(org.bukkit.event.Event.Result.DENY); } event.setUseItemInHand(org.bukkit.event.Event.Result.DENY); @@ -726,7 +714,6 @@ public class AuthMePlayerListener implements Listener { @Override public void run() { player.closeInventory(); - ; } }, 1); @@ -764,7 +751,7 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void playerHitPlayerEvent(EntityDamageByEntityEvent event) { Entity damager = event.getDamager(); - if (!(damager instanceof Player)){ + if (!(damager instanceof Player)) { return; } @@ -912,13 +899,11 @@ public class AuthMePlayerListener implements Listener { Location spawn = plugin.getSpawnLocation(player); if (Settings.isSaveQuitLocationEnabled && plugin.database.isAuthAvailable(name)) { final PlayerAuth auth = new PlayerAuth(name, spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getWorld().getName(), player.getName()); - try { - plugin.database.updateQuitLoc(auth); - } catch (NullPointerException npe) { - } + plugin.database.updateQuitLoc(auth); } - if (spawn != null && spawn.getWorld() != null) + if (spawn != null && spawn.getWorld() != null) { event.setRespawnLocation(spawn); + } } @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index b6d161f7..f493af63 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -1,5 +1,9 @@ package fr.xephi.authme.listener; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -7,11 +11,6 @@ import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.ServerListPingEvent; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; - public class AuthMeServerListener implements Listener { public AuthMe plugin; From a4fd60a6f653f741fe98a76aa084c6508ac00337 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 03:45:09 +0700 Subject: [PATCH 158/427] fix cache, still not add null check. --- .../authme/cache/backup/DataFileCache.java | 3 +- .../authme/commands/RegisterCommand.java | 34 +++++++------------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java b/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java index ef5ab501..6644166f 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java @@ -11,8 +11,7 @@ public class DataFileCache { private boolean flying; public DataFileCache(ItemStack[] inventory, ItemStack[] armor) { - this.inventory = inventory; - this.armor = armor; + this(inventory, armor, "", false, false); } public DataFileCache(ItemStack[] inventory, ItemStack[] armor, diff --git a/src/main/java/fr/xephi/authme/commands/RegisterCommand.java b/src/main/java/fr/xephi/authme/commands/RegisterCommand.java index 11ab0a12..68f59b94 100644 --- a/src/main/java/fr/xephi/authme/commands/RegisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/RegisterCommand.java @@ -1,15 +1,14 @@ package fr.xephi.authme.commands; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; public class RegisterCommand implements CommandExecutor { @@ -23,26 +22,23 @@ public class RegisterCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { + String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("Player Only! Use 'authme register ' instead"); return true; } - if (args.length == 0) { - m.send(sender, "usage_reg"); - } - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); + final Player player = (Player) sender; + if (args.length == 0 || (Settings.getEnablePasswordVerifier && args.length < 2)) { + m.send(player, "usage_reg"); + return true; + } + if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) { + m.send(player, "no_perm"); return true; } - final Player player = (Player) sender; if (Settings.emailRegistration && !Settings.getmailAccount.isEmpty()) { if (Settings.doubleEmailCheck) { - if (args.length < 2) { - m.send(player, "usage_reg"); - return true; - } - if (!args[0].equals(args[1])) { + if (args.length < 2 || !args[0].equals(args[1])) { m.send(player, "usage_reg"); return true; } @@ -57,10 +53,6 @@ public class RegisterCommand implements CommandExecutor { plugin.management.performRegister(player, thePass, email); return true; } - if (args.length == 0 || (Settings.getEnablePasswordVerifier && args.length < 2)) { - m.send(player, "usage_reg"); - return true; - } if (args.length > 1 && Settings.getEnablePasswordVerifier) if (!args[0].equals(args[1])) { m.send(player, "password_error"); From 2fe9e735a1fb5658e4cdf9d241946fa71a36871e Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 04:21:38 +0700 Subject: [PATCH 159/427] init playerBackup field on enable. --- src/main/java/fr/xephi/authme/AuthMe.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 0c9c5749..161925a7 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -65,7 +65,7 @@ public class AuthMe extends JavaPlugin { public DataManager dataManager; public DataSource database; - private JsonCache playerBackup = new JsonCache(this); + private JsonCache playerBackup; public OtherAccounts otherAccounts; public Permission permission; public Essentials ess; @@ -239,6 +239,9 @@ public class AuthMe extends JavaPlugin { return; } + // Setup the inventory backup + playerBackup = new JsonCache(this); + // Set the DataManager dataManager = new DataManager(this); From 9736e4c2075f370a28ac3d3a46a34aa767f96c2d Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 04:32:12 +0700 Subject: [PATCH 160/427] init instance at the top, to avoid problems. --- src/main/java/fr/xephi/authme/AuthMe.java | 11 +++++------ .../java/fr/xephi/authme/cache/backup/JsonCache.java | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 161925a7..8c5732e3 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -53,9 +53,9 @@ import java.util.zip.GZIPInputStream; public class AuthMe extends JavaPlugin { - public static Server server; - public static Logger authmeLogger = Logger.getLogger("AuthMe"); - public static AuthMe authme; + private static Server server; + private static Logger authmeLogger = Logger.getLogger("AuthMe"); + private static AuthMe authme; public Management management; public NewAPI api; private Utils utils = Utils.getInstance(); @@ -115,6 +115,8 @@ public class AuthMe extends JavaPlugin { @Override public void onEnable() { + // Set the Instance + authme = this; // TODO: split the plugin in more modules // TODO: remove vault as hard dependency @@ -125,9 +127,6 @@ public class AuthMe extends JavaPlugin { // Setup the Logger authmeLogger.setParent(this.getLogger()); - // Set the Instance - authme = this; - // Setup otherAccounts file otherAccounts = OtherAccounts.getInstance(); diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 25db2afb..1a952c93 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -28,7 +28,7 @@ public class JsonCache { public JsonCache(AuthMe plugin) { this.plugin = plugin; - cacheDir = new File(plugin.getDataFolder() + File.separator + "cache"); + cacheDir = new File(plugin.getDataFolder(), "cache"); if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { ConsoleLogger.showError("Failed to create cache directory."); } From 670caaea4bb2dd3a88f71947fe57d119ca820263 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 08:23:02 +0700 Subject: [PATCH 161/427] fix resource extracting. --- .../authme/settings/CustomConfiguration.java | 54 +++++++++---------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java index 7d02487f..5123ef58 100644 --- a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java +++ b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java @@ -1,21 +1,15 @@ package fr.xephi.authme.settings; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.StandardCharsets; - +import com.google.common.io.Files; +import com.google.common.io.Resources; +import fr.xephi.authme.ConsoleLogger; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; -import fr.xephi.authme.ConsoleLogger; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URL; public class CustomConfiguration extends YamlConfiguration { @@ -43,7 +37,7 @@ public class CustomConfiguration extends YamlConfiguration { public boolean reLoad() { boolean out = true; if (!configFile.exists()) { - out = loadRessource(configFile); + out = loadResource(configFile); } if (out) load(); @@ -58,28 +52,28 @@ public class CustomConfiguration extends YamlConfiguration { } } - public boolean loadRessource(File file) { - boolean out = true; + public boolean loadResource(File file) { if (!file.exists()) { try { - String charset = System.getProperty("file.encoding"); - String newline = System.getProperty("line.separator"); - InputStream fis = getClass().getResourceAsStream("/" + file.getName()); - BufferedReader reader = new BufferedReader(new InputStreamReader(fis, StandardCharsets.UTF_8)); - String str; - Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)); - while ((str = reader.readLine()) != null) { - writer.append(str).append(newline); + if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { + return false; + } + if (!file.exists() && !file.createNewFile()) { + return false; + } + int i = file.getPath().indexOf("AuthMe"); + if (i > -1) { + String path = file.getPath().substring(i + 6).replace('\\', '/'); + URL url = Resources.getResource(getClass(), path); + byte[] bytes = Resources.toByteArray(url); + Files.write(bytes, file); + return true; } - writer.flush(); - writer.close(); - reader.close(); - fis.close(); } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); ConsoleLogger.showError("Failed to load config from JAR"); - out = false; } } - return out; + return false; } } From 981da0a0f3dc30c65309c42c65a7b2ee40682736 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 09:26:52 +0700 Subject: [PATCH 162/427] extract language if available. --- src/main/java/fr/xephi/authme/AuthMe.java | 7 +- .../xephi/authme/commands/AdminCommand.java | 29 +------- .../fr/xephi/authme/datasource/FlatFile.java | 27 +++----- .../authme/settings/CustomConfiguration.java | 4 ++ .../fr/xephi/authme/settings/Messages.java | 26 +++---- .../fr/xephi/authme/settings/Settings.java | 68 ++++++++----------- 6 files changed, 59 insertions(+), 102 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 8c5732e3..0bd83cb6 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -127,9 +127,6 @@ public class AuthMe extends JavaPlugin { // Setup the Logger authmeLogger.setParent(this.getLogger()); - // Setup otherAccounts file - otherAccounts = OtherAccounts.getInstance(); - // Load settings and custom configurations // TODO: new configuration style (more files) try { @@ -139,6 +136,10 @@ public class AuthMe extends JavaPlugin { this.getServer().shutdown(); return; } + + // Setup otherAccounts file + otherAccounts = OtherAccounts.getInstance(); + // Configuration Security Warnings if (!Settings.isForceSingleSessionEnabled) { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 3e396150..5862b826 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -114,34 +114,7 @@ public class AdminCommand implements CommandExecutor { return true; } } else if (args[0].equalsIgnoreCase("reload")) { - File newConfigFile = new File("plugins" + File.separator + "AuthMe", "config.yml"); - if (!newConfigFile.exists()) { - InputStream fis = getClass().getResourceAsStream("" + File.separator + "config.yml"); - FileOutputStream fos = null; - try { - fos = new FileOutputStream(newConfigFile); - byte[] buf = new byte[1024]; - int i = 0; - - while ((i = fis.read(buf)) != -1) { - fos.write(buf, 0, i); - } - } catch (Exception e) { - ConsoleLogger.showError("Failed to load config from JAR"); - } finally { - try { - if (fis != null) { - fis.close(); - } - if (fos != null) { - fos.close(); - } - } catch (Exception e) { - } - } - } - YamlConfiguration newConfig = YamlConfiguration.loadConfiguration(newConfigFile); - Settings.reloadConfigOptions(newConfig); + plugin.getSettings().reload(); m.reloadMessages(); plugin.database.close(); diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 2b54e4df..22fee78c 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -1,21 +1,15 @@ package fr.xephi.authme.datasource; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -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.Settings; +import java.io.*; +import java.util.ArrayList; +import java.util.List; + public class FlatFile implements DataSource { /* @@ -32,7 +26,7 @@ public class FlatFile implements DataSource { private File source; public FlatFile() { - source = new File(Settings.AUTH_FILE); + source = Settings.AUTH_FILE; try { source.createNewFile(); } catch (IOException e) { @@ -41,9 +35,10 @@ public class FlatFile implements DataSource { ConsoleLogger.showError("Can't use FLAT FILE... SHUTDOWN..."); AuthMe.getInstance().getServer().shutdown(); } - if (!Settings.isStopEnabled) + if (!Settings.isStopEnabled) { AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; + } + e.printStackTrace(); } } @@ -108,7 +103,7 @@ public class FlatFile implements DataSource { BufferedReader br = null; try { br = new BufferedReader(new FileReader(source)); - String line = ""; + String line; while ((line = br.readLine()) != null) { String[] args = line.split(":"); if (args[0].equals(auth.getNickname())) { @@ -167,7 +162,7 @@ public class FlatFile implements DataSource { BufferedReader br = null; try { br = new BufferedReader(new FileReader(source)); - String line = ""; + String line; while ((line = br.readLine()) != null) { String[] args = line.split(":"); if (args[0].equalsIgnoreCase(auth.getNickname())) { @@ -226,7 +221,7 @@ public class FlatFile implements DataSource { BufferedReader br = null; try { br = new BufferedReader(new FileReader(source)); - String line = ""; + String line; while ((line = br.readLine()) != null) { String[] args = line.split(":"); if (args[0].equalsIgnoreCase(auth.getNickname())) { diff --git a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java index 5123ef58..88de17d7 100644 --- a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java +++ b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java @@ -52,6 +52,10 @@ public class CustomConfiguration extends YamlConfiguration { } } + public File getConfigFile() { + return configFile; + } + public boolean loadResource(File file) { if (!file.exists()) { try { diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index 197ddae5..7f3f04c3 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -1,10 +1,10 @@ package fr.xephi.authme.settings; -import java.io.File; +import fr.xephi.authme.ConsoleLogger; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; -import fr.xephi.authme.ConsoleLogger; +import java.io.File; public class Messages extends CustomConfiguration { @@ -23,11 +23,10 @@ public class Messages extends CustomConfiguration { /** * Loads a file from the plugin jar and sets as default * - * @param file - * The filename to open + * @param file The filename to open */ public final void loadDefaults(File file) { - if(file.isFile()){ + if (file.isFile()) { setDefaults(YamlConfiguration.loadConfiguration(file)); } } @@ -48,7 +47,7 @@ public class Messages extends CustomConfiguration { /** * Saves current configuration (plus defaults) to disk. - * + *

    * If defaults and configuration are empty, saves blank file. * * @return True if saved successfully @@ -73,7 +72,7 @@ public class Messages extends CustomConfiguration { String loc = (String) singleton.get(msg); if (loc == null) { loc = "Error with Translation files, please contact the admin for verify or update translation"; - ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml !"); + ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + getConfigFile() + " !"); } for (String l : loc.split("&n")) { sender.sendMessage(l.replace("&", "\u00a7")); @@ -81,15 +80,12 @@ public class Messages extends CustomConfiguration { } public String[] send(String msg) { - if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) + if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) { singleton.reloadMessages(); - String s = null; - try { - s = (String) singleton.get(msg); - } catch (Exception e) { } + String s = (String) singleton.get(msg); if (s == null) { - ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml !"); + ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + getConfigFile() + " !"); String[] loc = new String[1]; loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files"; return (loc); @@ -108,13 +104,13 @@ public class Messages extends CustomConfiguration { public static Messages getInstance() { if (singleton == null) { - singleton = new Messages(new File(Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); + singleton = new Messages(new File(Settings.MESSAGE_DIR, "messages_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); } return singleton; } public void reloadMessages() { - singleton = new Messages(new File(Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); + singleton = new Messages(new File(Settings.MESSAGE_DIR, "messages_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); } } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index cd915903..e7d34b99 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -1,35 +1,28 @@ package fr.xephi.authme.settings; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.bukkit.configuration.MemoryConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource.DataSourceType; import fr.xephi.authme.security.HashAlgorithm; +import org.bukkit.configuration.MemoryConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; public final class Settings extends YamlConfiguration { // This is not an option! public static Boolean antiBotInAction = false; - public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe"; - public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache"; - public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db"; - public static final String MESSAGE_FILE = Settings.PLUGIN_FOLDER + File.separator + "messages" + File.separator + "messages"; - public static final String SETTINGS_FILE = Settings.PLUGIN_FOLDER + File.separator + "config.yml"; + public static final File PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); + public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); + public static final File AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db"); + public static final File MESSAGE_DIR = new File(PLUGIN_FOLDER, "messages"); + public static final File SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml"); public static List allowCommands = null; public static List getJoinPermissions = null; public static List getUnrestrictedName = null; @@ -43,7 +36,6 @@ public final class Settings extends YamlConfiguration { public static List forceRegisterCommands = null; public static List forceRegisterCommandsAsConsole = null; private AuthMe plugin; - private final File file; public static DataSourceType getDataSource; public static HashAlgorithm getPasswordHash; public static Boolean useLogging = false; @@ -100,7 +92,7 @@ public final class Settings extends YamlConfiguration { protected static YamlConfiguration configFile; public Settings(AuthMe plugin) { - this.file = new File(plugin.getDataFolder(), "config.yml"); + configFile = (YamlConfiguration) plugin.getConfig(); this.plugin = plugin; boolean exist = exists(); if (exist) { @@ -109,8 +101,6 @@ public final class Settings extends YamlConfiguration { plugin.saveDefaultConfig(); load(); } - configFile = (YamlConfiguration) plugin.getConfig(); - PLUGIN_FOLDER = plugin.getDataFolder().toString(); loadConfigOptions(exist); } @@ -519,14 +509,10 @@ public final class Settings extends YamlConfiguration { ; } } - if (namefound == false) { + if (!namefound) { return true; } else { - if (trueonce == true) { - return true; - } else { - return false; - } + return trueonce; } } @@ -537,7 +523,7 @@ public final class Settings extends YamlConfiguration { */ public final boolean load() { try { - load(file); + load(SETTINGS_FILE); return true; } catch (Exception ex) { return false; @@ -545,8 +531,9 @@ public final class Settings extends YamlConfiguration { } public final void reload() { - if (!exists()) + if (!exists()) { plugin.saveDefaultConfig(); + } load(); } @@ -557,7 +544,7 @@ public final class Settings extends YamlConfiguration { */ public final boolean save() { try { - save(file); + save(SETTINGS_FILE); return true; } catch (Exception ex) { return false; @@ -570,12 +557,12 @@ public final class Settings extends YamlConfiguration { * @return True if configuration exists on disk */ public final boolean exists() { - return file.exists(); + return SETTINGS_FILE.exists(); } /** * Saves current configuration (plus defaults) to disk. - * + *

    * If defaults and configuration are empty, saves blank file. * * @return True if saved successfully @@ -602,14 +589,15 @@ public final class Settings extends YamlConfiguration { * @return false When all defaults aren't present in config */ public boolean checkDefaults() { - if (getDefaults() == null) { - return true; - } - return getKeys(true).containsAll(getDefaults().getKeys(true)); + return getDefaults() == null || getKeys(true).containsAll(getDefaults().getKeys(true)); } public static String checkLang(String lang) { - if (new File(MESSAGE_FILE + "_" + lang + ".yml").exists()) { + if (new File(MESSAGE_DIR, "messages_" + lang + ".yml").exists()) { + ConsoleLogger.info("Set Language to: " + lang); + return lang; + } + if (AuthMe.class.getResourceAsStream("/messages/messages_" + lang + ".yml") != null) { ConsoleLogger.info("Set Language to: " + lang); return lang; } @@ -629,7 +617,7 @@ public final class Settings extends YamlConfiguration { private static void getWelcomeMessage() { AuthMe plugin = AuthMe.getInstance(); - welcomeMsg = new ArrayList(); + welcomeMsg = new ArrayList<>(); if (!useWelcomeMessage) { return; } From 550cffcc421f76802273a476b2a3be2119541dde Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 14 Sep 2015 12:34:52 +0200 Subject: [PATCH 163/427] cleanup --- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 5862b826..3b4cee25 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -21,16 +21,12 @@ import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; import java.security.NoSuchAlgorithmException; import java.sql.SQLException; import java.util.ArrayList; From 9cb6dce6133ab79eeb4ed22751f22c6934b6ec90 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 14 Sep 2015 13:40:57 +0200 Subject: [PATCH 164/427] pom enhancements --- pom.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index b34222f3..7b5562aa 100644 --- a/pom.xml +++ b/pom.xml @@ -177,12 +177,6 @@ http://repo.mcstats.org/content/repositories/snapshots/ - - - hikaricp-log4j-releases - http://nexus-sgdc3.rhcloud.com/nexus/content/repositories/hikaricp-log4j-releases/ - - @@ -195,12 +189,12 @@ HikariCP 2.4.1 compile - - - org.slf4j - slf4j-api - 1.7.12 - compile + + + slf4j-api + org.slf4j + + org.slf4j @@ -229,6 +223,12 @@ javax.mail 1.5.4 compile + + + activation + javax.activation + + From 0768642e85f788a38fe47142f90cddf70af9e3d5 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 18:58:37 +0700 Subject: [PATCH 165/427] cleanup Settings --- .../xephi/authme/cache/backup/JsonCache.java | 3 +- .../xephi/authme/commands/AdminCommand.java | 4 - .../fr/xephi/authme/settings/Messages.java | 4 +- .../fr/xephi/authme/settings/Settings.java | 139 ++++++++---------- 4 files changed, 63 insertions(+), 87 deletions(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 1a952c93..720780c6 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -5,6 +5,7 @@ import com.google.gson.*; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; +import fr.xephi.authme.settings.Settings; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -28,7 +29,7 @@ public class JsonCache { public JsonCache(AuthMe plugin) { this.plugin = plugin; - cacheDir = new File(plugin.getDataFolder(), "cache"); + cacheDir = Settings.CACHE_FOLDER; if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { ConsoleLogger.showError("Failed to create cache directory."); } diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 3b4cee25..6852564d 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -517,11 +517,7 @@ public class AdminCommand implements CommandExecutor { if (Settings.applyBlindEffect) target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); m.send(target, "unregistered"); - } else { - // Player isn't online, do nothing else } - } else { - // Player does not exist, do nothing else } m.send(sender, "unregistered"); ConsoleLogger.info(args[1] + " unregistered"); diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index 7f3f04c3..4ddb9519 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -104,13 +104,13 @@ public class Messages extends CustomConfiguration { public static Messages getInstance() { if (singleton == null) { - singleton = new Messages(new File(Settings.MESSAGE_DIR, "messages_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); + singleton = new Messages(Settings.messageFile, Settings.messagesLanguage); } return singleton; } public void reloadMessages() { - singleton = new Messages(new File(Settings.MESSAGE_DIR, "messages_" + Settings.messagesLanguage + ".yml"), Settings.messagesLanguage); + singleton = new Messages(Settings.messageFile, Settings.messagesLanguage); } } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index e7d34b99..5b1a6b98 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -5,7 +5,6 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource.DataSourceType; import fr.xephi.authme.security.HashAlgorithm; -import org.bukkit.configuration.MemoryConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import java.io.*; @@ -15,14 +14,16 @@ import java.util.List; public final class Settings extends YamlConfiguration { + private AuthMe plugin; + // This is not an option! public static Boolean antiBotInAction = false; - public static final File PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); - public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); - public static final File AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db"); - public static final File MESSAGE_DIR = new File(PLUGIN_FOLDER, "messages"); - public static final File SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml"); + public static final File PLUGIN_FOLDER; + public static final File CACHE_FOLDER; + public static final File AUTH_FILE; + public static final File SETTINGS_FILE; + public static File messageFile; public static List allowCommands = null; public static List getJoinPermissions = null; public static List getUnrestrictedName = null; @@ -35,7 +36,6 @@ public final class Settings extends YamlConfiguration { public static List forceCommandsAsConsole = null; public static List forceRegisterCommands = null; public static List forceRegisterCommandsAsConsole = null; - private AuthMe plugin; public static DataSourceType getDataSource; public static HashAlgorithm getPasswordHash; public static Boolean useLogging = false; @@ -71,7 +71,7 @@ public final class Settings extends YamlConfiguration { getMySQLTablename, getMySQLColumnName, getMySQLColumnPassword, getMySQLColumnIp, getMySQLColumnLastLogin, getMySQLColumnSalt, getMySQLColumnGroup, getMySQLColumnEmail, unRegisteredGroup, - backupWindowsPath, getcUnrestrictedName, getRegisteredGroup, + backupWindowsPath, getRegisteredGroup, messagesLanguage, getMySQLlastlocX, getMySQLlastlocY, getMySQLlastlocZ, rakamakUsers, rakamakUsersIp, getmailAccount, getmailPassword, getmailSMTP, getMySQLColumnId, getmailSenderName, @@ -91,17 +91,23 @@ public final class Settings extends YamlConfiguration { protected static YamlConfiguration configFile; + static { + PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); + CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); + AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db"); + SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml"); + } + public Settings(AuthMe plugin) { configFile = (YamlConfiguration) plugin.getConfig(); this.plugin = plugin; boolean exist = exists(); - if (exist) { - load(); - } else { + if (!exist) { plugin.saveDefaultConfig(); - load(); } + load(); loadConfigOptions(exist); + messageFile = new File(PLUGIN_FOLDER, "messages" + File.separator + "messages_" + messagesLanguage + ".yml"); } public void loadConfigOptions(boolean exist) { @@ -277,133 +283,127 @@ public final class Settings extends YamlConfiguration { } - public static void reloadConfigOptions(YamlConfiguration newConfig) { - configFile = newConfig; - - loadVariables(); - } - public void mergeConfig() { - boolean changes = false; + int changes = 0; if (contains("Xenoforo.predefinedSalt")) set("Xenoforo.predefinedSalt", null); if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") || configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) set("settings.security.passwordHash", "XENFORO"); if (!contains("Protection.enableProtection")) { set("Protection.enableProtection", false); - changes = true; + changes++; } if (!contains("Protection.countries")) { - countries = new ArrayList(); + countries = new ArrayList<>(); countries.add("US"); countries.add("GB"); set("Protection.countries", countries); - changes = true; + changes++; } if (!contains("Protection.enableAntiBot")) { set("Protection.enableAntiBot", false); - changes = true; + changes++; } if (!contains("Protection.antiBotSensibility")) { set("Protection.antiBotSensibility", 5); - changes = true; + changes++; } if (!contains("Protection.antiBotDuration")) { set("Protection.antiBotDuration", 10); - changes = true; + changes++; } if (!contains("settings.forceCommands")) { set("settings.forceCommands", new ArrayList()); - changes = true; + changes++; } if (!contains("settings.forceCommandsAsConsole")) { set("settings.forceCommandsAsConsole", new ArrayList()); - changes = true; + changes++; } if (!contains("Email.recallPlayers")) { set("Email.recallPlayers", false); - changes = true; + changes++; } if (!contains("Email.delayRecall")) { set("Email.delayRecall", 5); - changes = true; + changes++; } if (!contains("settings.useWelcomeMessage")) { set("settings.useWelcomeMessage", true); - changes = true; + changes++; } if (!contains("settings.security.unsafePasswords")) { - List str = new ArrayList(); + List str = new ArrayList<>(); str.add("123456"); str.add("password"); set("settings.security.unsafePasswords", str); - changes = true; + changes++; } if (!contains("Protection.countriesBlacklist")) { - countriesBlacklist = new ArrayList(); + countriesBlacklist = new ArrayList<>(); countriesBlacklist.add("A1"); set("Protection.countriesBlacklist", countriesBlacklist); - changes = true; + changes++; } if (!contains("settings.broadcastWelcomeMessage")) { set("settings.broadcastWelcomeMessage", false); - changes = true; + changes++; } if (!contains("settings.registration.forceKickAfterRegister")) { set("settings.registration.forceKickAfterRegister", false); - changes = true; + changes++; } if (!contains("settings.registration.forceLoginAfterRegister")) { set("settings.registration.forceLoginAfterRegister", false); - changes = true; + changes++; } if (!contains("DataSource.mySQLColumnLogged")) { set("DataSource.mySQLColumnLogged", "isLogged"); - changes = true; + changes++; } if (!contains("settings.restrictions.spawnPriority")) { set("settings.restrictions.spawnPriority", "authme,essentials,multiverse,default"); - changes = true; + changes++; } if (!contains("settings.restrictions.maxLoginPerIp")) { set("settings.restrictions.maxLoginPerIp", 0); - changes = true; + changes++; } if (!contains("settings.restrictions.maxJoinPerIp")) { set("settings.restrictions.maxJoinPerIp", 0); - changes = true; + changes++; } if (!contains("VeryGames.enableIpCheck")) { set("VeryGames.enableIpCheck", false); - changes = true; + changes++; } if (getString("settings.restrictions.allowedNicknameCharacters").equals("[a-zA-Z0-9_?]*")) set("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_]*"); if (!contains("settings.delayJoinMessage")) { set("settings.delayJoinMessage", false); - changes = true; + changes++; } if (!contains("settings.restrictions.noTeleport")) { set("settings.restrictions.noTeleport", false); - changes = true; + changes++; } if (contains("Converter.Rakamak.newPasswordHash")) set("Converter.Rakamak.newPasswordHash", null); if (!contains("Converter.CrazyLogin.fileName")) { set("Converter.CrazyLogin.fileName", "accounts.db"); - changes = true; + changes++; } if (!contains("settings.restrictions.allowedPasswordCharacters")) { set("settings.restrictions.allowedPasswordCharacters", "[\\x21-\\x7E]*"); - changes = true; + changes++; } if (!contains("settings.applyBlindEffect")) { set("settings.applyBlindEffect", false); - changes = true; + changes++; } if (!contains("Email.emailBlacklisted")) { set("Email.emailBlacklisted", new ArrayList()); - changes = true; + changes++; } if (contains("Performances.useMultiThreading")) set("Performances.useMultiThreading", null); @@ -419,23 +419,23 @@ public final class Settings extends YamlConfiguration { if (!contains("Email.emailWhitelisted")) { set("Email.emailWhitelisted", new ArrayList()); - changes = true; + changes++; } if (!contains("settings.forceRegisterCommands")) { set("settings.forceRegisterCommands", new ArrayList()); - changes = true; + changes++; } if (!contains("settings.forceRegisterCommandsAsConsole")) { set("settings.forceRegisterCommandsAsConsole", new ArrayList()); - changes = true; + changes++; } if (!contains("Hooks.customAttributes")) { set("Hooks.customAttributes", false); - changes = true; + changes++; } if (!contains("Purge.removePermissions")) { set("Purge.removePermissions", false); - changes = true; + changes++; } if (contains("Hooks.notifications")) set("Hooks.notifications", null); @@ -447,19 +447,17 @@ public final class Settings extends YamlConfiguration { set("Hooks.legacyChestshop", useChestShop); if (!contains("Email.generateImage")) { set("Email.generateImage", true); - changes = true; + changes++; } if (!contains("DataSource.mySQLRealName")) { set("DataSource.mySQLRealName", "realname"); - changes = true; + changes++; } - if (changes) { - plugin.getLogger().warning("Merge new Config Options - I'm not an error, please don't report me"); + if (changes > 0) { + plugin.getLogger().warning("Merge " + changes + " new Config Options - I'm not an error, please don't report me"); plugin.getLogger().warning("Please check your config.yml file for new configs!"); } - - return; } public void setValue(String key, Object value) { @@ -506,7 +504,6 @@ public final class Settings extends YamlConfiguration { if (testip.equalsIgnoreCase(ip)) { trueonce = true; } - ; } } if (!namefound) { @@ -576,24 +573,8 @@ public final class Settings extends YamlConfiguration { return success; } - /** - * Clears current configuration defaults - */ - public final void clearDefaults() { - setDefaults(new MemoryConfiguration()); - } - - /** - * Check loaded defaults against current configuration - * - * @return false When all defaults aren't present in config - */ - public boolean checkDefaults() { - return getDefaults() == null || getKeys(true).containsAll(getDefaults().getKeys(true)); - } - public static String checkLang(String lang) { - if (new File(MESSAGE_DIR, "messages_" + lang + ".yml").exists()) { + if (new File(PLUGIN_FOLDER, "messages" + File.separator + "messages_" + lang + ".yml").exists()) { ConsoleLogger.info("Set Language to: " + lang); return lang; } @@ -636,13 +617,11 @@ public final class Settings extends YamlConfiguration { try { FileReader fr = new FileReader(plugin.getDataFolder() + File.separator + "welcome.txt"); BufferedReader br = new BufferedReader(fr); - String line = ""; + String line; while ((line = br.readLine()) != null) { welcomeMsg.add(line); } br.close(); - } catch (FileNotFoundException e) { - e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } From 7c56dec47686ae263e5c3c62e15f976a7eda9063 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 19:50:32 +0700 Subject: [PATCH 166/427] change all usage of getOnlinePlayers --- src/main/java/fr/xephi/authme/AuthMe.java | 6 +++--- src/main/java/fr/xephi/authme/DataManager.java | 2 +- .../fr/xephi/authme/cache/backup/JsonCache.java | 4 ++-- .../xephi/authme/datasource/CacheDataSource.java | 3 ++- .../authme/listener/AuthMePlayerListener.java | 2 +- .../authme/process/login/AsyncronousLogin.java | 3 ++- .../login/ProcessSyncronousPlayerLogin.java | 2 +- .../xephi/authme/settings/CustomConfiguration.java | 14 +++++--------- .../java/fr/xephi/authme/task/MessageTask.java | 10 +++++----- 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 0bd83cb6..321d83de 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -731,7 +731,7 @@ public class AuthMe extends JavaPlugin { @Override public void run() { - for (Player player : Bukkit.getOnlinePlayers()) { + for (Player player : Utils.getOnlinePlayers()) { if (player.isOnline()) { String name = player.getName().toLowerCase(); if (database.isAuthAvailable(name)) @@ -776,7 +776,7 @@ public class AuthMe extends JavaPlugin { public boolean isLoggedIp(String name, String ip) { int count = 0; - for (Player player : this.getServer().getOnlinePlayers()) { + for (Player player : Utils.getOnlinePlayers()) { if (ip.equalsIgnoreCase(getIP(player)) && database.isLogged(player.getName().toLowerCase()) && !player.getName().equalsIgnoreCase(name)) count++; } @@ -785,7 +785,7 @@ public class AuthMe extends JavaPlugin { public boolean hasJoinedIp(String name, String ip) { int count = 0; - for (Player player : this.getServer().getOnlinePlayers()) { + for (Player player : Utils.getOnlinePlayers()) { if (ip.equalsIgnoreCase(getIP(player)) && !player.getName().equalsIgnoreCase(name)) count++; } diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 472a29e8..23aaedc1 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -174,7 +174,7 @@ public class DataManager { public synchronized Boolean call() throws Exception { Boolean result = null; try { - for (OfflinePlayer op : Bukkit.getOnlinePlayers()) + for (OfflinePlayer op : Utils.getOnlinePlayers()) if (op.getName().equalsIgnoreCase(name)) { result = true; break; diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 720780c6..dce5a672 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -62,7 +62,7 @@ public class JsonCache { try { String data = gson.toJson(playerData); - Files.write(Paths.get(file.getPath()), data.getBytes()); + Files.write(file.toPath(), data.getBytes()); } catch (IOException e) { e.printStackTrace(); } @@ -78,7 +78,7 @@ public class JsonCache { File file = new File(cacheDir, path + File.separator + "cache.json"); try { - byte[] bytes = Files.readAllBytes(Paths.get(file.getPath())); + byte[] bytes = Files.readAllBytes(file.toPath()); String str = new String(bytes); return gson.fromJson(str, DataFileCache.class); } catch (Exception e) { diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 3d1aa5cc..5ac61715 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -3,6 +3,7 @@ package fr.xephi.authme.datasource; import java.util.List; import java.util.concurrent.ConcurrentHashMap; +import fr.xephi.authme.Utils; import org.bukkit.entity.Player; import fr.xephi.authme.AuthMe; @@ -140,7 +141,7 @@ public class CacheDataSource implements DataSource { public void reload() { cache.clear(); source.reload(); - for (Player player : plugin.getServer().getOnlinePlayers()) { + for (Player player : Utils.getOnlinePlayers()) { String user = player.getName().toLowerCase(); if (PlayerCache.getInstance().isAuthenticated(user)) { try { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index e98de7e5..349112fb 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -553,7 +553,7 @@ public class AuthMePlayerListener implements Listener { if (playersOnline > plugin.getServer().getMaxPlayers()) { event.allow(); } else { - final Player pl = plugin.generateKickPlayer(plugin.getServer().getOnlinePlayers()); + final Player pl = plugin.generateKickPlayer(Utils.getOnlinePlayers()); if (pl != null) { pl.kickPlayer(m.send("kick_forvip")[0]); event.allow(); diff --git a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java index 302203b7..bfc7569e 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java @@ -3,6 +3,7 @@ package fr.xephi.authme.process.login; import java.util.Date; import java.util.List; +import fr.xephi.authme.Utils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; @@ -239,7 +240,7 @@ public class AsyncronousLogin { * uuidaccounts = uuidaccounts + ", "; } else { uuidaccounts = * uuidaccounts + "."; } } */ - for (Player player : plugin.getServer().getOnlinePlayers()) { + for (Player player : Utils.getOnlinePlayers()) { if (plugin.authmePermissible(player, "authme.seeOtherAccounts")) { player.sendMessage("[AuthMe] The player " + auth.getNickname() + " has " + auths.size() + " accounts"); player.sendMessage(message); diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index acb1f832..b9d29411 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -177,7 +177,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { // We can now display the join message if (AuthMePlayerListener.joinMessage.containsKey(name) && AuthMePlayerListener.joinMessage.get(name) != null && !AuthMePlayerListener.joinMessage.get(name).isEmpty()) { - for (Player p : Bukkit.getServer().getOnlinePlayers()) { + for (Player p : Utils.getOnlinePlayers()) { if (p.isOnline()) p.sendMessage(AuthMePlayerListener.joinMessage.get(name)); } diff --git a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java index 88de17d7..abf63700 100644 --- a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java +++ b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java @@ -1,7 +1,5 @@ package fr.xephi.authme.settings; -import com.google.common.io.Files; -import com.google.common.io.Resources; import fr.xephi.authme.ConsoleLogger; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; @@ -9,7 +7,9 @@ import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.net.URL; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; public class CustomConfiguration extends YamlConfiguration { @@ -62,15 +62,11 @@ public class CustomConfiguration extends YamlConfiguration { if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { return false; } - if (!file.exists() && !file.createNewFile()) { - return false; - } int i = file.getPath().indexOf("AuthMe"); if (i > -1) { String path = file.getPath().substring(i + 6).replace('\\', '/'); - URL url = Resources.getResource(getClass(), path); - byte[] bytes = Resources.toByteArray(url); - Files.write(bytes, file); + InputStream is = getClass().getResourceAsStream(path); + Files.copy(is, file.toPath(), StandardCopyOption.REPLACE_EXISTING); return true; } } catch (Exception e) { diff --git a/src/main/java/fr/xephi/authme/task/MessageTask.java b/src/main/java/fr/xephi/authme/task/MessageTask.java index 94d20347..e4ac9e3a 100644 --- a/src/main/java/fr/xephi/authme/task/MessageTask.java +++ b/src/main/java/fr/xephi/authme/task/MessageTask.java @@ -1,11 +1,11 @@ package fr.xephi.authme.task; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitTask; public class MessageTask implements Runnable { @@ -15,7 +15,7 @@ public class MessageTask implements Runnable { private int interval; public MessageTask(AuthMe plugin, String name, String[] strings, - int interval) { + int interval) { this.plugin = plugin; this.name = name; this.msg = strings; @@ -27,7 +27,7 @@ public class MessageTask implements Runnable { if (PlayerCache.getInstance().isAuthenticated(name)) return; - for (Player player : plugin.getServer().getOnlinePlayers()) { + for (Player player : Utils.getOnlinePlayers()) { if (player.getName().toLowerCase().equals(name)) { for (String ms : msg) { player.sendMessage(ms); From 0b230747703b76a2ee6a0dd3a6a31751f1f0c7e8 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 20:46:56 +0700 Subject: [PATCH 167/427] changed settings load method. --- src/main/java/fr/xephi/authme/AuthMe.java | 35 ++---- .../java/fr/xephi/authme/DataManager.java | 36 +++--- .../xephi/authme/commands/AdminCommand.java | 67 +++-------- .../authme/datasource/CacheDataSource.java | 26 ++--- .../fr/xephi/authme/settings/Settings.java | 108 ++++++------------ 5 files changed, 93 insertions(+), 179 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 321d83de..0a1e3579 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -53,7 +53,7 @@ import java.util.zip.GZIPInputStream; public class AuthMe extends JavaPlugin { - private static Server server; + private final Server server = getServer(); private static Logger authmeLogger = Logger.getLogger("AuthMe"); private static AuthMe authme; public Management management; @@ -76,7 +76,6 @@ public class AuthMe extends JavaPlugin { public boolean isCitizensActive = false; public boolean CombatTag = false; public boolean legacyChestShop = false; - public boolean BungeeCord = false; public boolean antibotMod = false; public boolean delayedAntiBot = true; public ConcurrentHashMap sessions = new ConcurrentHashMap<>(); @@ -93,14 +92,6 @@ public class AuthMe extends JavaPlugin { return settings; } - public DataSource getAuthMeDatabase() { - return database; - } - - public void setAuthMeDatabase(DataSource database) { - this.database = database; - } - public void setMessages(Messages m) { this.m = m; } @@ -120,8 +111,6 @@ public class AuthMe extends JavaPlugin { // TODO: split the plugin in more modules // TODO: remove vault as hard dependency - - server = getServer(); PluginManager pm = server.getPluginManager(); // Setup the Logger @@ -131,9 +120,11 @@ public class AuthMe extends JavaPlugin { // TODO: new configuration style (more files) try { settings = new Settings(this); + settings.reload(); } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); ConsoleLogger.showError("Can't load the configuration file... Something went wrong, to avoid security issues the server will shutdown!"); - this.getServer().shutdown(); + server.shutdown(); return; } @@ -232,7 +223,7 @@ public class AuthMe extends JavaPlugin { // Connect to the database and setup tables try { setupDatabase(); - } catch (ClassNotFoundException | SQLException | PoolInitializationException ex) { + } catch (Exception ex) { ConsoleLogger.writeStackTrace(ex); ConsoleLogger.showError("Fatal error occurred during database connection! Authme initialization ABORTED!"); stopOrUnload(); @@ -346,7 +337,7 @@ public class AuthMe extends JavaPlugin { public void stopOrUnload() { if (Settings.isStopEnabled) { ConsoleLogger.showError("THE SERVER IS GOING TO SHUTDOWN AS DEFINED IN THE CONFIGURATION!"); - AuthMe.getInstance().getServer().shutdown(); + server.shutdown(); } else { server.getPluginManager().disablePlugin(AuthMe.getInstance()); } @@ -391,7 +382,7 @@ public class AuthMe extends JavaPlugin { if (Settings.getDataSource == DataSource.DataSourceType.FILE) { Converter converter = new ForceFlatToSqlite(database, this); - getServer().getScheduler().runTaskAsynchronously(this, converter); + server.getScheduler().runTaskAsynchronously(this, converter); ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated, next time server starts up, it will be changed to SQLite... Conversion will be started Asynchronously, it will not drop down your performance !"); ConsoleLogger.showError("If you want to keep FlatFile, set file again into config at backend, but this message and this change will appear again at the next restart"); } @@ -512,12 +503,12 @@ public class AuthMe extends JavaPlugin { // Check the presence of CombatTag public void checkCombatTag() { - this.CombatTag = this.getServer().getPluginManager().isPluginEnabled("CombatTag"); + this.CombatTag = server.getPluginManager().isPluginEnabled("CombatTag"); } // Check if Citizens is active public void checkCitizens() { - this.isCitizensActive = this.getServer().getPluginManager().isPluginEnabled("Citizens"); + this.isCitizensActive = server.getPluginManager().isPluginEnabled("Citizens"); } // Check if a player/command sender have a permission @@ -703,8 +694,6 @@ public class AuthMe extends JavaPlugin { } } - // TODO: Need to review the code below! - public String getCountryCode(String ip) { if (lookupService != null) { return lookupService.getCountry(ip).getCode(); @@ -751,12 +740,12 @@ public class AuthMe extends JavaPlugin { message = message.replace("&", "\u00a7"); message = message.replace("{PLAYER}", player.getName()); message = message.replace("{ONLINE}", "" + playersOnline); - message = message.replace("{MAXPLAYERS}", "" + this.getServer().getMaxPlayers()); + message = message.replace("{MAXPLAYERS}", "" + server.getMaxPlayers()); message = message.replace("{IP}", getIP(player)); message = message.replace("{LOGINS}", "" + PlayerCache.getInstance().getLogged()); message = message.replace("{WORLD}", player.getWorld().getName()); - message = message.replace("{SERVER}", this.getServer().getServerName()); - message = message.replace("{VERSION}", this.getServer().getBukkitVersion()); + message = message.replace("{SERVER}", server.getServerName()); + message = message.replace("{VERSION}", server.getBukkitVersion()); message = message.replace("{COUNTRY}", this.getCountryName(getIP(player))); return message; } diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 23aaedc1..43782c5b 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -1,5 +1,11 @@ package fr.xephi.authme; +import fr.xephi.authme.settings.Settings; +import net.milkbowl.vault.permission.Permission; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + import java.io.File; import java.util.List; import java.util.concurrent.Callable; @@ -7,13 +13,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - -import fr.xephi.authme.settings.Settings; -import net.milkbowl.vault.permission.Permission; - public class DataManager { public AuthMe plugin; @@ -150,7 +149,7 @@ public class DataManager { } public synchronized void purgePermissions(List cleared, - Permission permission) { + Permission permission) { int i = 0; for (String name : cleared) { try { @@ -170,24 +169,19 @@ public class DataManager { return true; ExecutorService executor = Executors.newSingleThreadExecutor(); Future result = executor.submit(new Callable() { - + @Override public synchronized Boolean call() throws Exception { - Boolean result = null; - try { - for (OfflinePlayer op : Utils.getOnlinePlayers()) - if (op.getName().equalsIgnoreCase(name)) { - result = true; - break; - } - } catch (Exception e) { - } - return result; + for (OfflinePlayer op : Utils.getOnlinePlayers()) + if (op.getName().equalsIgnoreCase(name)) { + return true; + } + return false; } }); try { - return result.get().booleanValue(); + return result.get(); } catch (Exception e) { - return (false); + return false; } finally { executor.shutdown(); } diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 6852564d..64b00031 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -1,6 +1,5 @@ package fr.xephi.authme.commands; -import com.zaxxer.hikari.pool.PoolInitializationException; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -28,7 +27,6 @@ import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import java.security.NoSuchAlgorithmException; -import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -110,48 +108,23 @@ public class AdminCommand implements CommandExecutor { return true; } } else if (args[0].equalsIgnoreCase("reload")) { - plugin.getSettings().reload(); - m.reloadMessages(); - plugin.database.close(); - try { + plugin.getSettings().reload(); + m.reloadMessages(); + plugin.database.close(); plugin.setupDatabase(); - } catch (ClassNotFoundException nfe) { + } catch (Exception e) { ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - return false; - } catch (SQLException sqle) { - ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - return false; - } catch (PoolInitializationException pie) { - ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } + plugin.stopOrUnload(); return false; } - m.send(sender, "reload"); } else if (args[0].equalsIgnoreCase("lastlogin")) { if (args.length != 2) { sender.sendMessage("Usage: /authme lastlogin "); return true; } - PlayerAuth auth = null; + PlayerAuth auth; try { auth = plugin.database.getAuth(args[1].toLowerCase()); } catch (NullPointerException e) { @@ -177,31 +150,30 @@ 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 auth = null; + PlayerAuth auth; String message = "[AuthMe] "; try { auth = plugin.database.getAuth(arguments[1].toLowerCase()); } catch (NullPointerException npe) { - m.send(fSender, "unknown_user"); + m.send(sender, "unknown_user"); return; } if (auth == null) { - m.send(fSender, "unknown_user"); + m.send(sender, "unknown_user"); return; } List accountList = plugin.database.getAllAuthsByName(auth); if (accountList == null || accountList.isEmpty()) { - m.send(fSender, "user_unknown"); + m.send(sender, "user_unknown"); return; } if (accountList.size() == 1) { - fSender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); + sender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); return; } int i = 0; @@ -214,13 +186,12 @@ public class AdminCommand implements CommandExecutor { message = message + "."; } } - fSender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - fSender.sendMessage(message); + sender.sendMessage("[AuthMe] " + arguments[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() { @@ -228,16 +199,16 @@ public class AdminCommand implements CommandExecutor { public void run() { String message = "[AuthMe] "; if (arguments[1] == null) { - fSender.sendMessage("[AuthMe] Please put a valid IP"); + sender.sendMessage("[AuthMe] Please put a valid IP"); return; } List accountList = plugin.database.getAllAuthsByIp(arguments[1]); if (accountList == null || accountList.isEmpty()) { - fSender.sendMessage("[AuthMe] This IP does not exist in the database"); + sender.sendMessage("[AuthMe] This IP does not exist in the database"); return; } if (accountList.size() == 1) { - fSender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); + sender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); return; } int i = 0; @@ -250,8 +221,8 @@ public class AdminCommand implements CommandExecutor { message = message + "."; } } - fSender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - fSender.sendMessage(message); + sender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); + sender.sendMessage(message); } }); return true; @@ -374,7 +345,7 @@ public class AdminCommand implements CommandExecutor { } return true; } else if (args[0].equalsIgnoreCase("purgebannedplayers")) { - List bannedPlayers = new ArrayList(); + List bannedPlayers = new ArrayList<>(); for (OfflinePlayer off : plugin.getServer().getBannedPlayers()) { bannedPlayers.add(off.getName().toLowerCase()); } diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 5ac61715..0b6dfe17 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -1,20 +1,19 @@ package fr.xephi.authme.datasource; +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 org.bukkit.entity.Player; + import java.util.List; import java.util.concurrent.ConcurrentHashMap; -import fr.xephi.authme.Utils; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.cache.auth.PlayerCache; - public class CacheDataSource implements DataSource { private DataSource source; public AuthMe plugin; - private ConcurrentHashMap cache = new ConcurrentHashMap(); + private ConcurrentHashMap cache = new ConcurrentHashMap<>(); public CacheDataSource(AuthMe plugin, DataSource source) { this.plugin = plugin; @@ -24,8 +23,9 @@ public class CacheDataSource implements DataSource { * load the server, but it will be much easier to check for an * isAuthAvailable ! */ - for (PlayerAuth auth : source.getAllAuths()) + for (PlayerAuth auth : source.getAllAuths()) { cache.put(auth.getNickname().toLowerCase(), auth); + } } @Override @@ -144,12 +144,8 @@ public class CacheDataSource implements DataSource { for (Player player : Utils.getOnlinePlayers()) { String user = player.getName().toLowerCase(); if (PlayerCache.getInstance().isAuthenticated(user)) { - try { - PlayerAuth auth = source.getAuth(user); - cache.put(user, auth); - } catch (NullPointerException npe) { - } - + PlayerAuth auth = source.getAuth(user); + cache.put(user, auth); } } } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 5b1a6b98..7b6758f4 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -19,33 +19,34 @@ public final class Settings extends YamlConfiguration { // This is not an option! public static Boolean antiBotInAction = false; - public static final File PLUGIN_FOLDER; - public static final File CACHE_FOLDER; - public static final File AUTH_FILE; - public static final File SETTINGS_FILE; + public static final File PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); + public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); + public static final File AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db"); + public static final File SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml"); + public static File messageFile; - public static List allowCommands = null; - public static List getJoinPermissions = null; - public static List getUnrestrictedName = null; - private static List getRestrictedIp; - public static List getMySQLOtherUsernameColumn = null; - public static List getForcedWorlds = null; - public static List countries = null; - public static List countriesBlacklist = null; - public static List forceCommands = null; - public static List forceCommandsAsConsole = null; - public static List forceRegisterCommands = null; - public static List forceRegisterCommandsAsConsole = null; + public static List allowCommands; + public static List getJoinPermissions; + public static List getUnrestrictedName; + public static List getRestrictedIp; + public static List getMySQLOtherUsernameColumn; + public static List getForcedWorlds; + public static List countries; + public static List countriesBlacklist; + public static List forceCommands; + public static List forceCommandsAsConsole; + public static List forceRegisterCommands; + public static List forceRegisterCommandsAsConsole; + public static List welcomeMsg; + public static List unsafePasswords; + public static List emailBlacklist; + public static List emailWhitelist; public static DataSourceType getDataSource; public static HashAlgorithm getPasswordHash; - public static Boolean useLogging = false; + public static boolean useLogging = false; public static int purgeDelay = 60; - public static List welcomeMsg = null; - public static List unsafePasswords; - public static List emailBlacklist = null; - public static List emailWhitelist = null; - public static Boolean isPermissionCheckEnabled, isRegistrationEnabled, + public static boolean isPermissionCheckEnabled, isRegistrationEnabled, isForcedRegistrationEnabled, isTeleportToSpawnEnabled, isSessionsEnabled, isChatAllowed, isAllowRestrictedIp, isMovementAllowed, isKickNonRegisteredEnabled, @@ -91,35 +92,28 @@ public final class Settings extends YamlConfiguration { protected static YamlConfiguration configFile; - static { - PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); - CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); - AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db"); - SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml"); - } - public Settings(AuthMe plugin) { configFile = (YamlConfiguration) plugin.getConfig(); this.plugin = plugin; - boolean exist = exists(); + } + + public final void reload() throws Exception { + plugin.getLogger().info("Loading Configuration File..."); + boolean exist = SETTINGS_FILE.exists(); if (!exist) { plugin.saveDefaultConfig(); } - load(); - loadConfigOptions(exist); + load(SETTINGS_FILE); + if (exist) { + mergeConfig(); + } + loadVariables(); + if (exist) { + saveDefaults(); + } messageFile = new File(PLUGIN_FOLDER, "messages" + File.separator + "messages_" + messagesLanguage + ".yml"); } - public void loadConfigOptions(boolean exist) { - plugin.getLogger().info("Loading Configuration File..."); - if (exist) - mergeConfig(); - - loadVariables(); - - if (exist) - saveDefaults(); - } @SuppressWarnings("unchecked") public static void loadVariables() { @@ -513,27 +507,6 @@ public final class Settings extends YamlConfiguration { } } - /** - * Loads the configuration from disk - * - * @return True if loaded successfully - */ - public final boolean load() { - try { - load(SETTINGS_FILE); - return true; - } catch (Exception ex) { - return false; - } - } - - public final void reload() { - if (!exists()) { - plugin.saveDefaultConfig(); - } - load(); - } - /** * Saves the configuration to disk * @@ -548,15 +521,6 @@ public final class Settings extends YamlConfiguration { } } - /** - * Simple function for if the Configuration file exists - * - * @return True if configuration exists on disk - */ - public final boolean exists() { - return SETTINGS_FILE.exists(); - } - /** * Saves current configuration (plus defaults) to disk. *

    From b8abe7158490af47c7691aff993f717181dbc997 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 23:35:31 +0700 Subject: [PATCH 168/427] remove message 'bad_database_email' --- src/main/resources/messages/messages_bg.yml | 2 - src/main/resources/messages/messages_br.yml | 1 - src/main/resources/messages/messages_cz.yml | 1 - src/main/resources/messages/messages_de.yml | 1 - src/main/resources/messages/messages_en.yml | 1 - src/main/resources/messages/messages_es.yml | 1 - src/main/resources/messages/messages_eu.yml | 1 - src/main/resources/messages/messages_fi.yml | 1 - src/main/resources/messages/messages_fr.yml | 1 - src/main/resources/messages/messages_gl.yml | 2 - src/main/resources/messages/messages_hu.yml | 1 - src/main/resources/messages/messages_it.yml | 1 - src/main/resources/messages/messages_ko.yml | 1 - src/main/resources/messages/messages_lt.yml | 1 - src/main/resources/messages/messages_nl.yml | 1 - src/main/resources/messages/messages_pl.yml | 1 - src/main/resources/messages/messages_pt.yml | 1 - src/main/resources/messages/messages_ru.yml | 1 - src/main/resources/messages/messages_sk.yml | 1 - src/main/resources/messages/messages_tr.yml | 1 - src/main/resources/messages/messages_uk.yml | 1 - src/main/resources/messages/messages_vn.yml | 8 +- src/main/resources/messages/messages_zhcn.yml | Bin 4566 -> 4406 bytes src/main/resources/messages/messages_zhhk.yml | 117 +++++++++--------- src/main/resources/messages/messages_zhtw.yml | 1 - 25 files changed, 60 insertions(+), 89 deletions(-) diff --git a/src/main/resources/messages/messages_bg.yml b/src/main/resources/messages/messages_bg.yml index 866931cc..81a7e708 100644 --- a/src/main/resources/messages/messages_bg.yml +++ b/src/main/resources/messages/messages_bg.yml @@ -37,8 +37,6 @@ usage_changepassword: '&fКоманда: /changepassword СтараПарола name_len: '&cТвоя никнейм е твърде малък или голям' regex: '&cТвоя никнейм съдържа забранени знацхи. Позволените са: REG_EX' add_email: '&cМоля добави своя имейл с : /email add имейл имейл' -bad_database_email: '[AuthMe] Тази /email команда работи само с БД (MySQL и SQLite), - свържи се с Админ' recovery_email: '&cЗабравихте своята парола? Моля използвай /email recovery <имейл>' usage_captcha: '&cYou need to type a captcha, please type: /captcha <код>' wrong_captcha: '&cГрешен код, използвай : /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_br.yml b/src/main/resources/messages/messages_br.yml index 044443fb..20243c68 100644 --- a/src/main/resources/messages/messages_br.yml +++ b/src/main/resources/messages/messages_br.yml @@ -36,7 +36,6 @@ usage_changepassword: '&fUse: /changepassword PasswordAntiga PasswordNova' name_len: '&cO seu nickname é muito curto, ou muito longo.' regex: '&cO seu nickname contém caracteres não permitidos. Permitido: REG_EX' add_email: '&cPor favor adicione o seu email com : /email add seuEmail confirmarSeuEmail' -bad_database_email: '[AuthMe] O comando /email não está disponível contacte o staff via ticket' recovery_email: '&cPerdeu/esqueceu a sua password(senha)? Para a recupera-la escreva /email recovery ' usage_captcha: '&cVocê precisa digitar um captcha, escreva: /captcha ' wrong_captcha: '&cCaptcha errado, por favor escreva: /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_cz.yml b/src/main/resources/messages/messages_cz.yml index 9d1b1031..7492503d 100644 --- a/src/main/resources/messages/messages_cz.yml +++ b/src/main/resources/messages/messages_cz.yml @@ -36,7 +36,6 @@ usage_changepassword: '&cPouzij: "/changepassword stareHeslo noveHeslo".' 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' -bad_database_email: '[AuthMe] Prikaz /email je mozno pouzit jen s MySQL a SQLite, kontaktuj Admina' recovery_email: '&cZapomel jsi heslo? Zadej: /email recovery ' usage_captcha: '&cPouzij: /captcha ' wrong_captcha: '&cSpatne opsana Captcha, pouzij prosim: /captcha CAPTCHA_TEXT' diff --git a/src/main/resources/messages/messages_de.yml b/src/main/resources/messages/messages_de.yml index 17a1657b..fa086015 100644 --- a/src/main/resources/messages/messages_de.yml +++ b/src/main/resources/messages/messages_de.yml @@ -36,7 +36,6 @@ usage_changepassword: '&cBenutze: /changepassword ' -bad_database_email: '&4Der /email Befehl ist nur mit MySQL und SQLite kompatibel. Bitte kontaktiere einen Administrator!' recovery_email: '&3Passwort vergessen? Nutze "/email recovery " für ein neues Passwort' usage_captcha: '&3Um dich einzuloggen, tippe dieses Captcha so ein: /captcha ' wrong_captcha: '&cFalsches Captcha, bitte nutze: /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_en.yml b/src/main/resources/messages/messages_en.yml index 8f07d88b..16218f32 100644 --- a/src/main/resources/messages/messages_en.yml +++ b/src/main/resources/messages/messages_en.yml @@ -36,7 +36,6 @@ usage_changepassword: '&cUsage: /changepassword ' name_len: '&4Your username is either too short or too long!' regex: '&4Your username contains illegal characters. Allowed chars: REG_EX' add_email: '&3Please add your email to your account with the command "/email add "' -bad_database_email: '&4The /email command is available only with MySQL and SQLite databases, please contact an Admin!' #This should be removed! recovery_email: '&3Forgot your password? Please use the command "/email recovery "' usage_captcha: '&3To login you have to solve a captcha code, please use the command "/captcha "' wrong_captcha: '&cWrong Captcha, please type "/captcha THE_CAPTCHA" into the chat!' diff --git a/src/main/resources/messages/messages_es.yml b/src/main/resources/messages/messages_es.yml index 62fbc53a..e91e310e 100644 --- a/src/main/resources/messages/messages_es.yml +++ b/src/main/resources/messages/messages_es.yml @@ -37,7 +37,6 @@ usage_changepassword: '&fUso: /changepw contraseñaaActual contraseñaNueva' 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' -bad_database_email: '[AuthMe] El comando /email sólo está disponible con MySQL y SQLite, contacta a un administrador' recovery_email: '&c¿Olvidaste tu contraseña? Por favor usa /email recovery ' usage_captcha: '&cUso: /captcha ' wrong_captcha: '&cCaptcha incorrecto, please use : /captcha EL_CAPTCHA' diff --git a/src/main/resources/messages/messages_eu.yml b/src/main/resources/messages/messages_eu.yml index 4a45b3f9..44d961de 100644 --- a/src/main/resources/messages/messages_eu.yml +++ b/src/main/resources/messages/messages_eu.yml @@ -36,7 +36,6 @@ 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' diff --git a/src/main/resources/messages/messages_fi.yml b/src/main/resources/messages/messages_fi.yml index 211928fe..be3779c7 100644 --- a/src/main/resources/messages/messages_fi.yml +++ b/src/main/resources/messages/messages_fi.yml @@ -36,7 +36,6 @@ usage_changepassword: '&fKäyttötapa: /changepassword vanhaSalasana uusiSalasan 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' -bad_database_email: '[AuthMe] Tämä /email komento on vain käytössä MySQLlän kanssa. Ota yhteys palveluntarjoojaan' recovery_email: '&cUnohtuiko salasana? Käytä komentoa: /email recovery ' usage_captcha: '&cKäyttötapa: /captcha ' wrong_captcha: '&cVäärä varmistus, käytä : /captcha CAPTCHA' diff --git a/src/main/resources/messages/messages_fr.yml b/src/main/resources/messages/messages_fr.yml index d337962a..51a2a53a 100644 --- a/src/main/resources/messages/messages_fr.yml +++ b/src/main/resources/messages/messages_fr.yml @@ -37,7 +37,6 @@ usage_changepassword: '&fPour changer de mot de passe, utilisez: /changepassword 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' -bad_database_email: '[AuthMe] La commande /email est disponible uniquement pour MySQL et SQLite, contactez un Admin' recovery_email: '&cVous avez oublié votre MotdePasse? Utilisez /email recovery ' usage_captcha: '&cTrop de tentatives de connexion échouées, utilisez: /captcha ' wrong_captcha: '&cCaptcha incorrect, écrivez de nouveau : /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_gl.yml b/src/main/resources/messages/messages_gl.yml index 5a43e796..2ead0316 100644 --- a/src/main/resources/messages/messages_gl.yml +++ b/src/main/resources/messages/messages_gl.yml @@ -37,8 +37,6 @@ usage_changepassword: '&fUso: /changepassword ' -bad_database_email: '[AuthMe] Este comando /email só está dispoñible con MySQL e SQLite, - contacta cun administrador' recovery_email: '&cOlvidaches o contrasinal? Por favor, usa /email recovery ' usage_captcha: '&cNecesitas escribir un captcha, por favor escribe: /captcha ' wrong_captcha: '&cCaptcha equivocado, por favor usa: /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_hu.yml b/src/main/resources/messages/messages_hu.yml index e71dae62..68fde4d1 100644 --- a/src/main/resources/messages/messages_hu.yml +++ b/src/main/resources/messages/messages_hu.yml @@ -36,7 +36,6 @@ usage_changepassword: 'használat: /changepassword régiJelszó újJelszó' name_len: '&cYour nickname is too Short or too long' regex: '&cYour nickname contains illegal characters. Allowed chars: REG_EX' add_email: '&cPlease add your email with : /email add yourEmail confirmEmail' -bad_database_email: '[AuthMe] This /email command only available with MySQL and SQLite, contact an Admin' recovery_email: '&cForgot your password? Please use /email recovery ' usage_captcha: '&cUsage: /captcha ' wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_it.yml b/src/main/resources/messages/messages_it.yml index 5a58cb28..4e4a0fa9 100644 --- a/src/main/resources/messages/messages_it.yml +++ b/src/main/resources/messages/messages_it.yml @@ -36,7 +36,6 @@ usage_changepassword: 'Utilizzo: /changepassword "' -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: '&cAbbiamo bisogno che tu inserisca un captcha, perfavore scrivi: "/captcha THE_CAPTCHA"' wrong_captcha: '&cCaptcha sbagliato, perfavore riprova con il comando: "/captcha THE_CAPTCHA"' diff --git a/src/main/resources/messages/messages_ko.yml b/src/main/resources/messages/messages_ko.yml index 2dc85116..db1bd421 100644 --- a/src/main/resources/messages/messages_ko.yml +++ b/src/main/resources/messages/messages_ko.yml @@ -40,7 +40,6 @@ usage_changepassword: '&f사용법: /changepassword 기존비밀번호 새로운 name_len: '&c당신의 이름은 너무 짧거나 너무 깁니다' regex: '&c당신의 이름에는 불법적인 글자들이 포함되어있습니다. 허용된 글자: REG_EX' add_email: '&c당신의 이메일을 추가해주세요 : /email add 당신의이메일 이메일재입력' -bad_database_email: '[AuthMe] 이 /email 명령어는 오직 MySQL와 SQLite에서만 가능합니다, 관리자에게 문의해주세요' recovery_email: '&c비밀번호를 잊어버리셨다고요? /email recovery <당신의이메일>을 사용하세요' usage_captcha: '&c보안문자 입력이 필요합니다, 입력해주세요: /captcha ' wrong_captcha: '&c잘못된 보안문자, 사용해주세요 : /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_lt.yml b/src/main/resources/messages/messages_lt.yml index c270da9f..80a7b3ab 100644 --- a/src/main/resources/messages/messages_lt.yml +++ b/src/main/resources/messages/messages_lt.yml @@ -36,7 +36,6 @@ usage_changepassword: '&ePanaudojimas: /changepassword senasSlaptazodis naujasSl name_len: '&cJusu varsdas yra per ilgas arba per trumpas.' regex: '&cJusu varde yra neledziamu simboliu, leidziami: REG_EX' add_email: '&ePrasau pridekite savo el.pasta : /email add Email confirmEmail' -bad_database_email: '&c[AuthMe] si /email komanda leidziama tik su MySQL ir SQLite, susisiekite su administratorium' recovery_email: '&cPamirsote slaptazodi? Rasykite: /email recovery el.pastas' usage_captcha: '&cPanaudojimas: /captcha ' wrong_captcha: '&cNeteisinga Captcha, naudokite : /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_nl.yml b/src/main/resources/messages/messages_nl.yml index 65c8a0fc..acd42a2c 100644 --- a/src/main/resources/messages/messages_nl.yml +++ b/src/main/resources/messages/messages_nl.yml @@ -35,7 +35,6 @@ usage_changepassword: 'Gebruik: /changepassword ' usage_captcha: '&cGebruik: /captcha ' wrong_captcha: '&cverkeerde Captcha, Gebruik alstublieft : /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_pl.yml b/src/main/resources/messages/messages_pl.yml index e9df2139..952fd1cc 100644 --- a/src/main/resources/messages/messages_pl.yml +++ b/src/main/resources/messages/messages_pl.yml @@ -36,7 +36,6 @@ usage_changepassword: '&fUzycie: /changepassword starehaslo nowehaslo' 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' -bad_database_email: '[AuthMe] Ta komenda /email dostepna jedynie z baza adnych MySQL lub SQLite, skontaktuj sie z Administratorem' recovery_email: '&cZapomniales hasla? Prosze uzyj komendy /email recovery ' usage_captcha: '&cWpisz: /captcha ' wrong_captcha: '&cZly kod, prosze wpisac: /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_pt.yml b/src/main/resources/messages/messages_pt.yml index 680f7c1b..02ec0420 100644 --- a/src/main/resources/messages/messages_pt.yml +++ b/src/main/resources/messages/messages_pt.yml @@ -36,7 +36,6 @@ usage_changepassword: '&fUse: /changepassword passwordAntiga passwordNova' name_len: '&cO seu nick é demasiado curto ou muito longo.' regex: '&cO seu nickname contém caracteres não permitidos. Permitido: REG_EX' add_email: '&cPor favor adicione o seu email com : /email add seuEmail confirmarSeuEmail' -bad_database_email: '[AuthMe] O comando /email não está disponível contacte o staff via ticket' recovery_email: '&cPerdeu a sua password? Para a recuperar escreva /email recovery ' usage_captcha: '&cVocê precisa digitar um captcha, escreva: /captcha ' wrong_captcha: '&cCaptcha errado, por favor escreva: /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_ru.yml b/src/main/resources/messages/messages_ru.yml index 4a6a2bf1..ddb84cdb 100644 --- a/src/main/resources/messages/messages_ru.yml +++ b/src/main/resources/messages/messages_ru.yml @@ -36,7 +36,6 @@ usage_changepassword: '&4Использование: &5/changepassword СТАР name_len: '&4Ваш логин слишком длинный или слишком короткий' regex: '&4Ваш логин содержит запрещенные символы. Разрешенные символы: REG_EX' add_email: '&4Добавьте свой email: &5/email add ВАШ_EMAIL ВАШ_EMAIL' -bad_database_email: '&4[AuthMe] Команда &5/email&4 доступна только при работе с MySQL или SQLite. Обратититесь к администрации сервера' recovery_email: '&4Забыли пароль? Используйте &5/email recovery ВАШ_EMAIL' usage_captcha: '&4Вы должны ввести код, используйте: &5/captcha ' wrong_captcha: '&4Неверный код, используйте: &5/captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_sk.yml b/src/main/resources/messages/messages_sk.yml index 95d293c3..010533fe 100644 --- a/src/main/resources/messages/messages_sk.yml +++ b/src/main/resources/messages/messages_sk.yml @@ -40,7 +40,6 @@ usage_changepassword: '&fPríkaz: /changepassword stareHeslo noveHeslo' name_len: '&cTvoje meno je velmi krátke alebo dlhé' regex: '&cTvoje meno obsahuje zakázané znaky. Povolené znaky: REG_EX' add_email: '&cPridaj svoj e-mail príkazom "/email add email zopakujEmail"' -bad_database_email: '[AuthMe] Tento príkaz je dostupny iba pri MySQL SQLite' recovery_email: '&cZabudol si heslo? Pouzi príkaz /email recovery ' usage_captcha: '&cUsage: /captcha ' wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_tr.yml b/src/main/resources/messages/messages_tr.yml index 899bee30..7f000396 100644 --- a/src/main/resources/messages/messages_tr.yml +++ b/src/main/resources/messages/messages_tr.yml @@ -36,7 +36,6 @@ 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' diff --git a/src/main/resources/messages/messages_uk.yml b/src/main/resources/messages/messages_uk.yml index aad7fc0c..6b132d8d 100644 --- a/src/main/resources/messages/messages_uk.yml +++ b/src/main/resources/messages/messages_uk.yml @@ -36,7 +36,6 @@ usage_changepassword: '&fВикористовуйте: /changepassword Стар name_len: '&cВаш нікнейм занадто довгий, або занадто короткий' regex: '&cВаш нікнейм містить заборонені символи. Доступні символи: REG_EX' add_email: '&cБудь ласка додайте свою електронну скриньку: /email add ВашEmail ВашEmail' -bad_database_email: '[AuthMe] Команда /email доступна лише при роботі з MySQL, або SQLite, зверніться до адміністратора.' recovery_email: '&cЗабули пароль? Введіть /email recovery ВашПароль' usage_captcha: '&cБудь ласка введіть капчу: /captcha ' wrong_captcha: '&cНевірне значення капчи: /captcha THE_CAPTCHA' diff --git a/src/main/resources/messages/messages_vn.yml b/src/main/resources/messages/messages_vn.yml index 1722385a..7acb4988 100644 --- a/src/main/resources/messages/messages_vn.yml +++ b/src/main/resources/messages/messages_vn.yml @@ -1,8 +1,7 @@ unknown_user: '&fNgười chơi không tồn tại trong cơ sở dữ liệu' unsafe_spawn: '&fNơi thoát server của bạn không an toàn, đang dịch chuyển bạn tới điểm spawn của server' not_logged_in: '&cChưa đăng nhập!' -reg_voluntarily: '&fBạn có thể đăng kí tài khoản với lệnh - "/register mật-khẩu nhập-lại-mật-khẩu"' +reg_voluntarily: '&fBạn có thể đăng kí tài khoản với lệnh "/register mật-khẩu nhập-lại-mật-khẩu"' usage_log: '&eSử dụng: /login password' wrong_pwd: '&cSai mật khẩu' unregistered: '&cHuỷ đăng kí thành công!' @@ -35,8 +34,6 @@ usage_changepassword: '&eSử dụng: /changepassword mật-khẩu-cũ mật-kh 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' -bad_database_email: '[AuthMe] Lệnh /email chỉ hoạt động với cơ sở dữ liệu MySQL và SQLite, - hãy liên hệ điều hành viên của server' 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 ' wrong_captcha: '&cSai mã xác nhận, nhập lại: /captcha ' @@ -55,5 +52,4 @@ email_changed: '[AuthMe] Đã thay đổi email !' email_send: '[AuthMe] Đã gửi email khôi phục mật khẩu tới bạn !' country_banned: 'Rất tiếc, quốc gia của bạn không được phép gia nhập server' antibot_auto_enabled: '[AuthMe] AntiBot đã được kích hoạt vì lượng người chơi kết nối vượt quá giới hạn!' -antibot_auto_disabled: '[AuthMe] AntiBot tự huỷ kích hoạt sau %m phút, - hi vọng lượng kết nối sẽ giảm bớt' \ No newline at end of file +antibot_auto_disabled: '[AuthMe] AntiBot tự huỷ kích hoạt sau %m phút, hi vọng lượng kết nối sẽ giảm bớt' \ No newline at end of file diff --git a/src/main/resources/messages/messages_zhcn.yml b/src/main/resources/messages/messages_zhcn.yml index 2571a88e637aa2323ca65b35c7dce1b94d166253..2d28081eb221a0d9712b8104796f2297aacc7690 100644 GIT binary patch delta 12 TcmcbnyiIAtKd#O5xGmTKCm#hQ delta 168 zcmdm{bWM4~Kd$;DhD3%GhIk-OWGDe*5Wkoq6)2L*kPBpIGUPB=F(@#oGek2uGL!<< zWH9&w+bb0P4;D|WC&&mWbk1S yOJZ$+urh%rr7{#qr{*P3j{BDCoAf?dqm<|W_wJB}-!%)X*-9cpHvizVV*>ySD>H-u diff --git a/src/main/resources/messages/messages_zhhk.yml b/src/main/resources/messages/messages_zhhk.yml index d66f1003..db8b158b 100644 --- a/src/main/resources/messages/messages_zhhk.yml +++ b/src/main/resources/messages/messages_zhhk.yml @@ -1,61 +1,60 @@ # Translator: uSoc_lifehome (http://lifeho.me) # -# Translator: WaterXCubic # +# Translator: WaterXCubic ����� # # -------------------------------------------- # -unknown_user: '&8[&6Τt&8] &fΤƨäsbƮwC' -unsafe_spawn: '&8[&6Τt&8] &fAnXmwA{bNǰeA쭫IC' -not_logged_in: '&8[&6Τt&8] &cA٨SnJ I' -reg_voluntarily: '&8[&6Τt&8] &fAiHϥγoӪOӵUG m /register <бKX> n' -usage_log: '&8[&6Τt&8] &cΪkG m /login n' -wrong_pwd: '&8[&6Τt&8] &cAJF~KXC' -unregistered: '&8[&6Τt&8] &cAw\|UOC' -reg_disabled: '&8[&6Τt&8] &cAwsaUC' -valid_session: '&8[&6Τt&8] &b I ڰOoAAw^ӡ' -login: '&8[&6Τt&8] &cA\nJFC' -password_error_nick: '&fAiHϥΧAWrKX!' -password_error_unsafe: '&fAiHϥΤwKX' -vb_nonActiv: '&8[&6Τt&8] &fAb٨SgLql I' -user_regged: '&8[&6Τt&8] &cΤWwgULFC' -usage_reg: '&8[&6Τt&8] &cΪkG m /register <бKX> n' -max_reg: '&8[&6Τt&8] &fAIPa}wFUƤWC' -no_perm: '&8[&6Τt&8] &bAiH CraftingHK aʬ줤dݻC' -error: '&8[&6Τt&8] &foͿ~AлP޲zpC' -login_msg: '&8[&6Τt&8] &cШϥγoӫOӵnJG m /login n' -reg_msg: '&8[&6Τt&8] &cШϥγoӪOӵUG m /register <бKX> n' -reg_email_msg: '&8[&6Τt&8] &cШϥγoӪOӵUG m /register <йql> n' -usage_unreg: '&8[&6Τt&8] &cΪkG m /unregister n' -pwd_changed: '&8[&6Τt&8] &cA\󴫤FAKX I' -user_unknown: '&8[&6Τt&8] &cΤWSwnOơC' -password_error: '&8[&6Τt&8] &fKXŦXC' -invalid_session: '&8[&6Τt&8] &fnJqƤwlaAеݵnJqC' -reg_only: '&8[&6Τt&8] &fwU|AХ https://www.example.com/ UC' -logged_in: '&8[&6Τt&8] &cAwgnJLFC' -logout: '&8[&6Τt&8] &bA\nXFC' -same_nick: '&8[&6Τt&8] &fPWawbCC' -registered: '&8[&6Τt&8] &bA\UFC' -pass_len: '&8[&6Τt&8] &fAKXäŦXWwסC' -reload: '&8[&6Τt&8] &bnJtγ]wθƮwsJC' -timeout: '&8[&6Τt&8] &fnJOɡC' -usage_changepassword: '&8[&6Τt&8] &fΪkG m /changepassword <±KX> n' -name_len: '&8[&6Τt&8] &cAΤWŦXWwסC' -regex: '&8[&6Τt&8] &cAΤWte\ršCHU\rG REG_EX' -add_email: '&8[&6Τt&8] &bЬAbߧYK[qla}G m /email add <йqla}> n' -bad_database_email: '&8[&6Τt&8] OuAΩϥMySQLSQLiteAC' -recovery_email: '&8[&6Τt&8] &cѰOKX H ШϥγoӪOӧsKXG m /email recovery n' -usage_captcha: '&8[&6Τt&8] &cΪkG m /captcha n' -wrong_captcha: '&8[&6Τt&8] &cAJF~ҽXAШϥ m /captcha <ҽX> n AJC' -valid_captcha: '&8[&6Τt&8] &cAҿJҽXOLĪ I' -kick_forvip: '&c]VIPanJFAC' -kick_fullserver: '&cpI ]AHFAҥHAثenJAC' -usage_email_add: '&8[&6Τt&8] &fΪkG m /email add <йql> n' -usage_email_change: '&8[&6Τt&8] &fΪkG m /email change <¹ql> n' -usage_email_recovery: '&8[&6Τt&8] &fΪkG m /email recovery n' -new_email_invalid: '&8[&6Τt&8] AҶgsqla}äTC' -old_email_invalid: '&8[&6Τt&8] AҶg¹qla}äTC' -email_invalid: '&8[&6Τt&8] AҶgqla}äTC' -email_added: '&8[&6Τt&8] w[JAqla}OC' -email_confirm: '&8[&6Τt&8] ЭпJAqla}C' -email_changed: '&8[&6Τt&8] Aqla}OwC' -email_send: '&8[&6Τt&8] ѰOKXHwHXAЬdC' -country_banned: '&8[&6Τt&8] AwAaѹCAȡC' -antibot_auto_enabled: '&8[&6Τt&8] H{Ǥw]{ɤjqM`suӱҥΡC' -antibot_auto_disabled: '&8[&6Τt&8] H{ˬd줣`sƤw֡Aé %m ᰱB@C' +unknown_user: '&8[&6�Τ�t��&8] &f�Τ��ƨä��s�b���Ʈw���C' +unsafe_spawn: '&8[&6�Τ�t��&8] &f�A���n�X��m���w���A�{�b�N�ǰe�A�쭫���I�C' +not_logged_in: '&8[&6�Τ�t��&8] &c�A�٨S���n�J �I' +reg_voluntarily: '&8[&6�Τ�t��&8] &f�A�i�H�ϥγo�Ӫ����O�ӵ��U�G �m /register <�K�X> <���бK�X> �n' +usage_log: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /login <�K�X> �n' +wrong_pwd: '&8[&6�Τ�t��&8] &c�A��J�F���~���K�X�C' +unregistered: '&8[&6�Τ�t��&8] &c�A�w���\�����|�����U�O���C' +reg_disabled: '&8[&6�Τ�t��&8] &c�����A���w����s���a���U�C' +valid_session: '&8[&6�Τ�t��&8] &b�� �I �ڰO�o�A�A�w��^�ӡ�' +login: '&8[&6�Τ�t��&8] &c�A���\���n�J�F�C' +password_error_nick: '&f�A���i�H�ϥΧA���W�r���K�X!' +password_error_unsafe: '&f�A���i�H�ϥΤ��w�����K�X' +vb_nonActiv: '&8[&6�Τ�t��&8] &f�A���b���٨S���g�L�q�l���� �I' +user_regged: '&8[&6�Τ�t��&8] &c���Τ�W�w�g���U�L�F�C' +usage_reg: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /register <�K�X> <���бK�X> �n' +max_reg: '&8[&6�Τ�t��&8] &f�A��IP�a�}�w�F����U�ƤW���C' +no_perm: '&8[&6�Τ�t��&8] &b�A�i�H�� CraftingHK ���a�ʬ줤�d�ݻ������C' +error: '&8[&6�Τ�t��&8] &f�o�Ϳ��~�A�лP�޲z���p���C' +login_msg: '&8[&6�Τ�t��&8] &c�Шϥγo�ӫ��O�ӵn�J�G �m /login <�K�X> �n' +reg_msg: '&8[&6�Τ�t��&8] &c�Шϥγo�Ӫ����O�ӵ��U�G �m /register <�K�X> <���бK�X> �n' +reg_email_msg: '&8[&6�Τ�t��&8] &c�Шϥγo�Ӫ����O�ӵ��U�G �m /register <�q�l> <���йq�l> �n' +usage_unreg: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /unregister <�K�X> �n' +pwd_changed: '&8[&6�Τ�t��&8] &c�A���\���󴫤F�A���K�X �I' +user_unknown: '&8[&6�Τ�t��&8] &c���Τ�W�S���w�n�O��ơC' +password_error: '&8[&6�Τ�t��&8] &f�K�X���ŦX�C' +invalid_session: '&8[&6�Τ�t��&8] &f�n�J���q��Ƥw�l�a�A�е��ݵn�J���q�����C' +reg_only: '&8[&6�Τ�t��&8] &f���w���U�|���A�Х��� https://www.example.com/ ���U�C' +logged_in: '&8[&6�Τ�t��&8] &c�A�w�g�n�J�L�F�C' +logout: '&8[&6�Τ�t��&8] &b�A���\���n�X�F�C' +same_nick: '&8[&6�Τ�t��&8] &f�P�W���a�w�b�C���C' +registered: '&8[&6�Τ�t��&8] &b�A���\�����U�F�C' +pass_len: '&8[&6�Τ�t��&8] &f�A���K�X�ä��ŦX�W�w���סC' +reload: '&8[&6�Τ�t��&8] &b�n�J�t�γ]�w�θ�Ʈw���s���J�����C' +timeout: '&8[&6�Τ�t��&8] &f�n�J�O�ɡC' +usage_changepassword: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /changepassword <�±K�X> <�s�K�X> �n' +name_len: '&8[&6�Τ�t��&8] &c�A���Τ�W���ŦX�W�w���סC' +regex: '&8[&6�Τ�t��&8] &c�A���Τ�W�t�����e�\���r�šC�H�U����\���r���G REG_EX' +add_email: '&8[&6�Τ�t��&8] &b�Ь��A���b��ߧY�K�[�q�l�a�}�G �m /email add <�q�l�a�}> <���йq�l�a�}> �n' +recovery_email: '&8[&6�Τ�t��&8] &c�ѰO�K�X �H �Шϥγo�Ӫ����O�ӧ�s�K�X�G �m /email recovery <�q�l�a�}> �n' +usage_captcha: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /captcha �n' +wrong_captcha: '&8[&6�Τ�t��&8] &c�A��J�F���~�����ҽX�A�Шϥ� �m /captcha <���ҽX> �n �A����J�C' +valid_captcha: '&8[&6�Τ�t��&8] &c�A�ҿ�J�����ҽX�O�L�Ī� �I' +kick_forvip: '&c�]����VIP���a�n�J�F���A���C' +kick_fullserver: '&c��p�I �]�����A�����H�F�A�ҥH�A�ثe����n�J���A���C' +usage_email_add: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /email add <�q�l> <���йq�l> �n' +usage_email_change: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /email change <�¹q�l> <�s�q�l> �n' +usage_email_recovery: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /email recovery <�q�l> �n' +new_email_invalid: '&8[&6�Τ�t��&8] �A�Ҷ�g���s�q�l�a�}�ä����T�C' +old_email_invalid: '&8[&6�Τ�t��&8] �A�Ҷ�g���¹q�l�a�}�ä����T�C' +email_invalid: '&8[&6�Τ�t��&8] �A�Ҷ�g���q�l�a�}�ä����T�C' +email_added: '&8[&6�Τ�t��&8] �w�[�J�A���q�l�a�}�O���C' +email_confirm: '&8[&6�Τ�t��&8] �Э��п�J�A���q�l�a�}�C' +email_changed: '&8[&6�Τ�t��&8] �A���q�l�a�}�O���w���C' +email_send: '&8[&6�Τ�t��&8] �ѰO�K�X�H��w�H�X�A�Ьd���C' +country_banned: '&8[&6�Τ�t��&8] �����A���w�����A����a���ѹC���A�ȡC' +antibot_auto_enabled: '&8[&6�Τ�t��&8] �������H�{�Ǥw�]���{�ɤj�q���M�`���s�u�ӱҥΡC' +antibot_auto_disabled: '&8[&6�Τ�t��&8] �������H�{���ˬd�줣���`�s���Ƥw��֡A�é� %m �����ᰱ��B�@�C' diff --git a/src/main/resources/messages/messages_zhtw.yml b/src/main/resources/messages/messages_zhtw.yml index 5091f841..34c21311 100644 --- a/src/main/resources/messages/messages_zhtw.yml +++ b/src/main/resources/messages/messages_zhtw.yml @@ -39,7 +39,6 @@ usage_changepassword: '&b【AuthMe】&6用法: &c"/changepassword <舊密碼> < name_len: '&b【AuthMe】&6你的暱稱 太長 / 太短 了!' regex: '&b【AuthMe】&6暱稱裡包含不能使用的字符' add_email: '&b【AuthMe】&6請使用 &c"/email add <你的Email> <再次輸入你的Email>" &6來添加 Email' -bad_database_email: '&b【AuthMe】&6此指令只適用於有使用MySQL和SQLite的伺服器。' recovery_email: '&b【AuthMe】&6忘記密碼了嗎? 使用 &c"/email recovery <你的Email>"' usage_captcha: '&b【AuthMe】&6請用 &c"/captcha " &6來輸入你的驗證碼' wrong_captcha: '&b【AuthMe】&6錯誤的驗證碼' From e9cf5de663152155e3553a7318df862f7af5561a Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 14 Sep 2015 23:39:53 +0700 Subject: [PATCH 169/427] added ID messages translation. --- src/main/resources/messages/messages_id.yml | 58 +++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/main/resources/messages/messages_id.yml diff --git a/src/main/resources/messages/messages_id.yml b/src/main/resources/messages/messages_id.yml new file mode 100644 index 00000000..2b183f3d --- /dev/null +++ b/src/main/resources/messages/messages_id.yml @@ -0,0 +1,58 @@ +unknown_user: '&cTidak dapat menemukan user yg diminta di database!' +unsafe_spawn: '&cLokasi quit kamu tidak aman, kamu telah diteleport ke titik spawn world.' +not_logged_in: '&cKamu belum login!' +reg_voluntarily: 'Kamu bisa register menggunakan command "/register "' +usage_log: '&cUsage: /login ' +wrong_pwd: '&cPassword salah!' +unregistered: '&cUnregister berhasil!' +reg_disabled: '&cRegister dalam game tidak diaktifkan!' +valid_session: '&2Otomatis login, karena sesi masih terhubung.' +login: '&2Login berhasil!' +vb_nonActiv: '&cAkunmu belum diaktifkan, silahkan periksa email kamu!' +user_regged: '&cKamu telah mendaftarkan username ini!' +usage_reg: '&cUsage: /register ' +max_reg: '&Kamu telah mencapai batas maksimum pendaftaran di server ini!' +no_perm: '&4Kamu tidak mempunyai izin melakukan ini!' +error: '&4Terjadi kesalahan tak dikenal, silahkan hubungi Administrator!' +login_msg: '&cSilahkan login menggunakan command "/login "' +reg_msg: '&3Silahkan mendaftar ke server menggunakan command "/register "' +reg_email_msg: '&3Silahkan mendaftar ke server menggunakan command "/register "' +usage_unreg: '&cUsage: /unregister ' +pwd_changed: '&2Berhasil mengubah password!' +user_unknown: '&cUser ini belum terdaftar!' +password_error: '&cPassword tidak cocok, silahkan periksa dan ulangi kembali!' +password_error_nick: '&cKamu tidak bisa menggunakan namamu sebagai password, silahkan coba yg lain...' +password_error_unsafe: '&cPassword yg kamu pilih tidak aman, silahkan coba yg lain...' +invalid_session: '&cIP kamu telah berubah, dan sesi kamu telah berakhir!' +reg_only: '&4Hanya pengguna terdaftar yg bisa bergabung! Silahkan kunjungi http://example.com untuk mendaftar!' +logged_in: '&cKamu telah login!' +logout: '&2Berhasil logout!' +same_nick: '&4Username yg sama telah bermain di server ini!' +registered: '&2Register berhasil!' +pass_len: '&cPassword kamu terlalu panjang/pendek! Silahkan pilih yg lain!' +reload: '&2Konfigurasi dan database telah dimuat ulang!' +timeout: '&4Jangka waktu login telah habis, kamu di keluarkan dari server. Silahkan coba lagi!' +usage_changepassword: '&cUsage: /changepassword ' +name_len: '&4Username kamu terlalu panjang atau terlalu pendek!' +regex: '&4Username kamu mengandung karakter illegal. Karakter yg diijinkan: REG_EX' +add_email: '&3Silahkan tambahkan email ke akunmu menggunakan command "/email add "' +recovery_email: '&3Lupa password? silahkan gunakan command "/email recovery "' +usage_captcha: '&3Kamu harus menyelesaikan kode captcha untuk login, silahkan gunakan command "/captcha "' +wrong_captcha: '&cCaptcha salah, gunakan command "/captcha THE_CAPTCHA" pada chat!' +valid_captcha: '&2Kode captcha terselesaikan!' +kick_forvip: '&3Player VIP mencoba masuk pada saat server sedang penuh!' +kick_fullserver: '&4Server sedang penuh, silahkan coba lagi nanti!' +usage_email_add: '&cUsage: /email add ' +usage_email_change: '&cUsage: /email change ' +usage_email_recovery: '&cUsage: /email recovery ' +new_email_invalid: '&cEmail baru tidak valid, coba lagi!' +old_email_invalid: '&cEmail lama tidak valid, coba lagi!' +email_invalid: '&cAlamat email tidak valid, coba lagi!' +email_added: '&2Berhasil menambahkan alamat email ke akunmu!' +email_confirm: '&cSilahkan konfirmasi alamat email kamu!' +email_changed: '&2Alamat email telah diubah dengan benar!' +email_send: '&2Email pemulihan akun telah dikirim! Silahkan periksa kotak masuk emailmu!' +email_exists: '&cEmail pemulihan sudah dikirim! kamu bisa membatalkan dan mengirimkan yg baru dengan command dibawah:' +country_banned: '&4Your country is banned from this server!' +antibot_auto_enabled: '&4[AntiBotService] AntiBot diaktifkan dikarenakan banyak koneksi yg diterima!' +antibot_auto_disabled: '&2[AntiBotService] AntiBot dimatikan setelah %m menit!' From 7add63869ee729160ff48efdc535414340b418c3 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 00:02:52 +0700 Subject: [PATCH 170/427] no need to rewrite language file. fix #206 --- .../authme/settings/CustomConfiguration.java | 1 - .../fr/xephi/authme/settings/Messages.java | 50 +------------------ 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java index abf63700..ae274ca5 100644 --- a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java +++ b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java @@ -17,7 +17,6 @@ public class CustomConfiguration extends YamlConfiguration { public CustomConfiguration(File file) { this.configFile = file; - load(); } diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index 4ddb9519..f9c7272a 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -13,59 +13,11 @@ public class Messages extends CustomConfiguration { public Messages(File file, String lang) { super(file); - loadDefaults(file); - loadFile(); - saveDefaults(file); + load(); singleton = this; this.lang = lang; } - /** - * Loads a file from the plugin jar and sets as default - * - * @param file The filename to open - */ - public final void loadDefaults(File file) { - if (file.isFile()) { - setDefaults(YamlConfiguration.loadConfiguration(file)); - } - } - - /** - * Saves the configuration to disk - * - * @return True if saved successfully - */ - public final boolean saved(File file) { - try { - save(file); - return true; - } catch (Exception ex) { - return false; - } - } - - /** - * Saves current configuration (plus defaults) to disk. - *

    - * If defaults and configuration are empty, saves blank file. - * - * @return True if saved successfully - */ - public final boolean saveDefaults(File file) { - options().copyDefaults(true); - options().copyHeader(true); - boolean success = saved(file); - options().copyDefaults(false); - options().copyHeader(false); - return success; - } - - private void loadFile() { - load(); - save(); - } - public void send(CommandSender sender, String msg) { if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) singleton.reloadMessages(); From b458547a176e90a28eee17ea7a95e70880c65864 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Tue, 15 Sep 2015 00:21:04 +0200 Subject: [PATCH 171/427] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7b5562aa..ce943cac 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ fr.xephi authme - 5.0-SNAPSHOT + 5.1-SNAPSHOT AuthMeReloaded Authentication plugin for CraftBukkit/Spigot! From 232f332be250cc1b32083048ef33b0401db4d840 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 13:43:39 +0700 Subject: [PATCH 172/427] revert, bad file encoding. --- src/main/resources/messages/messages_zhhk.yml | 115 +++++++++--------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/src/main/resources/messages/messages_zhhk.yml b/src/main/resources/messages/messages_zhhk.yml index db8b158b..b20ec71a 100644 --- a/src/main/resources/messages/messages_zhhk.yml +++ b/src/main/resources/messages/messages_zhhk.yml @@ -1,60 +1,59 @@ # Translator: uSoc_lifehome (http://lifeho.me) # -# Translator: WaterXCubic ����� # # -------------------------------------------- # -unknown_user: '&8[&6�Τ�t��&8] &f�Τ��ƨä��s�b���Ʈw���C' -unsafe_spawn: '&8[&6�Τ�t��&8] &f�A���n�X��m���w���A�{�b�N�ǰe�A�쭫���I�C' -not_logged_in: '&8[&6�Τ�t��&8] &c�A�٨S���n�J �I' -reg_voluntarily: '&8[&6�Τ�t��&8] &f�A�i�H�ϥγo�Ӫ����O�ӵ��U�G �m /register <�K�X> <���бK�X> �n' -usage_log: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /login <�K�X> �n' -wrong_pwd: '&8[&6�Τ�t��&8] &c�A��J�F���~���K�X�C' -unregistered: '&8[&6�Τ�t��&8] &c�A�w���\�����|�����U�O���C' -reg_disabled: '&8[&6�Τ�t��&8] &c�����A���w����s���a���U�C' -valid_session: '&8[&6�Τ�t��&8] &b�� �I �ڰO�o�A�A�w��^�ӡ�' -login: '&8[&6�Τ�t��&8] &c�A���\���n�J�F�C' -password_error_nick: '&f�A���i�H�ϥΧA���W�r���K�X!' -password_error_unsafe: '&f�A���i�H�ϥΤ��w�����K�X' -vb_nonActiv: '&8[&6�Τ�t��&8] &f�A���b���٨S���g�L�q�l���� �I' -user_regged: '&8[&6�Τ�t��&8] &c���Τ�W�w�g���U�L�F�C' -usage_reg: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /register <�K�X> <���бK�X> �n' -max_reg: '&8[&6�Τ�t��&8] &f�A��IP�a�}�w�F����U�ƤW���C' -no_perm: '&8[&6�Τ�t��&8] &b�A�i�H�� CraftingHK ���a�ʬ줤�d�ݻ������C' -error: '&8[&6�Τ�t��&8] &f�o�Ϳ��~�A�лP�޲z���p���C' -login_msg: '&8[&6�Τ�t��&8] &c�Шϥγo�ӫ��O�ӵn�J�G �m /login <�K�X> �n' -reg_msg: '&8[&6�Τ�t��&8] &c�Шϥγo�Ӫ����O�ӵ��U�G �m /register <�K�X> <���бK�X> �n' -reg_email_msg: '&8[&6�Τ�t��&8] &c�Шϥγo�Ӫ����O�ӵ��U�G �m /register <�q�l> <���йq�l> �n' -usage_unreg: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /unregister <�K�X> �n' -pwd_changed: '&8[&6�Τ�t��&8] &c�A���\���󴫤F�A���K�X �I' -user_unknown: '&8[&6�Τ�t��&8] &c���Τ�W�S���w�n�O��ơC' -password_error: '&8[&6�Τ�t��&8] &f�K�X���ŦX�C' -invalid_session: '&8[&6�Τ�t��&8] &f�n�J���q��Ƥw�l�a�A�е��ݵn�J���q�����C' -reg_only: '&8[&6�Τ�t��&8] &f���w���U�|���A�Х��� https://www.example.com/ ���U�C' -logged_in: '&8[&6�Τ�t��&8] &c�A�w�g�n�J�L�F�C' -logout: '&8[&6�Τ�t��&8] &b�A���\���n�X�F�C' -same_nick: '&8[&6�Τ�t��&8] &f�P�W���a�w�b�C���C' -registered: '&8[&6�Τ�t��&8] &b�A���\�����U�F�C' -pass_len: '&8[&6�Τ�t��&8] &f�A���K�X�ä��ŦX�W�w���סC' -reload: '&8[&6�Τ�t��&8] &b�n�J�t�γ]�w�θ�Ʈw���s���J�����C' -timeout: '&8[&6�Τ�t��&8] &f�n�J�O�ɡC' -usage_changepassword: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /changepassword <�±K�X> <�s�K�X> �n' -name_len: '&8[&6�Τ�t��&8] &c�A���Τ�W���ŦX�W�w���סC' -regex: '&8[&6�Τ�t��&8] &c�A���Τ�W�t�����e�\���r�šC�H�U����\���r���G REG_EX' -add_email: '&8[&6�Τ�t��&8] &b�Ь��A���b��ߧY�K�[�q�l�a�}�G �m /email add <�q�l�a�}> <���йq�l�a�}> �n' -recovery_email: '&8[&6�Τ�t��&8] &c�ѰO�K�X �H �Шϥγo�Ӫ����O�ӧ�s�K�X�G �m /email recovery <�q�l�a�}> �n' -usage_captcha: '&8[&6�Τ�t��&8] &c�Ϊk�G �m /captcha �n' -wrong_captcha: '&8[&6�Τ�t��&8] &c�A��J�F���~�����ҽX�A�Шϥ� �m /captcha <���ҽX> �n �A����J�C' -valid_captcha: '&8[&6�Τ�t��&8] &c�A�ҿ�J�����ҽX�O�L�Ī� �I' -kick_forvip: '&c�]����VIP���a�n�J�F���A���C' -kick_fullserver: '&c��p�I �]�����A�����H�F�A�ҥH�A�ثe����n�J���A���C' -usage_email_add: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /email add <�q�l> <���йq�l> �n' -usage_email_change: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /email change <�¹q�l> <�s�q�l> �n' -usage_email_recovery: '&8[&6�Τ�t��&8] &f�Ϊk�G �m /email recovery <�q�l> �n' -new_email_invalid: '&8[&6�Τ�t��&8] �A�Ҷ�g���s�q�l�a�}�ä����T�C' -old_email_invalid: '&8[&6�Τ�t��&8] �A�Ҷ�g���¹q�l�a�}�ä����T�C' -email_invalid: '&8[&6�Τ�t��&8] �A�Ҷ�g���q�l�a�}�ä����T�C' -email_added: '&8[&6�Τ�t��&8] �w�[�J�A���q�l�a�}�O���C' -email_confirm: '&8[&6�Τ�t��&8] �Э��п�J�A���q�l�a�}�C' -email_changed: '&8[&6�Τ�t��&8] �A���q�l�a�}�O���w���C' -email_send: '&8[&6�Τ�t��&8] �ѰO�K�X�H��w�H�X�A�Ьd���C' -country_banned: '&8[&6�Τ�t��&8] �����A���w�����A����a���ѹC���A�ȡC' -antibot_auto_enabled: '&8[&6�Τ�t��&8] �������H�{�Ǥw�]���{�ɤj�q���M�`���s�u�ӱҥΡC' -antibot_auto_disabled: '&8[&6�Τ�t��&8] �������H�{���ˬd�줣���`�s���Ƥw��֡A�é� %m �����ᰱ��B�@�C' +unknown_user: '&8[&6用戶系統&8] &f用戶資料並不存在於資料庫中。' +unsafe_spawn: '&8[&6用戶系統&8] &f你的登出位置不安全,現在將傳送你到重生點。' +not_logged_in: '&8[&6用戶系統&8] &c你還沒有登入 !' +reg_voluntarily: '&8[&6用戶系統&8] &f你可以使用這個的指令來註冊: 《 /register <密碼> <重覆密碼> 》' +usage_log: '&8[&6用戶系統&8] &c用法: 《 /login <密碼> 》' +wrong_pwd: '&8[&6用戶系統&8] &c你輸入了錯誤的密碼。' +unregistered: '&8[&6用戶系統&8] &c你已成功取消會員註冊記錄。' +reg_disabled: '&8[&6用戶系統&8] &c本伺服器已停止新玩家註冊。' +valid_session: '&8[&6用戶系統&8] &b嗨 ! 我記得你,歡迎回來~' +login: '&8[&6用戶系統&8] &c你成功的登入了。' +password_error_nick: '&fYou can''t use your name as password' +password_error_unsafe: '&fYou can''t use unsafe passwords' +vb_nonActiv: '&8[&6用戶系統&8] &f你的帳戶還沒有經過電郵驗證 !' +user_regged: '&8[&6用戶系統&8] &c此用戶名已經註冊過了。' +usage_reg: '&8[&6用戶系統&8] &c用法: 《 /register <密碼> <重覆密碼> 》' +max_reg: '&8[&6用戶系統&8] &f你的IP地址已達到註冊數上限。' +no_perm: '&8[&6用戶系統&8] &b你可以到 CraftingHK 玩家百科中查看說明文件。' +error: '&8[&6用戶系統&8] &f發生錯誤,請與管理員聯絡。' +login_msg: '&8[&6用戶系統&8] &c請使用這個指令來登入: 《 /login <密碼> 》' +reg_msg: '&8[&6用戶系統&8] &c請使用這個的指令來註冊: 《 /register <密碼> <重覆密碼> 》' +reg_email_msg: '&8[&6用戶系統&8] &c請使用這個的指令來註冊: 《 /register <電郵> <重覆電郵> 》' +usage_unreg: '&8[&6用戶系統&8] &c用法: 《 /unregister <密碼> 》' +pwd_changed: '&8[&6用戶系統&8] &c你成功的更換了你的密碼 !' +user_unknown: '&8[&6用戶系統&8] &c此用戶名沒有已登記資料。' +password_error: '&8[&6用戶系統&8] &f密碼不符合。' +invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞,請等待登入階段結束。' +reg_only: '&8[&6用戶系統&8] &f限已註冊會員,請先到 https://www.example.com/ 註冊。' +logged_in: '&8[&6用戶系統&8] &c你已經登入過了。' +logout: '&8[&6用戶系統&8] &b你成功的登出了。' +same_nick: '&8[&6用戶系統&8] &f同名玩家已在遊玩。' +registered: '&8[&6用戶系統&8] &b你成功的註冊了。' +pass_len: '&8[&6用戶系統&8] &f你的密碼並不符合規定長度。' +reload: '&8[&6用戶系統&8] &b登入系統設定及資料庫重新載入完畢。' +timeout: '&8[&6用戶系統&8] &f登入逾時。' +usage_changepassword: '&8[&6用戶系統&8] &f用法: 《 /changepassword <舊密碼> <新密碼> 》' +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] &c用法: 《 /captcha <驗證碼> 》' +wrong_captcha: '&8[&6用戶系統&8] &c你輸入了錯誤的驗證碼,請使用 《 /captcha <驗證碼> 》 再次輸入。' +valid_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼是無效的 !' +kick_forvip: '&c因為有VIP玩家登入了伺服器。' +kick_fullserver: '&c抱歉! 因為伺服器滿人了,所以你目前未能登入伺服器。' +usage_email_add: '&8[&6用戶系統&8] &f用法: 《 /email add <電郵> <重覆電郵> 》' +usage_email_change: '&8[&6用戶系統&8] &f用法: 《 /email change <舊電郵> <新電郵> 》' +usage_email_recovery: '&8[&6用戶系統&8] &f用法: 《 /email recovery <電郵> 》' +new_email_invalid: '&8[&6用戶系統&8] 你所填寫的新電郵地址並不正確。' +old_email_invalid: '&8[&6用戶系統&8] 你所填寫的舊電郵地址並不正確。' +email_invalid: '&8[&6用戶系統&8] 你所填寫的電郵地址並不正確。' +email_added: '&8[&6用戶系統&8] 已加入你的電郵地址記錄。' +email_confirm: '&8[&6用戶系統&8] 請重覆輸入你的電郵地址。' +email_changed: '&8[&6用戶系統&8] 你的電郵地址記錄已更改。' +email_send: '&8[&6用戶系統&8] 忘記密碼信件已寄出,請查收。' +country_banned: '&8[&6用戶系統&8] 本伺服器已停止對你的國家提供遊戲服務。' +antibot_auto_enabled: '&8[&6用戶系統&8] 防止機械人程序已因應現時大量不尋常的連線而啟用。' +antibot_auto_disabled: '&8[&6用戶系統&8] 防止機械人程序檢查到不正常連接數已減少,並於 %m 分鐘後停止運作。' From e1b2a1852cc0302bd155755e4a3054dceba2b33d Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 14:33:23 +0700 Subject: [PATCH 173/427] update ConsoleLogger --- .../java/fr/xephi/authme/ConsoleLogger.java | 46 ++++++------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index 4305f85d..a632282a 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -1,33 +1,27 @@ package fr.xephi.authme; import com.google.common.base.Throwables; +import fr.xephi.authme.api.NewAPI; import fr.xephi.authme.settings.Settings; -import org.bukkit.Bukkit; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.StandardOpenOption; import java.text.DateFormat; -import java.util.Calendar; +import java.util.Date; import java.util.logging.Logger; public class ConsoleLogger { - private static final Logger log = Logger.getLogger("AuthMe"); + private static final Logger log = AuthMe.getInstance().getLogger(); + private static final DateFormat format = DateFormat.getDateTimeInstance(); + public static void info(String message) { if (AuthMe.getInstance().isEnabled()) { log.info("[AuthMe] " + message); if (Settings.useLogging) { - Calendar date = Calendar.getInstance(); - final String actually = "[" + DateFormat.getDateInstance().format(date.getTime()) + ", " + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + "] " + message; - Bukkit.getScheduler().runTaskAsynchronously(AuthMe.getInstance(), new Runnable() { - @Override - public void run() { - writeLog(actually); - } - }); + writeLog("[" + format.format(new Date()) + "] " + message); } } } @@ -36,31 +30,21 @@ public class ConsoleLogger { if (AuthMe.getInstance().isEnabled()) { log.warning("[AuthMe] " + message); if (Settings.useLogging) { - Calendar date = Calendar.getInstance(); - final String actually = "[" + DateFormat.getDateInstance().format(date.getTime()) + ", " + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + "] ERROR : " + message; - Bukkit.getScheduler().runTaskAsynchronously(AuthMe.getInstance(), new Runnable() { - @Override - public void run() { - writeLog(actually); - } - }); + writeLog("[" + format.format(new Date()) + "] ERROR: " + message); } } } - public static void writeLog(String string) { + public static void writeLog(String message) { try { - FileWriter fw = new FileWriter(AuthMe.getInstance().getDataFolder() + File.separator + "authme.log", true); - BufferedWriter w = new BufferedWriter(fw); - w.write(string); - w.newLine(); - w.close(); - } catch (IOException e) { - e.printStackTrace(); + Files.write(Settings.LOG_FILE.toPath(), (message + NewAPI.newline).getBytes(), + StandardOpenOption.APPEND, + StandardOpenOption.CREATE); + } catch (IOException ignored) { } } - public static void writeStackTrace(Exception ex){ + public static void writeStackTrace(Exception ex) { writeLog(Throwables.getStackTraceAsString(ex)); } } From 91d6ead4665ab6d85c6bd68b8ee5ae52aff20622 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 14:34:07 +0700 Subject: [PATCH 174/427] update ConsoleLogger --- src/main/java/fr/xephi/authme/settings/Settings.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 7b6758f4..d57a82cf 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -20,9 +20,11 @@ public final class Settings extends YamlConfiguration { public static Boolean antiBotInAction = false; public static final File PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); + public static final File MODULE_FOLDER = new File(PLUGIN_FOLDER, "modules"); public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); public static final File AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db"); public static final File SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml"); + public static final File LOG_FILE = new File(PLUGIN_FOLDER, "authme.log"); public static File messageFile; public static List allowCommands; From 3620b712b76af7abad87adc5d9cfd00b4a93b5dc Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 14:38:55 +0700 Subject: [PATCH 175/427] improve DatabaseCalls, --- src/main/java/fr/xephi/authme/AuthMe.java | 55 +-- .../xephi/authme/cache/auth/PlayerCache.java | 2 +- .../authme/datasource/CacheDataSource.java | 19 +- .../xephi/authme/datasource/DataSource.java | 2 +- .../authme/datasource/DatabaseCalls.java | 345 +++--------------- .../fr/xephi/authme/datasource/MySQL.java | 13 +- .../fr/xephi/authme/process/Management.java | 6 +- 7 files changed, 109 insertions(+), 333 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 0a1e3579..6f2bd2fd 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -53,13 +53,14 @@ import java.util.zip.GZIPInputStream; public class AuthMe extends JavaPlugin { - private final Server server = getServer(); - private static Logger authmeLogger = Logger.getLogger("AuthMe"); private static AuthMe authme; + + private final Server server = getServer(); + private final Logger authmeLogger = Logger.getLogger("AuthMe"); public Management management; public NewAPI api; private Utils utils = Utils.getInstance(); - public SendMailSSL mail = null; + public SendMailSSL mail; private Settings settings; private Messages m; public DataManager dataManager; @@ -70,8 +71,8 @@ public class AuthMe extends JavaPlugin { public Permission permission; public Essentials ess; public Location essentialsSpawn; - public MultiverseCore multiverse = null; - public LookupService lookupService = null; + public MultiverseCore multiverse; + public LookupService lookupService; public CitizensCommunicator citizens; public boolean isCitizensActive = false; public boolean CombatTag = false; @@ -82,7 +83,6 @@ public class AuthMe extends JavaPlugin { public ConcurrentHashMap captcha = new ConcurrentHashMap<>(); public ConcurrentHashMap cap = new ConcurrentHashMap<>(); public ConcurrentHashMap realIp = new ConcurrentHashMap<>(); - protected static String vgUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; public static AuthMe getInstance() { return authme; @@ -131,14 +131,6 @@ public class AuthMe extends JavaPlugin { // Setup otherAccounts file otherAccounts = OtherAccounts.getInstance(); - // Configuration Security Warnings - if (!Settings.isForceSingleSessionEnabled) { - ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); - } - if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { - ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); - } - // Setup messages m = Messages.getInstance(); @@ -148,8 +140,9 @@ public class AuthMe extends JavaPlugin { Metrics metrics = new Metrics(this); metrics.start(); ConsoleLogger.info("Metrics started successfully!"); - } catch (IOException e) { + } catch (Exception e) { // Failed to submit the metrics data + ConsoleLogger.writeStackTrace(e); ConsoleLogger.showError("Can't start Metrics! The plugin will work anyway..."); } @@ -258,8 +251,8 @@ public class AuthMe extends JavaPlugin { // Reload support hook if (Settings.reloadSupport) { - int playersOnline = Utils.getOnlinePlayers().size(); if (database != null) { + int playersOnline = Utils.getOnlinePlayers().size(); if (playersOnline < 1) { database.purgeLogged(); } else { @@ -281,15 +274,15 @@ public class AuthMe extends JavaPlugin { pm.registerEvents(new AuthMeServerListener(this), this); // Register commands - this.getCommand("authme").setExecutor(new AdminCommand(this)); - this.getCommand("register").setExecutor(new RegisterCommand(this)); - this.getCommand("login").setExecutor(new LoginCommand(this)); - this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); - this.getCommand("logout").setExecutor(new LogoutCommand(this)); - this.getCommand("unregister").setExecutor(new UnregisterCommand(this)); - this.getCommand("email").setExecutor(new EmailCommand(this)); - this.getCommand("captcha").setExecutor(new CaptchaCommand(this)); - this.getCommand("converter").setExecutor(new ConverterCommand(this)); + getCommand("authme").setExecutor(new AdminCommand(this)); + getCommand("register").setExecutor(new RegisterCommand(this)); + getCommand("login").setExecutor(new LoginCommand(this)); + getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); + getCommand("logout").setExecutor(new LogoutCommand(this)); + getCommand("unregister").setExecutor(new UnregisterCommand(this)); + getCommand("email").setExecutor(new EmailCommand(this)); + getCommand("captcha").setExecutor(new CaptchaCommand(this)); + getCommand("converter").setExecutor(new ConverterCommand(this)); // Purge on start if enabled autoPurge(); @@ -297,6 +290,14 @@ public class AuthMe extends JavaPlugin { // Start Email recall task if needed recallEmail(); + // Configuration Security Warnings + if (!Settings.isForceSingleSessionEnabled) { + ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); + } + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { + ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + } + // Sponsor messages ConsoleLogger.info("AuthMe hooks perfectly with the VERYGAMES server hosting!"); ConsoleLogger.info("Development builds are available on our jenkins, thanks to f14stelt."); @@ -331,6 +332,8 @@ public class AuthMe extends JavaPlugin { // Disabled correctly ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " disabled!"); + + authme = null; } // Stop/unload the server/plugin as defined in the configuration @@ -789,7 +792,7 @@ public class AuthMe extends JavaPlugin { @Deprecated public String getVeryGamesIP(Player player) { String realIP = player.getAddress().getAddress().getHostAddress(); - String sUrl = vgUrl; + String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; sUrl = sUrl.replace("%IP%", player.getAddress().getAddress().getHostAddress()).replace("%PORT%", "" + player.getAddress().getPort()); try { URL url = new URL(sUrl); diff --git a/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java b/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java index 8f39c0d3..491c33a4 100644 --- a/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java +++ b/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java @@ -8,7 +8,7 @@ public class PlayerCache { private ConcurrentHashMap cache; private PlayerCache() { - cache = new ConcurrentHashMap(); + cache = new ConcurrentHashMap<>(); } public void addPlayer(PlayerAuth auth) { diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 0b6dfe17..f9ba8898 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -11,21 +11,24 @@ import java.util.concurrent.ConcurrentHashMap; public class CacheDataSource implements DataSource { - private DataSource source; - public AuthMe plugin; + private final DataSource source; private ConcurrentHashMap cache = new ConcurrentHashMap<>(); - public CacheDataSource(AuthMe plugin, DataSource source) { - this.plugin = plugin; - this.source = source; + public CacheDataSource(AuthMe plugin, DataSource src) { + this.source = src; /* * We need to load all players in cache ... It will took more time to * load the server, but it will be much easier to check for an * isAuthAvailable ! */ - for (PlayerAuth auth : source.getAllAuths()) { - cache.put(auth.getNickname().toLowerCase(), auth); - } + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable(){ + @Override + public void run() { + for (PlayerAuth auth : source.getAllAuths()) { + cache.put(auth.getNickname().toLowerCase(), auth); + } + } + }); } @Override diff --git a/src/main/java/fr/xephi/authme/datasource/DataSource.java b/src/main/java/fr/xephi/authme/datasource/DataSource.java index 4592ec56..b89f13aa 100644 --- a/src/main/java/fr/xephi/authme/datasource/DataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/DataSource.java @@ -6,7 +6,7 @@ import java.util.List; public interface DataSource { - public enum DataSourceType { + enum DataSourceType { MYSQL, FILE, SQLITE, diff --git a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java index 1b3e0993..6b84c7d7 100644 --- a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java +++ b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java @@ -1,67 +1,42 @@ package fr.xephi.authme.datasource; +import fr.xephi.authme.cache.auth.PlayerAuth; + import java.util.ArrayList; import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import fr.xephi.authme.cache.auth.PlayerAuth; +import java.util.concurrent.*; public class DatabaseCalls implements DataSource { private DataSource database; + private final ExecutorService exec; public DatabaseCalls(DataSource database) { this.database = database; + this.exec = Executors.newCachedThreadPool(); } @Override public synchronized boolean isAuthAvailable(final String user) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.isAuthAvailable(user); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized PlayerAuth getAuth(final String user) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - PlayerAuth result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public PlayerAuth call() throws Exception { return database.getAuth(user); } }).get(); - } catch (InterruptedException e1) { - return null; - } catch (ExecutionException e1) { - return null; - } finally { - executor.shutdown(); - } - try { - return result; } catch (Exception e) { return null; } @@ -69,332 +44,183 @@ public class DatabaseCalls implements DataSource { @Override public synchronized boolean saveAuth(final PlayerAuth auth) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.saveAuth(auth); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized boolean updateSession(final PlayerAuth auth) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.updateSession(auth); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized boolean updatePassword(final PlayerAuth auth) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.updatePassword(auth); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized int purgeDatabase(final long until) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Integer result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Integer call() throws Exception { return database.purgeDatabase(until); } }).get(); - } catch (InterruptedException e1) { - return 0; - } catch (ExecutionException e1) { - return 0; - } finally { - executor.shutdown(); - } - try { - return result.intValue(); } catch (Exception e) { - return (0); + return -1; } } @Override public synchronized List autoPurgeDatabase(final long until) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - List result; try { - result = executor.submit(new Callable>() { - + return exec.submit(new Callable>() { public List call() throws Exception { return database.autoPurgeDatabase(until); } }).get(); - } catch (InterruptedException e1) { - return new ArrayList(); - } catch (ExecutionException e1) { - return new ArrayList(); - } finally { - executor.shutdown(); - } - try { - return result; } catch (Exception e) { - return (new ArrayList()); + return new ArrayList<>(); } } @Override public synchronized boolean removeAuth(final String user) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.removeAuth(user); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized boolean updateQuitLoc(final PlayerAuth auth) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.updateQuitLoc(auth); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized int getIps(final String ip) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Integer result; try { - result = executor.submit(new Callable() { + return exec.submit(new Callable() { public Integer call() throws Exception { return database.getIps(ip); } }).get(); - } catch (InterruptedException e1) { - return 0; - } catch (ExecutionException e1) { - return 0; - } finally { - executor.shutdown(); - } - try { - return result.intValue(); } catch (Exception e) { - return (0); + return -1; } } @Override public synchronized List getAllAuthsByName(final PlayerAuth auth) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - List result; try { - result = executor.submit(new Callable>() { - + return exec.submit(new Callable>() { public List call() throws Exception { return database.getAllAuthsByName(auth); } }).get(); - } catch (InterruptedException e1) { - return new ArrayList(); - } catch (ExecutionException e1) { - return new ArrayList(); - } finally { - executor.shutdown(); - } - try { - return result; } catch (Exception e) { - return (new ArrayList()); + return new ArrayList<>(); } } @Override public synchronized List getAllAuthsByIp(final String ip) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - List result; try { - result = executor.submit(new Callable>() { - + return exec.submit(new Callable>() { public List call() throws Exception { return database.getAllAuthsByIp(ip); } }).get(); - } catch (InterruptedException e1) { - return new ArrayList(); - } catch (ExecutionException e1) { - return new ArrayList(); - } finally { - executor.shutdown(); - } - try { - return result; } catch (Exception e) { - return (new ArrayList()); + return new ArrayList<>(); } } @Override public synchronized List getAllAuthsByEmail(final String email) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - List result; try { - result = executor.submit(new Callable>() { - + return exec.submit(new Callable>() { public List call() throws Exception { return database.getAllAuthsByEmail(email); } }).get(); - } catch (InterruptedException e1) { - return new ArrayList(); - } catch (ExecutionException e1) { - return new ArrayList(); - } finally { - executor.shutdown(); - } - try { - return result; } catch (Exception e) { - return (new ArrayList()); + return new ArrayList<>(); } } @Override public synchronized boolean updateEmail(final PlayerAuth auth) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.updateEmail(auth); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized boolean updateSalt(final PlayerAuth auth) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.updateSalt(auth); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized void close() { - database.close(); + try { + exec.shutdown(); + exec.awaitTermination(10, TimeUnit.SECONDS); + database.close(); + } catch (Exception e) { + e.printStackTrace(); + } } @Override @@ -405,8 +231,6 @@ public class DatabaseCalls implements DataSource { @Override public synchronized void purgeBanned(final List banned) { new Thread(new Runnable() { - - @Override public synchronized void run() { database.purgeBanned(banned); } @@ -420,139 +244,90 @@ public class DatabaseCalls implements DataSource { @Override public synchronized boolean isLogged(final String user) { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Boolean result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Boolean call() throws Exception { return database.isLogged(user); } }).get(); - } catch (InterruptedException e1) { - return false; - } catch (ExecutionException e1) { - return false; - } finally { - executor.shutdown(); - } - try { - return result.booleanValue(); } catch (Exception e) { - return (false); + return false; } } @Override public synchronized void setLogged(final String user) { - new Thread(new Runnable() { - - @Override + exec.execute(new Runnable() { public synchronized void run() { database.setLogged(user); } - }).start(); + }); } @Override public synchronized void setUnlogged(final String user) { - new Thread(new Runnable() { - - @Override + exec.execute(new Runnable() { public synchronized void run() { database.setUnlogged(user); } - }).start(); + }); } @Override public synchronized void purgeLogged() { - new Thread(new Runnable() { - - @Override + exec.execute(new Runnable() { public synchronized void run() { database.purgeLogged(); } - }).start(); + }); } @Override public synchronized int getAccountsRegistered() { - ExecutorService executor = Executors.newSingleThreadExecutor(); - Integer result; try { - result = executor.submit(new Callable() { - + return exec.submit(new Callable() { public Integer call() throws Exception { return database.getAccountsRegistered(); } }).get(); - } catch (InterruptedException e1) { - return 0; - } catch (ExecutionException e1) { - return 0; - } finally { - executor.shutdown(); - } - try { - return result.intValue(); } catch (Exception e) { - return (0); + return -1; } } @Override - public synchronized void updateName(final String oldone, - final String newone) { - new Thread(new Runnable() { - - @Override + public synchronized void updateName(final String oldone, final String newone) { + exec.execute(new Runnable() { public synchronized void run() { database.updateName(oldone, newone); } - }).start(); + }); } @Override public synchronized List getAllAuths() { - ExecutorService executor = Executors.newSingleThreadExecutor(); - List result; try { - result = executor.submit(new Callable>() { - + return exec.submit(new Callable>() { public List call() throws Exception { return database.getAllAuths(); } }).get(); - } catch (InterruptedException e1) { - return (new ArrayList()); - } catch (ExecutionException e1) { - return (new ArrayList()); - } finally { - executor.shutdown(); + } catch (Exception e) { + return new ArrayList<>(); } - return result; } @Override public List getLoggedPlayers() { - ExecutorService executor = Executors.newSingleThreadExecutor(); - List result; try { - result = executor.submit(new Callable>() { - + return exec.submit(new Callable>() { public List call() throws Exception { return database.getLoggedPlayers(); } }).get(); - } catch (InterruptedException e1) { - return (new ArrayList()); - } catch (ExecutionException e1) { - return (new ArrayList()); - } finally { - executor.shutdown(); + } catch (Exception e) { + return new ArrayList<>(); } - return result; } } diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index ee58973f..41adbeb2 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -235,14 +235,13 @@ public class MySQL implements DataSource { } } - @SuppressWarnings("resource") @Override public synchronized PlayerAuth getAuth(String user) { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; PlayerAuth pAuth = null; - int id = -1; + int id; try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); @@ -1019,7 +1018,7 @@ public class MySQL implements DataSource { @Override public List getAllAuths() { - List auths = new ArrayList(); + List auths = new ArrayList<>(); Connection con = null; PreparedStatement pst = null; ResultSet rs = null; @@ -1028,7 +1027,7 @@ public class MySQL implements DataSource { pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); rs = pst.executeQuery(); while (rs.next()) { - PlayerAuth pAuth = null; + PlayerAuth pAuth; int id = rs.getInt(columnID); if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) { 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), rs.getString(columnRealName)); @@ -1052,11 +1051,9 @@ public class MySQL implements DataSource { byte[] bytes = blob.getBytes(1, (int) blob.length()); pAuth.setHash(new String(bytes)); } - if (rsid != null) - rsid.close(); + rsid.close(); } - if (pAuth != null) - auths.add(pAuth); + auths.add(pAuth); } } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); diff --git a/src/main/java/fr/xephi/authme/process/Management.java b/src/main/java/fr/xephi/authme/process/Management.java index 479790e5..209e12a9 100644 --- a/src/main/java/fr/xephi/authme/process/Management.java +++ b/src/main/java/fr/xephi/authme/process/Management.java @@ -30,8 +30,7 @@ public class Management { this.pm = plugin.getServer().getPluginManager(); } - public void performLogin(final Player player, final String password, - final boolean forceLogin) { + public void performLogin(final Player player, final String password, final boolean forceLogin) { Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { @Override @@ -41,8 +40,7 @@ public class Management { }); } - public void performRegister(final Player player, final String password, - final String email) { + public void performRegister(final Player player, final String password, final String email) { Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { @Override From 3996c8cfcaf905669cafbc875963bd817faad071 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 15:03:00 +0700 Subject: [PATCH 176/427] this should not cause lag anymore if database cache is enabled. --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../java/fr/xephi/authme/datasource/CacheDataSource.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 6f2bd2fd..d1b48e61 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -56,7 +56,7 @@ public class AuthMe extends JavaPlugin { private static AuthMe authme; private final Server server = getServer(); - private final Logger authmeLogger = Logger.getLogger("AuthMe"); + private final Logger authmeLogger = getLogger(); public Management management; public NewAPI api; private Utils utils = Utils.getInstance(); diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index f9ba8898..a42c9ddf 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -41,12 +41,8 @@ public class CacheDataSource implements DataSource { user = user.toLowerCase(); if (cache.containsKey(user)) { return cache.get(user); - } else { - PlayerAuth auth = source.getAuth(user); - if (auth != null) - cache.put(user, auth); - return auth; } + return null; } @Override From f975fefd4a23e5e8f3c8bb377fa2916e1b01f682 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 15:39:45 +0700 Subject: [PATCH 177/427] run saveAuth async in CacheDataSource --- .../authme/datasource/CacheDataSource.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index a42c9ddf..d4b0772c 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -12,16 +12,18 @@ import java.util.concurrent.ConcurrentHashMap; public class CacheDataSource implements DataSource { private final DataSource source; + private final AuthMe plugin; private ConcurrentHashMap cache = new ConcurrentHashMap<>(); - public CacheDataSource(AuthMe plugin, DataSource src) { + public CacheDataSource(AuthMe pl, DataSource src) { + this.plugin = pl; this.source = src; /* * We need to load all players in cache ... It will took more time to * load the server, but it will be much easier to check for an * isAuthAvailable ! */ - plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable(){ + pl.getServer().getScheduler().runTaskAsynchronously(pl, new Runnable() { @Override public void run() { for (PlayerAuth auth : source.getAllAuths()) { @@ -46,12 +48,17 @@ public class CacheDataSource implements DataSource { } @Override - public synchronized boolean saveAuth(PlayerAuth auth) { - if (source.saveAuth(auth)) { - cache.put(auth.getNickname(), auth); - return true; - } - return false; + public synchronized boolean saveAuth(final PlayerAuth auth) { + cache.put(auth.getNickname(), auth); + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + if (!source.saveAuth(auth)) { + cache.remove(auth.getNickname()); + } + } + }); + return true; } @Override From c82aaa303d55c8cebb976d8a0427826919f580db Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 15:40:19 +0700 Subject: [PATCH 178/427] cleanup MySQL code. --- .../fr/xephi/authme/datasource/MySQL.java | 105 ++++++------------ 1 file changed, 34 insertions(+), 71 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 41adbeb2..289e5dc0 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -149,7 +149,7 @@ public class MySQL implements DataSource { } private synchronized Connection getConnection() throws SQLException { - Connection con = null; + Connection con; con = ds.getConnection(); return con; } @@ -290,6 +290,7 @@ public class MySQL implements DataSource { public synchronized boolean saveAuth(PlayerAuth auth) { Connection con = null; PreparedStatement pst = null; + ResultSet rs = null; try { con = getConnection(); if ((columnSalt == null || columnSalt.isEmpty()) || (auth.getSalt() == null || auth.getSalt().isEmpty())) { @@ -322,13 +323,11 @@ public class MySQL implements DataSource { } } if (Settings.getPasswordHash == HashAlgorithm.PHPBB) { - int id; - ResultSet rs = null; PreparedStatement pst2 = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;"); pst2.setString(1, auth.getNickname()); rs = pst2.executeQuery(); if (rs.next()) { - id = rs.getInt(columnID); + int id = rs.getInt(columnID); // Insert player in phpbb_user_group pst = con.prepareStatement("INSERT INTO " + Settings.getPhpbbPrefix + "user_group (group_id, user_id, group_leader, user_pending) VALUES (?,?,?,?);"); pst.setInt(1, Settings.getPhpbbGroup); @@ -368,16 +367,15 @@ public class MySQL implements DataSource { pst.executeUpdate(); pst.close(); } + rs.close(); pst2.close(); } if (Settings.getPasswordHash == HashAlgorithm.WORDPRESS) { - int id; - ResultSet rs = null; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;"); pst.setString(1, auth.getNickname()); rs = pst.executeQuery(); if (rs.next()) { - id = rs.getInt(columnID); + int id = rs.getInt(columnID); // First Name pst = con.prepareStatement("INSERT INTO " + Settings.getWordPressPrefix + "usermeta (user_id, meta_key, meta_value) VALUES (?,?,?);"); pst.setInt(1, id); @@ -463,15 +461,14 @@ public class MySQL implements DataSource { pst.executeUpdate(); pst.close(); } + rs.close(); } if (Settings.getPasswordHash == HashAlgorithm.XENFORO) { - int id; - ResultSet rs = null; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;"); pst.setString(1, auth.getNickname()); rs = pst.executeQuery(); if (rs.next()) { - id = rs.getInt(columnID); + int id = rs.getInt(columnID); // Insert password in the correct table pst = con.prepareStatement("INSERT INTO xf_user_authenticate (user_id, scheme_class, data) VALUES (?,?,?);"); pst.setInt(1, id); @@ -482,13 +479,13 @@ public class MySQL implements DataSource { pst.setBlob(3, blob); pst.executeUpdate(); } - if (rs != null && !rs.isClosed()) - rs.close(); + rs.close(); } } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { + close(rs); close(pst); close(con); } @@ -499,6 +496,7 @@ public class MySQL implements DataSource { public synchronized boolean updatePassword(PlayerAuth auth) { Connection con = null; PreparedStatement pst = null; + ResultSet rs = null; try { con = getConnection(); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnPassword + "=? WHERE LOWER(" + columnName + ")=?;"); @@ -507,13 +505,11 @@ public class MySQL implements DataSource { pst.executeUpdate(); pst.close(); if (Settings.getPasswordHash == HashAlgorithm.XENFORO) { - int id; - ResultSet rs = null; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getNickname()); rs = pst.executeQuery(); if (rs.next()) { - id = rs.getInt(columnID); + int id = rs.getInt(columnID); // Insert password in the correct table pst = con.prepareStatement("UPDATE xf_user_authenticate SET data=? WHERE " + columnID + "=?;"); byte[] bytes = auth.getHash().getBytes(); @@ -527,13 +523,13 @@ public class MySQL implements DataSource { pst.setInt(2, id); pst.executeUpdate(); } - if (rs != null && !rs.isClosed()) - rs.close(); + rs.close(); } } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); return false; } finally { + close(rs); close(pst); close(con); } @@ -585,7 +581,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List list = new ArrayList(); + List list = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + "(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -617,7 +613,7 @@ public class MySQL implements DataSource { con = getConnection(); if (Settings.getPasswordHash == HashAlgorithm.XENFORO) { int id; - ResultSet rs = null; + ResultSet rs; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, user); rs = pst.executeQuery(); @@ -753,37 +749,14 @@ public class MySQL implements DataSource { @Override public synchronized void close() { - try { - if (ds != null) - ds.close(); - } catch (Exception e) { - } + if (ds != null) + ds.close(); } - private void close(Statement st) { - if (st != null) { + private void close(AutoCloseable o) { + if (o != null) { try { - st.close(); - } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - - private void close(ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - - private void close(Connection con) { - if (con != null) { - try { - con.close(); + o.close(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); } @@ -795,7 +768,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List countIp = new ArrayList(); + List countIp = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); @@ -807,7 +780,7 @@ public class MySQL implements DataSource { return countIp; } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -820,7 +793,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List countIp = new ArrayList(); + List countIp = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); @@ -832,7 +805,7 @@ public class MySQL implements DataSource { return countIp; } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -845,7 +818,7 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List countEmail = new ArrayList(); + List countEmail = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); @@ -857,7 +830,7 @@ public class MySQL implements DataSource { return countEmail; } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -924,12 +897,10 @@ public class MySQL implements DataSource { pst.executeUpdate(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override @@ -945,12 +916,10 @@ public class MySQL implements DataSource { pst.executeUpdate(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override @@ -965,12 +934,10 @@ public class MySQL implements DataSource { pst.executeUpdate(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override @@ -978,7 +945,7 @@ public class MySQL implements DataSource { int result = 0; Connection con = null; PreparedStatement pst = null; - ResultSet rs = null; + ResultSet rs; try { con = getConnection(); pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";"); @@ -1008,12 +975,10 @@ public class MySQL implements DataSource { pst.executeUpdate(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override @@ -1042,7 +1007,7 @@ public class MySQL implements DataSource { } } if (Settings.getPasswordHash == HashAlgorithm.XENFORO) { - ResultSet rsid = null; + ResultSet rsid; pst = con.prepareStatement("SELECT * FROM xf_user_authenticate WHERE " + columnID + "=?;"); pst.setInt(1, id); rsid = pst.executeQuery(); @@ -1068,7 +1033,7 @@ public class MySQL implements DataSource { @Override public List getLoggedPlayers() { - List auths = new ArrayList(); + List auths = new ArrayList<>(); Connection con = null; PreparedStatement pst = null; ResultSet rs = null; @@ -1077,7 +1042,7 @@ public class MySQL implements DataSource { pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); rs = pst.executeQuery(); while (rs.next()) { - PlayerAuth pAuth = null; + PlayerAuth pAuth; int id = rs.getInt(columnID); if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) { 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), rs.getString(columnRealName)); @@ -1092,7 +1057,7 @@ public class MySQL implements DataSource { } } if (Settings.getPasswordHash == HashAlgorithm.XENFORO) { - ResultSet rsid = null; + ResultSet rsid; pst = con.prepareStatement("SELECT * FROM xf_user_authenticate WHERE " + columnID + "=?;"); pst.setInt(1, id); rsid = pst.executeQuery(); @@ -1101,11 +1066,9 @@ public class MySQL implements DataSource { byte[] bytes = blob.getBytes(1, (int) blob.length()); pAuth.setHash(new String(bytes)); } - if (rsid != null) - rsid.close(); + rsid.close(); } - if (pAuth != null) - auths.add(pAuth); + auths.add(pAuth); } } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); From 6f22aa779b0fbb52052b7dc9209c1e93e4e0ba90 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 16:23:56 +0700 Subject: [PATCH 179/427] sqlite fix, load AuthMe faster. --- src/main/java/fr/xephi/authme/AuthMe.java | 30 ++-- .../authme/datasource/SQLite_HIKARI.java | 162 +++++------------- 2 files changed, 58 insertions(+), 134 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index d1b48e61..e7fa120d 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -3,7 +3,6 @@ package fr.xephi.authme; import com.earth2me.essentials.Essentials; import com.maxmind.geoip.LookupService; import com.onarandombox.MultiverseCore.MultiverseCore; -import com.zaxxer.hikari.pool.PoolInitializationException; import fr.xephi.authme.api.API; import fr.xephi.authme.api.NewAPI; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -42,7 +41,6 @@ import org.mcstats.Metrics; import java.io.*; import java.net.URL; import java.net.URLConnection; -import java.sql.SQLException; import java.util.Calendar; import java.util.Collection; import java.util.Date; @@ -216,8 +214,9 @@ public class AuthMe extends JavaPlugin { // Connect to the database and setup tables try { setupDatabase(); - } catch (Exception ex) { - ConsoleLogger.writeStackTrace(ex); + } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); + ConsoleLogger.showError(e.getMessage()); ConsoleLogger.showError("Fatal error occurred during database connection! Authme initialization ABORTED!"); stopOrUnload(); return; @@ -353,9 +352,9 @@ public class AuthMe extends JavaPlugin { } // Initialize and setup the database - public void setupDatabase() throws ClassNotFoundException, PoolInitializationException, SQLException { + public void setupDatabase() throws Exception { // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI - int accounts; + boolean isSQLite = false; switch (Settings.getDataSource) { case FILE: database = new FlatFile(); @@ -365,18 +364,25 @@ public class AuthMe extends JavaPlugin { break; case SQLITE: database = new SQLite(); - accounts = database.getAccountsRegistered(); - if (accounts >= 4000) - ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); + isSQLite = true; break; case SQLITEHIKARI: database = new SQLite_HIKARI(); - accounts = database.getAccountsRegistered(); - if (accounts >= 8000) - ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); + isSQLite = true; break; } + if (isSQLite) { + server.getScheduler().runTaskAsynchronously(this, new Runnable() { + @Override + public void run() { + int accounts = database.getAccountsRegistered(); + if (accounts >= 4000) + ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); + } + }); + } + if (Settings.isCachingEnabled) { database = new CacheDataSource(this, database); } diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index de91d2bb..d0b14026 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -1,22 +1,16 @@ package fr.xephi.authme.datasource; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; -import com.zaxxer.hikari.pool.PoolInitializationException; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.settings.Settings; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; + public class SQLite_HIKARI implements DataSource { private String database; @@ -37,7 +31,7 @@ public class SQLite_HIKARI implements DataSource { private String columnLogged; private String columnRealName; - public SQLite_HIKARI() throws ClassNotFoundException, SQLException, PoolInitializationException { + public SQLite_HIKARI() throws ClassNotFoundException, SQLException { this.database = Settings.getMySQLDatabase; this.tableName = Settings.getMySQLTablename; this.columnName = Settings.getMySQLColumnName; @@ -55,61 +49,22 @@ public class SQLite_HIKARI implements DataSource { this.columnLogged = Settings.getMySQLColumnLogged; this.columnRealName = Settings.getMySQLColumnRealName; - // Set the connection arguments (and check if connection is ok) + // Set the connection arguments try { this.setConnectionArguments(); - } catch (ClassNotFoundException ne) { - ConsoleLogger.showError(ne.getMessage()); - ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new ClassNotFoundException(ne.getMessage()); - } catch (IllegalArgumentException ae) { // This means that there are problems with the hikaricp pool arguments! - ConsoleLogger.showError(ae.getMessage()); - ConsoleLogger.showError("Invalid database arguments! Please check your configuration!"); - ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new IllegalArgumentException(ae); - } catch (PoolInitializationException ie) { // Can't initialize the connection pool! - ConsoleLogger.showError(ie.getMessage()); - ConsoleLogger.showError("Can't connect to the SQLite database! Please check your configuration!"); - ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new PoolInitializationException(ie); + } catch (RuntimeException rt) { + ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer!"); + throw rt; } // Initialize the database try { this.setupConnection(); } catch (SQLException e) { - ConsoleLogger.showError(e.getMessage()); + this.close(); ConsoleLogger.showError("Can't initialize the SQLite database... Please check your database settings in the config.yml file! SHUTDOWN..."); ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new SQLException(e); + throw e; } } @@ -118,11 +73,10 @@ public class SQLite_HIKARI implements DataSource { return DataSourceType.SQLITEHIKARI; } - private synchronized void setConnectionArguments() - throws ClassNotFoundException, IllegalArgumentException { + private synchronized void setConnectionArguments() throws RuntimeException { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeSQLitePool"); - config.setDriverClassName("org.sqlite.JDBC"); + config.setDriverClassName("org.sqlite.JDBC"); // RuntimeException config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); config.setConnectionTestQuery("SELECT 1"); config.setMaxLifetime(180000); // 3 Min @@ -134,7 +88,7 @@ public class SQLite_HIKARI implements DataSource { private synchronized void reloadArguments() throws ClassNotFoundException, IllegalArgumentException { - if (ds != null){ + if (ds != null) { ds.close(); } setConnectionArguments(); @@ -142,9 +96,7 @@ public class SQLite_HIKARI implements DataSource { } private synchronized Connection getConnection() throws SQLException { - Connection con = null; - con = ds.getConnection(); - return con; + return ds.getConnection(); } private synchronized void setupConnection() throws SQLException { @@ -357,7 +309,7 @@ public class SQLite_HIKARI implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List list = new ArrayList(); + List list = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + "(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -492,7 +444,7 @@ public class SQLite_HIKARI implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List countIp = new ArrayList(); + List countIp = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); @@ -504,9 +456,9 @@ public class SQLite_HIKARI implements DataSource { return countIp; } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } catch (NullPointerException npe) { - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -519,7 +471,7 @@ public class SQLite_HIKARI implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List countIp = new ArrayList(); + List countIp = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); @@ -531,9 +483,9 @@ public class SQLite_HIKARI implements DataSource { return countIp; } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } catch (NullPointerException npe) { - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -546,7 +498,7 @@ public class SQLite_HIKARI implements DataSource { Connection con = null; PreparedStatement pst = null; ResultSet rs = null; - List countEmail = new ArrayList(); + List countEmail = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); @@ -558,9 +510,9 @@ public class SQLite_HIKARI implements DataSource { return countEmail; } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } catch (NullPointerException npe) { - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -622,12 +574,10 @@ public class SQLite_HIKARI implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override @@ -643,12 +593,10 @@ public class SQLite_HIKARI implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override @@ -663,19 +611,17 @@ public class SQLite_HIKARI implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override public int getAccountsRegistered() { Connection con = null; PreparedStatement pst = null; - ResultSet rs = null; + ResultSet rs; int result = 0; try { con = getConnection(); @@ -706,26 +652,24 @@ public class SQLite_HIKARI implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); close(con); } - return; } @Override public List getAllAuths() { Connection con = null; PreparedStatement pst = null; - ResultSet rs = null; - List auths = new ArrayList(); + ResultSet rs; + List auths = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); rs = pst.executeQuery(); while (rs.next()) { - PlayerAuth pAuth = null; + PlayerAuth pAuth; if (rs.getString(columnIp).isEmpty()) { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } else { @@ -735,8 +679,7 @@ public class SQLite_HIKARI implements DataSource { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } } - if (pAuth != null) - auths.add(pAuth); + auths.add(pAuth); } } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); @@ -752,14 +695,14 @@ public class SQLite_HIKARI implements DataSource { public List getLoggedPlayers() { Connection con = null; PreparedStatement pst = null; - ResultSet rs = null; - List auths = new ArrayList(); + ResultSet rs; + List auths = new ArrayList<>(); try { con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); rs = pst.executeQuery(); while (rs.next()) { - PlayerAuth pAuth = null; + PlayerAuth pAuth; if (rs.getString(columnIp).isEmpty()) { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } else { @@ -769,12 +712,10 @@ public class SQLite_HIKARI implements DataSource { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } } - if (pAuth != null) - auths.add(pAuth); + auths.add(pAuth); } } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return auths; } finally { close(pst); close(con); @@ -799,37 +740,14 @@ public class SQLite_HIKARI implements DataSource { @Override public synchronized void close() { - try { - if (ds != null) - ds.close(); - } catch (Exception e) { - } + if (ds != null) + ds.close(); } - private void close(Statement st) { - if (st != null) { + private void close(AutoCloseable o) { + if (o != null) { try { - st.close(); - } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - - private void close(ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - - private void close(Connection con) { - if (con != null) { - try { - con.close(); + o.close(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); } From c473e81eb9670421d46e304c9d7de74f389ce30e Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 16:31:07 +0700 Subject: [PATCH 180/427] same fix for normal sqlite --- .../fr/xephi/authme/datasource/SQLite.java | 90 ++++++------------- 1 file changed, 29 insertions(+), 61 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index a465ddd7..466dbe7f 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -1,19 +1,13 @@ package fr.xephi.authme.datasource; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -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.settings.Settings; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; + public class SQLite implements DataSource { private String database; @@ -34,7 +28,7 @@ public class SQLite implements DataSource { private String columnLogged; private String columnRealName; - public SQLite() { + public SQLite() throws ClassNotFoundException, SQLException { this.database = Settings.getMySQLDatabase; this.tableName = Settings.getMySQLTablename; this.columnName = Settings.getMySQLColumnName; @@ -55,29 +49,13 @@ public class SQLite implements DataSource { try { this.connect(); this.setup(); - } catch (ClassNotFoundException e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use SQLITE... ! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; - } catch (SQLException e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use SQLITE... ! SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - return; + } catch (ClassNotFoundException | SQLException cnf) { + ConsoleLogger.showError("Can't use SQLITE... !"); + throw cnf; } } - 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"); @@ -273,7 +251,7 @@ public class SQLite implements DataSource { public List autoPurgeDatabase(long until) { PreparedStatement pst = null; ResultSet rs = null; - List list = new ArrayList(); + List list = new ArrayList<>(); try { pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + "(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -423,7 +401,7 @@ public class SQLite implements DataSource { public List getAllAuthsByName(PlayerAuth auth) { PreparedStatement pst = null; ResultSet rs = null; - List countIp = new ArrayList(); + List countIp = new ArrayList<>(); try { pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, auth.getIp()); @@ -434,9 +412,9 @@ public class SQLite implements DataSource { return countIp; } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } catch (NullPointerException npe) { - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -447,7 +425,7 @@ public class SQLite implements DataSource { public List getAllAuthsByIp(String ip) { PreparedStatement pst = null; ResultSet rs = null; - List countIp = new ArrayList(); + List countIp = new ArrayList<>(); try { pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, ip); @@ -458,9 +436,9 @@ public class SQLite implements DataSource { return countIp; } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } catch (NullPointerException npe) { - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -471,7 +449,7 @@ public class SQLite implements DataSource { public List getAllAuthsByEmail(String email) { PreparedStatement pst = null; ResultSet rs = null; - List countEmail = new ArrayList(); + List countEmail = new ArrayList<>(); try { pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); pst.setString(1, email); @@ -482,9 +460,9 @@ public class SQLite implements DataSource { return countEmail; } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } catch (NullPointerException npe) { - return new ArrayList(); + return new ArrayList<>(); } finally { close(rs); close(pst); @@ -542,11 +520,9 @@ public class SQLite implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } - return; } @Override @@ -560,11 +536,9 @@ public class SQLite implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } - return; } @Override @@ -577,18 +551,16 @@ public class SQLite implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } - return; } @Override public int getAccountsRegistered() { int result = 0; PreparedStatement pst = null; - ResultSet rs = null; + ResultSet rs; try { pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";"); rs = pst.executeQuery(); @@ -614,23 +586,21 @@ public class SQLite implements DataSource { pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); - return; } finally { close(pst); } - return; } @Override public List getAllAuths() { - List auths = new ArrayList(); + List auths = new ArrayList<>(); PreparedStatement pst = null; - ResultSet rs = null; + ResultSet rs; try { pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); rs = pst.executeQuery(); while (rs.next()) { - PlayerAuth pAuth = null; + PlayerAuth pAuth; if (rs.getString(columnIp).isEmpty()) { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } else { @@ -640,8 +610,7 @@ public class SQLite implements DataSource { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } } - if (pAuth != null) - auths.add(pAuth); + auths.add(pAuth); } } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); @@ -654,14 +623,14 @@ public class SQLite implements DataSource { @Override public List getLoggedPlayers() { - List auths = new ArrayList(); + List auths = new ArrayList<>(); PreparedStatement pst = null; - ResultSet rs = null; + ResultSet rs; try { pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); rs = pst.executeQuery(); while (rs.next()) { - PlayerAuth pAuth = null; + PlayerAuth pAuth; if (rs.getString(columnIp).isEmpty()) { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } else { @@ -671,8 +640,7 @@ public class SQLite implements DataSource { pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); } } - if (pAuth != null) - auths.add(pAuth); + auths.add(pAuth); } } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage()); From 026d84427b23352beab72f052438a36868bb9637 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 15 Sep 2015 16:33:32 +0200 Subject: [PATCH 181/427] General npc support, fixes and enhancements --- pom.xml | 24 ----------------- src/main/java/fr/xephi/authme/AuthMe.java | 17 +----------- .../java/fr/xephi/authme/ConsoleLogger.java | 5 ++-- src/main/java/fr/xephi/authme/Utils.java | 9 +++++++ src/main/java/fr/xephi/authme/api/API.java | 5 ++-- src/main/java/fr/xephi/authme/api/NewAPI.java | 3 ++- .../xephi/authme/cache/backup/JsonCache.java | 1 - .../fr/xephi/authme/datasource/MySQL.java | 1 + .../authme/listener/AuthMeEntityListener.java | 13 ++++----- .../authme/listener/AuthMePlayerListener.java | 25 ++++++++--------- .../authme/listener/AuthMeServerListener.java | 6 ----- .../plugin/manager/CitizensCommunicator.java | 27 ------------------- .../authme/process/join/AsyncronousJoin.java | 2 +- .../authme/process/quit/AsyncronousQuit.java | 2 +- .../fr/xephi/authme/settings/Messages.java | 2 -- 15 files changed, 40 insertions(+), 102 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/plugin/manager/CitizensCommunicator.java diff --git a/pom.xml b/pom.xml index ce943cac..56c33e60 100644 --- a/pom.xml +++ b/pom.xml @@ -129,12 +129,6 @@ https://ci.drtshock.net/plugin/repository/everything - - - citizensapi-repo - http://ci.citizensnpcs.co/plugin/repository/project/CitizensAPI/LastSuccessful/repository - - minelink-thirdparty @@ -299,24 +293,6 @@ - - - net.citizensnpcs - citizensapi - 2.0.16-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - - com.onarandombox.multiversecore diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index e7fa120d..672df357 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -16,7 +16,6 @@ import fr.xephi.authme.converter.ForceFlatToSqlite; import fr.xephi.authme.datasource.*; import fr.xephi.authme.listener.*; import fr.xephi.authme.plugin.manager.BungeeCordMessage; -import fr.xephi.authme.plugin.manager.CitizensCommunicator; import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.plugin.manager.EssSpawn; import fr.xephi.authme.process.Management; @@ -71,8 +70,6 @@ public class AuthMe extends JavaPlugin { public Location essentialsSpawn; public MultiverseCore multiverse; public LookupService lookupService; - public CitizensCommunicator citizens; - public boolean isCitizensActive = false; public boolean CombatTag = false; public boolean legacyChestShop = false; public boolean antibotMod = false; @@ -98,9 +95,6 @@ public class AuthMe extends JavaPlugin { return m; } - public CitizensCommunicator getCitizensCommunicator() { - return citizens; - } @Override public void onEnable() { @@ -182,10 +176,6 @@ public class AuthMe extends JavaPlugin { // Find Permissions checkVault(); - // Check Citizens Version - citizens = new CitizensCommunicator(this); - checkCitizens(); - // Check Combat Tag Version checkCombatTag(); @@ -515,11 +505,6 @@ public class AuthMe extends JavaPlugin { this.CombatTag = server.getPluginManager().isPluginEnabled("CombatTag"); } - // Check if Citizens is active - public void checkCitizens() { - this.isCitizensActive = server.getPluginManager().isPluginEnabled("Citizens"); - } - // Check if a player/command sender have a permission public boolean authmePermissible(Player player, String perm) { if (player.hasPermission(perm)) { @@ -541,7 +526,7 @@ public class AuthMe extends JavaPlugin { // Save Player Data public void savePlayer(Player player) { - if ((citizens.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) { + if ((utils.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) { return; } String name = player.getName().toLowerCase(); diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index a632282a..f33ff152 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -14,14 +14,13 @@ import java.util.logging.Logger; public class ConsoleLogger { private static final Logger log = AuthMe.getInstance().getLogger(); - private static final DateFormat format = DateFormat.getDateTimeInstance(); public static void info(String message) { if (AuthMe.getInstance().isEnabled()) { log.info("[AuthMe] " + message); if (Settings.useLogging) { - writeLog("[" + format.format(new Date()) + "] " + message); + writeLog("[" + DateFormat.getDateTimeInstance().format(new Date()) + "] " + message); } } } @@ -30,7 +29,7 @@ public class ConsoleLogger { if (AuthMe.getInstance().isEnabled()) { log.warning("[AuthMe] " + message); if (Settings.useLogging) { - writeLog("[" + format.format(new Date()) + "] ERROR: " + message); + writeLog("[" + DateFormat.getDateTimeInstance().format(new Date()) + "] ERROR: " + message); } } } diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 563a76f6..eb794b48 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -8,6 +8,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import java.io.File; @@ -211,4 +212,12 @@ public class Utils { } return Collections.emptyList(); } + + public boolean isNPC(final Entity player) { + try { + return player.hasMetadata("NPC"); + } catch (Exception e) { + return false; + } + } } diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index 477494a2..eb9cf3ff 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -20,6 +20,7 @@ public class API { public static final String newline = System.getProperty("line.separator"); public static AuthMe instance; + private Utils utils = Utils.getInstance(); @Deprecated public API(AuthMe instance) { @@ -65,7 +66,7 @@ public class API { */ @Deprecated public boolean isaNPC(Player player) { - if (instance.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return true; return CombatTagComunicator.isNPC(player); } @@ -77,7 +78,7 @@ public class API { */ @Deprecated public boolean isNPC(Player player) { - if (instance.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return true; return CombatTagComunicator.isNPC(player); } diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 48ce0705..41b955e6 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -23,6 +23,7 @@ public class NewAPI { public static final String newline = System.getProperty("line.separator"); public static NewAPI singleton; public AuthMe plugin; + private Utils utils = Utils.getInstance(); public NewAPI(AuthMe plugin) { this.plugin = plugin; @@ -70,7 +71,7 @@ public class NewAPI { * @return true if player is a npc */ public boolean isNPC(Player player) { - return plugin.getCitizensCommunicator().isNPC(player) || CombatTagComunicator.isNPC(player); + return utils.isNPC(player) || CombatTagComunicator.isNPC(player); } /** diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index dce5a672..912a1509 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -19,7 +19,6 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Type; import java.nio.file.Files; -import java.nio.file.Paths; public class JsonCache { diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 289e5dc0..555ccf89 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -263,6 +263,7 @@ public class MySQL implements DataSource { } if (Settings.getPasswordHash == HashAlgorithm.XENFORO) { rs.close(); + pst.close(); pst = con.prepareStatement("SELECT * FROM xf_user_authenticate WHERE " + columnID + "=?;"); pst.setInt(1, id); rs = pst.executeQuery(); diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 16238133..90d5bd6e 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -15,6 +15,7 @@ import org.bukkit.event.entity.*; public class AuthMeEntityListener implements Listener { public AuthMe instance; + private Utils utils = Utils.getInstance(); public AuthMeEntityListener(AuthMe instance) { this.instance = instance; @@ -32,7 +33,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (instance.citizens.isNPC(entity)) + if (utils.isNPC(entity)) return; Player player = (Player) entity; @@ -64,7 +65,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (instance.citizens.isNPC(entity)) + if (utils.isNPC(entity)) return; Player player = (Player) entity; @@ -114,7 +115,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (instance.citizens.isNPC(entity)) + if (utils.isNPC(entity)) return; Player player = (Player) entity; @@ -141,7 +142,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (instance.citizens.isNPC(entity)) + if (utils.isNPC(entity)) return; Player player = (Player) entity; @@ -174,7 +175,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (instance.citizens.isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName())) { @@ -202,7 +203,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (instance.citizens.isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName())) { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 349112fb..4386664e 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -40,6 +40,7 @@ public class AuthMePlayerListener implements Listener { public static ConcurrentHashMap joinMessage = new ConcurrentHashMap<>(); private Messages m = Messages.getInstance(); public AuthMe plugin; + private Utils utils = Utils.getInstance(); public static ConcurrentHashMap causeByAuthMe = new ConcurrentHashMap<>(); private List antibot = new ArrayList<>(); @@ -305,7 +306,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { return; } @@ -440,7 +441,7 @@ public class AuthMePlayerListener implements Listener { final String name = player.getName().toLowerCase(); boolean isAuthAvailable = plugin.database.isAuthAvailable(name); - if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { return; } @@ -608,7 +609,7 @@ public class AuthMePlayerListener implements Listener { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) { @@ -636,7 +637,7 @@ public class AuthMePlayerListener implements Listener { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { @@ -667,7 +668,7 @@ public class AuthMePlayerListener implements Listener { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) { + if (utils.isNPC(player)) { return; } @@ -693,7 +694,7 @@ public class AuthMePlayerListener implements Listener { if (Utils.getInstance().isUnrestricted(player)) { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { return; @@ -732,7 +733,7 @@ public class AuthMePlayerListener implements Listener { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { @@ -762,7 +763,7 @@ public class AuthMePlayerListener implements Listener { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) { + if (utils.isNPC(player)) { return; } @@ -786,7 +787,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { return; } @@ -814,7 +815,7 @@ public class AuthMePlayerListener implements Listener { return; } - if (plugin.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { @@ -886,7 +887,7 @@ public class AuthMePlayerListener implements Listener { if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) return; - if (plugin.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -921,7 +922,7 @@ public class AuthMePlayerListener implements Listener { if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) return; - if (plugin.getCitizensCommunicator().isNPC(player)) + if (utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index f493af63..6ee60baa 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -63,10 +63,6 @@ public class AuthMeServerListener implements Listener { plugin.CombatTag = false; ConsoleLogger.info("CombatTag has been disabled, unhook!"); } - if (pluginName.equalsIgnoreCase("Citizens")) { - plugin.isCitizensActive = false; - ConsoleLogger.info("Citizens has been disabled, unhook!"); - } if (pluginName.equalsIgnoreCase("Vault")) { plugin.permission = null; ConsoleLogger.showError("Vault has been disabled, unhook permissions!"); @@ -84,8 +80,6 @@ public class AuthMeServerListener implements Listener { plugin.checkChestShop(); if (pluginName.equalsIgnoreCase("CombatTag")) plugin.checkCombatTag(); - if (pluginName.equalsIgnoreCase("Citizens")) - plugin.checkCitizens(); if (pluginName.equalsIgnoreCase("Vault")) plugin.checkVault(); } diff --git a/src/main/java/fr/xephi/authme/plugin/manager/CitizensCommunicator.java b/src/main/java/fr/xephi/authme/plugin/manager/CitizensCommunicator.java deleted file mode 100644 index d09a5fcd..00000000 --- a/src/main/java/fr/xephi/authme/plugin/manager/CitizensCommunicator.java +++ /dev/null @@ -1,27 +0,0 @@ -package fr.xephi.authme.plugin.manager; - -import org.bukkit.entity.Entity; - -import fr.xephi.authme.AuthMe; -import net.citizensnpcs.api.CitizensAPI; - -public class CitizensCommunicator { - - public AuthMe instance; - - public CitizensCommunicator(AuthMe instance) { - this.instance = instance; - } - - public boolean isNPC(final Entity player) { - if (!this.instance.isCitizensActive) - return false; - try { - return CitizensAPI.getNPCRegistry().isNPC(player); - } catch (NoClassDefFoundError ncdfe) { - return false; - } catch (Exception npe) { - return false; - } - } -} diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index b1db6afe..455a937f 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -58,7 +58,7 @@ public class AsyncronousJoin { AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode()); BukkitScheduler sched = plugin.getServer().getScheduler(); - if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { return; } diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index dd84fdc8..b6cca430 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -44,7 +44,7 @@ public class AsyncronousQuit { public void process() { if (player == null) return; - if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { return; } diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index f9c7272a..81c6a038 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -2,8 +2,6 @@ package fr.xephi.authme.settings; import fr.xephi.authme.ConsoleLogger; import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.YamlConfiguration; - import java.io.File; public class Messages extends CustomConfiguration { From 221b32744cd70e5f2789cdc5b1310e0ba2ed3225 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 22:43:19 +0700 Subject: [PATCH 182/427] fix string concatenates performance --- .../xephi/authme/cache/backup/JsonCache.java | 2 +- .../xephi/authme/commands/AdminCommand.java | 21 +++++----- .../process/login/AsyncronousLogin.java | 38 ++++++++----------- .../xephi/authme/security/crypts/PHPBB.java | 35 +++++++---------- .../authme/security/crypts/WORDPRESS.java | 18 ++++----- 5 files changed, 50 insertions(+), 64 deletions(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 912a1509..3203fae5 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -138,7 +138,7 @@ public class JsonCache { } } - private class PlayerDataDeserializer implements JsonDeserializer { + private static class PlayerDataDeserializer implements JsonDeserializer { @Override public DataFileCache deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { JsonObject jsonObject = jsonElement.getAsJsonObject(); diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 64b00031..13105c0f 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -156,7 +156,7 @@ public class AdminCommand implements CommandExecutor { @Override public void run() { PlayerAuth auth; - String message = "[AuthMe] "; + StringBuilder message = new StringBuilder("[AuthMe] "); try { auth = plugin.database.getAuth(arguments[1].toLowerCase()); } catch (NullPointerException npe) { @@ -179,25 +179,24 @@ public class AdminCommand implements CommandExecutor { int i = 0; for (String account : accountList) { i++; - message = message + account; + message.append(account); if (i != accountList.size()) { - message = message + ", "; + message.append(", "); } else { - message = message + "."; + message.append("."); } } sender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - sender.sendMessage(message); + sender.sendMessage(message.toString()); } }); return true; } else { final String[] arguments = args; Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override public void run() { - String message = "[AuthMe] "; + StringBuilder message = new StringBuilder("[AuthMe] "); if (arguments[1] == null) { sender.sendMessage("[AuthMe] Please put a valid IP"); return; @@ -214,15 +213,15 @@ public class AdminCommand implements CommandExecutor { int i = 0; for (String account : accountList) { i++; - message = message + account; + message.append(account); if (i != accountList.size()) { - message = message + ", "; + message.append(", "); } else { - message = message + "."; + message.append("."); } } sender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - sender.sendMessage(message); + sender.sendMessage(message.toString()); } }); return true; diff --git a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java index bfc7569e..e25c8457 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java @@ -1,15 +1,8 @@ package fr.xephi.authme.process.login; -import java.util.Date; -import java.util.List; - -import fr.xephi.authme.Utils; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -21,6 +14,12 @@ import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitTask; + +import java.util.Date; +import java.util.List; public class AsyncronousLogin { @@ -35,7 +34,7 @@ public class AsyncronousLogin { private Messages m = Messages.getInstance(); public AsyncronousLogin(Player player, String password, boolean forceLogin, - AuthMe plugin, DataSource data) { + AuthMe plugin, DataSource data) { this.player = player; this.password = password; name = player.getName().toLowerCase(); @@ -64,13 +63,9 @@ public class AsyncronousLogin { player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(name)).replace("", plugin.cap.get(name))); } return true; - } else - if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) { - try { - plugin.captcha.remove(name); - plugin.cap.remove(name); - } catch (NullPointerException npe) { - } + } else if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) { + plugin.captcha.remove(name); + plugin.cap.remove(name); } } return false; @@ -198,7 +193,6 @@ public class AsyncronousLogin { }); } else { m.send(player, "wrong_pwd"); - return; } } else { ConsoleLogger.showError("Player " + name + " wasn't online during login process, aborted... "); @@ -221,17 +215,17 @@ public class AsyncronousLogin { if (auths.size() == 1) { return; } - String message = "[AuthMe] "; + StringBuilder message = new StringBuilder("[AuthMe] "); // String uuidaccounts = // "[AuthMe] PlayerNames has %size% links to this UUID : "; int i = 0; for (String account : auths) { i++; - message = message + account; + message.append(account); if (i != auths.size()) { - message = message + ", "; + message.append(", "); } else { - message = message + "."; + message.append("."); } } /* @@ -243,7 +237,7 @@ public class AsyncronousLogin { for (Player player : Utils.getOnlinePlayers()) { if (plugin.authmePermissible(player, "authme.seeOtherAccounts")) { player.sendMessage("[AuthMe] The player " + auth.getNickname() + " has " + auths.size() + " accounts"); - player.sendMessage(message); + player.sendMessage(message.toString()); // player.sendMessage(uuidaccounts.replace("%size%", // ""+uuidlist.size())); } diff --git a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java index fc2f1896..07eeef68 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java +++ b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java @@ -10,7 +10,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** - * * @author stefano */ public class PHPBB implements EncryptionMethod { @@ -20,19 +19,16 @@ public class PHPBB implements EncryptionMethod { public String phpbb_hash(String password, String salt) { String random_state = salt; - String random = ""; + StringBuilder random = new StringBuilder(); int count = 6; - if (random.length() < count) { - random = ""; - for (int i = 0; i < count; i += 16) { - random_state = md5(salt + random_state); - random += pack(md5(random_state)); - } - random = random.substring(0, count); + for (int i = 0; i < count; i += 16) { + random_state = md5(salt + random_state); + random.append(pack(md5(random_state))); } - String hash = _hash_crypt_private(password, _hash_gensalt_private(random, itoa64)); - if (hash.length() == 34) + String hash = _hash_crypt_private(password, _hash_gensalt_private(random.substring(0, count), itoa64)); + if (hash.length() == 34) { return hash; + } return md5(password); } @@ -40,9 +36,8 @@ public class PHPBB implements EncryptionMethod { return _hash_gensalt_private(input, itoa64, 6); } - @SuppressWarnings("unused") private String _hash_gensalt_private(String input, String itoa64, - int iteration_count_log2) { + int iteration_count_log2) { if (iteration_count_log2 < 4 || iteration_count_log2 > 31) { iteration_count_log2 = 8; } @@ -109,9 +104,7 @@ public class PHPBB implements EncryptionMethod { MessageDigest md5er = MessageDigest.getInstance("MD5"); byte[] hash = md5er.digest(bytes); return bytes2hex(hash); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } catch (UnsupportedEncodingException e) { + } catch (GeneralSecurityException | UnsupportedEncodingException e) { throw new RuntimeException(e); } } @@ -126,9 +119,9 @@ public class PHPBB implements EncryptionMethod { } private static String bytes2hex(byte[] bytes) { - StringBuffer r = new StringBuffer(32); - for (int i = 0; i < bytes.length; i++) { - String x = Integer.toHexString(bytes[i] & 0xff); + StringBuilder r = new StringBuilder(32); + for (byte b : bytes) { + String x = Integer.toHexString(b & 0xff); if (x.length() < 2) r.append("0"); r.append(x); @@ -137,7 +130,7 @@ public class PHPBB implements EncryptionMethod { } static String pack(String hex) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < hex.length(); i += 2) { char c1 = hex.charAt(i); char c2 = hex.charAt(i + 1); @@ -155,7 +148,7 @@ public class PHPBB implements EncryptionMethod { @Override public boolean comparePassword(String hash, String password, - String playerName) throws NoSuchAlgorithmException { + String playerName) throws NoSuchAlgorithmException { return phpbb_check_hash(password, hash); } } diff --git a/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java b/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java index 59871d7d..c0ba2ffe 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java +++ b/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java @@ -8,13 +8,12 @@ import java.util.Arrays; public class WORDPRESS implements EncryptionMethod { - private static String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - private int iterationCountLog2 = 8; + private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private SecureRandom randomGen = new SecureRandom(); private String encode64(byte[] src, int count) { int i, value; - String output = ""; + StringBuilder output = new StringBuilder(); i = 0; if (src.length < count) { @@ -26,24 +25,24 @@ public class WORDPRESS implements EncryptionMethod { do { value = src[i] + (src[i] < 0 ? 256 : 0); ++i; - output += itoa64.charAt(value & 63); + output.append(itoa64.charAt(value & 63)); if (i < count) { value |= (src[i] + (src[i] < 0 ? 256 : 0)) << 8; } - output += itoa64.charAt((value >> 6) & 63); + output.append(itoa64.charAt((value >> 6) & 63)); if (i++ >= count) { break; } if (i < count) { value |= (src[i] + (src[i] < 0 ? 256 : 0)) << 16; } - output += itoa64.charAt((value >> 12) & 63); + output.append(itoa64.charAt((value >> 12) & 63)); if (i++ >= count) { break; } - output += itoa64.charAt((value >> 18) & 63); + output.append(itoa64.charAt((value >> 18) & 63)); } while (i < count); - return output; + return output.toString(); } private String crypt(String password, String setting) { @@ -86,7 +85,8 @@ public class WORDPRESS implements EncryptionMethod { private String gensaltPrivate(byte[] input) { String output = "$P$"; - output += itoa64.charAt(Math.min(this.iterationCountLog2 + 5, 30)); + int iterationCountLog2 = 8; + output += itoa64.charAt(Math.min(iterationCountLog2 + 5, 30)); output += encode64(input, 6); return output; } From 24c7efbd942ddc4b66b556983a60988ed2d3e544 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 23:10:52 +0700 Subject: [PATCH 183/427] update loadResource method --- .../java/fr/xephi/authme/settings/CustomConfiguration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java index ae274ca5..d9db941e 100644 --- a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java +++ b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java @@ -1,5 +1,6 @@ package fr.xephi.authme.settings; +import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; @@ -64,7 +65,7 @@ public class CustomConfiguration extends YamlConfiguration { int i = file.getPath().indexOf("AuthMe"); if (i > -1) { String path = file.getPath().substring(i + 6).replace('\\', '/'); - InputStream is = getClass().getResourceAsStream(path); + InputStream is = AuthMe.class.getResourceAsStream(path); Files.copy(is, file.toPath(), StandardCopyOption.REPLACE_EXISTING); return true; } From f2e207dab1d07b6a12c979488f6a8f0a4dacdd78 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 23:11:45 +0700 Subject: [PATCH 184/427] change structure of ModuleManager --- .../xephi/authme/modules/ModuleManager.java | 104 +++++++++++------- 1 file changed, 63 insertions(+), 41 deletions(-) diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index 87dabc53..1050d93d 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -1,5 +1,9 @@ package fr.xephi.authme.modules; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.settings.Settings; + import java.io.File; import java.io.IOException; import java.net.URL; @@ -10,56 +14,69 @@ import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; - -public class ModuleManager implements Module { +public class ModuleManager { private AuthMe plugin; - private ModuleManager instance; - private List modules = new ArrayList(); + + private List modules = new ArrayList<>(); public ModuleManager(AuthMe plugin) { this.plugin = plugin; } - @Override - public String getName() { - return "AuthMe Module Manager"; + public boolean isModuleEnabled(String name) { + for (Module m : modules) { + if (m.getName().equalsIgnoreCase(name)) + return true; + } + return false; } - @Override - public AuthMe getInstanceOfAuthMe() { - return this.plugin; + public boolean isModuleEnabled(Module.ModuleType type) { + for (Module m : modules) { + if (m.getType() == type) + return true; + } + return false; } - @Override - public Module getInstance() { - if (this.instance == null) - instance = new ModuleManager(AuthMe.getInstance()); - return instance; + public Module getModule(String name) { + for (Module m : modules) { + if (m.getName().equalsIgnoreCase(name)) + return m; + } + return null; } - @Override - public ModuleType getType() { - return (Module.ModuleType.MANAGER); + public Module getModule(Module.ModuleType type) { + for (Module m : modules) { + if (m.getType() == type) + return m; + } + return null; } - @Override - public boolean load() { - File dir = new File(plugin.getDataFolder() + File.separator + "modules"); + public int loadModules() { + File dir = Settings.MODULE_FOLDER; + int count = 0; + if (!dir.isDirectory()) { + dir.mkdirs(); + return count; + } + File[] files = dir.listFiles(); if (files == null) { - return false; + return count; } for (File pathToJar : files) { JarFile jarFile = null; + URLClassLoader cl = null; try { jarFile = new JarFile(pathToJar); - Enumeration e = jarFile.entries(); - URL[] urls = { new URL("jar:file:" + pathToJar.getAbsolutePath() + "!/") }; - URLClassLoader cl = URLClassLoader.newInstance(urls); + URL[] urls = {new URL("jar:file:" + pathToJar.getAbsolutePath() + "!/")}; + cl = URLClassLoader.newInstance(urls); + Enumeration e = jarFile.entries(); while (e.hasMoreElements()) { JarEntry je = (JarEntry) e.nextElement(); if (je.isDirectory() || !je.getName().endsWith("Main.class")) { @@ -68,35 +85,40 @@ public class ModuleManager implements Module { String className = je.getName().substring(0, je.getName().length() - 6); className = className.replace('/', '.'); Class c = cl.loadClass(className); + if (!Module.class.isAssignableFrom(c)) { + continue; + } + Module mod = (Module) c.newInstance(); mod.load(); modules.add(mod); + count++; break; - } + } catch (Exception ex) { + ConsoleLogger.writeStackTrace(ex); ConsoleLogger.showError("Cannot load " + pathToJar.getName() + " jar file !"); } finally { - if (jarFile != null) - try { + try { + if (jarFile != null) { jarFile.close(); - } catch (IOException e) { } + if (cl != null) { + cl.close(); + } + } catch (IOException ignored) { + } } } - return true; + return count; } - @Override - public boolean unload() { - try { - for (Module mod : modules) { - mod.unload(); - modules.remove(mod); - } - } catch (Exception e) { + public void unloadModules() { + for (Module m : modules) { + m.unload(); + modules.remove(m); } - return true; } } From b62e527b403f2ea7a45f780060986667bedcc579 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 15 Sep 2015 18:15:26 +0200 Subject: [PATCH 185/427] useless stuff --- src/main/java/fr/xephi/authme/modules/ModuleManager.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index 1050d93d..f3c7df3c 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -16,12 +16,9 @@ import java.util.jar.JarFile; public class ModuleManager { - private AuthMe plugin; - private List modules = new ArrayList<>(); public ModuleManager(AuthMe plugin) { - this.plugin = plugin; } public boolean isModuleEnabled(String name) { From 1de2705840da2480c492151ff7f66a24ec87df80 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 23:20:26 +0700 Subject: [PATCH 186/427] remove constant check --- src/main/java/fr/xephi/authme/security/crypts/PHPBB.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java index 07eeef68..107fb388 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java +++ b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java @@ -14,7 +14,6 @@ import java.security.NoSuchAlgorithmException; */ public class PHPBB implements EncryptionMethod { - private static final int PHP_VERSION = 4; private String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public String phpbb_hash(String password, String salt) { @@ -42,7 +41,7 @@ public class PHPBB implements EncryptionMethod { iteration_count_log2 = 8; } String output = "$H$"; - output += itoa64.charAt(Math.min(iteration_count_log2 + ((PHP_VERSION >= 5) ? 5 : 3), 30)); + output += itoa64.charAt(Math.min(iteration_count_log2 + 3, 30)); output += _hash_encode64(input, 6); return output; } From cdfdc06312a4b9ddbdd0ae5745be5dc9dbf17851 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 23:37:33 +0700 Subject: [PATCH 187/427] revert logger --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- src/main/java/fr/xephi/authme/security/crypts/PHPBB.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 672df357..b9c84a01 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -53,7 +53,7 @@ public class AuthMe extends JavaPlugin { private static AuthMe authme; private final Server server = getServer(); - private final Logger authmeLogger = getLogger(); + private final Logger authmeLogger = Logger.getLogger("AuthMe"); public Management management; public NewAPI api; private Utils utils = Utils.getInstance(); diff --git a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java index 107fb388..e5c666b6 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java +++ b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java @@ -41,7 +41,7 @@ public class PHPBB implements EncryptionMethod { iteration_count_log2 = 8; } String output = "$H$"; - output += itoa64.charAt(Math.min(iteration_count_log2 + 3, 30)); + output += itoa64.charAt(Math.min(iteration_count_log2 + 3, 30)); // PHP_VERSION >= 5 ? 5 : 3 output += _hash_encode64(input, 6); return output; } From 4fca6108d958de11d5278cea607b6e2fd0580143 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 15 Sep 2015 19:07:34 +0200 Subject: [PATCH 188/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 8 ++++---- src/main/java/fr/xephi/authme/PerformBackup.java | 2 +- src/main/java/fr/xephi/authme/Utils.java | 6 +++--- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 4 ++-- .../java/fr/xephi/authme/commands/UnregisterCommand.java | 6 +++--- .../fr/xephi/authme/converter/CrazyLoginConverter.java | 4 +--- src/main/java/fr/xephi/authme/converter/FlatToSql.java | 4 +--- src/main/java/fr/xephi/authme/converter/FlatToSqlite.java | 5 +---- .../java/fr/xephi/authme/converter/RakamakConverter.java | 5 +---- .../fr/xephi/authme/listener/AuthMeEntityListener.java | 2 +- .../fr/xephi/authme/listener/AuthMeServerListener.java | 2 +- .../xephi/authme/plugin/manager/CombatTagComunicator.java | 2 +- .../fr/xephi/authme/process/join/AsyncronousJoin.java | 8 ++++---- .../process/login/ProcessSyncronousPlayerLogin.java | 4 ++-- .../fr/xephi/authme/process/logout/AsyncronousLogout.java | 4 ++-- .../process/register/ProcessSyncronousEmailRegister.java | 2 +- .../register/ProcessSyncronousPasswordRegister.java | 2 +- 17 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index b9c84a01..d38fbf9b 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -70,7 +70,7 @@ public class AuthMe extends JavaPlugin { public Location essentialsSpawn; public MultiverseCore multiverse; public LookupService lookupService; - public boolean CombatTag = false; + public boolean combatTag = false; public boolean legacyChestShop = false; public boolean antibotMod = false; public boolean delayedAntiBot = true; @@ -194,7 +194,7 @@ public class AuthMe extends JavaPlugin { // Do backup on start if enabled if (Settings.isBackupActivated && Settings.isBackupOnStart) { // Do backup and check return value! - if (new PerformBackup(this).DoBackup()) { + if (new PerformBackup(this).doBackup()) { ConsoleLogger.info("Backup performed correctly"); } else { ConsoleLogger.showError("Error while performing the backup!"); @@ -313,7 +313,7 @@ public class AuthMe extends JavaPlugin { // Do backup on stop if enabled if (Settings.isBackupActivated && Settings.isBackupOnStop) { - Boolean Backup = new PerformBackup(this).DoBackup(); + Boolean Backup = new PerformBackup(this).doBackup(); if (Backup) ConsoleLogger.info("Backup performed correctly."); else ConsoleLogger.showError("Error while performing the backup!"); @@ -502,7 +502,7 @@ public class AuthMe extends JavaPlugin { // Check the presence of CombatTag public void checkCombatTag() { - this.CombatTag = server.getPluginManager().isPluginEnabled("CombatTag"); + this.combatTag = server.getPluginManager().isPluginEnabled("CombatTag"); } // Check if a player/command sender have a permission diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index 72ae2faf..5550a7c7 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -30,7 +30,7 @@ public class PerformBackup { this.setInstance(instance); } - public boolean DoBackup() { + public boolean doBackup() { switch (Settings.getDataSource) { case FILE: diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index eb794b48..21822566 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -38,12 +38,12 @@ public class Utils { } } - public void setGroup(Player player, groupType group) { + public void setGroup(Player player, GroupType group) { setGroup(player.getName(), group); } @SuppressWarnings("deprecation") - public void setGroup(String player, groupType group) { + public void setGroup(String player, GroupType group) { if (!Settings.isPermissionCheckEnabled) return; if (plugin.permission == null) @@ -172,7 +172,7 @@ public class Utils { player.setGameMode(GameMode.SURVIVAL); } - public enum groupType { + public enum GroupType { UNREGISTERED, REGISTERED, NOTLOGGEDIN, diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 13105c0f..41c4fbfd 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -3,7 +3,7 @@ package fr.xephi.authme.commands; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.groupType; +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; @@ -464,7 +464,7 @@ public class AdminCommand implements CommandExecutor { @SuppressWarnings("deprecation") Player target = Bukkit.getPlayer(name); PlayerCache.getInstance().removePlayer(name); - Utils.getInstance().setGroup(name, groupType.UNREGISTERED); + Utils.getInstance().setGroup(name, GroupType.UNREGISTERED); if (target != null) { if (target.isOnline()) { if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 57e65303..b9f5cd14 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -16,7 +16,7 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.groupType; +import fr.xephi.authme.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -82,7 +82,7 @@ public class UnregisterCommand implements CommandExecutor { player.saveData(); PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); if (!Settings.getRegisteredGroup.isEmpty()) - Utils.getInstance().setGroup(player, groupType.UNREGISTERED); + Utils.getInstance().setGroup(player, GroupType.UNREGISTERED); LimboCache.getInstance().addLimboPlayer(player); int delay = Settings.getRegistrationTimeout * 20; int interval = Settings.getWarnMessageInterval; @@ -97,7 +97,7 @@ public class UnregisterCommand implements CommandExecutor { return true; } if (!Settings.unRegisteredGroup.isEmpty()) { - Utils.getInstance().setGroup(player, Utils.groupType.UNREGISTERED); + Utils.getInstance().setGroup(player, Utils.GroupType.UNREGISTERED); } PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); // check if Player cache File Exist and delete it, preventing diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index 0ffae7db..dbb247d0 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -2,7 +2,6 @@ package fr.xephi.authme.converter; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; @@ -70,10 +69,9 @@ public class CrazyLoginConverter implements Converter { } users.close(); ConsoleLogger.info("CrazyLogin database has been imported correctly"); - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); } catch (IOException ex) { ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.showError("Can't open the crazylogin database file! Does it exist?"); } } diff --git a/src/main/java/fr/xephi/authme/converter/FlatToSql.java b/src/main/java/fr/xephi/authme/converter/FlatToSql.java index 03112a60..0f0b7bf8 100644 --- a/src/main/java/fr/xephi/authme/converter/FlatToSql.java +++ b/src/main/java/fr/xephi/authme/converter/FlatToSql.java @@ -3,7 +3,6 @@ package fr.xephi.authme.converter; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; @@ -79,10 +78,9 @@ public class FlatToSql implements Converter { sql.close(); br.close(); ConsoleLogger.info("The FlatFile has been converted to authme.sql file"); - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); } catch (IOException ex) { ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.showError("Can't open the flat database file! Does it exist?"); } } } diff --git a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java index 757a9d2d..f81d4a69 100644 --- a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java @@ -2,7 +2,6 @@ package fr.xephi.authme.converter; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.sql.Connection; @@ -90,12 +89,10 @@ public class FlatToSqlite implements Converter { close(); sender.sendMessage("The FlatFile has been converted to " + database + ".db file"); return; - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); } catch (IOException ex) { ConsoleLogger.showError(ex.getMessage()); + sender.sendMessage("Can't open the flat database file! Does it exist?"); } - sender.sendMessage("Errors appears while trying to convert to SQLite"); return; } diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index 333b6bde..ae3b51d5 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -100,12 +100,9 @@ public class RakamakConverter implements Converter { } ConsoleLogger.info("Rakamak database has been imported correctly"); sender.sendMessage("Rakamak database has been imported correctly"); - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - sender.sendMessage("Error file not found"); } catch (IOException ex) { ConsoleLogger.showError(ex.getMessage()); - sender.sendMessage("Error IOException"); + sender.sendMessage("Can't open the rakamak database file! Does it exist?"); } } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 90d5bd6e..96ff1c81 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -136,7 +136,7 @@ public class AuthMeEntityListener implements Listener { } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) - public void EntityRegainHealthEvent(EntityRegainHealthEvent event) { + public void entityRegainHealthEvent(EntityRegainHealthEvent event) { Entity entity = event.getEntity(); if (!(entity instanceof Player)) { return; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 6ee60baa..184cf834 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -60,7 +60,7 @@ public class AuthMeServerListener implements Listener { ConsoleLogger.info("ChestShop has been disabled, unhook!"); } if (pluginName.equalsIgnoreCase("CombatTag")) { - plugin.CombatTag = false; + plugin.combatTag = false; ConsoleLogger.info("CombatTag has been disabled, unhook!"); } if (pluginName.equalsIgnoreCase("Vault")) { diff --git a/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java b/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java index ac80a632..a98df207 100644 --- a/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java +++ b/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java @@ -22,7 +22,7 @@ public abstract class CombatTagComunicator { * @return true if the player is an NPC */ public static boolean isNPC(Entity player) { - if (!AuthMe.getInstance().CombatTag) + if (!AuthMe.getInstance().combatTag) return false; try { if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) { diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 455a937f..fda8c97c 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -15,7 +15,7 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.groupType; +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.backup.DataFileCache; @@ -151,7 +151,7 @@ public class AsyncronousJoin { }); } if (!Settings.unRegisteredGroup.isEmpty()) { - utils.setGroup(player, Utils.groupType.UNREGISTERED); + utils.setGroup(player, Utils.GroupType.UNREGISTERED); } if (!Settings.isForcedRegistrationEnabled) { return; @@ -216,9 +216,9 @@ public class AsyncronousJoin { if (!LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().addLimboPlayer(player); if (database.isAuthAvailable(name)) { - utils.setGroup(player, groupType.NOTLOGGEDIN); + utils.setGroup(player, GroupType.NOTLOGGEDIN); } else { - utils.setGroup(player, groupType.UNREGISTERED); + utils.setGroup(player, GroupType.UNREGISTERED); } sched.scheduleSyncDelayedTask(plugin, new Runnable() { diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index b9d29411..659825d7 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -9,7 +9,7 @@ import org.bukkit.potion.PotionEffectType; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.groupType; +import fr.xephi.authme.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -166,7 +166,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { Utils.forceGM(player); // Restore Permission Group - Utils.getInstance().setGroup(player, groupType.LOGGEDIN); + Utils.getInstance().setGroup(player, GroupType.LOGGEDIN); // Cleanup no longer used temporary data LimboCache.getInstance().deleteLimboPlayer(name); diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index f1dde587..1f44b3a3 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -6,7 +6,7 @@ import org.bukkit.scheduler.BukkitScheduler; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.groupType; +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.backup.DataFileCache; @@ -79,7 +79,7 @@ public class AsyncronousLogout { if (LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().addLimboPlayer(player); - utils.setGroup(player, groupType.NOTLOGGEDIN); + utils.setGroup(player, GroupType.NOTLOGGEDIN); if (Settings.protectInventoryBeforeLogInEnabled) { player.getInventory().clear(); // create cache file for handling lost of inventories on unlogged in diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index 9da83002..64eec84d 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -31,7 +31,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { public void run() { LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); if (!Settings.getRegisteredGroup.isEmpty()) { - Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); + Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED); } m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index c8b64ed6..71d8292c 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -108,7 +108,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } if (!Settings.getRegisteredGroup.isEmpty()) { - Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); + Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED); } m.send(player, "registered"); if (!Settings.getmailAccount.isEmpty()) From 5fb3542ceaf85b8b807d5c8f7d15378a1437b3f8 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 15 Sep 2015 19:37:59 +0200 Subject: [PATCH 189/427] useledd imports --- src/main/java/fr/xephi/authme/converter/RakamakConverter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index ae3b51d5..38697dbb 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -2,7 +2,6 @@ package fr.xephi.authme.converter; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.security.NoSuchAlgorithmException; From f63fe5bc374b0866d6ec34f5447c0c1918186e2b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 15 Sep 2015 21:11:56 +0200 Subject: [PATCH 190/427] Enhance combattag hook --- pom.xml | 18 ------ src/main/java/fr/xephi/authme/AuthMe.java | 25 ++++++--- src/main/java/fr/xephi/authme/Utils.java | 9 ++- src/main/java/fr/xephi/authme/api/API.java | 9 +-- src/main/java/fr/xephi/authme/api/NewAPI.java | 3 +- .../authme/listener/AuthMeEntityListener.java | 16 +----- .../authme/listener/AuthMePlayerListener.java | 55 ++++++++----------- .../authme/listener/AuthMeServerListener.java | 10 ++-- .../plugin/manager/CombatTagComunicator.java | 49 ----------------- .../authme/process/join/AsyncronousJoin.java | 3 +- .../authme/process/quit/AsyncronousQuit.java | 3 +- 11 files changed, 59 insertions(+), 141 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java diff --git a/pom.xml b/pom.xml index 56c33e60..69e0c32d 100644 --- a/pom.xml +++ b/pom.xml @@ -412,24 +412,6 @@ - - - com.trc202 - CombatTag - 6.2.1-SNAPSHOT - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - - de.luricos.bukkit diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index d38fbf9b..6be444cd 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -16,7 +16,6 @@ import fr.xephi.authme.converter.ForceFlatToSqlite; import fr.xephi.authme.datasource.*; import fr.xephi.authme.listener.*; import fr.xephi.authme.plugin.manager.BungeeCordMessage; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.plugin.manager.EssSpawn; import fr.xephi.authme.process.Management; import fr.xephi.authme.settings.Messages; @@ -24,6 +23,8 @@ import fr.xephi.authme.settings.OtherAccounts; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import net.milkbowl.vault.permission.Permission; +import net.minelink.ctplus.CombatTagPlus; + import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -62,7 +63,6 @@ public class AuthMe extends JavaPlugin { private Messages m; public DataManager dataManager; public DataSource database; - private JsonCache playerBackup; public OtherAccounts otherAccounts; public Permission permission; @@ -70,7 +70,7 @@ public class AuthMe extends JavaPlugin { public Location essentialsSpawn; public MultiverseCore multiverse; public LookupService lookupService; - public boolean combatTag = false; + public CombatTagPlus combatTagPlus = null; public boolean legacyChestShop = false; public boolean antibotMod = false; public boolean delayedAntiBot = true; @@ -176,8 +176,8 @@ public class AuthMe extends JavaPlugin { // Find Permissions checkVault(); - // Check Combat Tag Version - checkCombatTag(); + // Check Combat Tag Plus Version + checkCombatTagPlus(); // Check Multiverse checkMultiverse(); @@ -501,8 +501,17 @@ public class AuthMe extends JavaPlugin { } // Check the presence of CombatTag - public void checkCombatTag() { - this.combatTag = server.getPluginManager().isPluginEnabled("CombatTag"); + public void checkCombatTagPlus() { + if (server.getPluginManager().isPluginEnabled("CombatTagPlus")) { + try { + combatTagPlus = (CombatTagPlus) server.getPluginManager().getPlugin("CombatTagPlus"); + ConsoleLogger.info("Hooked correctly with CombatTagPlus"); + } catch (Exception | NoClassDefFoundError ingnored) { + combatTagPlus = null; + } + } else { + combatTagPlus = null; + } } // Check if a player/command sender have a permission @@ -526,7 +535,7 @@ public class AuthMe extends JavaPlugin { // Save Player Data public void savePlayer(Player player) { - if ((utils.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) { + if ((utils.isNPC(player)) || (Utils.getInstance().isUnrestricted(player))) { return; } String name = player.getName().toLowerCase(); diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 21822566..7ba328b6 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -215,7 +215,14 @@ public class Utils { public boolean isNPC(final Entity player) { try { - return player.hasMetadata("NPC"); + if (player.hasMetadata("NPC")) { + return true; + } else if(plugin.combatTagPlus != null + && player instanceof Player + && plugin.combatTagPlus.getNpcPlayerHelper().isNpc((Player) player)) { + return true; + } + return false; } catch (Exception e) { return false; } diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index eb9cf3ff..026a9577 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -12,7 +12,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.plugin.manager.CombatTagComunicator; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Settings; @@ -66,9 +65,7 @@ public class API { */ @Deprecated public boolean isaNPC(Player player) { - if (utils.isNPC(player)) - return true; - return CombatTagComunicator.isNPC(player); + return utils.isNPC(player); } /** @@ -78,9 +75,7 @@ public class API { */ @Deprecated public boolean isNPC(Player player) { - if (utils.isNPC(player)) - return true; - return CombatTagComunicator.isNPC(player); + return utils.isNPC(player); } /** diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 41b955e6..604d9d2d 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -14,7 +14,6 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Settings; @@ -71,7 +70,7 @@ public class NewAPI { * @return true if player is a npc */ public boolean isNPC(Player player) { - return utils.isNPC(player) || CombatTagComunicator.isNPC(player); + return utils.isNPC(player); } /** diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 96ff1c81..e1bfea52 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -3,7 +3,6 @@ package fr.xephi.authme.listener; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.settings.Settings; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -39,9 +38,6 @@ public class AuthMeEntityListener implements Listener { Player player = (Player) entity; String name = player.getName().toLowerCase(); - if (CombatTagComunicator.isNPC(player)) - return; - if (PlayerCache.getInstance().isAuthenticated(name)) { return; } @@ -171,11 +167,7 @@ public class AuthMeEntityListener implements Listener { Player player = (Player) event.getEntity(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { - return; - } - - if (utils.isNPC(player)) + if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName())) { @@ -199,11 +191,7 @@ public class AuthMeEntityListener implements Listener { Player player = (Player) event.getEntity(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { - return; - } - - if (utils.isNPC(player)) + if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName())) { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 4386664e..93884b28 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -8,7 +8,6 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import org.bukkit.Bukkit; @@ -56,7 +55,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) + if (utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -90,7 +89,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) + if (utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -126,7 +125,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) + if (utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -162,7 +161,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) + if (utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -198,7 +197,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) + if (utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -234,7 +233,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) + if (utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) { @@ -271,7 +270,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) + if (utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -306,7 +305,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || utils.isUnrestricted(player)) { return; } @@ -424,7 +423,7 @@ public class AuthMePlayerListener implements Listener { public void run() { LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); if (limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - Utils.getInstance().addNormal(player, limbo.getGroup()); + utils.addNormal(player, limbo.getGroup()); LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); } } @@ -441,7 +440,7 @@ public class AuthMePlayerListener implements Listener { final String name = player.getName().toLowerCase(); boolean isAuthAvailable = plugin.database.isAuthAvailable(name); - if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || utils.isUnrestricted(player)) { return; } @@ -605,7 +604,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } @@ -633,7 +632,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } @@ -664,7 +663,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } @@ -691,7 +690,7 @@ public class AuthMePlayerListener implements Listener { return; final Player player = (Player) event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } if (utils.isNPC(player)) @@ -729,7 +728,7 @@ public class AuthMePlayerListener implements Listener { Player player = (Player) event.getWhoClicked(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } @@ -759,7 +758,7 @@ public class AuthMePlayerListener implements Listener { Player player = (Player) damager; String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } @@ -787,7 +786,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || utils.isUnrestricted(player)) { return; } @@ -811,11 +810,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { - return; - } - - if (utils.isNPC(player)) + if (utils.isUnrestricted(player) || utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { @@ -838,7 +833,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } @@ -861,7 +856,7 @@ public class AuthMePlayerListener implements Listener { } Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (utils.isUnrestricted(player)) { return; } if (PlayerCache.getInstance().isAuthenticated(name)) { @@ -884,10 +879,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) - return; - - if (utils.isNPC(player)) + if (utils.isUnrestricted(player) || utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -919,10 +911,7 @@ public class AuthMePlayerListener implements Listener { String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) - return; - - if (utils.isNPC(player)) + if (utils.isUnrestricted(player) || utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 184cf834..8e796021 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -59,9 +59,9 @@ public class AuthMeServerListener implements Listener { plugin.legacyChestShop = false; ConsoleLogger.info("ChestShop has been disabled, unhook!"); } - if (pluginName.equalsIgnoreCase("CombatTag")) { - plugin.combatTag = false; - ConsoleLogger.info("CombatTag has been disabled, unhook!"); + if (pluginName.equalsIgnoreCase("CombatTagPlus")) { + plugin.combatTagPlus = null; + ConsoleLogger.info("CombatTagPlus has been disabled, unhook!"); } if (pluginName.equalsIgnoreCase("Vault")) { plugin.permission = null; @@ -78,8 +78,8 @@ public class AuthMeServerListener implements Listener { plugin.checkMultiverse(); if (pluginName.equalsIgnoreCase("ChestShop")) plugin.checkChestShop(); - if (pluginName.equalsIgnoreCase("CombatTag")) - plugin.checkCombatTag(); + if (pluginName.equalsIgnoreCase("CombatTagPlus")) + plugin.checkCombatTagPlus(); if (pluginName.equalsIgnoreCase("Vault")) plugin.checkVault(); } diff --git a/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java b/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java deleted file mode 100644 index a98df207..00000000 --- a/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java +++ /dev/null @@ -1,49 +0,0 @@ -package fr.xephi.authme.plugin.manager; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import com.trc202.CombatTag.CombatTag; -import com.trc202.CombatTagApi.CombatTagApi; - -import fr.xephi.authme.AuthMe; -import net.minelink.ctplus.CombatTagPlus; - -public abstract class CombatTagComunicator { - - public static CombatTagApi combatApi; - - /** - * Returns if the entity is an NPC - * - * @param player - * @return true if the player is an NPC - */ - public static boolean isNPC(Entity player) { - if (!AuthMe.getInstance().combatTag) - return false; - try { - if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) { - combatApi = new CombatTagApi((CombatTag) Bukkit.getServer().getPluginManager().getPlugin("CombatTag")); - try { - combatApi.getClass().getMethod("isNPC"); - } catch (Exception e) { - return false; - } - return combatApi.isNPC(player); - } else { - Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("CombatTagPlus"); - return (plugin != null && plugin instanceof CombatTagPlus && player instanceof Player && ((CombatTagPlus) plugin).getNpcPlayerHelper().isNpc((Player) player)); - } - } catch (ClassCastException ex) { - return false; - } catch (NullPointerException npe) { - return false; - } catch (NoClassDefFoundError ncdfe) { - return false; - } - } - -} diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index fda8c97c..a9e7d603 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -27,7 +27,6 @@ import fr.xephi.authme.events.FirstSpawnTeleportEvent; import fr.xephi.authme.events.ProtectInventoryEvent; import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.listener.AuthMePlayerListener; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; @@ -58,7 +57,7 @@ public class AsyncronousJoin { AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode()); BukkitScheduler sched = plugin.getServer().getScheduler(); - if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) { return; } diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index b6cca430..9a05229a 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -15,7 +15,6 @@ import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.listener.AuthMePlayerListener; -import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.settings.Settings; public class AsyncronousQuit { @@ -44,7 +43,7 @@ public class AsyncronousQuit { public void process() { if (player == null) return; - if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { + if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) { return; } From 27f9b14067fe7d201f3939f6af3fff8d9bd4082e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 15 Sep 2015 21:26:31 +0200 Subject: [PATCH 191/427] GSON library --- pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pom.xml b/pom.xml index 69e0c32d..87feaae4 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,7 @@ com.zaxxer:HikariCP org.slf4j:slf4j-simple org.slf4j:slf4j-api + com.google.code.gson:gson com.maxmind.geoip:geoip-api com.sun.mail:javax.mail com.comphenix.attribute:AttributeStorage @@ -205,6 +206,14 @@ compile + + + com.google.code.gson + gson + 2.3.1 + compile + + javax.mail From 6a8e581ba852e1923dcf2008ac0c6a8d645ba062 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 15 Sep 2015 23:44:37 +0700 Subject: [PATCH 192/427] added softdepend for PerWorldInventories --- src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 68aab3b3..6b2e6174 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the player. main: fr.xephi.authme.AuthMe version: ${project.version} -softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn] +softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories] commands: register: description: Register an account From 51067498eae837d8f7033d83c644effb272529a7 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Wed, 16 Sep 2015 11:36:08 +0700 Subject: [PATCH 193/427] cleanup MySQL throws --- .../fr/xephi/authme/datasource/MySQL.java | 57 +++++-------------- 1 file changed, 14 insertions(+), 43 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 555ccf89..6557ebac 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -64,58 +64,29 @@ public class MySQL implements DataSource { // Set the connection arguments (and check if connection is ok) try { this.setConnectionArguments(); - } catch (ClassNotFoundException ne) { - ConsoleLogger.showError(ne.getMessage()); + } catch (RuntimeException e) { + if (e instanceof IllegalArgumentException) { + ConsoleLogger.showError("Invalid database arguments! Please check your configuration!"); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + throw new IllegalArgumentException(e); + } + if (e instanceof PoolInitializationException) { + ConsoleLogger.showError("Can't initialize database connection! Please check your configuration!"); + ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); + throw new PoolInitializationException(e); + } ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new ClassNotFoundException(ne.getMessage()); - } catch (IllegalArgumentException ae) { // This means that there are problems with the hikaricp pool arguments! - ConsoleLogger.showError(ae.getMessage()); - ConsoleLogger.showError("Invalid database arguments! Please check your configuration!"); - ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new IllegalArgumentException(ae); - } catch (PoolInitializationException ie) { // Can't initialize the connection pool! - ConsoleLogger.showError(ie.getMessage()); - ConsoleLogger.showError("Can't connect to the MySql database! Please check your configuration!"); - ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new PoolInitializationException(ie); + throw e; } // Initialize the database try { this.setupConnection(); } catch (SQLException e) { - ConsoleLogger.showError(e.getMessage()); + this.close(); ConsoleLogger.showError("Can't initialize the MySQL database... Please check your database settings in the config.yml file! SHUTDOWN..."); ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); - this.close(); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } else { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - throw new SQLException(e); + throw e; } } From b5546c07b4fe1381f3527040ef9ec44ea7f2c747 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Wed, 16 Sep 2015 11:37:18 +0700 Subject: [PATCH 194/427] cleanup string concatenates --- src/main/java/fr/xephi/authme/Utils.java | 25 +++++++++++-------- .../xephi/authme/security/crypts/PHPBB.java | 12 ++++----- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 7ba328b6..645e7faf 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -12,7 +12,9 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import java.io.File; +import java.io.IOException; import java.lang.reflect.Method; +import java.nio.file.Files; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -180,16 +182,19 @@ public class Utils { } public static void purgeDirectory(File file) { - String files[] = file.list(); - if (files != null && files.length != 0) { - for (String temp : files) { - File fileDelete = new File(file, temp); - if (fileDelete.isDirectory()) { - purgeDirectory(fileDelete); - fileDelete.delete(); - } else { - fileDelete.delete(); - } + if (!file.isDirectory()) { + return; + } + File[] files = file.listFiles(); + if (files == null) { + return; + } + for (File target : files) { + if(target.isDirectory()) { + purgeDirectory(target); + target.delete(); + } else { + target.delete(); } } } diff --git a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java index e5c666b6..cc5d4dc3 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java +++ b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java @@ -50,24 +50,24 @@ public class PHPBB implements EncryptionMethod { * Encode hash */ private String _hash_encode64(String input, int count) { - String output = ""; + StringBuilder output = new StringBuilder(); int i = 0; do { int value = input.charAt(i++); - output += itoa64.charAt(value & 0x3f); + output.append(itoa64.charAt(value & 0x3f)); if (i < count) value |= input.charAt(i) << 8; - output += itoa64.charAt((value >> 6) & 0x3f); + output.append(itoa64.charAt((value >> 6) & 0x3f)); if (i++ >= count) break; if (i < count) value |= input.charAt(i) << 16; - output += itoa64.charAt((value >> 12) & 0x3f); + output.append(itoa64.charAt((value >> 12) & 0x3f)); if (i++ >= count) break; - output += itoa64.charAt((value >> 18) & 0x3f); + output.append(itoa64.charAt((value >> 18) & 0x3f)); } while (i < count); - return output; + return output.toString(); } String _hash_crypt_private(String password, String setting) { From a00deb0e0f72dc248c8cfbd872ab61e687357997 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sat, 19 Sep 2015 12:51:59 +0700 Subject: [PATCH 195/427] unregister asynchronously --- .../authme/commands/UnregisterCommand.java | 160 +++++++++--------- 1 file changed, 82 insertions(+), 78 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index b9f5cd14..7c1a4c1e 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -1,18 +1,5 @@ package fr.xephi.authme.commands; -import java.security.NoSuchAlgorithmException; - -import org.bukkit.Location; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -26,6 +13,18 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + +import java.security.NoSuchAlgorithmException; public class UnregisterCommand implements CommandExecutor { @@ -39,8 +38,8 @@ public class UnregisterCommand implements CommandExecutor { } @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { + public boolean onCommand(final CommandSender sender, Command cmnd, String label, + final String[] args) { if (!(sender instanceof Player)) { return true; } @@ -50,8 +49,8 @@ public class UnregisterCommand implements CommandExecutor { return true; } - Player player = (Player) sender; - String name = player.getName().toLowerCase(); + final Player player = (Player) sender; + final String name = player.getName().toLowerCase(); if (!PlayerCache.getInstance().isAuthenticated(name)) { m.send(player, "not_logged_in"); @@ -62,72 +61,77 @@ public class UnregisterCommand implements CommandExecutor { m.send(player, "usage_unreg"); return true; } - try { - if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { - if (!plugin.database.removeAuth(name)) { - player.sendMessage("error"); - return true; - } - if (Settings.isForcedRegistrationEnabled) { - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(player); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - player.teleport(tpEvent.getTo()); + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + try { + if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { + if (!plugin.database.removeAuth(name)) { + player.sendMessage("error"); + return; } - } - player.getInventory().setContents(new ItemStack[36]); - player.getInventory().setArmorContents(new ItemStack[4]); - player.saveData(); - PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); - if (!Settings.getRegisteredGroup.isEmpty()) - Utils.getInstance().setGroup(player, GroupType.UNREGISTERED); - LimboCache.getInstance().addLimboPlayer(player); - int delay = Settings.getRegistrationTimeout * 20; - int interval = Settings.getWarnMessageInterval; - BukkitScheduler sched = sender.getServer().getScheduler(); - if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); - } - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); - m.send(player, "unregistered"); - ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); - return true; - } - if (!Settings.unRegisteredGroup.isEmpty()) { - Utils.getInstance().setGroup(player, Utils.GroupType.UNREGISTERED); - } - PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); - // check if Player cache File Exist and delete it, preventing - // duplication of items - if (playerCache.doesCacheExist(player)) { - playerCache.removeCache(player); - } - if (Settings.applyBlindEffect) - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - m.send(player, "unregistered"); - ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(player); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); + if (Settings.isForcedRegistrationEnabled) { + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawn = plugin.getSpawnLocation(player); + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + player.teleport(tpEvent.getTo()); + } + } + player.getInventory().setContents(new ItemStack[36]); + player.getInventory().setArmorContents(new ItemStack[4]); + player.saveData(); + PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); + if (!Settings.getRegisteredGroup.isEmpty()) + Utils.getInstance().setGroup(player, GroupType.UNREGISTERED); + LimboCache.getInstance().addLimboPlayer(player); + int delay = Settings.getRegistrationTimeout * 20; + int interval = Settings.getWarnMessageInterval; + BukkitScheduler sched = sender.getServer().getScheduler(); + if (delay != 0) { + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); + LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + } + LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); + m.send(player, "unregistered"); + ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); + return; } - player.teleport(tpEvent.getTo()); + if (!Settings.unRegisteredGroup.isEmpty()) { + Utils.getInstance().setGroup(player, Utils.GroupType.UNREGISTERED); + } + PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); + // check if Player cache File Exist and delete it, preventing + // duplication of items + if (playerCache.doesCacheExist(player)) { + playerCache.removeCache(player); + } + if (Settings.applyBlindEffect) + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + m.send(player, "unregistered"); + ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawn = plugin.getSpawnLocation(player); + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { + tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); + } + player.teleport(tpEvent.getTo()); + } + } + return; + } else { + m.send(player, "wrong_pwd"); } + } catch (NoSuchAlgorithmException ex) { + ConsoleLogger.showError(ex.getMessage()); + sender.sendMessage("Internal Error please read the server log"); } - return true; - } else { - m.send(player, "wrong_pwd"); } - } catch (NoSuchAlgorithmException ex) { - ConsoleLogger.showError(ex.getMessage()); - sender.sendMessage("Internal Error please read the server log"); - } + }); return true; } } From 4ec548cb8d548f35a70b5c57ea765d85d23f683b Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sat, 19 Sep 2015 13:27:31 +0700 Subject: [PATCH 196/427] added null check, #209 #210 --- src/main/java/fr/xephi/authme/api/NewAPI.java | 4 +- .../xephi/authme/cache/backup/JsonCache.java | 47 ++++++++++++++----- .../authme/process/join/AsyncronousJoin.java | 3 +- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 604d9d2d..b31f9ab2 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -34,9 +34,7 @@ public class NewAPI { /** * Hook into AuthMe - * - * @return - * + * * @return AuthMe plugin */ public static NewAPI getInstance() { diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 3203fae5..dee7b743 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -1,6 +1,8 @@ package fr.xephi.authme.cache.backup; +import com.google.common.base.Charsets; import com.google.common.io.BaseEncoding; +import com.google.common.io.Files; import com.google.gson.*; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; @@ -18,7 +20,6 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.lang.reflect.Type; -import java.nio.file.Files; public class JsonCache { @@ -61,7 +62,8 @@ public class JsonCache { try { String data = gson.toJson(playerData); - Files.write(file.toPath(), data.getBytes()); + Files.touch(file); + Files.write(data, file, Charsets.UTF_8); } catch (IOException e) { e.printStackTrace(); } @@ -76,9 +78,12 @@ public class JsonCache { } File file = new File(cacheDir, path + File.separator + "cache.json"); + if (!file.exists()) { + return null; + } + try { - byte[] bytes = Files.readAllBytes(file.toPath()); - String str = new String(bytes); + String str = Files.toString(file, Charsets.UTF_8); return gson.fromJson(str, DataFileCache.class); } catch (Exception e) { e.printStackTrace(); @@ -142,17 +147,37 @@ public class JsonCache { @Override public DataFileCache deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { JsonObject jsonObject = jsonElement.getAsJsonObject(); - String group = jsonObject.get("group").getAsString(); - boolean operator = jsonObject.get("operator").getAsBoolean(); - boolean flying = jsonObject.get("flying").getAsBoolean(); + if (jsonObject == null) { + return null; + } + JsonElement e; + String group = null; + boolean operator = false; + boolean flying = false; + + if ((e = jsonObject.get("group")) != null) { + group = e.getAsString(); + } + if ((e = jsonObject.get("operator")) != null) { + operator = e.getAsBoolean(); + } + if ((e = jsonObject.get("flying")) != null) { + flying = e.getAsBoolean(); + } JsonArray arr; + ItemStack[] inv = null; + ItemStack[] armour = null; - arr = jsonObject.get("inventory").getAsJsonArray(); - ItemStack[] inv = getItems(arr); + if (jsonObject.has("inventory")) { + arr = jsonObject.get("inventory").getAsJsonArray(); + inv = getItems(arr); + } - arr = jsonObject.get("armour").getAsJsonArray(); - ItemStack[] armour = getItems(arr); + if (jsonObject.has("armour")) { + arr = jsonObject.get("armour").getAsJsonArray(); + armour = getItems(arr); + } return new DataFileCache(inv, armour, group, operator, flying); } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index a9e7d603..a75b91b4 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -195,7 +195,8 @@ public class AsyncronousJoin { }); } - } catch (NullPointerException ex) { + } catch (Exception ex) { + ex.printStackTrace(); } } String[] msg; From dc35d768aae4b36cf4c62f549e89b49b75e6431b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 19 Sep 2015 20:20:46 +0200 Subject: [PATCH 197/427] add max connections setting --- src/main/java/fr/xephi/authme/Utils.java | 2 - .../fr/xephi/authme/datasource/MySQL.java | 4 +- .../fr/xephi/authme/settings/Settings.java | 130 ++++++++++-------- src/main/resources/config.yml | 2 + 4 files changed, 80 insertions(+), 58 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 645e7faf..b0feda6b 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -12,9 +12,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import java.io.File; -import java.io.IOException; import java.lang.reflect.Method; -import java.nio.file.Files; import java.util.Arrays; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 6557ebac..8e5d4cc1 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -37,6 +37,7 @@ public class MySQL implements DataSource { private List columnOthers; private HikariDataSource ds; private String columnRealName; + private int maxConnections; public MySQL() throws ClassNotFoundException, SQLException, PoolInitializationException { this.host = Settings.getMySQLHost; @@ -60,6 +61,7 @@ public class MySQL implements DataSource { this.columnID = Settings.getMySQLColumnId; this.columnLogged = Settings.getMySQLColumnLogged; this.columnRealName = Settings.getMySQLColumnRealName; + this.maxConnections = Settings.getMySQLMaxConnections; // Set the connection arguments (and check if connection is ok) try { @@ -105,7 +107,7 @@ public class MySQL implements DataSource { config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable config.setMaxLifetime(180000); // 3 Min config.setIdleTimeout(60000); // 1 Min - config.setMaximumPoolSize(50); // 50 (including idle connections) + config.setMaximumPoolSize(maxConnections); ds = new HikariDataSource(config); ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index d57a82cf..0b923314 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -90,7 +90,7 @@ public final class Settings extends YamlConfiguration { getMailPort, maxLoginTry, captchaLength, saltLength, getmaxRegPerEmail, bCryptLog2Rounds, getPhpbbGroup, antiBotSensibility, antiBotDuration, delayRecall, getMaxLoginPerIp, - getMaxJoinPerIp; + getMaxJoinPerIp, getMySQLMaxConnections; protected static YamlConfiguration configFile; @@ -152,6 +152,7 @@ public final class Settings extends YamlConfiguration { isCachingEnabled = configFile.getBoolean("DataSource.caching", true); getMySQLHost = configFile.getString("DataSource.mySQLHost", "127.0.0.1"); getMySQLPort = configFile.getString("DataSource.mySQLPort", "3306"); + getMySQLMaxConnections = configFile.getInt("DataSource.mySQLMaxConections", 25); getMySQLUsername = configFile.getString("DataSource.mySQLUsername", "authme"); getMySQLPassword = configFile.getString("DataSource.mySQLPassword", "12345"); getMySQLDatabase = configFile.getString("DataSource.mySQLDatabase", "authme"); @@ -280,178 +281,197 @@ public final class Settings extends YamlConfiguration { } public void mergeConfig() { - int changes = 0; - if (contains("Xenoforo.predefinedSalt")) + boolean changes = false; + if (contains("Xenoforo.predefinedSalt")) { set("Xenoforo.predefinedSalt", null); - if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") || configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) + changes = true; + } + if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") || configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) { set("settings.security.passwordHash", "XENFORO"); + changes = true; + } if (!contains("Protection.enableProtection")) { set("Protection.enableProtection", false); - changes++; + changes = true; + } + if (!contains("DataSource.mySQLMaxConections")) { + set("DataSource.mySQLMaxConections", 25); + changes = true; } if (!contains("Protection.countries")) { countries = new ArrayList<>(); countries.add("US"); countries.add("GB"); set("Protection.countries", countries); - changes++; + changes = true; } if (!contains("Protection.enableAntiBot")) { set("Protection.enableAntiBot", false); - changes++; + changes = true; } if (!contains("Protection.antiBotSensibility")) { set("Protection.antiBotSensibility", 5); - changes++; + changes = true; } if (!contains("Protection.antiBotDuration")) { set("Protection.antiBotDuration", 10); - changes++; + changes = true; } if (!contains("settings.forceCommands")) { set("settings.forceCommands", new ArrayList()); - changes++; + changes = true; } if (!contains("settings.forceCommandsAsConsole")) { set("settings.forceCommandsAsConsole", new ArrayList()); - changes++; + changes = true; } if (!contains("Email.recallPlayers")) { set("Email.recallPlayers", false); - changes++; + changes = true; } if (!contains("Email.delayRecall")) { set("Email.delayRecall", 5); - changes++; + changes = true; } if (!contains("settings.useWelcomeMessage")) { set("settings.useWelcomeMessage", true); - changes++; + changes = true; } if (!contains("settings.security.unsafePasswords")) { List str = new ArrayList<>(); str.add("123456"); str.add("password"); set("settings.security.unsafePasswords", str); - changes++; + changes = true; } if (!contains("Protection.countriesBlacklist")) { countriesBlacklist = new ArrayList<>(); countriesBlacklist.add("A1"); set("Protection.countriesBlacklist", countriesBlacklist); - changes++; + changes = true; } if (!contains("settings.broadcastWelcomeMessage")) { set("settings.broadcastWelcomeMessage", false); - changes++; + changes = true; } if (!contains("settings.registration.forceKickAfterRegister")) { set("settings.registration.forceKickAfterRegister", false); - changes++; + changes = true; } if (!contains("settings.registration.forceLoginAfterRegister")) { set("settings.registration.forceLoginAfterRegister", false); - changes++; + changes = true; } if (!contains("DataSource.mySQLColumnLogged")) { set("DataSource.mySQLColumnLogged", "isLogged"); - changes++; + changes = true; } if (!contains("settings.restrictions.spawnPriority")) { set("settings.restrictions.spawnPriority", "authme,essentials,multiverse,default"); - changes++; + changes = true; } if (!contains("settings.restrictions.maxLoginPerIp")) { set("settings.restrictions.maxLoginPerIp", 0); - changes++; + changes = true; } if (!contains("settings.restrictions.maxJoinPerIp")) { set("settings.restrictions.maxJoinPerIp", 0); - changes++; + changes = true; } if (!contains("VeryGames.enableIpCheck")) { set("VeryGames.enableIpCheck", false); - changes++; + changes = true; } - if (getString("settings.restrictions.allowedNicknameCharacters").equals("[a-zA-Z0-9_?]*")) + if (getString("settings.restrictions.allowedNicknameCharacters").equals("[a-zA-Z0-9_?]*")) { set("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_]*"); + changes = true; + } if (!contains("settings.delayJoinMessage")) { set("settings.delayJoinMessage", false); - changes++; + changes = true; } if (!contains("settings.restrictions.noTeleport")) { set("settings.restrictions.noTeleport", false); - changes++; + changes = true; } - if (contains("Converter.Rakamak.newPasswordHash")) + if (contains("Converter.Rakamak.newPasswordHash")) { set("Converter.Rakamak.newPasswordHash", null); + changes = true; + } if (!contains("Converter.CrazyLogin.fileName")) { set("Converter.CrazyLogin.fileName", "accounts.db"); - changes++; + changes = true; } if (!contains("settings.restrictions.allowedPasswordCharacters")) { set("settings.restrictions.allowedPasswordCharacters", "[\\x21-\\x7E]*"); - changes++; + changes = true; } if (!contains("settings.applyBlindEffect")) { set("settings.applyBlindEffect", false); - changes++; + changes = true; } if (!contains("Email.emailBlacklisted")) { set("Email.emailBlacklisted", new ArrayList()); - changes++; + changes = true; } - if (contains("Performances.useMultiThreading")) + if (contains("Performances.useMultiThreading")) { set("Performances.useMultiThreading", null); - - if (contains("Performances")) + changes = true; + } + if (contains("Performances")) { set("Performances", null); - - if (contains("Passpartu.enablePasspartu")) + changes = true; + } + if (contains("Passpartu.enablePasspartu")) { set("Passpartu.enablePasspartu", null); - - if (contains("Passpartu")) + changes = true; + } + if (contains("Passpartu")) { set("Passpartu", null); - + changes = true; + } if (!contains("Email.emailWhitelisted")) { set("Email.emailWhitelisted", new ArrayList()); - changes++; + changes = true; } if (!contains("settings.forceRegisterCommands")) { set("settings.forceRegisterCommands", new ArrayList()); - changes++; + changes = true; } if (!contains("settings.forceRegisterCommandsAsConsole")) { set("settings.forceRegisterCommandsAsConsole", new ArrayList()); - changes++; + changes = true; } if (!contains("Hooks.customAttributes")) { set("Hooks.customAttributes", false); - changes++; + changes = true; } if (!contains("Purge.removePermissions")) { set("Purge.removePermissions", false); - changes++; + changes = true; } - if (contains("Hooks.notifications")) + if (contains("Hooks.notifications")) { set("Hooks.notifications", null); - boolean useChestShop = false; - if (contains("Hooks.chestshop")) { - useChestShop = getBoolean("Hooks.chestshop"); - set("Hooks.chestshop", null); + changes = true; + } + if (contains("Hooks.chestshop")) { + if(getBoolean("Hooks.chestshop")) { + set("Hooks.legacyChestshop", true); + } + set("Hooks.chestshop", null); + changes = true; } - set("Hooks.legacyChestshop", useChestShop); if (!contains("Email.generateImage")) { set("Email.generateImage", true); - changes++; + changes = true; } if (!contains("DataSource.mySQLRealName")) { set("DataSource.mySQLRealName", "realname"); - changes++; + changes = true; } - if (changes > 0) { - plugin.getLogger().warning("Merge " + changes + " new Config Options - I'm not an error, please don't report me"); + if (changes) { + plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me"); plugin.getLogger().warning("Please check your config.yml file for new configs!"); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d66c5a14..b183912e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -8,6 +8,8 @@ DataSource: mySQLHost: 127.0.0.1 # Database Port mySQLPort: '3306' + # MySql Max Connections + mySQLMaxConections: 25 # Username about Database Connection Infos mySQLUsername: authme # Password about Database Connection Infos From b427d14bcb286c0406ef6115800b45064357414f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 19 Sep 2015 22:28:55 +0200 Subject: [PATCH 198/427] Speed 0 when not logged! --- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 4 ++++ src/main/java/fr/xephi/authme/commands/UnregisterCommand.java | 4 ++++ .../java/fr/xephi/authme/process/join/AsyncronousJoin.java | 4 ++++ .../authme/process/login/ProcessSyncronousPlayerLogin.java | 4 ++++ .../authme/process/logout/ProcessSyncronousPlayerLogout.java | 2 ++ .../process/register/ProcessSyncronousPasswordRegister.java | 4 ++++ 6 files changed, 22 insertions(+) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 41c4fbfd..569088b3 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -486,6 +486,10 @@ public class AdminCommand implements CommandExecutor { LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); if (Settings.applyBlindEffect) target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed) { + target.setWalkSpeed(0.0f); + target.setFlySpeed(0.0f); + } m.send(target, "unregistered"); } } diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 7c1a4c1e..6d8196e5 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -109,6 +109,10 @@ public class UnregisterCommand implements CommandExecutor { } if (Settings.applyBlindEffect) player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } m.send(player, "unregistered"); ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index a75b91b4..442fab0a 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -235,6 +235,10 @@ public class AsyncronousJoin { player.performCommand("motd"); if (Settings.applyBlindEffect) player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } } }); diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 659825d7..2ad48153 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -186,6 +186,10 @@ public class ProcessSyncronousPlayerLogin implements Runnable { if (Settings.applyBlindEffect) player.removePotionEffect(PotionEffectType.BLINDNESS); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.2f); + player.setFlySpeed(0.4f); + } // The Loginevent now fires (as intended) after everything is processed Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index 4cac3864..f78685b0 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -54,6 +54,8 @@ public class ProcessSyncronousPlayerLogout implements Runnable { if (!Settings.isMovementAllowed) { player.setAllowFlight(true); player.setFlying(true); + player.setFlySpeed(0.0f); + player.setWalkSpeed(0.0f); } // Player is now logout... Time to fire event ! Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 71d8292c..60e1f9de 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -119,6 +119,10 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } if (Settings.applyBlindEffect) player.removePotionEffect(PotionEffectType.BLINDNESS); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.2f); + player.setFlySpeed(0.4f); + } // The Loginevent now fires (as intended) after everything is processed Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); player.saveData(); From 53fcfb5b4343299f378f7f621add91233bdfb6f8 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sat, 19 Sep 2015 14:10:48 +0700 Subject: [PATCH 199/427] cleanup encryption --- .../authme/process/join/AsyncronousJoin.java | 30 +++++------ .../authme/security/PasswordSecurity.java | 54 +++++++++---------- 2 files changed, 39 insertions(+), 45 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 442fab0a..613e43c3 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -1,17 +1,5 @@ package fr.xephi.authme.process.join; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -32,6 +20,17 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; public class AsyncronousJoin { @@ -62,10 +61,7 @@ public class AsyncronousJoin { } if (plugin.ess != null && Settings.disableSocialSpy) { - try { - plugin.ess.getUser(player.getName().toLowerCase()).setSocialSpyEnabled(false); - } catch (NoSuchMethodError e) { - } + plugin.ess.getUser(player).setSocialSpyEnabled(false); } final String ip = plugin.getIP(player); @@ -289,7 +285,7 @@ public class AsyncronousJoin { } private void placePlayerSafely(final Player player, - final Location spawnLoc) { + final Location spawnLoc) { Location loc = null; if (spawnLoc == null) return; diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index 3cc83cfc..a95a848d 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -1,19 +1,18 @@ package fr.xephi.authme.security; -import java.math.BigInteger; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.util.HashMap; - -import org.bukkit.Bukkit; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.events.PasswordEncryptionEvent; import fr.xephi.authme.security.crypts.BCRYPT; import fr.xephi.authme.security.crypts.EncryptionMethod; import fr.xephi.authme.settings.Settings; +import org.bukkit.Bukkit; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.util.HashMap; public class PasswordSecurity { @@ -31,7 +30,7 @@ public class PasswordSecurity { } public static String getHash(HashAlgorithm alg, String password, - String playerName) throws NoSuchAlgorithmException { + String playerName) throws NoSuchAlgorithmException { EncryptionMethod method; try { if (alg != HashAlgorithm.CUSTOM) @@ -126,41 +125,39 @@ public class PasswordSecurity { } public static boolean comparePasswordWithHash(String password, String hash, - String playerName) throws NoSuchAlgorithmException { + String playerName) throws NoSuchAlgorithmException { HashAlgorithm algo = Settings.getPasswordHash; EncryptionMethod method; try { if (algo != HashAlgorithm.CUSTOM) method = (EncryptionMethod) algo.getclasse().newInstance(); - else method = null; - } catch (InstantiationException | IllegalAccessException e) { - throw new NoSuchAlgorithmException("Problem with this hash algorithm"); - } - PasswordEncryptionEvent event = new PasswordEncryptionEvent(method, playerName); - Bukkit.getPluginManager().callEvent(event); - method = event.getMethod(); - if (method == null) - throw new NoSuchAlgorithmException("Unknown hash algorithm"); + else + method = null; + + PasswordEncryptionEvent event = new PasswordEncryptionEvent(method, playerName); + Bukkit.getPluginManager().callEvent(event); + method = event.getMethod(); + + if (method == null) + throw new NoSuchAlgorithmException("Unknown hash algorithm"); - try { if (method.comparePassword(hash, password, playerName)) return true; - } catch (Exception e) { - } - if (Settings.supportOldPassword) { - try { + + if (Settings.supportOldPassword) { if (compareWithAllEncryptionMethod(password, hash, playerName)) return true; - } catch (Exception e) { } + } catch (InstantiationException | IllegalAccessException e) { + throw new NoSuchAlgorithmException("Problem with this hash algorithm"); } return false; } private static boolean compareWithAllEncryptionMethod(String password, - String hash, String playerName) throws NoSuchAlgorithmException { + String hash, String playerName) throws NoSuchAlgorithmException { for (HashAlgorithm algo : HashAlgorithm.values()) { - if (algo != HashAlgorithm.CUSTOM) + if (algo != HashAlgorithm.CUSTOM) { try { EncryptionMethod method = (EncryptionMethod) algo.getclasse().newInstance(); if (method.comparePassword(hash, password, playerName)) { @@ -173,8 +170,9 @@ public class PasswordSecurity { } return true; } - } catch (Exception e) { + } catch (Exception ignored) { } + } } return false; } From 350ab535634864a03184fd21ce4cf8f8bfb262f8 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 08:40:02 +0700 Subject: [PATCH 200/427] update base64 --- .../xephi/authme/cache/backup/JsonCache.java | 6 +- .../authme/process/join/AsyncronousJoin.java | 34 ++--- .../xephi/authme/security/crypts/BCRYPT.java | 135 +++++++----------- .../security/crypts/CryptPBKDF2Django.java | 6 +- 4 files changed, 75 insertions(+), 106 deletions(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index dee7b743..13c1777a 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -1,7 +1,6 @@ package fr.xephi.authme.cache.backup; import com.google.common.base.Charsets; -import com.google.common.io.BaseEncoding; import com.google.common.io.Files; import com.google.gson.*; import fr.xephi.authme.AuthMe; @@ -14,6 +13,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.util.io.BukkitObjectInputStream; import org.bukkit.util.io.BukkitObjectOutputStream; +import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -133,7 +133,7 @@ public class JsonCache { BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos); objectOut.writeObject(item); objectOut.close(); - val.addProperty("item", BaseEncoding.base64().encode(baos.toByteArray())); + val.addProperty("item", Base64Coder.encodeLines(baos.toByteArray())); } catch (IOException e) { e.printStackTrace(); continue; @@ -187,7 +187,7 @@ public class JsonCache { for (int i = 0; i < arr.size(); i++) { JsonObject item = arr.get(i).getAsJsonObject(); String encoded = item.get("item").getAsString(); - byte[] decoded = BaseEncoding.base64().decode(encoded); + byte[] decoded = Base64Coder.decode(encoded); try { ByteArrayInputStream baos = new ByteArrayInputStream(decoded); BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 613e43c3..b6362624 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -172,27 +172,23 @@ public class AsyncronousJoin { } if (Settings.protectInventoryBeforeLogInEnabled) { - try { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); - ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); - plugin.getServer().getPluginManager().callEvent(ev); - if (ev.isCancelled()) { - if (!Settings.noConsoleSpam) - ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); - } else { - final ItemStack[] inv = ev.getEmptyArmor(); - final ItemStack[] armor = ev.getEmptyArmor(); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); + ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); + plugin.getServer().getPluginManager().callEvent(ev); + if (ev.isCancelled()) { + if (!Settings.noConsoleSpam) + ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); + } else { + final ItemStack[] inv = ev.getEmptyArmor(); + final ItemStack[] armor = ev.getEmptyArmor(); + sched.scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - plugin.api.setPlayerInventory(player, inv, armor); - } + @Override + public void run() { + plugin.api.setPlayerInventory(player, inv, armor); + } - }); - } - } catch (Exception ex) { - ex.printStackTrace(); + }); } } String[] msg; diff --git a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java index 847e9951..7f420c00 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java +++ b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java @@ -69,17 +69,17 @@ public class BCRYPT implements EncryptionMethod { private static final int BLOWFISH_NUM_ROUNDS = 16; // Initial contents of key schedule - private static final int P_orig[] = { 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b }; - private static final int S_orig[] = { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 }; + private static final int P_orig[] = {0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b}; + private static final int S_orig[] = {0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}; // bcrypt IV: "OrpheanBeholderScryDoubt" - static private final int bf_crypt_ciphertext[] = { 0x4f727068, 0x65616e42, 0x65686f6c, 0x64657253, 0x63727944, 0x6f756274 }; + static private final int bf_crypt_ciphertext[] = {0x4f727068, 0x65616e42, 0x65686f6c, 0x64657253, 0x63727944, 0x6f756274}; // Table for Base64 encoding - static private final char base64_code[] = { '.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; + static private final char base64_code[] = {'.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; // Table for Base64 decoding - static private final byte index_64[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, -1, -1, -1, -1, -1 }; + static private final byte index_64[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, -1, -1, -1, -1, -1}; // Expanded Blowfish key private int P[]; @@ -90,13 +90,10 @@ public class BCRYPT implements EncryptionMethod { * scheme. Note that this is *not* compatible with the standard MIME-base64 * encoding. * - * @param d - * the byte array to encode - * @param len - * the number of bytes to encode + * @param d the byte array to encode + * @param len the number of bytes to encode * @return base64-encoded string - * @exception IllegalArgumentException - * if the length is invalid + * @throws IllegalArgumentException if the length is invalid */ private static String encode_base64(byte d[], int len) throws IllegalArgumentException { @@ -134,9 +131,8 @@ public class BCRYPT implements EncryptionMethod { /** * Look up the 3 bits base64-encoded by the specified character, * range-checking againt conversion table - * - * @param x - * the base64-encoded value + * + * @param x the base64-encoded value * @return the decoded value of x */ private static byte char64(char x) { @@ -149,14 +145,11 @@ public class BCRYPT implements EncryptionMethod { * Decode a string encoded using bcrypt's base64 scheme to a byte array. * Note that this is *not* compatible with the standard MIME-base64 * encoding. - * - * @param s - * the string to decode - * @param maxolen - * the maximum number of bytes to decode + * + * @param s the string to decode + * @param maxolen the maximum number of bytes to decode * @return an array containing the decoded bytes - * @throws IllegalArgumentException - * if maxolen is invalid + * @throws IllegalArgumentException if maxolen is invalid */ private static byte[] decode_base64(String s, int maxolen) throws IllegalArgumentException { @@ -201,17 +194,15 @@ public class BCRYPT implements EncryptionMethod { /** * Blowfish encipher a single 64-bit block encoded as two 32-bit halves - * - * @param lr - * an array containing the two 32-bit half blocks - * @param off - * the position in the array of the blocks + * + * @param lr an array containing the two 32-bit half blocks + * @param off the position in the array of the blocks */ private final void encipher(int lr[], int off) { int i, n, l = lr[off], r = lr[off + 1]; l ^= P[0]; - for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2;) { + for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2; ) { // Feistel substitution on left word n = S[(l >> 24) & 0xff]; n += S[0x100 | ((l >> 16) & 0xff)]; @@ -232,12 +223,10 @@ public class BCRYPT implements EncryptionMethod { /** * Cycically extract a word of key material - * - * @param data - * the string to extract the data from - * @param offp - * a "pointer" (as a one-entry array) to the current offset into - * data + * + * @param data the string to extract the data from + * @param offp a "pointer" (as a one-entry array) to the current offset into + * data * @return the next word of material from data */ private static int streamtoword(byte data[], int offp[]) { @@ -264,14 +253,13 @@ public class BCRYPT implements EncryptionMethod { /** * Key the Blowfish cipher - * - * @param key - * an array containing the key + * + * @param key an array containing the key */ private void key(byte key[]) { int i; - int koffp[] = { 0 }; - int lr[] = { 0, 0 }; + int koffp[] = {0}; + int lr[] = {0, 0}; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) @@ -294,16 +282,14 @@ public class BCRYPT implements EncryptionMethod { * Perform the "enhanced key schedule" step described by Provos and Mazieres * in "A Future-Adaptable Password Scheme" * http://www.openbsd.org/papers/bcrypt-paper.ps - * - * @param data - * salt information - * @param key - * password information + * + * @param data salt information + * @param key password information */ private void ekskey(byte data[], byte key[]) { int i; - int koffp[] = { 0 }, doffp[] = { 0 }; - int lr[] = { 0, 0 }; + int koffp[] = {0}, doffp[] = {0}; + int lr[] = {0, 0}; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) @@ -328,14 +314,11 @@ public class BCRYPT implements EncryptionMethod { /** * Perform the central password hashing step in the bcrypt scheme - * - * @param password - * the password to hash - * @param salt - * the binary salt to hash with the password - * @param log_rounds - * the binary logarithm of the number of rounds of hashing to - * apply + * + * @param password the password to hash + * @param salt the binary salt to hash with the password + * @param log_rounds the binary logarithm of the number of rounds of hashing to + * apply * @return an array containing the binary hashed password */ private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) { @@ -374,11 +357,9 @@ public class BCRYPT implements EncryptionMethod { /** * Hash a password using the OpenBSD bcrypt scheme - * - * @param password - * the password to hash - * @param salt - * the salt to hash with (perhaps generated using BCrypt.gensalt) + * + * @param password the password to hash + * @param salt the salt to hash with (perhaps generated using BCrypt.gensalt) * @return the hashed password */ public static String hashpw(String password, String salt) { @@ -432,12 +413,10 @@ public class BCRYPT implements EncryptionMethod { /** * Generate a salt for use with the BCrypt.hashpw() method - * - * @param log_rounds - * the log2 of the number of rounds of hashing to apply - the - * work factor therefore increases as 2**log_rounds. - * @param random - * an instance of SecureRandom to use + * + * @param log_rounds the log2 of the number of rounds of hashing to apply - the + * work factor therefore increases as 2**log_rounds. + * @param random an instance of SecureRandom to use * @return an encoded salt value */ public static String gensalt(int log_rounds, SecureRandom random) { @@ -457,10 +436,9 @@ public class BCRYPT implements EncryptionMethod { /** * Generate a salt for use with the BCrypt.hashpw() method - * - * @param log_rounds - * the log2 of the number of rounds of hashing to apply - the - * work factor therefore increases as 2**log_rounds. + * + * @param log_rounds the log2 of the number of rounds of hashing to apply - the + * work factor therefore increases as 2**log_rounds. * @return an encoded salt value */ public static String gensalt(int log_rounds) { @@ -470,7 +448,7 @@ public class BCRYPT implements EncryptionMethod { /** * Generate a salt for use with the BCrypt.hashpw() method, selecting a * reasonable default for the number of hashing rounds to apply - * + * * @return an encoded salt value */ public static String gensalt() { @@ -479,11 +457,9 @@ public class BCRYPT implements EncryptionMethod { /** * Check that a plaintext password matches a previously hashed one - * - * @param plaintext - * the plaintext password to verify - * @param hashed - * the previously-hashed password + * + * @param plaintext the plaintext password to verify + * @param hashed the previously-hashed password * @return true if the passwords match, false otherwise */ public static boolean checkpw(String plaintext, String hashed) { @@ -494,12 +470,9 @@ public class BCRYPT implements EncryptionMethod { * Check that a text password matches a previously hashed one with the * specified number of rounds using recursion * - * @param text - * plaintext or hashed text - * @param hashed - * the previously-hashed password - * @param rounds - * number of rounds to hash the password + * @param text plaintext or hashed text + * @param hashed the previously-hashed password + * @param rounds number of rounds to hash the password * @return */ public static boolean checkpw(String text, String hashed, int rounds) { @@ -528,7 +501,7 @@ public class BCRYPT implements EncryptionMethod { @Override public boolean comparePassword(String hash, String password, - String playerName) throws NoSuchAlgorithmException { + String playerName) throws NoSuchAlgorithmException { return checkpw(password, hash); } diff --git a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java index fc998664..c1e119a3 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java @@ -1,10 +1,10 @@ package fr.xephi.authme.security.crypts; -import java.security.NoSuchAlgorithmException; - import fr.xephi.authme.security.pbkdf2.PBKDF2Engine; import fr.xephi.authme.security.pbkdf2.PBKDF2Parameters; + import javax.xml.bind.DatatypeConverter; +import java.security.NoSuchAlgorithmException; public class CryptPBKDF2Django implements EncryptionMethod { @@ -20,7 +20,7 @@ public class CryptPBKDF2Django implements EncryptionMethod { @Override public boolean comparePassword(String hash, String password, - String playerName) throws NoSuchAlgorithmException { + String playerName) throws NoSuchAlgorithmException { String[] line = hash.split("\\$"); String salt = line[2]; byte[] derivedKey = DatatypeConverter.parseBase64Binary(line[3]); From b1276da4166906961591a7abca3f0713872bb44e Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 09:18:30 +0700 Subject: [PATCH 201/427] protect inventory only for registered player --- .../xephi/authme/cache/limbo/LimboCache.java | 8 ++-- .../authme/process/join/AsyncronousJoin.java | 47 +++++++++---------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index b158a8cc..366bc60a 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -17,14 +17,14 @@ import java.util.concurrent.ConcurrentHashMap; public class LimboCache { - private volatile static LimboCache singleton = null; + private volatile static LimboCache singleton; public ConcurrentHashMap cache; private JsonCache playerData; public AuthMe plugin; private LimboCache(AuthMe plugin) { this.plugin = plugin; - this.cache = new ConcurrentHashMap(); + this.cache = new ConcurrentHashMap<>(); this.playerData = new JsonCache(plugin); } @@ -77,7 +77,7 @@ public class LimboCache { } if (Settings.isForceSurvivalModeEnabled) { - if (Settings.isResetInventoryIfCreative && player.getGameMode() == GameMode.CREATIVE) { + if (Settings.isResetInventoryIfCreative && gameMode == GameMode.CREATIVE) { ResetInventoryEvent event = new ResetInventoryEvent(player); Bukkit.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { @@ -123,7 +123,7 @@ public class LimboCache { if (this.hasLimboPlayer(player.getName().toLowerCase())) { this.deleteLimboPlayer(player.getName().toLowerCase()); } - this.addLimboPlayer(player); + addLimboPlayer(player); } } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index b6362624..7099486b 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -127,11 +127,28 @@ public class AsyncronousJoin { } placePlayerSafely(player, spawnLoc); LimboCache.getInstance().updateLimboPlayer(player); - try { - DataFileCache dataFile = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour()); - playerBackup.createCache(player, dataFile); - } catch (Exception e) { - ConsoleLogger.showError("Error on creating an inventory cache for " + name + ", maybe inventory wipe in preparation..."); + DataFileCache dataFile = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour()); + playerBackup.createCache(player, dataFile); + // protect inventory + if (Settings.protectInventoryBeforeLogInEnabled) { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); + ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); + plugin.getServer().getPluginManager().callEvent(ev); + if (ev.isCancelled()) { + if (!Settings.noConsoleSpam) + ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); + } else { + final ItemStack[] inv = ev.getEmptyArmor(); + final ItemStack[] armor = ev.getEmptyArmor(); + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + plugin.api.setPlayerInventory(player, inv, armor); + } + + }); + } } } else { if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { @@ -171,26 +188,6 @@ public class AsyncronousJoin { } } - if (Settings.protectInventoryBeforeLogInEnabled) { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); - ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); - plugin.getServer().getPluginManager().callEvent(ev); - if (ev.isCancelled()) { - if (!Settings.noConsoleSpam) - ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); - } else { - final ItemStack[] inv = ev.getEmptyArmor(); - final ItemStack[] armor = ev.getEmptyArmor(); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - plugin.api.setPlayerInventory(player, inv, armor); - } - - }); - } - } String[] msg; if (Settings.emailRegistration) { msg = database.isAuthAvailable(name) ? m.send("login_msg") : m.send("reg_email_msg"); From 4288fa29b676237cc35649e27b902621bc43fbf6 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 09:26:29 +0700 Subject: [PATCH 202/427] update --- src/main/java/fr/xephi/authme/cache/backup/JsonCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 13c1777a..b4198c48 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -187,7 +187,7 @@ public class JsonCache { for (int i = 0; i < arr.size(); i++) { JsonObject item = arr.get(i).getAsJsonObject(); String encoded = item.get("item").getAsString(); - byte[] decoded = Base64Coder.decode(encoded); + byte[] decoded = Base64Coder.decodeLines(encoded); try { ByteArrayInputStream baos = new ByteArrayInputStream(decoded); BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); From e1893ce85b1b2d9adcb9a4b6fa4c6ff3645f5f9e Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 11:42:41 +0700 Subject: [PATCH 203/427] ups, forgot to put inventory. --- src/main/java/fr/xephi/authme/cache/backup/JsonCache.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index b4198c48..018e6ba2 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -106,6 +106,7 @@ public class JsonCache { contents = dataFileCache.getInventory(); arr = new JsonArray(); putItems(contents, arr); + jsonObject.add("inventory", arr); // armour contents = dataFileCache.getArmour(); From 4e275eeb1d979b7ec42ddd5e7b315b16b104701a Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 14:11:17 +0700 Subject: [PATCH 204/427] change Utils to static class. --- src/main/java/fr/xephi/authme/AuthMe.java | 5 +- src/main/java/fr/xephi/authme/Utils.java | 29 ++++------ src/main/java/fr/xephi/authme/api/API.java | 7 +-- src/main/java/fr/xephi/authme/api/NewAPI.java | 5 +- .../xephi/authme/commands/AdminCommand.java | 2 +- .../authme/commands/UnregisterCommand.java | 4 +- .../authme/listener/AuthMeBlockListener.java | 4 +- .../listener/AuthMeChestShopListener.java | 2 +- .../authme/listener/AuthMeEntityListener.java | 15 +++-- .../authme/listener/AuthMePlayerListener.java | 57 +++++++++---------- .../authme/process/join/AsyncronousJoin.java | 9 ++- .../login/ProcessSyncronousPlayerLogin.java | 4 +- .../process/logout/AsyncronousLogout.java | 3 +- .../authme/process/quit/AsyncronousQuit.java | 5 +- .../ProcessSyncronousEmailRegister.java | 2 +- .../ProcessSyncronousPasswordRegister.java | 25 ++++---- 16 files changed, 79 insertions(+), 99 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 6be444cd..c6385f3e 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -57,7 +57,6 @@ public class AuthMe extends JavaPlugin { private final Logger authmeLogger = Logger.getLogger("AuthMe"); public Management management; public NewAPI api; - private Utils utils = Utils.getInstance(); public SendMailSSL mail; private Settings settings; private Messages m; @@ -535,7 +534,7 @@ public class AuthMe extends JavaPlugin { // Save Player Data public void savePlayer(Player player) { - if ((utils.isNPC(player)) || (Utils.getInstance().isUnrestricted(player))) { + if ((Utils.isNPC(player)) || (Utils.isUnrestricted(player))) { return; } String name = player.getName().toLowerCase(); @@ -552,7 +551,7 @@ public class AuthMe extends JavaPlugin { if (!Settings.noTeleport) { player.teleport(limbo.getLoc()); } - this.utils.addNormal(player, limbo.getGroup()); + Utils.addNormal(player, limbo.getGroup()); player.setOp(limbo.getOperator()); limbo.getTimeoutTaskId().cancel(); LimboCache.getInstance().deleteLimboPlayer(name); diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index b0feda6b..88b6d9d2 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -21,16 +21,12 @@ import java.util.Iterator; public class Utils { private static boolean getOnlinePlayersIsCollection; - private String currentGroup; private static Utils singleton; private static Method getOnlinePlayers; - public final AuthMe plugin; - - public Utils(AuthMe plugin) { - this.plugin = plugin; - } + public static AuthMe plugin; static { + plugin = AuthMe.getInstance(); try { Method m = Bukkit.class.getDeclaredMethod("getOnlinePlayers"); getOnlinePlayersIsCollection = m.getReturnType() == Collection.class; @@ -38,17 +34,18 @@ public class Utils { } } - public void setGroup(Player player, GroupType group) { + public static void setGroup(Player player, GroupType group) { setGroup(player.getName(), group); } @SuppressWarnings("deprecation") - public void setGroup(String player, GroupType group) { + public static void setGroup(String player, GroupType group) { if (!Settings.isPermissionCheckEnabled) return; if (plugin.permission == null) return; String name = player; + String currentGroup; try { World world = null; currentGroup = plugin.permission.getPrimaryGroup(world, name); @@ -88,11 +85,10 @@ public class Utils { break; } } - return; } @SuppressWarnings("deprecation") - public boolean addNormal(Player player, String group) { + public static boolean addNormal(Player player, String group) { if (!useGroupSystem()) { return false; } @@ -123,20 +119,15 @@ public class Utils { } } - public boolean isUnrestricted(Player player) { + public static boolean isUnrestricted(Player player) { return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName())); } - public static Utils getInstance() { - singleton = new Utils(AuthMe.getInstance()); - return singleton; - } - - private boolean useGroupSystem() { + private static boolean useGroupSystem() { return Settings.isPermissionCheckEnabled && !Settings.getUnloggedinGroup.isEmpty(); } - public void packCoords(double x, double y, double z, String w, + public static void packCoords(double x, double y, double z, String w, final Player pl) { World theWorld; if (w.equals("unavailableworld")) { @@ -216,7 +207,7 @@ public class Utils { return Collections.emptyList(); } - public boolean isNPC(final Entity player) { + public static boolean isNPC(final Entity player) { try { if (player.hasMetadata("NPC")) { return true; diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index 026a9577..11eba861 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -19,7 +19,6 @@ public class API { public static final String newline = System.getProperty("line.separator"); public static AuthMe instance; - private Utils utils = Utils.getInstance(); @Deprecated public API(AuthMe instance) { @@ -65,7 +64,7 @@ public class API { */ @Deprecated public boolean isaNPC(Player player) { - return utils.isNPC(player); + return Utils.isNPC(player); } /** @@ -75,7 +74,7 @@ public class API { */ @Deprecated public boolean isNPC(Player player) { - return utils.isNPC(player); + return Utils.isNPC(player); } /** @@ -85,7 +84,7 @@ public class API { */ @Deprecated public static boolean isUnrestricted(Player player) { - return Utils.getInstance().isUnrestricted(player); + return Utils.isUnrestricted(player); } @Deprecated diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index b31f9ab2..937a8abe 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -22,7 +22,6 @@ public class NewAPI { public static final String newline = System.getProperty("line.separator"); public static NewAPI singleton; public AuthMe plugin; - private Utils utils = Utils.getInstance(); public NewAPI(AuthMe plugin) { this.plugin = plugin; @@ -68,7 +67,7 @@ public class NewAPI { * @return true if player is a npc */ public boolean isNPC(Player player) { - return utils.isNPC(player); + return Utils.isNPC(player); } /** @@ -77,7 +76,7 @@ public class NewAPI { * @return true if the player is unrestricted */ public boolean isUnrestricted(Player player) { - return Utils.getInstance().isUnrestricted(player); + return Utils.isUnrestricted(player); } public Location getLastLocation(Player player) { diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 569088b3..0376f12e 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -464,7 +464,7 @@ public class AdminCommand implements CommandExecutor { @SuppressWarnings("deprecation") Player target = Bukkit.getPlayer(name); PlayerCache.getInstance().removePlayer(name); - Utils.getInstance().setGroup(name, GroupType.UNREGISTERED); + Utils.setGroup(name, GroupType.UNREGISTERED); if (target != null) { if (target.isOnline()) { if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 6d8196e5..ce02aee6 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -84,7 +84,7 @@ public class UnregisterCommand implements CommandExecutor { player.saveData(); PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); if (!Settings.getRegisteredGroup.isEmpty()) - Utils.getInstance().setGroup(player, GroupType.UNREGISTERED); + Utils.setGroup(player, GroupType.UNREGISTERED); LimboCache.getInstance().addLimboPlayer(player); int delay = Settings.getRegistrationTimeout * 20; int interval = Settings.getWarnMessageInterval; @@ -99,7 +99,7 @@ public class UnregisterCommand implements CommandExecutor { return; } if (!Settings.unRegisteredGroup.isEmpty()) { - Utils.getInstance().setGroup(player, Utils.GroupType.UNREGISTERED); + Utils.setGroup(player, Utils.GroupType.UNREGISTERED); } PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); // check if Player cache File Exist and delete it, preventing diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index d6c64582..e6903ce3 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -28,7 +28,7 @@ public class AuthMeBlockListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } @@ -53,7 +53,7 @@ public class AuthMeBlockListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java index bafa9c4c..3577dc34 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java @@ -28,7 +28,7 @@ public class AuthMeChestShopListener implements Listener { Player player = event.getClient(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index e1bfea52..f85e2497 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -14,7 +14,6 @@ import org.bukkit.event.entity.*; public class AuthMeEntityListener implements Listener { public AuthMe instance; - private Utils utils = Utils.getInstance(); public AuthMeEntityListener(AuthMe instance) { this.instance = instance; @@ -28,11 +27,11 @@ public class AuthMeEntityListener implements Listener { return; } - if (Utils.getInstance().isUnrestricted((Player) entity)) { + if (Utils.isUnrestricted((Player) entity)) { return; } - if (utils.isNPC(entity)) + if (Utils.isNPC(entity)) return; Player player = (Player) entity; @@ -61,7 +60,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (utils.isNPC(entity)) + if (Utils.isNPC(entity)) return; Player player = (Player) entity; @@ -111,7 +110,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (utils.isNPC(entity)) + if (Utils.isNPC(entity)) return; Player player = (Player) entity; @@ -138,7 +137,7 @@ public class AuthMeEntityListener implements Listener { return; } - if (utils.isNPC(entity)) + if (Utils.isNPC(entity)) return; Player player = (Player) entity; @@ -167,7 +166,7 @@ public class AuthMeEntityListener implements Listener { Player player = (Player) event.getEntity(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player)) + if (Utils.isUnrestricted(player) || Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName())) { @@ -191,7 +190,7 @@ public class AuthMeEntityListener implements Listener { Player player = (Player) event.getEntity(); String name = player.getName().toLowerCase(); - if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player)) + if (Utils.isUnrestricted(player) || Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName())) { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 93884b28..afd1b085 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -39,7 +39,6 @@ public class AuthMePlayerListener implements Listener { public static ConcurrentHashMap joinMessage = new ConcurrentHashMap<>(); private Messages m = Messages.getInstance(); public AuthMe plugin; - private Utils utils = Utils.getInstance(); public static ConcurrentHashMap causeByAuthMe = new ConcurrentHashMap<>(); private List antibot = new ArrayList<>(); @@ -55,7 +54,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) + if (Utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -89,7 +88,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) + if (Utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -125,7 +124,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) + if (Utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -161,7 +160,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) + if (Utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -197,7 +196,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) + if (Utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -233,7 +232,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) + if (Utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) { @@ -270,7 +269,7 @@ public class AuthMePlayerListener implements Listener { final Player player = event.getPlayer(); final String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) + if (Utils.isUnrestricted(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -305,7 +304,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isNPC(player) || utils.isUnrestricted(player)) { + if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { return; } @@ -423,7 +422,7 @@ public class AuthMePlayerListener implements Listener { public void run() { LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); if (limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - utils.addNormal(player, limbo.getGroup()); + Utils.addNormal(player, limbo.getGroup()); LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); } } @@ -440,7 +439,7 @@ public class AuthMePlayerListener implements Listener { final String name = player.getName().toLowerCase(); boolean isAuthAvailable = plugin.database.isAuthAvailable(name); - if (utils.isNPC(player) || utils.isUnrestricted(player)) { + if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { return; } @@ -604,11 +603,11 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } - if (utils.isNPC(player)) + if (Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) { @@ -632,11 +631,11 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } - if (utils.isNPC(player)) + if (Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { @@ -663,11 +662,11 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } - if (utils.isNPC(player)) { + if (Utils.isNPC(player)) { return; } @@ -690,10 +689,10 @@ public class AuthMePlayerListener implements Listener { return; final Player player = (Player) event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } - if (utils.isNPC(player)) + if (Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { return; @@ -728,11 +727,11 @@ public class AuthMePlayerListener implements Listener { Player player = (Player) event.getWhoClicked(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } - if (utils.isNPC(player)) + if (Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { @@ -758,11 +757,11 @@ public class AuthMePlayerListener implements Listener { Player player = (Player) damager; String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } - if (utils.isNPC(player)) { + if (Utils.isNPC(player)) { return; } @@ -786,7 +785,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isNPC(player) || utils.isUnrestricted(player)) { + if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { return; } @@ -810,7 +809,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player) || utils.isNPC(player)) + if (Utils.isUnrestricted(player) || Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { @@ -833,7 +832,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } @@ -856,7 +855,7 @@ public class AuthMePlayerListener implements Listener { } Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player)) { + if (Utils.isUnrestricted(player)) { return; } if (PlayerCache.getInstance().isAuthenticated(name)) { @@ -879,7 +878,7 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player) || utils.isNPC(player)) + if (Utils.isUnrestricted(player) || Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) @@ -911,7 +910,7 @@ public class AuthMePlayerListener implements Listener { String name = player.getName().toLowerCase(); - if (utils.isUnrestricted(player) || utils.isNPC(player)) + if (Utils.isUnrestricted(player) || Utils.isNPC(player)) return; if (PlayerCache.getInstance().isAuthenticated(name)) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 7099486b..dbe71d20 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -38,7 +38,6 @@ public class AsyncronousJoin { protected DataSource database; protected AuthMe plugin; protected String name; - private Utils utils = Utils.getInstance(); private Messages m = Messages.getInstance(); private JsonCache playerBackup; @@ -56,7 +55,7 @@ public class AsyncronousJoin { AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode()); BukkitScheduler sched = plugin.getServer().getScheduler(); - if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) { + if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { return; } @@ -163,7 +162,7 @@ public class AsyncronousJoin { }); } if (!Settings.unRegisteredGroup.isEmpty()) { - utils.setGroup(player, Utils.GroupType.UNREGISTERED); + Utils.setGroup(player, Utils.GroupType.UNREGISTERED); } if (!Settings.isForcedRegistrationEnabled) { return; @@ -205,9 +204,9 @@ public class AsyncronousJoin { if (!LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().addLimboPlayer(player); if (database.isAuthAvailable(name)) { - utils.setGroup(player, GroupType.NOTLOGGEDIN); + Utils.setGroup(player, GroupType.NOTLOGGEDIN); } else { - utils.setGroup(player, GroupType.UNREGISTERED); + Utils.setGroup(player, GroupType.UNREGISTERED); } sched.scheduleSyncDelayedTask(plugin, new Runnable() { diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 2ad48153..2f70bfcf 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -63,7 +63,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { } protected void packQuitLocation() { - Utils.getInstance().packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player); + Utils.packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player); } protected void teleportBackFromSpawn() { @@ -166,7 +166,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { Utils.forceGM(player); // Restore Permission Group - Utils.getInstance().setGroup(player, GroupType.LOGGEDIN); + Utils.setGroup(player, GroupType.LOGGEDIN); // Cleanup no longer used temporary data LimboCache.getInstance().deleteLimboPlayer(name); diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index 1f44b3a3..d1f890ad 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -25,7 +25,6 @@ public class AsyncronousLogout { protected DataSource database; protected boolean canLogout = true; private Messages m = Messages.getInstance(); - private Utils utils = Utils.getInstance(); private JsonCache playerBackup; public AsyncronousLogout(Player player, AuthMe plugin, @@ -79,7 +78,7 @@ public class AsyncronousLogout { if (LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().addLimboPlayer(player); - utils.setGroup(player, GroupType.NOTLOGGEDIN); + Utils.setGroup(player, GroupType.NOTLOGGEDIN); if (Settings.protectInventoryBeforeLogInEnabled) { player.getInventory().clear(); // create cache file for handling lost of inventories on unlogged in diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 9a05229a..da594606 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -22,7 +22,6 @@ public class AsyncronousQuit { protected AuthMe plugin; protected DataSource database; protected Player player; - protected Utils utils = Utils.getInstance(); private String name; private ItemStack[] armor = null; private ItemStack[] inv = null; @@ -43,7 +42,7 @@ public class AsyncronousQuit { public void process() { if (player == null) return; - if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) { + if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { return; } @@ -66,7 +65,7 @@ public class AsyncronousQuit { armor = limbo.getArmour(); } if (limbo.getGroup() != null && !limbo.getGroup().equals("")) - utils.addNormal(player, limbo.getGroup()); + Utils.addNormal(player, limbo.getGroup()); needToChange = true; isOp = limbo.getOperator(); isFlying = limbo.isFlying(); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index 64eec84d..280daa29 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -31,7 +31,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { public void run() { LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); if (!Settings.getRegisteredGroup.isEmpty()) { - Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED); + Utils.setGroup(player, Utils.GroupType.REGISTERED); } m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 60e1f9de..409895d4 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -1,13 +1,5 @@ package fr.xephi.authme.process.register; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -21,6 +13,13 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; public class ProcessSyncronousPasswordRegister implements Runnable { @@ -39,7 +38,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { for (String command : Settings.forceRegisterCommands) { try { player.performCommand(command.replace("%p", player.getName())); - } catch (Exception e) { + } catch (Exception ignored) { } } for (String command : Settings.forceRegisterCommandsAsConsole) { @@ -71,10 +70,8 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); - try { - if (player.isInsideVehicle()) - player.getVehicle().eject(); - } catch (NullPointerException npe) { + if (player.isInsideVehicle() && player.getVehicle() != null) { + player.getVehicle().eject(); } } @@ -108,7 +105,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } if (!Settings.getRegisteredGroup.isEmpty()) { - Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED); + Utils.setGroup(player, Utils.GroupType.REGISTERED); } m.send(player, "registered"); if (!Settings.getmailAccount.isEmpty()) From 22638c29e5c9e08b1dcef7a64cc7bc1c688197cb Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 14:26:46 +0700 Subject: [PATCH 205/427] update logger --- .../java/fr/xephi/authme/ConsoleLogger.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index f33ff152..befffc68 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -8,19 +8,24 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Logger; public class ConsoleLogger { private static final Logger log = AuthMe.getInstance().getLogger(); - + private static final DateFormat df = new SimpleDateFormat("[MM-dd HH:mm:ss]"); public static void info(String message) { if (AuthMe.getInstance().isEnabled()) { log.info("[AuthMe] " + message); if (Settings.useLogging) { - writeLog("[" + DateFormat.getDateTimeInstance().format(new Date()) + "] " + message); + String dateTime; + synchronized (df) { + dateTime = df.format(new Date()); + } + writeLog(dateTime + " " + message); } } } @@ -29,7 +34,11 @@ public class ConsoleLogger { if (AuthMe.getInstance().isEnabled()) { log.warning("[AuthMe] " + message); if (Settings.useLogging) { - writeLog("[" + DateFormat.getDateTimeInstance().format(new Date()) + "] ERROR: " + message); + String dateTime; + synchronized (df) { + dateTime = df.format(new Date()); + } + writeLog(dateTime + " ERROR: " + message); } } } @@ -44,6 +53,10 @@ public class ConsoleLogger { } public static void writeStackTrace(Exception ex) { - writeLog(Throwables.getStackTraceAsString(ex)); + String dateTime; + synchronized (df) { + dateTime = df.format(new Date()); + } + writeLog(dateTime + " " + Throwables.getStackTraceAsString(ex)); } } From 314fb011051e81d1774f26006f41fc445bb73b22 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 14:46:03 +0700 Subject: [PATCH 206/427] store isAuthAvailable into local variable. improve performance when cache is not enabled. --- .../authme/process/join/AsyncronousJoin.java | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index dbe71d20..0302e06f 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -94,7 +94,8 @@ public class AsyncronousJoin { } } final Location spawnLoc = plugin.getSpawnLocation(player); - if (database.isAuthAvailable(name)) { + final boolean isAuthAvailable = database.isAuthAvailable(name); + if (isAuthAvailable) { if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { @@ -170,7 +171,6 @@ public class AsyncronousJoin { if (!Settings.noTeleport) if (!needFirstspawn() && Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { - @Override public void run() { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); @@ -189,9 +189,9 @@ public class AsyncronousJoin { } String[] msg; if (Settings.emailRegistration) { - msg = database.isAuthAvailable(name) ? m.send("login_msg") : m.send("reg_email_msg"); + msg = isAuthAvailable ? m.send("login_msg") : m.send("reg_email_msg"); } else { - msg = database.isAuthAvailable(name) ? m.send("login_msg") : m.send("reg_msg"); + msg = isAuthAvailable ? m.send("login_msg") : m.send("reg_msg"); } int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; @@ -203,7 +203,7 @@ public class AsyncronousJoin { } if (!LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().addLimboPlayer(player); - if (database.isAuthAvailable(name)) { + if (isAuthAvailable) { Utils.setGroup(player, GroupType.NOTLOGGEDIN); } else { Utils.setGroup(player, GroupType.UNREGISTERED); @@ -230,7 +230,7 @@ public class AsyncronousJoin { } }); - if (Settings.isSessionsEnabled && database.isAuthAvailable(name) && (PlayerCache.getInstance().isAuthenticated(name) || database.isLogged(name))) { + if (Settings.isSessionsEnabled && isAuthAvailable && (PlayerCache.getInstance().isAuthenticated(name) || database.isLogged(name))) { if (plugin.sessions.containsKey(name)) plugin.sessions.get(name).cancel(); plugin.sessions.remove(name); @@ -252,28 +252,27 @@ public class AsyncronousJoin { } private boolean needFirstspawn() { - if (database.isAuthAvailable(player.getName().toLowerCase()) && player.hasPlayedBefore()) + if (player.hasPlayedBefore()) return false; - else { - if (Spawn.getInstance().getFirstSpawn() == null || Spawn.getInstance().getFirstSpawn().getWorld() == null) - return false; - FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), Spawn.getInstance().getFirstSpawn()); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { - final Location fLoc = tpEvent.getTo(); - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + if (Spawn.getInstance().getFirstSpawn() == null || Spawn.getInstance().getFirstSpawn().getWorld() == null) + return false; + FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), Spawn.getInstance().getFirstSpawn()); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { + final Location fLoc = tpEvent.getTo(); + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - player.teleport(fLoc); - } + @Override + public void run() { + player.teleport(fLoc); + } - }); - } + }); } - return true; } + return true; + } private void placePlayerSafely(final Player player, @@ -285,7 +284,7 @@ public class AsyncronousJoin { return; if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) return; - if (!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) + if (!player.hasPlayedBefore()) return; Block b = player.getLocation().getBlock(); if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) { From ff1cc8c27dbef523fcd75e312d54023a07f13918 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 14:54:49 +0700 Subject: [PATCH 207/427] not needed, it does the same thing if event is cancelled --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index afd1b085..7402effe 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -647,10 +647,6 @@ public class AuthMePlayerListener implements Listener { return; } } - if (event.getClickedBlock() != null) { - event.setUseInteractedBlock(org.bukkit.event.Event.Result.DENY); - } - event.setUseItemInHand(org.bukkit.event.Event.Result.DENY); event.setCancelled(true); } From 6babac98ebfdaa7c7bfc7c02d3f91b1faac8fb74 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 15:53:18 +0700 Subject: [PATCH 208/427] extract auth check into a method. --- .../authme/listener/AuthMePlayerListener.java | 514 +++--------------- 1 file changed, 66 insertions(+), 448 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 7402effe..5bcad56d 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -46,24 +46,47 @@ public class AuthMePlayerListener implements Listener { this.plugin = plugin; } + private boolean checkAuth(Player player) { + if (player == null) return true; + String name = player.getName().toLowerCase(); + if (Utils.isUnrestricted(player)) { + return true; + } + if (PlayerCache.getInstance().isAuthenticated(name)) { + return true; + } + if (!plugin.database.isAuthAvailable(name)) { + if (!Settings.isForcedRegistrationEnabled) { + return true; + } + } + return false; + } + + private void handleChat(AsyncPlayerChatEvent event) { + Player player = event.getPlayer(); + if (!checkAuth(player)) { + String cmd = event.getMessage().split(" ")[0]; + if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { + event.setCancelled(true); + } + if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) { + m.send(player, "login_msg"); + } else { + if (Settings.emailRegistration) { + m.send(player, "reg_email_msg"); + } else { + m.send(player, "reg_msg"); + } + } + } + } + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - if (event.getPlayer() == null) + if (checkAuth(event.getPlayer())) return; - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - if (!plugin.database.isAuthAvailable(name)) - if (!Settings.isForcedRegistrationEnabled) - return; - String msg = event.getMessage(); if (msg.equalsIgnoreCase("/worldedit cui")) return; @@ -82,240 +105,39 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onPlayerNormalChat(AsyncPlayerChatEvent event) { - if (event.getPlayer() == null) - return; - - final Player player = event.getPlayer(); - final String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - String cmd = event.getMessage().split(" ")[0]; - - if (plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - if (Settings.emailRegistration) { - m.send(player, "reg_email_msg"); - return; - } else { - m.send(player, "reg_msg"); - return; - } - } - - if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { - event.setCancelled(true); - } + handleChat(event); } @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) public void onPlayerHighChat(AsyncPlayerChatEvent event) { - if (event.getPlayer() == null) - return; - - final Player player = event.getPlayer(); - final String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - String cmd = event.getMessage().split(" ")[0]; - - if (plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - if (Settings.emailRegistration) { - m.send(player, "reg_email_msg"); - return; - } else { - m.send(player, "reg_msg"); - return; - } - } - - if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { - event.setCancelled(true); - } + handleChat(event); } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onPlayerChat(AsyncPlayerChatEvent event) { - if (event.getPlayer() == null) - return; - - final Player player = event.getPlayer(); - final String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - String cmd = event.getMessage().split(" ")[0]; - - if (plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - if (Settings.emailRegistration) { - m.send(player, "reg_email_msg"); - return; - } else { - m.send(player, "reg_msg"); - return; - } - } - - if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { - event.setCancelled(true); - } + handleChat(event); } @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerHighestChat(AsyncPlayerChatEvent event) { - if (event.getPlayer() == null) - return; - - final Player player = event.getPlayer(); - final String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - String cmd = event.getMessage().split(" ")[0]; - - if (plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - if (Settings.emailRegistration) { - m.send(player, "reg_email_msg"); - return; - } else { - m.send(player, "reg_msg"); - return; - } - } - - if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { - event.setCancelled(true); - } + handleChat(event); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) - public void onPlayerEarlyChat(final AsyncPlayerChatEvent event) { - if (event.getPlayer() == null) - return; - - final Player player = event.getPlayer(); - final String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - String cmd = event.getMessage().split(" ")[0]; - - if (plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - if (Settings.emailRegistration) { - m.send(player, "reg_email_msg"); - return; - } else { - m.send(player, "reg_msg"); - return; - } - } - - if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { - event.setCancelled(true); - } + public void onPlayerEarlyChat(AsyncPlayerChatEvent event) { + handleChat(event); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) public void onPlayerLowChat(AsyncPlayerChatEvent event) { - if (event.getPlayer() == null) - return; - - final Player player = event.getPlayer(); - final String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - String cmd = event.getMessage().split(" ")[0]; - - if (plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - if (Settings.emailRegistration) { - m.send(player, "reg_email_msg"); - } else { - m.send(player, "reg_msg"); - } - } - - if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { - event.setCancelled(true); - } + handleChat(event); } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onPlayerMove(PlayerMoveEvent event) { - if (event.getPlayer() == null) { - return; - } - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { + if (checkAuth(player)) return; - } - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - if (!Settings.isForcedRegistrationEnabled) { - if (!plugin.database.isAuthAvailable(name)) - return; - } if (!Settings.isMovementAllowed) { if (!event.getFrom().getBlock().equals(event.getTo().getBlock())) @@ -375,9 +197,7 @@ public class AuthMePlayerListener implements Listener { } @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerJoin(PlayerJoinEvent e) { - final PlayerJoinEvent event = e; - + public void onPlayerJoin(final PlayerJoinEvent event) { if (event.getPlayer() == null) { return; } @@ -464,7 +284,7 @@ public class AuthMePlayerListener implements Listener { } if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction) { - if (!plugin.database.isAuthAvailable(name)) { + if (!isAuthAvailable) { event.setKickMessage(m.send("reg_only")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; @@ -472,14 +292,14 @@ public class AuthMePlayerListener implements Listener { } if (Settings.antiBotInAction) { - if (!plugin.database.isAuthAvailable(name)) { + if (!isAuthAvailable) { event.setKickMessage("AntiBot service in action! You actually need to be registered!"); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } } - if (plugin.database.isAuthAvailable(name) && plugin.database.getType() != DataSource.DataSourceType.FILE) { + if (isAuthAvailable && plugin.database.getType() != DataSource.DataSourceType.FILE) { PlayerAuth auth = plugin.database.getAuth(name); if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { event.setKickMessage(m.send("same_nick")[0]); @@ -575,7 +395,7 @@ public class AuthMePlayerListener implements Listener { plugin.management.performQuit(player, false); - if (plugin.database.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection) + if (plugin.database.isAuthAvailable(name) && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection) event.setQuitMessage(null); } @@ -596,108 +416,30 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerPickupItem(PlayerPickupItemEvent event) { - if (event.getPlayer() == null) { + if (checkAuth(event.getPlayer())) return; - } - - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { - return; - } - - if (Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } - event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onPlayerInteract(PlayerInteractEvent event) { - if (event.getPlayer() == null) + if (checkAuth(event.getPlayer())) return; - - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { - return; - } - - if (Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } @EventHandler(priority = EventPriority.NORMAL) public void onPlayerConsumeItem(PlayerItemConsumeEvent event) { - if (event.getPlayer() == null) + if (checkAuth(event.getPlayer())) return; - - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { - return; - } - - if (Utils.isNPC(player)) { - return; - } - - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } - event.setCancelled(true); } @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInventoryOpen(InventoryOpenEvent event) { - if (event.getPlayer() == null) - return; final Player player = (Player) event.getPlayer(); - String name = player.getName().toLowerCase(); - if (Utils.isUnrestricted(player)) { + if (checkAuth(player)) return; - } - if (Utils.isNPC(player)) - return; - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); /* @@ -720,25 +462,8 @@ public class AuthMePlayerListener implements Listener { return; if (!(event.getWhoClicked() instanceof Player)) return; - Player player = (Player) event.getWhoClicked(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { + if (checkAuth((Player) event.getWhoClicked())) return; - } - - if (Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setResult(org.bukkit.event.Event.Result.DENY); event.setCancelled(true); } @@ -749,141 +474,46 @@ public class AuthMePlayerListener implements Listener { if (!(damager instanceof Player)) { return; } - - Player player = (Player) damager; - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { + if (checkAuth((Player) damager)) return; - } - - if (Utils.isNPC(player)) { - return; - } - - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - - if (!plugin.database.isAuthAvailable(name) && !Settings.isForcedRegistrationEnabled) { - return; - } event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { - if (event.getPlayer() == null) { + if (checkAuth(event.getPlayer())) return; - } - - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { - return; - } - - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerDropItem(PlayerDropItemEvent event) { - if (event.getPlayer() == null) { + if (checkAuth(event.getPlayer())) return; - } - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player) || Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerBedEnter(PlayerBedEnterEvent event) { - if (event.getPlayer() == null) { + if (checkAuth(event.getPlayer())) return; - } - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { - return; - } - - if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onSignChange(SignChangeEvent event) { - if (event.getPlayer() == null) { + if (checkAuth(event.getPlayer())) return; - } - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - if (Utils.isUnrestricted(player)) { - return; - } - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerRespawn(PlayerRespawnEvent event) { - if (event.getPlayer() == null) { - return; - } - Player player = event.getPlayer(); + if (checkAuth(player)) + return; String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player) || Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - if (!plugin.database.isAuthAvailable(name)) - if (!Settings.isForcedRegistrationEnabled) - return; - Location spawn = plugin.getSpawnLocation(player); if (Settings.isSaveQuitLocationEnabled && plugin.database.isAuthAvailable(name)) { final PlayerAuth auth = new PlayerAuth(name, spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getWorld().getName(), player.getName()); @@ -896,31 +526,19 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) { - if (event.getPlayer() == null) - return; - Player player = event.getPlayer(); - + if (player == null) + return; if (plugin.authmePermissible(player, "authme.bypassforcesurvival")) return; + if (checkAuth(player)) + return; String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player) || Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(name)) - return; - - if (!plugin.database.isAuthAvailable(name)) - if (!Settings.isForcedRegistrationEnabled) - return; - if (causeByAuthMe.containsKey(name)) { causeByAuthMe.remove(name); return; } - event.setCancelled(true); } } From 297e41e9bd828c0ccababb6fda60ee5f5c56c4bd Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 15:54:37 +0700 Subject: [PATCH 209/427] cleanup --- src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 5bcad56d..71702210 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -464,7 +464,6 @@ public class AuthMePlayerListener implements Listener { return; if (checkAuth((Player) event.getWhoClicked())) return; - event.setResult(org.bukkit.event.Event.Result.DENY); event.setCancelled(true); } From ec1e0527ec438349f83ba90983f5f6565523fdc8 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 15:58:16 +0700 Subject: [PATCH 210/427] sneaky plugin message --- .../authme/listener/AuthMePlayerListener.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 71702210..3c67085c 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -1,5 +1,8 @@ package fr.xephi.authme.listener; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -349,14 +352,9 @@ public class AuthMePlayerListener implements Listener { if (event.getResult() == PlayerLoginEvent.Result.ALLOWED) { checkAntiBotMod(player); if (Settings.bungee) { - try { - final ByteArrayOutputStream b = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(b); - out.writeUTF("IP"); - player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray()); - } catch (IOException e) { - ConsoleLogger.writeStackTrace(e); - } + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("IP"); + player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); } return; } From 23e16bb7179277a6ae52d73895991ff056ea71bc Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 20 Sep 2015 12:08:24 +0200 Subject: [PATCH 211/427] Fix fly speed --- src/main/java/fr/xephi/authme/Utils.java | 1 - .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 4 ---- .../authme/process/login/ProcessSyncronousPlayerLogin.java | 2 +- .../process/register/ProcessSyncronousPasswordRegister.java | 2 +- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 88b6d9d2..9951de5b 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -21,7 +21,6 @@ import java.util.Iterator; public class Utils { private static boolean getOnlinePlayersIsCollection; - private static Utils singleton; private static Method getOnlinePlayers; public static AuthMe plugin; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 3c67085c..9d53fb7c 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -1,6 +1,5 @@ package fr.xephi.authme.listener; -import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import fr.xephi.authme.AuthMe; @@ -27,9 +26,6 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.*; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 2f70bfcf..c0f05c22 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -188,7 +188,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { player.removePotionEffect(PotionEffectType.BLINDNESS); if (!Settings.isMovementAllowed) { player.setWalkSpeed(0.2f); - player.setFlySpeed(0.4f); + player.setFlySpeed(0.1f); } // The Loginevent now fires (as intended) after everything is processed diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 409895d4..d5573c27 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -118,7 +118,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { player.removePotionEffect(PotionEffectType.BLINDNESS); if (!Settings.isMovementAllowed) { player.setWalkSpeed(0.2f); - player.setFlySpeed(0.4f); + player.setFlySpeed(0.1f); } // The Loginevent now fires (as intended) after everything is processed Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); From d8267777012a23c5cb9046d39a1d99108d15d080 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 20 Sep 2015 13:41:06 +0200 Subject: [PATCH 212/427] remove speed option + config description enhancements --- .../xephi/authme/commands/AdminCommand.java | 2 +- .../authme/commands/UnregisterCommand.java | 2 +- .../login/ProcessSyncronousPlayerLogin.java | 2 +- .../logout/ProcessSyncronousPlayerLogout.java | 6 +- .../ProcessSyncronousPasswordRegister.java | 2 +- .../fr/xephi/authme/settings/Settings.java | 9 +- src/main/resources/config.yml | 97 ++++++++++--------- 7 files changed, 65 insertions(+), 55 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 0376f12e..d3b9b6bb 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -486,7 +486,7 @@ public class AdminCommand implements CommandExecutor { LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); if (Settings.applyBlindEffect) target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed) { + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { target.setWalkSpeed(0.0f); target.setFlySpeed(0.0f); } diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index ce02aee6..814757e1 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -109,7 +109,7 @@ public class UnregisterCommand implements CommandExecutor { } if (Settings.applyBlindEffect) player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed) { + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { player.setWalkSpeed(0.0f); player.setFlySpeed(0.0f); } diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index c0f05c22..a94375e0 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -186,7 +186,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { if (Settings.applyBlindEffect) player.removePotionEffect(PotionEffectType.BLINDNESS); - if (!Settings.isMovementAllowed) { + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { player.setWalkSpeed(0.2f); player.setFlySpeed(0.1f); } diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index f78685b0..e2a96b0e 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -54,8 +54,10 @@ public class ProcessSyncronousPlayerLogout implements Runnable { if (!Settings.isMovementAllowed) { player.setAllowFlight(true); player.setFlying(true); - player.setFlySpeed(0.0f); - player.setWalkSpeed(0.0f); + if (Settings.isRemoveSpeedEnabled) { + player.setFlySpeed(0.0f); + player.setWalkSpeed(0.0f); + } } // Player is now logout... Time to fire event ! Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index d5573c27..553e536d 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -116,7 +116,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } if (Settings.applyBlindEffect) player.removePotionEffect(PotionEffectType.BLINDNESS); - if (!Settings.isMovementAllowed) { + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { player.setWalkSpeed(0.2f); player.setFlySpeed(0.1f); } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 0b923314..f3f437be 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -67,7 +67,7 @@ public final class Settings extends YamlConfiguration { enableProtection, enableAntiBot, recallEmail, useWelcomeMessage, broadcastWelcomeMessage, forceRegKick, forceRegLogin, checkVeryGames, delayJoinMessage, noTeleport, applyBlindEffect, - customAttributes, generateImage; + customAttributes, generateImage, isRemoveSpeedEnabled; public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase, @@ -136,6 +136,7 @@ public final class Settings extends YamlConfiguration { isAllowRestrictedIp = configFile.getBoolean("settings.restrictions.AllowRestrictedUser", false); getRestrictedIp = configFile.getStringList("settings.restrictions.AllowedRestrictedUser"); isMovementAllowed = configFile.getBoolean("settings.restrictions.allowMovement", false); + isRemoveSpeedEnabled = configFile.getBoolean("settings.restrictions.removeSpeed", true); getMovementRadius = configFile.getInt("settings.restrictions.allowedMovementRadius", 100); getJoinPermissions = configFile.getStringList("GroupOptions.Permissions.PermissionsOnJoin"); isKickOnWrongPasswordEnabled = configFile.getBoolean("settings.restrictions.kickOnWrongPassword", false); @@ -225,7 +226,7 @@ public final class Settings extends YamlConfiguration { getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds"); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false); - sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false); + sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", true); useLogging = configFile.getBoolean("Security.console.logConsole", false); disableSocialSpy = configFile.getBoolean("Hooks.disableSocialSpy", true); bCryptLog2Rounds = configFile.getInt("ExternalBoardOptions.bCryptLog2Round", 10); @@ -294,6 +295,10 @@ public final class Settings extends YamlConfiguration { set("Protection.enableProtection", false); changes = true; } + if (!contains("settings.restrictions.removeSpeed")) { + set("settings.restrictions.removeSpeed", true); + changes = true; + } if (!contains("DataSource.mySQLMaxConections")) { set("DataSource.mySQLMaxConections", 25); changes = true; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b183912e..19753d80 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,6 +1,7 @@ DataSource: + # What type of database do you want to use? # Can be set to: sqlite, sqlitehikari, mysql - # sqlitehikari should be more fast than normal sqlite but it's an experimental feature! + # (sqlitehikari should be more fast than normal sqlite but it's an experimental feature!) backend: sqlite # Enable database caching caching: true @@ -44,24 +45,28 @@ DataSource: mySQLRealName: realname settings: sessions: - # Do you want to enable session? When enabled - # the ip of a player will be bound to the nickname - # of the player on login. As long as neither of those - # two change players don't have to login on a reconnect + # Do you want to enable the session feature? + # If enabled, when a player authenticates successfully, + # his IP and his nickname is saved. + # The next time the player joins the server, if his IP + # is the same of the last time, and the timeout time + # hasn't expired, he will not need to authenticate. enabled: false - # After how many minutes a session should timeout? - # 0 for unlimitted sessions, use 0 at your own risk! - # consider that session will end only after timeout, and - # if player's ip is changed but the timeout treshould isent - # ended, player will kick out of sever for invalidSession! + # After how many minutes a session should expire? + # 0 for unlimited time (Very dangerous, use it at your own risk!) + # Consider that session will end only after the timeout time, and + # if the player's ip has changed but the timeout hasn't expired, + # player will be kicked out of sever due to invalidSession! timeout: 10 - # Do we need to timeout the session if the player is offline - # And try to login with an another IP Address? - sessionExpireOnIpChange: false + # Should the session expire if the player try to login with an + # another IP Address? + sessionExpireOnIpChange: true restrictions: - # Can unregistered/unlogged players chat and see chat, care , that block all commands except followers + # Can not authenticated players chat and see the chat log? + # Care that this feature blocks also all the commands not + # listed in the list below. allowChat: false - # Commands allowed when a player is unlogged + # Commands allowed when a player is not authenticated allowCommands: - /login - /register @@ -69,54 +74,52 @@ settings: - /reg - /email - /captcha - # Maximum Registration per IP default: 1 + # Max number of allowed registrations per IP (default: 1) maxRegPerIp: 1 - # Max allowed nick length + # Max allowed username length maxNicknameLength: 16 - # Player that is online arent - # kick out for "logged in from another - # Location", this options will prevent players that would exploit - # your account when you are playing + # When this setting is enabled, online players can't be kicked out + # due to "Logged in from another Location" + # This setting will prevent potetial security exploits. ForceSingleSession: true - # Teleport every time player join at World Spawn location, - # even if they loggedin successfully, - # all quit and previus location will - # overwrite with World Spawn. Different From - # "teleportUnAuthedToSpawn" - # that teleport player back to his quit or kick position, - # when he loggedin + # If enabled, every player will be teleported to the world spawnpoint + # after successful authentication. + # The quit location of the player will be overwritten. + # This is different from "teleportUnAuthedToSpawn" that teleport player + # back to his quit location after the authentication. ForceSpawnLocOnJoinEnabled: false - # This will prevent all lost of quit position, when player - # isent loggedin + # This option will save the quit location of the players. SaveQuitLocation: false - # For activate Restricted user by ip u need - # to set True this option and configure the field - # AllowedRestrctedUser as show below + # To activate the restricted user feature you need + # to enable this option and configure the + # AllowedRestrctedUser field. AllowRestrictedUser: false - # Restricted user will kick players that - # is listed below and they dont - # meet the match of username;ip - # Example playername;127.0.0.1 , if playername - # hasent 127.0.0.1 as ip address - # he will not be allowed to join the server + # The restricted user feature will kick players listed below + # if they dont match of the defined ip address. + # Example: + # AllowedRestrictedUser: + # - playername;127.0.0.1 AllowedRestrictedUser: - playername;127.0.0.1 # Should unregistered players be kicked immediatly? kickNonRegistered: false - # Should fail password players be kicked immediatly? + # Should players be kicked on wrong password? kickOnWrongPassword: false - # should not loged in players be teleported to spawn? - # On login they will be teleported back to their normal - # position + # Should not logged in players be teleported to the spawn? + # After the authentication they will be teleported back to + # their normal position. teleportUnAuthedToSpawn: false - # min allowed nick length + # Minimum allowed nick length minNicknameLength: 4 # Can unregistered players walk around? allowMovement: false - # After what time players who fail to login or register - # should be kicked. Set to 0 to disable. + # Should not authenticated players have speed = 0? + # This will reset the fly/walk speed to default value after the login. + removeSpeed: true + # After how many time players who fail to login or register + # should be kicked? Set to 0 to disable. timeout: 30 - # Regex sintax for allowed Char in player name. + # Regex sintax of allowed characters in the player name. allowedNicknameCharacters: '[a-zA-Z0-9_]*' # How far can unregistered players walk? Set to 0 # for unlimited radius From b27079026b1b1455dc395c8e40dced362023b895 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 16:06:56 +0700 Subject: [PATCH 213/427] use guava's bytestream --- .../plugin/manager/BungeeCordMessage.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java b/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java index b1014077..59814738 100644 --- a/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java +++ b/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java @@ -1,14 +1,11 @@ package fr.xephi.authme.plugin.manager; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; - +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; +import fr.xephi.authme.AuthMe; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; -import fr.xephi.authme.AuthMe; - public class BungeeCordMessage implements PluginMessageListener { public AuthMe plugin; @@ -19,19 +16,16 @@ public class BungeeCordMessage implements PluginMessageListener { @Override public void onPluginMessageReceived(String channel, Player player, - byte[] message) { + byte[] message) { if (!channel.equals("BungeeCord")) { return; } - try { - final DataInputStream in = new DataInputStream(new ByteArrayInputStream(message)); - String subchannel = in.readUTF(); - if (subchannel.equals("IP")) { // We need only the IP channel - String ip = in.readUTF(); - plugin.realIp.put(player.getName().toLowerCase(), ip); - // Put the IP (only the ip not the port) in the hashmap - } - } catch (IOException ex) { + ByteArrayDataInput in = ByteStreams.newDataInput(message); + String subChannel = in.readUTF(); + if (subChannel.equals("IP")) { // We need only the IP channel + String ip = in.readUTF(); + // Put the IP (only the ip not the port) in the hashMap + plugin.realIp.put(player.getName().toLowerCase(), ip); } } From c94f9c5cdc800dd7f2a78ddfa44b54cd74489841 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 19:38:46 +0700 Subject: [PATCH 214/427] update to use the new vault API --- src/main/java/fr/xephi/authme/Utils.java | 51 ++++++++----------- .../xephi/authme/commands/AdminCommand.java | 2 +- .../login/ProcessSyncronousPlayerLogin.java | 23 +++------ .../ProcessSyncronousPasswordRegister.java | 8 +-- 4 files changed, 33 insertions(+), 51 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 9951de5b..2ebb6537 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -16,7 +16,6 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Iterator; public class Utils { @@ -34,68 +33,58 @@ public class Utils { } public static void setGroup(Player player, GroupType group) { - setGroup(player.getName(), group); - } - - @SuppressWarnings("deprecation") - public static void setGroup(String player, GroupType group) { if (!Settings.isPermissionCheckEnabled) return; if (plugin.permission == null) return; - String name = player; String currentGroup; try { - World world = null; - currentGroup = plugin.permission.getPrimaryGroup(world, name); + currentGroup = plugin.permission.getPrimaryGroup(player); } catch (UnsupportedOperationException e) { ConsoleLogger.showError("Your permission plugin (" + plugin.permission.getName() + ") doesn't support the Group system... unhook!"); plugin.permission = null; return; } - World world = null; switch (group) { case UNREGISTERED: { - plugin.permission.playerRemoveGroup(world, name, currentGroup); - plugin.permission.playerAddGroup(world, name, Settings.unRegisteredGroup); + plugin.permission.playerRemoveGroup(player, currentGroup); + plugin.permission.playerAddGroup(player, Settings.unRegisteredGroup); break; } case REGISTERED: { - plugin.permission.playerRemoveGroup(world, name, currentGroup); - plugin.permission.playerAddGroup(world, name, Settings.getRegisteredGroup); + plugin.permission.playerRemoveGroup(player, currentGroup); + plugin.permission.playerAddGroup(player, Settings.getRegisteredGroup); break; } case NOTLOGGEDIN: { if (!useGroupSystem()) break; - plugin.permission.playerRemoveGroup(world, name, currentGroup); - plugin.permission.playerAddGroup(world, name, Settings.getUnloggedinGroup); + plugin.permission.playerRemoveGroup(player, currentGroup); + plugin.permission.playerAddGroup(player, Settings.getUnloggedinGroup); break; } case LOGGEDIN: { if (!useGroupSystem()) break; - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name.toLowerCase()); + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); if (limbo == null) break; String realGroup = limbo.getGroup(); - plugin.permission.playerRemoveGroup(world, name, currentGroup); - plugin.permission.playerAddGroup(world, name, realGroup); + plugin.permission.playerRemoveGroup(player, currentGroup); + plugin.permission.playerAddGroup(player, realGroup); break; } } } - @SuppressWarnings("deprecation") public static boolean addNormal(Player player, String group) { if (!useGroupSystem()) { return false; } if (plugin.permission == null) return false; - World world = null; try { - if (plugin.permission.playerRemoveGroup(world, player.getName().toString(), Settings.getUnloggedinGroup) && plugin.permission.playerAddGroup(world, player.getName().toString(), group)) { + if (plugin.permission.playerRemoveGroup(player, Settings.getUnloggedinGroup) && plugin.permission.playerAddGroup(player, group)) { return true; } } catch (UnsupportedOperationException e) { @@ -106,12 +95,12 @@ public class Utils { return false; } - public void hasPermOnJoin(Player player) { + // TODO: remove if not needed + @SuppressWarnings("unused") + public static void hasPermOnJoin(Player player) { if (plugin.permission == null) return; - Iterator iter = Settings.getJoinPermissions.iterator(); - while (iter.hasNext()) { - String permission = iter.next(); + for (String permission : Settings.getJoinPermissions) { if (plugin.permission.playerHas(player, permission)) { plugin.permission.playerAddTransient(player, permission); } @@ -127,7 +116,7 @@ public class Utils { } public static void packCoords(double x, double y, double z, String w, - final Player pl) { + final Player pl) { World theWorld; if (w.equals("unavailableworld")) { theWorld = pl.getWorld(); @@ -158,7 +147,7 @@ public class Utils { * Used for force player GameMode */ public static void forceGM(Player player) { - if (!AuthMe.getInstance().authmePermissible(player, "authme.bypassforcesurvival")) + if (!plugin.authmePermissible(player, "authme.bypassforcesurvival")) player.setGameMode(GameMode.SURVIVAL); } @@ -178,7 +167,7 @@ public class Utils { return; } for (File target : files) { - if(target.isDirectory()) { + if (target.isDirectory()) { purgeDirectory(target); target.delete(); } else { @@ -210,8 +199,8 @@ public class Utils { try { if (player.hasMetadata("NPC")) { return true; - } else if(plugin.combatTagPlus != null - && player instanceof Player + } else if (plugin.combatTagPlus != null + && player instanceof Player && plugin.combatTagPlus.getNpcPlayerHelper().isNpc((Player) player)) { return true; } diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index d3b9b6bb..7a562ea5 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -464,7 +464,7 @@ public class AdminCommand implements CommandExecutor { @SuppressWarnings("deprecation") Player target = Bukkit.getPlayer(name); PlayerCache.getInstance().removePlayer(name); - Utils.setGroup(name, GroupType.UNREGISTERED); + Utils.setGroup(target, GroupType.UNREGISTERED); if (target != null) { if (target.isOnline()) { if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index a94375e0..28f9a861 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -103,7 +103,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { for (String command : Settings.forceCommands) { try { player.performCommand(command.replace("%p", player.getName())); - } catch (Exception e) { + } catch (Exception ignored) { } } for (String command : Settings.forceCommandsAsConsole) { @@ -125,20 +125,13 @@ public class ProcessSyncronousPlayerLogin implements Runnable { * world inventory ! */ player.setGameMode(limbo.getGameMode()); - if (!Settings.forceOnlyAfterLogin) { - // Inventory - Make it after restore GameMode , cause we need to - // restore the - // right inventory in the right gamemode - if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) { - restoreInventory(); - } - } else { - // Inventory - Make it before force the survival GameMode to - // cancel all - // inventory problem - if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) { - restoreInventory(); - } + // Inventory - Make it after restore GameMode , cause we need to + // restore the + // right inventory in the right gamemode + if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) { + restoreInventory(); + } + if (Settings.forceOnlyAfterLogin) { player.setGameMode(GameMode.SURVIVAL); } diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 553e536d..5a7a1353 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -120,8 +120,8 @@ public class ProcessSyncronousPasswordRegister implements Runnable { player.setWalkSpeed(0.2f); player.setFlySpeed(0.1f); } - // The Loginevent now fires (as intended) after everything is processed - Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); + // The LoginEvent now fires (as intended) after everything is processed + plugin.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); player.saveData(); if (!Settings.noConsoleSpam) @@ -133,7 +133,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { return; } - // Request Login after Registation + // Request Login after Registration if (Settings.forceRegLogin) { forceLogin(player); return; @@ -143,7 +143,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { if (Settings.useWelcomeMessage) if (Settings.broadcastWelcomeMessage) { for (String s : Settings.welcomeMsg) { - Bukkit.getServer().broadcastMessage(plugin.replaceAllInfos(s, player)); + plugin.getServer().broadcastMessage(plugin.replaceAllInfos(s, player)); } } else { for (String s : Settings.welcomeMsg) { From 14f187c32dbf393508b36fb0720f1d87afe11166 Mon Sep 17 00:00:00 2001 From: DNx Date: Sun, 20 Sep 2015 20:15:36 +0700 Subject: [PATCH 215/427] start working on modules --- src/main/java/fr/xephi/authme/AuthMe.java | 27 +++++++++++++------ .../java/fr/xephi/authme/modules/Module.java | 24 +++++++---------- .../xephi/authme/modules/ModuleManager.java | 20 +++++++++++--- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index c6385f3e..0cf32597 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -15,6 +15,7 @@ import fr.xephi.authme.converter.Converter; import fr.xephi.authme.converter.ForceFlatToSqlite; import fr.xephi.authme.datasource.*; import fr.xephi.authme.listener.*; +import fr.xephi.authme.modules.ModuleManager; import fr.xephi.authme.plugin.manager.BungeeCordMessage; import fr.xephi.authme.plugin.manager.EssSpawn; import fr.xephi.authme.process.Management; @@ -24,7 +25,6 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import net.milkbowl.vault.permission.Permission; import net.minelink.ctplus.CombatTagPlus; - import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -64,15 +64,22 @@ public class AuthMe extends JavaPlugin { public DataSource database; private JsonCache playerBackup; public OtherAccounts otherAccounts; - public Permission permission; - public Essentials ess; public Location essentialsSpawn; - public MultiverseCore multiverse; public LookupService lookupService; - public CombatTagPlus combatTagPlus = null; public boolean legacyChestShop = false; public boolean antibotMod = false; public boolean delayedAntiBot = true; + + // Hooks TODO: move into modules + public Permission permission; + public Essentials ess; + public MultiverseCore multiverse; + public CombatTagPlus combatTagPlus; + + // Manager + private ModuleManager moduleManager; + + // TODO: Create Manager for fields below public ConcurrentHashMap sessions = new ConcurrentHashMap<>(); public ConcurrentHashMap captcha = new ConcurrentHashMap<>(); public ConcurrentHashMap cap = new ConcurrentHashMap<>(); @@ -101,6 +108,9 @@ public class AuthMe extends JavaPlugin { authme = this; // TODO: split the plugin in more modules + moduleManager = new ModuleManager(this); + int loaded = moduleManager.loadModules(); + // TODO: remove vault as hard dependency PluginManager pm = server.getPluginManager(); @@ -312,16 +322,17 @@ public class AuthMe extends JavaPlugin { // Do backup on stop if enabled if (Settings.isBackupActivated && Settings.isBackupOnStop) { - Boolean Backup = new PerformBackup(this).doBackup(); + boolean Backup = new PerformBackup(this).doBackup(); if (Backup) ConsoleLogger.info("Backup performed correctly."); else ConsoleLogger.showError("Error while performing the backup!"); } + // Unload modules + moduleManager.unloadModules(); + // Disabled correctly ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " disabled!"); - - authme = null; } // Stop/unload the server/plugin as defined in the configuration diff --git a/src/main/java/fr/xephi/authme/modules/Module.java b/src/main/java/fr/xephi/authme/modules/Module.java index 6011097a..ab30e5ef 100644 --- a/src/main/java/fr/xephi/authme/modules/Module.java +++ b/src/main/java/fr/xephi/authme/modules/Module.java @@ -1,28 +1,24 @@ package fr.xephi.authme.modules; -import fr.xephi.authme.AuthMe; +public abstract class Module { -public interface Module { - - public String getName(); - - public AuthMe getInstanceOfAuthMe(); - - public Module getInstance(); - - public enum ModuleType { + enum ModuleType { MANAGER, MYSQL, REDIS, ACTIONS, CONVERTERS, EMAILS, - CUSTOM; + CUSTOM } - public ModuleType getType(); + public abstract String getName(); - public boolean load(); + public abstract ModuleType getType(); - public boolean unload(); + public void load() { + } + + public void unload() { + } } diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index f3c7df3c..32d4d1fa 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -10,6 +10,7 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Iterator; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -111,10 +112,23 @@ public class ModuleManager { return count; } + public void unloadModule(String name) { + Iterator it = modules.iterator(); + while (it.hasNext()) { + Module m = it.next(); + if (m.getName().equalsIgnoreCase(name)) { + m.unload(); + it.remove(); + return; + } + } + } + public void unloadModules() { - for (Module m : modules) { - m.unload(); - modules.remove(m); + Iterator it = modules.iterator(); + while (it.hasNext()) { + it.next().unload(); + it.remove(); } } From 2cea7387c986211ccc5034c88e9ed2443dec15b5 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 21:25:29 +0700 Subject: [PATCH 216/427] set all listeners to use checkAuth method. --- src/main/java/fr/xephi/authme/Utils.java | 18 +++ .../authme/listener/AuthMeBlockListener.java | 43 +------ .../listener/AuthMeChestShopListener.java | 20 +-- .../authme/listener/AuthMeEntityListener.java | 115 +++--------------- .../authme/listener/AuthMePlayerListener.java | 49 +++----- 5 files changed, 52 insertions(+), 193 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 2ebb6537..9540e448 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,5 +1,6 @@ package fr.xephi.authme; +import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.events.AuthMeTeleportEvent; @@ -107,6 +108,23 @@ public class Utils { } } + // TODO: Move to a Manager + public static boolean checkAuth(Player player) { + if (player == null || Utils.isUnrestricted(player)) { + return true; + } + String name = player.getName().toLowerCase(); + if (PlayerCache.getInstance().isAuthenticated(name)) { + return true; + } + if (!plugin.database.isAuthAvailable(name)) { + if (!Settings.isForcedRegistrationEnabled) { + return true; + } + } + return false; + } + public static boolean isUnrestricted(Player player) { return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName())); } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index e6903ce3..ca5f68d3 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -2,9 +2,6 @@ package fr.xephi.authme.listener; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Settings; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; @@ -21,51 +18,15 @@ public class AuthMeBlockListener implements Listener { @EventHandler(ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent event) { - if (event.getPlayer() == null) { + if (Utils.checkAuth(event.getPlayer())) return; - } - - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { - return; - } - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } @EventHandler(ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { - if (event.getPlayer() == null) { + if (Utils.checkAuth(event.getPlayer())) return; - } - - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { - return; - } - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java index 3577dc34..cf551a63 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java @@ -21,26 +21,8 @@ public class AuthMeChestShopListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPreTransaction(PreTransactionEvent event) { - if (event.getClient() == null) { + if (Utils.checkAuth(event.getClient())) return; - } - - Player player = event.getClient(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player)) { - return; - } - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(TransactionOutcome.OTHER); } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index f85e2497..109fe83d 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -2,8 +2,6 @@ package fr.xephi.authme.listener; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Settings; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -22,30 +20,15 @@ public class AuthMeEntityListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onEntityDamage(EntityDamageEvent event) { Entity entity = event.getEntity(); - - if (!(entity instanceof Player)) { + if (entity == null || !(entity instanceof Player)) { return; } - if (Utils.isUnrestricted((Player) entity)) { - return; - } - - if (Utils.isNPC(entity)) - return; - Player player = (Player) entity; - String name = player.getName().toLowerCase(); - - if (PlayerCache.getInstance().isAuthenticated(name)) { + if (Utils.checkAuth(player)) { return; } - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } player.setFireTicks(0); event.setDamage(0.0); event.setCancelled(true); @@ -53,28 +36,15 @@ public class AuthMeEntityListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onEntityTarget(EntityTargetEvent event) { - if (event.getTarget() == null) - return; Entity entity = event.getTarget(); - if (!(entity instanceof Player)) { + if (entity == null || !(entity instanceof Player)) { return; } - if (Utils.isNPC(entity)) - return; - - Player player = (Player) entity; - String name = player.getName().toLowerCase(); - - if (PlayerCache.getInstance().isAuthenticated(name)) { + if (Utils.checkAuth((Player) entity)) { return; } - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setTarget(null); event.setCancelled(true); } @@ -82,75 +52,40 @@ public class AuthMeEntityListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onDmg(EntityDamageByEntityEvent event) { Entity entity = event.getDamager(); - if (entity == null || !(entity instanceof Player)) { return; } - Player player = (Player) entity; - String name = player.getName().toLowerCase(); - - if (PlayerCache.getInstance().isAuthenticated(name)) { + if (Utils.checkAuth((Player) entity)) { return; } - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } - event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onFoodLevelChange(FoodLevelChangeEvent event) { Entity entity = event.getEntity(); - if (!(entity instanceof Player)) { + if (entity == null || !(entity instanceof Player)) { return; } - if (Utils.isNPC(entity)) + if (Utils.checkAuth((Player) entity)) { return; - - Player player = (Player) entity; - String name = player.getName().toLowerCase(); - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } } event.setCancelled(true); - } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void entityRegainHealthEvent(EntityRegainHealthEvent event) { Entity entity = event.getEntity(); - if (!(entity instanceof Player)) { + if (entity == null || !(entity instanceof Player)) { return; } - if (Utils.isNPC(entity)) + if (Utils.checkAuth((Player) entity)) { return; - - Player player = (Player) entity; - String name = player.getName().toLowerCase(); - - if (PlayerCache.getInstance().isAuthenticated(name)) { - return; - } - - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } } event.setAmount(0.0); @@ -159,49 +94,29 @@ public class AuthMeEntityListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onEntityInteract(EntityInteractEvent event) { - if (!(event.getEntity() instanceof Player)) { + Entity entity = event.getEntity(); + if (entity == null || !(entity instanceof Player)) { return; } - Player player = (Player) event.getEntity(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player) || Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(player.getName())) { + if (Utils.checkAuth((Player) entity)) { return; } - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onLowestEntityInteract(EntityInteractEvent event) { - if (!(event.getEntity() instanceof Player)) { + Entity entity = event.getEntity(); + if (entity == null || !(entity instanceof Player)) { return; } - Player player = (Player) event.getEntity(); - String name = player.getName().toLowerCase(); - - if (Utils.isUnrestricted(player) || Utils.isNPC(player)) - return; - - if (PlayerCache.getInstance().isAuthenticated(player.getName())) { + if (Utils.checkAuth((Player) entity)) { return; } - if (!instance.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return; - } - } event.setCancelled(true); } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 9d53fb7c..390154e5 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -45,26 +45,9 @@ public class AuthMePlayerListener implements Listener { this.plugin = plugin; } - private boolean checkAuth(Player player) { - if (player == null) return true; - String name = player.getName().toLowerCase(); - if (Utils.isUnrestricted(player)) { - return true; - } - if (PlayerCache.getInstance().isAuthenticated(name)) { - return true; - } - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { - return true; - } - } - return false; - } - private void handleChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); - if (!checkAuth(player)) { + if (!Utils.checkAuth(player)) { String cmd = event.getMessage().split(" ")[0]; if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { event.setCancelled(true); @@ -83,7 +66,7 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; String msg = event.getMessage(); @@ -135,7 +118,7 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onPlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); - if (checkAuth(player)) + if (Utils.checkAuth(player)) return; if (!Settings.isMovementAllowed) { @@ -410,21 +393,21 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerPickupItem(PlayerPickupItemEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } @EventHandler(priority = EventPriority.NORMAL) public void onPlayerConsumeItem(PlayerItemConsumeEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } @@ -432,7 +415,7 @@ public class AuthMePlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInventoryOpen(InventoryOpenEvent event) { final Player player = (Player) event.getPlayer(); - if (checkAuth(player)) + if (Utils.checkAuth(player)) return; event.setCancelled(true); @@ -456,7 +439,7 @@ public class AuthMePlayerListener implements Listener { return; if (!(event.getWhoClicked() instanceof Player)) return; - if (checkAuth((Player) event.getWhoClicked())) + if (Utils.checkAuth((Player) event.getWhoClicked())) return; event.setCancelled(true); } @@ -467,7 +450,7 @@ public class AuthMePlayerListener implements Listener { if (!(damager instanceof Player)) { return; } - if (checkAuth((Player) damager)) + if (Utils.checkAuth((Player) damager)) return; event.setCancelled(true); @@ -475,28 +458,28 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerDropItem(PlayerDropItemEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerBedEnter(PlayerBedEnterEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onSignChange(SignChangeEvent event) { - if (checkAuth(event.getPlayer())) + if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } @@ -504,7 +487,7 @@ public class AuthMePlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerRespawn(PlayerRespawnEvent event) { Player player = event.getPlayer(); - if (checkAuth(player)) + if (Utils.checkAuth(player)) return; String name = player.getName().toLowerCase(); Location spawn = plugin.getSpawnLocation(player); @@ -524,7 +507,7 @@ public class AuthMePlayerListener implements Listener { return; if (plugin.authmePermissible(player, "authme.bypassforcesurvival")) return; - if (checkAuth(player)) + if (Utils.checkAuth(player)) return; String name = player.getName().toLowerCase(); From 878ab70c2fcaba170a546558fc674cb2a880825e Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 21:50:39 +0700 Subject: [PATCH 217/427] move GeoIP function into Utils --- src/main/java/fr/xephi/authme/AuthMe.java | 52 +-------------- src/main/java/fr/xephi/authme/Utils.java | 65 ++++++++++++++++++- .../authme/listener/AuthMePlayerListener.java | 4 +- .../authme/listener/AuthMeServerListener.java | 5 +- 4 files changed, 71 insertions(+), 55 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 0cf32597..737299d4 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -175,7 +175,7 @@ public class AuthMe extends JavaPlugin { } // Download GeoIp.dat file - downloadGeoIp(); + Utils.checkGeoIP(); // Load MailApi if needed if (!Settings.getmailAccount.isEmpty() && !Settings.getmailPassword.isEmpty()) { @@ -673,54 +673,6 @@ public class AuthMe extends JavaPlugin { return player.getWorld().getSpawnLocation(); } - // Download GeoIp data - public void downloadGeoIp() { - ConsoleLogger.info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, available at http://www.maxmind.com"); - File file = new File(getDataFolder(), "GeoIP.dat"); - try { - if (file.exists()) { - if (lookupService == null) { - lookupService = new LookupService(file); - } - } else { - String url = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"; - URL downloadUrl = new URL(url); - URLConnection conn = downloadUrl.openConnection(); - conn.setConnectTimeout(10000); - conn.connect(); - InputStream input = conn.getInputStream(); - if (url.endsWith(".gz")) { - input = new GZIPInputStream(input); - } - OutputStream output = new FileOutputStream(file); - byte[] buffer = new byte[2048]; - int length = input.read(buffer); - while (length >= 0) { - output.write(buffer, 0, length); - length = input.read(buffer); - } - output.close(); - input.close(); - } - } catch (Exception e) { - ConsoleLogger.writeStackTrace(e); - } - } - - public String getCountryCode(String ip) { - if (lookupService != null) { - return lookupService.getCountry(ip).getCode(); - } - return "--"; - } - - public String getCountryName(String ip) { - if (lookupService != null) { - return lookupService.getCountry(ip).getName(); - } - return "N/A"; - } - public void switchAntiBotMod(boolean mode) { this.antibotMod = mode; Settings.switchAntiBotMod(mode); @@ -759,7 +711,7 @@ public class AuthMe extends JavaPlugin { message = message.replace("{WORLD}", player.getWorld().getName()); message = message.replace("{SERVER}", server.getServerName()); message = message.replace("{VERSION}", server.getBukkitVersion()); - message = message.replace("{COUNTRY}", this.getCountryName(getIP(player))); + message = message.replace("{COUNTRY}", Utils.getCountryName(getIP(player))); return message; } diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 9540e448..bdd156ff 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,5 +1,6 @@ package fr.xephi.authme; +import com.maxmind.geoip.LookupService; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; @@ -13,19 +14,28 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLConnection; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.zip.GZIPInputStream; public class Utils { + public static AuthMe plugin; + private static boolean getOnlinePlayersIsCollection; private static Method getOnlinePlayers; - public static AuthMe plugin; + private static LookupService lookupService; static { plugin = AuthMe.getInstance(); + checkGeoIP(); try { Method m = Bukkit.class.getDeclaredMethod("getOnlinePlayers"); getOnlinePlayersIsCollection = m.getReturnType() == Collection.class; @@ -33,6 +43,59 @@ public class Utils { } } + // Check and Download GeoIP data if not exist + public static boolean checkGeoIP() { + if (lookupService != null) { + return true; + } + ConsoleLogger.info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, available at http://www.maxmind.com"); + File file = new File(Settings.PLUGIN_FOLDER, "GeoIP.dat"); + try { + if (file.exists()) { + if (lookupService == null) { + lookupService = new LookupService(file); + return true; + } + } + String url = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"; + URL downloadUrl = new URL(url); + URLConnection conn = downloadUrl.openConnection(); + conn.setConnectTimeout(10000); + conn.connect(); + InputStream input = conn.getInputStream(); + if (conn.getURL().toString().endsWith(".gz")) { + input = new GZIPInputStream(input); + } + OutputStream output = new FileOutputStream(file); + byte[] buffer = new byte[2048]; + int length = input.read(buffer); + while (length >= 0) { + output.write(buffer, 0, length); + length = input.read(buffer); + } + output.close(); + input.close(); + } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); + return false; + } + return checkGeoIP(); + } + + public static String getCountryCode(String ip) { + if (checkGeoIP()) { + return lookupService.getCountry(ip).getCode(); + } + return "--"; + } + + public static String getCountryName(String ip) { + if (checkGeoIP()) { + return lookupService.getCountry(ip).getName(); + } + return "N/A"; + } + public static void setGroup(Player player, GroupType group) { if (!Settings.isPermissionCheckEnabled) return; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 390154e5..b7723522 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -249,7 +249,7 @@ public class AuthMePlayerListener implements Listener { return; if (!Settings.countriesBlacklist.isEmpty()) { - String code = plugin.getCountryCode(event.getAddress().getHostAddress()); + String code = Utils.getCountryCode(event.getAddress().getHostAddress()); if (((code == null) || (Settings.countriesBlacklist.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { event.setKickMessage(m.send("country_banned")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); @@ -257,7 +257,7 @@ public class AuthMePlayerListener implements Listener { } } if (Settings.enableProtection && !Settings.countries.isEmpty()) { - String code = plugin.getCountryCode(event.getAddress().getHostAddress()); + String code = Utils.getCountryCode(event.getAddress().getHostAddress()); if (((code == null) || (!Settings.countries.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { event.setKickMessage(m.send("country_banned")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 8e796021..d13e8738 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -2,6 +2,7 @@ package fr.xephi.authme.listener; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import org.bukkit.event.EventHandler; @@ -27,10 +28,10 @@ public class AuthMeServerListener implements Listener { if (Settings.countries.isEmpty()) return; if (!Settings.countriesBlacklist.isEmpty()) { - if (Settings.countriesBlacklist.contains(plugin.getCountryCode(event.getAddress().getHostAddress()))) + if (Settings.countriesBlacklist.contains(Utils.getCountryCode(event.getAddress().getHostAddress()))) event.setMotd(m.send("country_banned")[0]); } - if (Settings.countries.contains(plugin.getCountryCode(event.getAddress().getHostAddress()))) { + if (Settings.countries.contains(Utils.getCountryCode(event.getAddress().getHostAddress()))) { event.setMotd(plugin.getServer().getMotd()); } else { event.setMotd(m.send("country_banned")[0]); From 4b67cf961ccc8980e3e468140d8e2d8e65b7f078 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 20 Sep 2015 17:21:49 +0200 Subject: [PATCH 218/427] fix speed remover --- src/main/java/fr/xephi/authme/AuthMe.java | 1 - .../java/fr/xephi/authme/listener/AuthMeChestShopListener.java | 3 --- .../java/fr/xephi/authme/process/join/AsyncronousJoin.java | 2 +- .../authme/process/logout/ProcessSyncronousPlayerLogout.java | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 737299d4..170e6d7d 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -47,7 +47,6 @@ import java.util.Date; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; -import java.util.zip.GZIPInputStream; public class AuthMe extends JavaPlugin { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java index cf551a63..476f2586 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java @@ -4,9 +4,6 @@ import com.Acrobot.ChestShop.Events.PreTransactionEvent; import com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Settings; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 0302e06f..4df4928e 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -223,7 +223,7 @@ public class AsyncronousJoin { player.performCommand("motd"); if (Settings.applyBlindEffect) player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed) { + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { player.setWalkSpeed(0.0f); player.setFlySpeed(0.0f); } diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index e2a96b0e..e9efd847 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -54,7 +54,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable { if (!Settings.isMovementAllowed) { player.setAllowFlight(true); player.setFlying(true); - if (Settings.isRemoveSpeedEnabled) { + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { player.setFlySpeed(0.0f); player.setWalkSpeed(0.0f); } From 5247b5aa2c391e302f85f2088b73311a54af1449 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 22:55:44 +0700 Subject: [PATCH 219/427] fix cache folder not removed --- src/main/java/fr/xephi/authme/cache/backup/JsonCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 018e6ba2..760def96 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -209,7 +209,7 @@ public class JsonCache { } catch (Exception | Error e) { path = player.getName().toLowerCase(); } - File file = new File(cacheDir, path + File.separator + "cache.json"); + File file = new File(cacheDir, path); if (file.exists()) { Utils.purgeDirectory(file); if (!file.delete()) { From accd209e84fe37af30f9afd17aee6d466571d134 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 22:58:54 +0700 Subject: [PATCH 220/427] add null check for vehicle --- .../process/logout/ProcessSyncronousPlayerLogout.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index e9efd847..96ea7e1f 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -43,11 +43,8 @@ public class ProcessSyncronousPlayerLogout implements Runnable { } BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); - try { - if (player.isInsideVehicle()) - player.getVehicle().eject(); - } catch (NullPointerException npe) { - } + if (player.isInsideVehicle() && player.getVehicle() != null) + player.getVehicle().eject(); if (Settings.applyBlindEffect) player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); player.setOp(false); From b9dce03af52dc8a855237df9bb32cad7b2c189a7 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 20 Sep 2015 23:17:03 +0700 Subject: [PATCH 221/427] add ProjectileLaunch listener. --- .../authme/listener/AuthMeEntityListener.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 109fe83d..7ace12c9 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -8,6 +8,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.*; +import org.bukkit.event.player.PlayerEggThrowEvent; public class AuthMeEntityListener implements Listener { @@ -119,4 +120,18 @@ public class AuthMeEntityListener implements Listener { event.setCancelled(true); } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onProjectileLaunch(ProjectileLaunchEvent event) { + Entity entity = (Entity) event.getEntity().getShooter(); + if (entity == null || !(entity instanceof Player)) { + return; + } + + if (Utils.checkAuth((Player) entity)) { + return; + } + + event.setCancelled(true); + } } From 490f9406c3eb0f3be9d157aaf20b487b627ce589 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 21 Sep 2015 00:15:05 +0700 Subject: [PATCH 222/427] added durability fix --- src/main/java/fr/xephi/authme/Utils.java | 16 ++++++++++ .../authme/listener/AuthMeBlockListener.java | 7 ++++- .../authme/listener/AuthMeEntityListener.java | 29 +++++++++++++++++-- .../authme/listener/AuthMePlayerListener.java | 29 +++++++++++++++++-- 4 files changed, 75 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index bdd156ff..be103fa8 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -12,6 +12,7 @@ import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import java.io.File; import java.io.FileOutputStream; @@ -290,4 +291,19 @@ public class Utils { return false; } } + + public static void fixDurability(final ItemStack item) { + if (item == null || item.getType().getMaxDurability() == 0) + return; + final short old = item.getDurability(); + plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { + @Override + public void run() { + int diff = old - item.getDurability(); + if (diff != 0) { + item.setDurability((short) (item.getDurability() + diff)); + } + } + }, 1); + } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index ca5f68d3..58a05683 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -2,10 +2,12 @@ package fr.xephi.authme.listener; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.inventory.ItemStack; public class AuthMeBlockListener implements Listener { @@ -25,8 +27,11 @@ public class AuthMeBlockListener implements Listener { @EventHandler(ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { - if (Utils.checkAuth(event.getPlayer())) + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) { return; + } + Utils.fixDurability(player.getItemInHand()); event.setCancelled(true); } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 7ace12c9..ae838588 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -8,7 +8,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.*; -import org.bukkit.event.player.PlayerEggThrowEvent; +import org.bukkit.inventory.ItemStack; public class AuthMeEntityListener implements Listener { @@ -29,7 +29,11 @@ public class AuthMeEntityListener implements Listener { if (Utils.checkAuth(player)) { return; } - + for (ItemStack item : player.getInventory().getArmorContents()) { + if (item != null) { + Utils.fixDurability(item); + } + } player.setFireTicks(0); event.setDamage(0.0); event.setCancelled(true); @@ -57,10 +61,12 @@ public class AuthMeEntityListener implements Listener { return; } - if (Utils.checkAuth((Player) entity)) { + Player player = (Player) entity; + if (Utils.checkAuth(player)) { return; } + Utils.fixDurability(player.getItemInHand()); event.setCancelled(true); } @@ -134,4 +140,21 @@ public class AuthMeEntityListener implements Listener { event.setCancelled(true); } + + @EventHandler + public void onShoot(EntityShootBowEvent event) { + Entity entity = event.getEntity(); + if (entity == null || !(entity instanceof Player)) { + return; + } + + Player player = (Player) entity; + if (Utils.checkAuth(player)) { + return; + } + + Utils.fixDurability(player.getItemInHand()); + event.setCancelled(true); + } + } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index b7723522..ccb11a28 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -20,6 +20,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; @@ -400,8 +401,14 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { - if (Utils.checkAuth(event.getPlayer())) + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) return; + + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { + Utils.fixDurability(player.getItemInHand()); + } + event.setCancelled(true); } @@ -487,7 +494,7 @@ public class AuthMePlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerRespawn(PlayerRespawnEvent event) { Player player = event.getPlayer(); - if (Utils.checkAuth(player)) + if (player == null || Utils.checkAuth(player)) return; String name = player.getName().toLowerCase(); Location spawn = plugin.getSpawnLocation(player); @@ -517,4 +524,22 @@ public class AuthMePlayerListener implements Listener { } event.setCancelled(true); } + + @EventHandler(priority = EventPriority.NORMAL) + public void onPlayerShear(PlayerShearEntityEvent event) { + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) + return; + Utils.fixDurability(player.getItemInHand()); + event.setCancelled(true); + } + + @EventHandler + public void onPlayerFish(PlayerFishEvent event) { + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) + return; + Utils.fixDurability(player.getItemInHand()); + event.setCancelled(true); + } } From 365e23d863a0a706fa6994385fa746e901f21f3f Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 21 Sep 2015 00:44:40 +0700 Subject: [PATCH 223/427] show the name, not displayname --- src/main/java/fr/xephi/authme/Utils.java | 15 --------------- .../authme/listener/AuthMeEntityListener.java | 8 -------- .../authme/listener/AuthMePlayerListener.java | 8 -------- .../logout/ProcessSyncronousPlayerLogout.java | 2 +- 4 files changed, 1 insertion(+), 32 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index be103fa8..c814fd67 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -291,19 +291,4 @@ public class Utils { return false; } } - - public static void fixDurability(final ItemStack item) { - if (item == null || item.getType().getMaxDurability() == 0) - return; - final short old = item.getDurability(); - plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { - @Override - public void run() { - int diff = old - item.getDurability(); - if (diff != 0) { - item.setDurability((short) (item.getDurability() + diff)); - } - } - }, 1); - } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index ae838588..46c924b9 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -8,7 +8,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.*; -import org.bukkit.inventory.ItemStack; public class AuthMeEntityListener implements Listener { @@ -29,11 +28,6 @@ public class AuthMeEntityListener implements Listener { if (Utils.checkAuth(player)) { return; } - for (ItemStack item : player.getInventory().getArmorContents()) { - if (item != null) { - Utils.fixDurability(item); - } - } player.setFireTicks(0); event.setDamage(0.0); event.setCancelled(true); @@ -66,7 +60,6 @@ public class AuthMeEntityListener implements Listener { return; } - Utils.fixDurability(player.getItemInHand()); event.setCancelled(true); } @@ -153,7 +146,6 @@ public class AuthMeEntityListener implements Listener { return; } - Utils.fixDurability(player.getItemInHand()); event.setCancelled(true); } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index ccb11a28..c275e9b8 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -20,7 +20,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; @@ -404,11 +403,6 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); if (player == null || Utils.checkAuth(player)) return; - - if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { - Utils.fixDurability(player.getItemInHand()); - } - event.setCancelled(true); } @@ -530,7 +524,6 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); if (player == null || Utils.checkAuth(player)) return; - Utils.fixDurability(player.getItemInHand()); event.setCancelled(true); } @@ -539,7 +532,6 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); if (player == null || Utils.checkAuth(player)) return; - Utils.fixDurability(player.getItemInHand()); event.setCancelled(true); } } diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index 96ea7e1f..7c199201 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -59,7 +59,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable { // Player is now logout... Time to fire event ! Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); m.send(player, "logout"); - ConsoleLogger.info(player.getDisplayName() + " logged out"); + ConsoleLogger.info(player.getName() + " logged out"); } } From dfe1074f657b029988e95c10b64da251430c6c8f Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 21 Sep 2015 00:45:37 +0700 Subject: [PATCH 224/427] revert fixdurability task. not necessary --- src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index 58a05683..678fbca2 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -7,7 +7,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.inventory.ItemStack; public class AuthMeBlockListener implements Listener { @@ -31,7 +30,6 @@ public class AuthMeBlockListener implements Listener { if (player == null || Utils.checkAuth(player)) { return; } - Utils.fixDurability(player.getItemInHand()); event.setCancelled(true); } From 837da9a0fa03e9c7a29c7d5e9c2c13676fe39b4a Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 21 Sep 2015 01:16:04 +0700 Subject: [PATCH 225/427] disabling protectInventory should be okay now --- src/main/java/fr/xephi/authme/Utils.java | 1 - .../authme/listener/AuthMeEntityListener.java | 11 +++++--- .../authme/listener/AuthMePlayerListener.java | 27 +++++++++++++++---- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index c814fd67..bdd156ff 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -12,7 +12,6 @@ import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import java.io.File; import java.io.FileOutputStream; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 46c924b9..da4b43ea 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -4,6 +4,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -122,12 +123,16 @@ public class AuthMeEntityListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onProjectileLaunch(ProjectileLaunchEvent event) { - Entity entity = (Entity) event.getEntity().getShooter(); - if (entity == null || !(entity instanceof Player)) { + Projectile projectile = event.getEntity(); + if (projectile == null) + return; + + Entity shooter = (Entity) projectile.getShooter(); + if (shooter == null || !(shooter instanceof Player)) { return; } - if (Utils.checkAuth((Player) entity)) { + if (Utils.checkAuth((Player) shooter)) { return; } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index c275e9b8..882ddcbd 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -406,14 +406,14 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } - @EventHandler(priority = EventPriority.NORMAL) + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onPlayerConsumeItem(PlayerItemConsumeEvent event) { if (Utils.checkAuth(event.getPlayer())) return; event.setCancelled(true); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerInventoryOpen(InventoryOpenEvent event) { final Player player = (Player) event.getPlayer(); if (Utils.checkAuth(player)) @@ -459,7 +459,16 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { - if (Utils.checkAuth(event.getPlayer())) + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) + return; + event.setCancelled(true); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) return; event.setCancelled(true); } @@ -519,7 +528,7 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } - @EventHandler(priority = EventPriority.NORMAL) + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onPlayerShear(PlayerShearEntityEvent event) { Player player = event.getPlayer(); if (player == null || Utils.checkAuth(player)) @@ -527,11 +536,19 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } - @EventHandler + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onPlayerFish(PlayerFishEvent event) { Player player = event.getPlayer(); if (player == null || Utils.checkAuth(player)) return; event.setCancelled(true); } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) + public void onPlayerEditBook(PlayerEditBookEvent event) { + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) + return; + event.setCancelled(true); + } } From fec4fb29138686674241fc2a6f471bf20dedf46b Mon Sep 17 00:00:00 2001 From: DNx5 Date: Wed, 23 Sep 2015 17:55:56 +0700 Subject: [PATCH 226/427] projectile issue --- .../fr/xephi/authme/listener/AuthMeEntityListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index da4b43ea..34b3b0f2 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.*; +import org.bukkit.projectiles.ProjectileSource; public class AuthMeEntityListener implements Listener { @@ -121,13 +122,14 @@ public class AuthMeEntityListener implements Listener { event.setCancelled(true); } - @EventHandler(priority = EventPriority.HIGHEST) + // TODO: Need to check this, player can't throw snowball but the item is taken. + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onProjectileLaunch(ProjectileLaunchEvent event) { Projectile projectile = event.getEntity(); if (projectile == null) return; - Entity shooter = (Entity) projectile.getShooter(); + ProjectileSource shooter = projectile.getShooter(); if (shooter == null || !(shooter instanceof Player)) { return; } @@ -139,7 +141,7 @@ public class AuthMeEntityListener implements Listener { event.setCancelled(true); } - @EventHandler + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onShoot(EntityShootBowEvent event) { Entity entity = event.getEntity(); if (entity == null || !(entity instanceof Player)) { From 10580e3447017f09c6bd5212f64ec5f123754a1d Mon Sep 17 00:00:00 2001 From: DNx5 Date: Wed, 23 Sep 2015 21:50:17 +0700 Subject: [PATCH 227/427] cleanup converters --- .../xephi/authme/commands/AdminCommand.java | 2 +- .../authme/converter/CrazyLoginConverter.java | 34 ++--- .../fr/xephi/authme/converter/FlatToSql.java | 16 +-- .../xephi/authme/converter/FlatToSqlite.java | 116 +++++++----------- .../authme/converter/ForceFlatToSqlite.java | 3 +- .../authme/converter/RakamakConverter.java | 46 +++---- .../authme/converter/RoyalAuthConverter.java | 12 +- .../authme/converter/RoyalAuthYamlReader.java | 4 +- .../fr/xephi/authme/converter/SqlToFlat.java | 9 +- .../authme/converter/vAuthConverter.java | 3 +- .../authme/converter/vAuthFileReader.java | 32 +++-- .../authme/converter/xAuthConverter.java | 3 +- .../xephi/authme/converter/xAuthToFlat.java | 21 ++-- .../fr/xephi/authme/settings/Settings.java | 26 ++-- 14 files changed, 134 insertions(+), 193 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 7a562ea5..eab60353 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -109,7 +109,7 @@ public class AdminCommand implements CommandExecutor { } } else if (args[0].equalsIgnoreCase("reload")) { try { - plugin.getSettings().reload(); + Settings.reload(); m.reloadMessages(); plugin.database.close(); plugin.setupDatabase(); diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index dbb247d0..7ba5742a 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -1,20 +1,18 @@ package fr.xephi.authme.converter; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; - -import org.bukkit.command.CommandSender; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; /** - * * @author Xephi59 */ public class CrazyLoginConverter implements Converter { @@ -33,22 +31,17 @@ public class CrazyLoginConverter implements Converter { return this; } - private static String fileName; - private static File source; - @Override public void run() { - fileName = Settings.crazyloginFileName; + String fileName = Settings.crazyloginFileName; try { - source = new File(AuthMe.getInstance().getDataFolder() + File.separator + fileName); + File source = new File(AuthMe.getInstance().getDataFolder() + File.separator + fileName); if (!source.exists()) { sender.sendMessage("Error while trying to import datas, please put " + fileName + " in AuthMe folder!"); return; } - source.createNewFile(); - BufferedReader users = null; String line; - users = new BufferedReader(new FileReader(source)); + BufferedReader users = new BufferedReader(new FileReader(source)); while ((line = users.readLine()) != null) { if (line.contains("|")) { String[] args = line.split("\\|"); @@ -58,12 +51,9 @@ public class CrazyLoginConverter implements Converter { continue; String player = args[0].toLowerCase(); String psw = args[1]; - try { - if (player != null && psw != null) { - PlayerAuth auth = new PlayerAuth(player, psw, "127.0.0.1", System.currentTimeMillis(), player); - database.saveAuth(auth); - } - } catch (Exception e) { + if (psw != null) { + PlayerAuth auth = new PlayerAuth(player, psw, "127.0.0.1", System.currentTimeMillis(), player); + database.saveAuth(auth); } } } diff --git a/src/main/java/fr/xephi/authme/converter/FlatToSql.java b/src/main/java/fr/xephi/authme/converter/FlatToSql.java index 0f0b7bf8..17a5701a 100644 --- a/src/main/java/fr/xephi/authme/converter/FlatToSql.java +++ b/src/main/java/fr/xephi/authme/converter/FlatToSql.java @@ -1,18 +1,12 @@ package fr.xephi.authme.converter; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.settings.Settings; +import java.io.*; + /** - * * @author Xephi59 */ public class FlatToSql implements Converter { @@ -29,8 +23,6 @@ public class FlatToSql implements Converter { private static String columnEmail; private static String columnLogged; private static String columnID; - private static File source; - private static File output; public FlatToSql() { tableName = Settings.getMySQLTablename; @@ -50,9 +42,9 @@ public class FlatToSql implements Converter { @Override public void run() { try { - source = new File(AuthMe.getInstance().getDataFolder() + File.separator + "auths.db"); + File source = new File(AuthMe.getInstance().getDataFolder() + File.separator + "auths.db"); source.createNewFile(); - output = new File(AuthMe.getInstance().getDataFolder() + File.separator + "authme.sql"); + File output = new File(AuthMe.getInstance().getDataFolder() + File.separator + "authme.sql"); output.createNewFile(); BufferedReader br = new BufferedReader(new FileReader(source)); BufferedWriter sql = new BufferedWriter(new FileWriter(output)); diff --git a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java index f81d4a69..fb77d492 100644 --- a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java @@ -1,44 +1,44 @@ package fr.xephi.authme.converter; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.bukkit.command.CommandSender; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.settings.Settings; +import java.sql.*; public class FlatToSqlite implements Converter { public CommandSender sender; - + private String tableName; + private String columnName; + private String columnPassword; + private String columnIp; + private String columnLastLogin; + private String lastlocX; + private String lastlocY; + private String lastlocZ; + private String lastlocWorld; + private String columnEmail; + private String database; + private String columnID; + private Connection con; public FlatToSqlite(CommandSender sender) { this.sender = sender; } - private static String tableName; - private static String columnName; - private static String columnPassword; - private static String columnIp; - private static String columnLastLogin; - private static String lastlocX; - private static String lastlocY; - private static String lastlocZ; - private static String lastlocWorld; - private static String columnEmail; - private static File source; - private static String database; - private static String columnID; - private static Connection con; + private static void close(AutoCloseable o) { + if (o != null) { + try { + o.close(); + } catch (Exception ex) { + ConsoleLogger.showError(ex.getMessage()); + } + } + } @Override public void run() { @@ -55,6 +55,12 @@ public class FlatToSqlite implements Converter { columnEmail = Settings.getMySQLColumnEmail; columnID = Settings.getMySQLColumnId; + File source = new File(Settings.PLUGIN_FOLDER, "auths.db"); + if (!source.exists()) { + sender.sendMessage("Source file for FlatFile database not found... Aborting"); + return; + } + try { connect(); setup(); @@ -62,14 +68,12 @@ public class FlatToSqlite implements Converter { sender.sendMessage("Some error appeared while trying to setup and connect to sqlite database... Aborting"); return; } - try { - source = new File(AuthMe.getInstance().getDataFolder() + File.separator + "auths.db"); - source.createNewFile(); - BufferedReader br = new BufferedReader(new FileReader(source)); + + try (BufferedReader reader = new BufferedReader(new FileReader(source))) { String line; int i = 1; String newline; - while ((line = br.readLine()) != null) { + while ((line = reader.readLine()) != null) { String[] args = line.split(":"); if (args.length == 4) newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", 0, 0, 0, 'world', 'your@email.com');"; @@ -84,25 +88,23 @@ public class FlatToSqlite implements Converter { saveAuth(newline); i = i + 1; } - br.close(); - ConsoleLogger.info("The FlatFile has been converted to " + database + ".db file"); - close(); - sender.sendMessage("The FlatFile has been converted to " + database + ".db file"); - return; + String resp = "The FlatFile has been converted to " + database + ".db file"; + ConsoleLogger.info(resp); + sender.sendMessage(resp); } catch (IOException ex) { ConsoleLogger.showError(ex.getMessage()); - sender.sendMessage("Can't open the flat database file! Does it exist?"); + sender.sendMessage("Can't open the flat database file!"); + } finally { + close(con); } - return; } - private synchronized static void connect() - throws ClassNotFoundException, SQLException { + private synchronized void connect() throws ClassNotFoundException, SQLException { Class.forName("org.sqlite.JDBC"); con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); } - private synchronized static void setup() throws SQLException { + private synchronized void setup() throws SQLException { Statement st = null; ResultSet rs = null; try { @@ -145,7 +147,7 @@ public class FlatToSqlite implements Converter { } } - private static synchronized boolean saveAuth(String s) { + private synchronized boolean saveAuth(String s) { PreparedStatement pst = null; try { pst = con.prepareStatement(s); @@ -158,32 +160,4 @@ public class FlatToSqlite implements Converter { } return true; } - - private static void close(Statement st) { - if (st != null) { - try { - st.close(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - - private static void close(ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } - - public synchronized static void close() { - try { - con.close(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } } diff --git a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java index f2bbd204..b25e7110 100644 --- a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java @@ -5,6 +5,7 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.SQLite; +import fr.xephi.authme.settings.Settings; public class ForceFlatToSqlite implements Converter { @@ -25,7 +26,7 @@ public class ForceFlatToSqlite implements Converter { auth.setRealName("Player"); sqlite.saveAuth(auth); } - plugin.getSettings().setValue("DataSource.backend", "sqlite"); + Settings.setValue("DataSource.backend", "sqlite"); ConsoleLogger.info("Database successfully converted to sqlite !"); } catch (Exception e) { ConsoleLogger.showError("An error appeared while trying to convert flatfile to sqlite ..."); diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index 38697dbb..3f8cc0c0 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -1,5 +1,14 @@ 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; +import fr.xephi.authme.security.HashAlgorithm; +import fr.xephi.authme.security.PasswordSecurity; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -8,18 +17,7 @@ import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map.Entry; -import org.bukkit.command.CommandSender; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.security.HashAlgorithm; -import fr.xephi.authme.security.PasswordSecurity; -import fr.xephi.authme.settings.Settings; - /** - * * @author Xephi59 */ public class RakamakConverter implements Converter { @@ -38,27 +36,19 @@ public class RakamakConverter implements Converter { return this; } - private static Boolean useIP; - private static String fileName; - private static String ipFileName; - private static File source; - private static File ipfiles; - @Override public void run() { HashAlgorithm hash = Settings.getPasswordHash; - useIP = Settings.rakamakUseIp; - fileName = Settings.rakamakUsers; - ipFileName = Settings.rakamakUsersIp; - HashMap playerIP = new HashMap(); - HashMap playerPSW = new HashMap(); + boolean useIP = Settings.rakamakUseIp; + String fileName = Settings.rakamakUsers; + String ipFileName = Settings.rakamakUsersIp; + File source = new File(Settings.PLUGIN_FOLDER, fileName); + File ipfiles = new File(Settings.PLUGIN_FOLDER, ipFileName); + HashMap playerIP = new HashMap<>(); + HashMap playerPSW = new HashMap<>(); try { - source = new File(AuthMe.getInstance().getDataFolder() + File.separator + fileName); - ipfiles = new File(AuthMe.getInstance().getDataFolder() + File.separator + ipFileName); - source.createNewFile(); - ipfiles.createNewFile(); - BufferedReader users = null; - BufferedReader ipFile = null; + BufferedReader users; + BufferedReader ipFile; ipFile = new BufferedReader(new FileReader(ipfiles)); String line; if (useIP) { diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java index c39984d8..78a32aee 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java @@ -1,13 +1,12 @@ package fr.xephi.authme.converter; -import java.io.File; - -import org.bukkit.OfflinePlayer; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; +import org.bukkit.OfflinePlayer; + +import java.io.File; public class RoyalAuthConverter implements Converter { @@ -24,8 +23,8 @@ public class RoyalAuthConverter implements Converter { for (OfflinePlayer o : plugin.getServer().getOfflinePlayers()) { try { String name = o.getName().toLowerCase(); - String separator = File.separator; - File file = new File("." + separator + "plugins" + separator + "RoyalAuth" + separator + "userdata" + separator + name + ".yml"); + String sp = File.separator; + File file = new File("." + sp + "plugins" + sp + "RoyalAuth" + sp + "userdata" + sp + name + ".yml"); if (data.isAuthAvailable(name)) continue; if (!file.exists()) @@ -34,6 +33,7 @@ public class RoyalAuthConverter implements Converter { PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com"); data.saveAuth(auth); } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); ConsoleLogger.showError("Error while trying to import " + o.getName() + " RoyalAuth datas"); } } diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java index cebbee0d..f0510c75 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java @@ -1,9 +1,9 @@ package fr.xephi.authme.converter; -import java.io.File; - import fr.xephi.authme.settings.CustomConfiguration; +import java.io.File; + public class RoyalAuthYamlReader extends CustomConfiguration { public RoyalAuthYamlReader(File file) { diff --git a/src/main/java/fr/xephi/authme/converter/SqlToFlat.java b/src/main/java/fr/xephi/authme/converter/SqlToFlat.java index 4dccbd43..bc8b0834 100644 --- a/src/main/java/fr/xephi/authme/converter/SqlToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/SqlToFlat.java @@ -1,15 +1,14 @@ package fr.xephi.authme.converter; -import java.util.List; - -import org.bukkit.command.CommandSender; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.FlatFile; import fr.xephi.authme.settings.Messages; +import org.bukkit.command.CommandSender; + +import java.util.List; public class SqlToFlat implements Converter { @@ -38,11 +37,9 @@ public class SqlToFlat implements Converter { } } sender.sendMessage("Successfully convert from SQL table to file auths.db"); - return; } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); Messages.getInstance().send(sender, "error"); - return; } } diff --git a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java index 1939c6c1..1de9f104 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java @@ -1,10 +1,9 @@ package fr.xephi.authme.converter; -import org.bukkit.command.CommandSender; - 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 { diff --git a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java index 5b2a0be9..0fb2c73e 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java @@ -1,18 +1,18 @@ 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; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + import java.io.File; import java.io.IOException; import java.util.Scanner; import java.util.UUID; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.CommandSender; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.datasource.DataSource; - public class vAuthFileReader { public AuthMe plugin; @@ -27,21 +27,19 @@ public class vAuthFileReader { public void convert() throws IOException { final File file = new File(plugin.getDataFolder().getParent() + "" + File.separator + "vAuth" + File.separator + "passwords.yml"); - Scanner scanner = null; + Scanner scanner; try { scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); String name = line.split(": ")[0]; String password = line.split(": ")[1]; - PlayerAuth auth = null; + PlayerAuth auth; if (isUUIDinstance(password)) { - String pname = null; + String pname; try { pname = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName(); - } catch (Exception e) { - pname = getName(UUID.fromString(name)); - } catch (NoSuchMethodError e) { + } catch (Exception | NoSuchMethodError e) { pname = getName(UUID.fromString(name)); } if (pname == null) @@ -50,10 +48,10 @@ public class vAuthFileReader { } else { auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com"); } - if (auth != null) - database.saveAuth(auth); + database.saveAuth(auth); } } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); } } @@ -70,7 +68,7 @@ public class vAuthFileReader { if (op.getUniqueId().compareTo(uuid) == 0) return op.getName(); } - } catch (Exception e) { + } catch (Exception ignored) { } return null; } diff --git a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java index 1f813668..a5c063fd 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java @@ -1,8 +1,7 @@ package fr.xephi.authme.converter; -import org.bukkit.command.CommandSender; - import fr.xephi.authme.AuthMe; +import org.bukkit.command.CommandSender; public class xAuthConverter implements Converter { diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index 61be7cb8..0c6d62fd 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -1,5 +1,13 @@ package fr.xephi.authme.converter; +import de.luricos.bukkit.xAuth.database.DatabaseTables; +import de.luricos.bukkit.xAuth.utils.xAuthLog; +import de.luricos.bukkit.xAuth.xAuth; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.datasource.DataSource; +import org.bukkit.command.CommandSender; + import java.io.File; import java.sql.Connection; import java.sql.PreparedStatement; @@ -8,15 +16,6 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import org.bukkit.command.CommandSender; - -import de.luricos.bukkit.xAuth.xAuth; -import de.luricos.bukkit.xAuth.database.DatabaseTables; -import de.luricos.bukkit.xAuth.utils.xAuthLog; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.datasource.DataSource; - public class xAuthToFlat { public AuthMe instance; @@ -82,7 +81,7 @@ public class xAuthToFlat { } public List getXAuthPlayers() { - List xP = new ArrayList(); + List xP = new ArrayList<>(); Connection conn = xAuth.getPlugin().getDatabaseController().getConnection(); PreparedStatement ps = null; ResultSet rs = null; @@ -95,7 +94,7 @@ public class xAuthToFlat { } } catch (SQLException e) { xAuthLog.severe("Cannot import xAuthPlayers", e); - return new ArrayList(); + return new ArrayList<>(); } finally { xAuth.getPlugin().getDatabaseController().close(conn, ps, rs); } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index f3f437be..8576b3ce 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -14,7 +14,8 @@ import java.util.List; public final class Settings extends YamlConfiguration { - private AuthMe plugin; + private static AuthMe plugin; + private static Settings instance; // This is not an option! public static Boolean antiBotInAction = false; @@ -94,24 +95,25 @@ public final class Settings extends YamlConfiguration { protected static YamlConfiguration configFile; - public Settings(AuthMe plugin) { + public Settings(AuthMe pl) { configFile = (YamlConfiguration) plugin.getConfig(); - this.plugin = plugin; + plugin = pl; + instance = this; } - public final void reload() throws Exception { + public static void reload() throws Exception { plugin.getLogger().info("Loading Configuration File..."); boolean exist = SETTINGS_FILE.exists(); if (!exist) { plugin.saveDefaultConfig(); } - load(SETTINGS_FILE); + instance.load(SETTINGS_FILE); if (exist) { - mergeConfig(); + instance.mergeConfig(); } loadVariables(); if (exist) { - saveDefaults(); + instance.saveDefaults(); } messageFile = new File(PLUGIN_FOLDER, "messages" + File.separator + "messages_" + messagesLanguage + ".yml"); } @@ -481,9 +483,9 @@ public final class Settings extends YamlConfiguration { } } - public void setValue(String key, Object value) { - this.set(key, value); - this.save(); + public static void setValue(String key, Object value) { + instance.set(key, value); + save(); } private static HashAlgorithm getPasswordHash() { @@ -539,9 +541,9 @@ public final class Settings extends YamlConfiguration { * * @return True if saved successfully */ - public final boolean save() { + public static boolean save() { try { - save(SETTINGS_FILE); + instance.save(SETTINGS_FILE); return true; } catch (Exception ex) { return false; From 53f3ad114b604e0f450c569e1d884bfc5612d461 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Thu, 24 Sep 2015 00:55:01 +0700 Subject: [PATCH 228/427] re-add geoip methods and set as deprecated --- src/main/java/fr/xephi/authme/AuthMe.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 170e6d7d..dc797d0c 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -64,7 +64,6 @@ public class AuthMe extends JavaPlugin { private JsonCache playerBackup; public OtherAccounts otherAccounts; public Location essentialsSpawn; - public LookupService lookupService; public boolean legacyChestShop = false; public boolean antibotMod = false; public boolean delayedAntiBot = true; @@ -768,5 +767,14 @@ public class AuthMe extends JavaPlugin { return realIP; } + @Deprecated + public String getCountryCode(String ip) { + return Utils.getCountryCode(ip); + } + + @Deprecated + public String getCountryName(String ip) { + return Utils.getCountryName(ip); + } } From 8f446fa6af459411635b9299c4ee5c209244ad80 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 23 Sep 2015 22:10:11 +0200 Subject: [PATCH 229/427] Fix settings (i hope) --- src/main/java/fr/xephi/authme/AuthMe.java | 3 +-- src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index dc797d0c..6e11d612 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -1,7 +1,6 @@ package fr.xephi.authme; import com.earth2me.essentials.Essentials; -import com.maxmind.geoip.LookupService; import com.onarandombox.MultiverseCore.MultiverseCore; import fr.xephi.authme.api.API; import fr.xephi.authme.api.NewAPI; @@ -119,7 +118,7 @@ public class AuthMe extends JavaPlugin { // TODO: new configuration style (more files) try { settings = new Settings(this); - settings.reload(); + Settings.reload(); } catch (Exception e) { ConsoleLogger.writeStackTrace(e); ConsoleLogger.showError("Can't load the configuration file... Something went wrong, to avoid security issues the server will shutdown!"); diff --git a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java index b25e7110..2c95d1cd 100644 --- a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java @@ -10,11 +10,8 @@ import fr.xephi.authme.settings.Settings; public class ForceFlatToSqlite implements Converter { private DataSource data; - private AuthMe plugin; - public ForceFlatToSqlite(DataSource data, AuthMe plugin) { this.data = data; - this.plugin = plugin; } @Override From 8b71f964dad4ea2e5af5bf6c8cbcd1ea9be1acd1 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Thu, 24 Sep 2015 18:30:24 +0700 Subject: [PATCH 230/427] fix changepassword issue. #190 #218 --- .../commands/ChangePasswordCommand.java | 2 +- .../xephi/authme/task/ChangePasswordTask.java | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java index 6d3c1f2f..54626d77 100644 --- a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java @@ -62,7 +62,7 @@ public class ChangePasswordCommand implements CommandExecutor { return true; } } - plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, args[0])); + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, args[0], args[1])); return true; } } diff --git a/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java b/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java index c9cb72d6..2cf21d19 100644 --- a/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java +++ b/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java @@ -15,12 +15,14 @@ public class ChangePasswordTask implements Runnable { private final AuthMe plugin; private final Player player; - private String password; + private final String oldPassword; + private final String newPassword; - public ChangePasswordTask(AuthMe plugin, Player player, String password) { + public ChangePasswordTask(AuthMe plugin, Player player, String oldPassword, String newPassword) { this.plugin = plugin; this.player = player; - this.password = password; + this.oldPassword = oldPassword; + this.newPassword = newPassword; } @Override @@ -28,13 +30,15 @@ public class ChangePasswordTask implements Runnable { Messages m = Messages.getInstance(); try { String name = player.getName().toLowerCase(); - String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); - if (PasswordSecurity.comparePasswordWithHash(password, PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(name); + String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, newPassword, name); + PlayerAuth auth = PlayerCache.getInstance().getAuth(name); + if (PasswordSecurity.comparePasswordWithHash(oldPassword, auth.getHash(), player.getName())) { auth.setHash(hashnew); - if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) + if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) { auth.setSalt(PasswordSecurity.userSalt.get(name)); - else auth.setSalt(""); + } else { + auth.setSalt(""); + } if (!plugin.database.updatePassword(auth)) { m.send(player, "error"); return; From 45d939f0f53718e39824d7e8b5b2e6235e1b9f63 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Fri, 25 Sep 2015 01:06:58 +0700 Subject: [PATCH 231/427] init field first, fix #221 --- src/main/java/fr/xephi/authme/settings/Settings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 8576b3ce..f79d4e24 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -96,9 +96,9 @@ public final class Settings extends YamlConfiguration { protected static YamlConfiguration configFile; public Settings(AuthMe pl) { - configFile = (YamlConfiguration) plugin.getConfig(); - plugin = pl; instance = this; + plugin = pl; + configFile = (YamlConfiguration) plugin.getConfig(); } public static void reload() throws Exception { From f88e197863779cf0c4150956a7d6f87b0f9885af Mon Sep 17 00:00:00 2001 From: DNx5 Date: Fri, 25 Sep 2015 05:21:32 +0700 Subject: [PATCH 232/427] cleanup Settings --- .../java/fr/xephi/authme/settings/Settings.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index f79d4e24..24a72173 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -18,7 +18,7 @@ public final class Settings extends YamlConfiguration { private static Settings instance; // This is not an option! - public static Boolean antiBotInAction = false; + public static boolean antiBotInAction = false; public static final File PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); public static final File MODULE_FOLDER = new File(PLUGIN_FOLDER, "modules"); @@ -513,11 +513,11 @@ public final class Settings extends YamlConfiguration { * return false if ip and name doesnt amtch with player that join the * server, so player has a restricted access */ - public static Boolean getRestrictedIp(String name, String ip) { + public static boolean getRestrictedIp(String name, String ip) { Iterator iter = getRestrictedIp.iterator(); - Boolean trueonce = false; - Boolean namefound = false; + boolean trueonce = false; + boolean namefound = false; while (iter.hasNext()) { String[] args = iter.next().split(";"); String testname = args[0]; @@ -529,11 +529,7 @@ public final class Settings extends YamlConfiguration { } } } - if (!namefound) { - return true; - } else { - return trueonce; - } + return !namefound || trueonce; } /** From 72604bfdea51a6beb6efbe52b000c5ee0f0b4118 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Fri, 25 Sep 2015 07:20:46 +0700 Subject: [PATCH 233/427] improve cached datasource performance. --- src/main/java/fr/xephi/authme/AuthMe.java | 7 +- .../authme/datasource/CacheDataSource.java | 286 +++++++++++++----- .../authme/datasource/DatabaseCalls.java | 13 +- 3 files changed, 220 insertions(+), 86 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 6e11d612..77a0e5c1 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -37,7 +37,8 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; import org.mcstats.Metrics; -import java.io.*; +import java.io.BufferedReader; +import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Calendar; @@ -382,10 +383,10 @@ public class AuthMe extends JavaPlugin { if (Settings.isCachingEnabled) { database = new CacheDataSource(this, database); + } else { + database = new DatabaseCalls(database); } - database = new DatabaseCalls(database); - if (Settings.getDataSource == DataSource.DataSourceType.FILE) { Converter converter = new ForceFlatToSqlite(database, this); server.getScheduler().runTaskAsynchronously(this, converter); diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index d4b0772c..08419710 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -6,24 +6,31 @@ import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import org.bukkit.entity.Player; +import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class CacheDataSource implements DataSource { private final DataSource source; private final AuthMe plugin; - private ConcurrentHashMap cache = new ConcurrentHashMap<>(); + private final ExecutorService exec; + private final ConcurrentHashMap cache = new ConcurrentHashMap<>(); public CacheDataSource(AuthMe pl, DataSource src) { this.plugin = pl; this.source = src; + this.exec = Executors.newCachedThreadPool(); + /* * We need to load all players in cache ... It will took more time to * load the server, but it will be much easier to check for an * isAuthAvailable ! */ - pl.getServer().getScheduler().runTaskAsynchronously(pl, new Runnable() { + exec.execute(new Runnable() { @Override public void run() { for (PlayerAuth auth : source.getAllAuths()) { @@ -50,7 +57,7 @@ public class CacheDataSource implements DataSource { @Override public synchronized boolean saveAuth(final PlayerAuth auth) { cache.put(auth.getNickname(), auth); - plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + exec.execute(new Runnable() { @Override public void run() { if (!source.saveAuth(auth)) { @@ -62,45 +69,95 @@ public class CacheDataSource implements DataSource { } @Override - public synchronized boolean updatePassword(PlayerAuth auth) { - if (source.updatePassword(auth)) { - if (cache.containsKey(auth.getNickname())) - cache.get(auth.getNickname()).setHash(auth.getHash()); - return true; + public synchronized boolean updatePassword(final PlayerAuth auth) { + if (!cache.containsKey(auth.getNickname())) { + return false; } - return false; + final String oldHash = cache.get(auth.getNickname()).getHash(); + cache.get(auth.getNickname()).setHash(auth.getHash()); + exec.execute(new Runnable() { + @Override + public void run() { + if (!source.updatePassword(auth)) { + if (cache.containsKey(auth.getNickname())) { + cache.get(auth.getNickname()).setHash(oldHash); + } + } + } + }); + return true; } @Override - public boolean updateSession(PlayerAuth auth) { - if (source.updateSession(auth)) { - if (cache.containsKey(auth.getNickname())) { - cache.get(auth.getNickname()).setIp(auth.getIp()); - cache.get(auth.getNickname()).setLastLogin(auth.getLastLogin()); - cache.get(auth.getNickname()).setRealName(auth.getRealName()); - } - return true; + public boolean updateSession(final PlayerAuth auth) { + if (!cache.containsKey(auth.getNickname())) { + return false; } - return false; + PlayerAuth cachedAuth = cache.get(auth.getNickname()); + final String oldIp = cachedAuth.getIp(); + final long oldLastLogin = cachedAuth.getLastLogin(); + final String oldRealName = cachedAuth.getRealName(); + + cachedAuth.setIp(auth.getIp()); + cachedAuth.setLastLogin(auth.getLastLogin()); + cachedAuth.setRealName(auth.getRealName()); + exec.execute(new Runnable() { + @Override + public void run() { + if (!source.updateSession(auth)) { + if (cache.containsKey(auth.getNickname())) { + PlayerAuth cachedAuth = cache.get(auth.getNickname()); + cachedAuth.setIp(oldIp); + cachedAuth.setLastLogin(oldLastLogin); + cachedAuth.setRealName(oldRealName); + } + } + } + }); + return true; } @Override - public boolean updateQuitLoc(PlayerAuth auth) { - if (source.updateQuitLoc(auth)) { - if (cache.containsKey(auth.getNickname())) { - cache.get(auth.getNickname()).setQuitLocX(auth.getQuitLocX()); - cache.get(auth.getNickname()).setQuitLocY(auth.getQuitLocY()); - cache.get(auth.getNickname()).setQuitLocZ(auth.getQuitLocZ()); - cache.get(auth.getNickname()).setWorld(auth.getWorld()); - } - return true; + public boolean updateQuitLoc(final PlayerAuth auth) { + if (!cache.containsKey(auth.getNickname())) { + return false; } - return false; + final PlayerAuth cachedAuth = cache.get(auth.getNickname()); + final double oldX = cachedAuth.getQuitLocX(); + final double oldY = cachedAuth.getQuitLocY(); + final double oldZ = cachedAuth.getQuitLocZ(); + final String oldWorld = cachedAuth.getWorld(); + + cachedAuth.setQuitLocX(auth.getQuitLocX()); + cachedAuth.setQuitLocY(auth.getQuitLocY()); + cachedAuth.setQuitLocZ(auth.getQuitLocZ()); + cachedAuth.setWorld(auth.getWorld()); + exec.execute(new Runnable() { + @Override + public void run() { + if (!source.updateQuitLoc(auth)) { + if (cache.containsKey(auth.getNickname())) { + PlayerAuth cachedAuth = cache.get(auth.getNickname()); + cachedAuth.setQuitLocX(oldX); + cachedAuth.setQuitLocY(oldY); + cachedAuth.setQuitLocZ(oldZ); + cachedAuth.setWorld(oldWorld); + } + } + } + }); + return true; } @Override public int getIps(String ip) { - return source.getIps(ip); + int count = 0; + for (Map.Entry p : cache.entrySet()) { + if (p.getValue().getIp().equals(ip)) { + count++; + } + } + return count; } @Override @@ -130,75 +187,133 @@ public class CacheDataSource implements DataSource { } @Override - public synchronized boolean removeAuth(String user) { - if (source.removeAuth(user)) { - cache.remove(user); - return true; - } - return false; + public synchronized boolean removeAuth(String username) { + final String user = username.toLowerCase(); + final PlayerAuth auth = cache.get(user); + cache.remove(user); + exec.execute(new Runnable() { + @Override + public void run() { + if (!source.removeAuth(user)) { + cache.put(user, auth); + } + } + }); + return true; } @Override public synchronized void close() { + exec.shutdown(); source.close(); } @Override public void reload() { - cache.clear(); - source.reload(); - for (Player player : Utils.getOnlinePlayers()) { - String user = player.getName().toLowerCase(); - if (PlayerCache.getInstance().isAuthenticated(user)) { - PlayerAuth auth = source.getAuth(user); - cache.put(user, auth); + exec.execute(new Runnable() { + @Override + public void run() { + cache.clear(); + source.reload(); + for (Player player : Utils.getOnlinePlayers()) { + String user = player.getName().toLowerCase(); + if (PlayerCache.getInstance().isAuthenticated(user)) { + PlayerAuth auth = source.getAuth(user); + cache.put(user, auth); + } + } } - } + }); } @Override - public synchronized boolean updateEmail(PlayerAuth auth) { - if (source.updateEmail(auth)) { - if (cache.containsKey(auth.getNickname())) - cache.get(auth.getNickname()).setEmail(auth.getEmail()); - return true; + public synchronized boolean updateEmail(final PlayerAuth auth) { + if (!cache.containsKey(auth.getNickname())) { + return false; } - return false; + PlayerAuth cachedAuth = cache.get(auth.getNickname()); + final String oldEmail = cachedAuth.getEmail(); + cachedAuth.setEmail(auth.getEmail()); + exec.execute(new Runnable() { + @Override + public void run() { + if (!source.updateEmail(auth)) { + if (cache.containsKey(auth.getNickname())) { + cache.get(auth.getNickname()).setEmail(oldEmail); + } + } + } + }); + return true; } @Override - public synchronized boolean updateSalt(PlayerAuth auth) { - if (source.updateSalt(auth)) { - if (cache.containsKey(auth.getNickname())) - cache.get(auth.getNickname()).setSalt(auth.getSalt()); - return true; + public synchronized boolean updateSalt(final PlayerAuth auth) { + if (!cache.containsKey(auth.getNickname())) { + return false; } - return false; + PlayerAuth cachedAuth = cache.get(auth.getNickname()); + final String oldSalt = cachedAuth.getSalt(); + cachedAuth.setSalt(auth.getSalt()); + exec.execute(new Runnable() { + @Override + public void run() { + if (!source.updateSalt(auth)) { + if (cache.containsKey(auth.getNickname())) { + cache.get(auth.getNickname()).setSalt(oldSalt); + } + } + } + }); + return true; } @Override public synchronized List getAllAuthsByName(PlayerAuth auth) { - return source.getAllAuthsByName(auth); + List result = new ArrayList<>(); + for (Map.Entry stringPlayerAuthEntry : cache.entrySet()) { + PlayerAuth p = stringPlayerAuthEntry.getValue(); + if (p.getIp().equals(auth.getIp())) + result.add(p.getNickname()); + } + return result; } @Override public synchronized List getAllAuthsByIp(String ip) { - return source.getAllAuthsByIp(ip); + List result = new ArrayList<>(); + for (Map.Entry stringPlayerAuthEntry : cache.entrySet()) { + PlayerAuth p = stringPlayerAuthEntry.getValue(); + if (p.getIp().equals(ip)) + result.add(p.getNickname()); + } + return result; } @Override public synchronized List getAllAuthsByEmail(String email) { - return source.getAllAuthsByEmail(email); + List result = new ArrayList<>(); + for (Map.Entry stringPlayerAuthEntry : cache.entrySet()) { + PlayerAuth p = stringPlayerAuthEntry.getValue(); + if (p.getEmail().equals(email)) + result.add(p.getNickname()); + } + return result; } @Override - public synchronized void purgeBanned(List banned) { - source.purgeBanned(banned); - for (PlayerAuth auth : cache.values()) { - if (banned.contains(auth.getNickname())) { - cache.remove(auth.getNickname()); + public synchronized void purgeBanned(final List banned) { + exec.execute(new Runnable() { + @Override + public void run() { + source.purgeBanned(banned); + for (PlayerAuth auth : cache.values()) { + if (banned.contains(auth.getNickname())) { + cache.remove(auth.getNickname()); + } + } } - } + }); } @Override @@ -208,45 +323,66 @@ public class CacheDataSource implements DataSource { @Override public boolean isLogged(String user) { - return source.isLogged(user.toLowerCase()); + user = user.toLowerCase(); + return PlayerCache.getInstance().getCache().containsKey(user); } @Override - public void setLogged(String user) { - source.setLogged(user.toLowerCase()); + public void setLogged(final String user) { + exec.execute(new Runnable() { + @Override + public void run() { + source.setLogged(user.toLowerCase()); + } + }); } @Override - public void setUnlogged(String user) { - source.setUnlogged(user.toLowerCase()); + public void setUnlogged(final String user) { + exec.execute(new Runnable() { + @Override + public void run() { + source.setUnlogged(user.toLowerCase()); + } + }); } @Override public void purgeLogged() { - source.purgeLogged(); + exec.execute(new Runnable() { + @Override + public void run() { + source.purgeLogged(); + } + }); } @Override public int getAccountsRegistered() { - return source.getAccountsRegistered(); + return cache.size(); } @Override - public void updateName(String oldone, String newone) { + public void updateName(final String oldone, final String newone) { if (cache.containsKey(oldone)) { cache.put(newone, cache.get(oldone)); cache.remove(oldone); } - source.updateName(oldone, newone); + exec.execute(new Runnable() { + @Override + public void run() { + source.updateName(oldone, newone); + } + }); } @Override public List getAllAuths() { - return source.getAllAuths(); + return new ArrayList<>(cache.values()); } @Override public List getLoggedPlayers() { - return source.getLoggedPlayers(); + return new ArrayList<>(PlayerCache.getInstance().getCache().values()); } } diff --git a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java index 6b84c7d7..20cd97df 100644 --- a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java +++ b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java @@ -4,7 +4,9 @@ import fr.xephi.authme.cache.auth.PlayerAuth; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class DatabaseCalls implements DataSource { @@ -214,13 +216,8 @@ public class DatabaseCalls implements DataSource { @Override public synchronized void close() { - try { - exec.shutdown(); - exec.awaitTermination(10, TimeUnit.SECONDS); - database.close(); - } catch (Exception e) { - e.printStackTrace(); - } + exec.shutdown(); + database.close(); } @Override From b61db5c56977eada7fd856504f98b2b79f563ff3 Mon Sep 17 00:00:00 2001 From: Ivan Ip Date: Mon, 28 Sep 2015 16:34:07 +0800 Subject: [PATCH 234/427] Simplified and updated strings. Modified some translation and proofread grammars, for players' easy-understanding. Also corrected some typo on color scheme. --- src/main/resources/messages/messages_zhhk.yml | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/main/resources/messages/messages_zhhk.yml b/src/main/resources/messages/messages_zhhk.yml index b20ec71a..6cd67c6b 100644 --- a/src/main/resources/messages/messages_zhhk.yml +++ b/src/main/resources/messages/messages_zhhk.yml @@ -1,47 +1,48 @@ -# Translator: uSoc_lifehome (http://lifeho.me) # +# Translator: lifehome # +# Last modif: 1443428389 UTC # # -------------------------------------------- # -unknown_user: '&8[&6用戶系統&8] &f用戶資料並不存在於資料庫中。' +unknown_user: '&8[&6用戶系統&8] &f用戶資料並不存在。' unsafe_spawn: '&8[&6用戶系統&8] &f你的登出位置不安全,現在將傳送你到重生點。' not_logged_in: '&8[&6用戶系統&8] &c你還沒有登入 !' -reg_voluntarily: '&8[&6用戶系統&8] &f你可以使用這個的指令來註冊: 《 /register <密碼> <重覆密碼> 》' -usage_log: '&8[&6用戶系統&8] &c用法: 《 /login <密碼> 》' +reg_voluntarily: '&8[&6用戶系統&8] &f你可以使用這個指令來註冊: 《 /register <密碼> <重覆密碼> 》' +usage_log: '&8[&6用戶系統&8] &f用法: 《 /login <密碼> 》' wrong_pwd: '&8[&6用戶系統&8] &c你輸入了錯誤的密碼。' -unregistered: '&8[&6用戶系統&8] &c你已成功取消會員註冊記錄。' +unregistered: '&8[&6用戶系統&8] &c你已成功刪除會員註冊記錄。' reg_disabled: '&8[&6用戶系統&8] &c本伺服器已停止新玩家註冊。' -valid_session: '&8[&6用戶系統&8] &b嗨 ! 我記得你,歡迎回來~' -login: '&8[&6用戶系統&8] &c你成功的登入了。' -password_error_nick: '&fYou can''t use your name as password' -password_error_unsafe: '&fYou can''t use unsafe passwords' +valid_session: '&8[&6用戶系統&8] &b嗨 ! 歡迎回來喔~' +login: '&8[&6用戶系統&8] &c你成功登入了。' +password_error_nick: '&8[&6用戶系統&8] &c這個密碼太不安全了!' +password_error_unsafe: '&8[&6用戶系統&8] &c這個密碼太不安全了!' vb_nonActiv: '&8[&6用戶系統&8] &f你的帳戶還沒有經過電郵驗證 !' user_regged: '&8[&6用戶系統&8] &c此用戶名已經註冊過了。' -usage_reg: '&8[&6用戶系統&8] &c用法: 《 /register <密碼> <重覆密碼> 》' +usage_reg: '&8[&6用戶系統&8] &f用法: 《 /register <密碼> <重覆密碼> 》' max_reg: '&8[&6用戶系統&8] &f你的IP地址已達到註冊數上限。' no_perm: '&8[&6用戶系統&8] &b你可以到 CraftingHK 玩家百科中查看說明文件。' error: '&8[&6用戶系統&8] &f發生錯誤,請與管理員聯絡。' login_msg: '&8[&6用戶系統&8] &c請使用這個指令來登入: 《 /login <密碼> 》' -reg_msg: '&8[&6用戶系統&8] &c請使用這個的指令來註冊: 《 /register <密碼> <重覆密碼> 》' -reg_email_msg: '&8[&6用戶系統&8] &c請使用這個的指令來註冊: 《 /register <電郵> <重覆電郵> 》' -usage_unreg: '&8[&6用戶系統&8] &c用法: 《 /unregister <密碼> 》' -pwd_changed: '&8[&6用戶系統&8] &c你成功的更換了你的密碼 !' +reg_msg: '&8[&6用戶系統&8] &c請使用這個指令來註冊: 《 /register <密碼> <重覆密碼> 》' +reg_email_msg: '&8[&6用戶系統&8] &c請使用這個指令來註冊: 《 /register <電郵> <重覆電郵> 》' +usage_unreg: '&8[&6用戶系統&8] &f用法: 《 /unregister <密碼> 》' +pwd_changed: '&8[&6用戶系統&8] &c你成功更換了你的密碼 !' user_unknown: '&8[&6用戶系統&8] &c此用戶名沒有已登記資料。' password_error: '&8[&6用戶系統&8] &f密碼不符合。' invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞,請等待登入階段結束。' -reg_only: '&8[&6用戶系統&8] &f限已註冊會員,請先到 https://www.example.com/ 註冊。' +reg_only: '&8[&6用戶系統&8] &f限已註冊會員,請先到 https://crafting.hk/ 註冊。' logged_in: '&8[&6用戶系統&8] &c你已經登入過了。' -logout: '&8[&6用戶系統&8] &b你成功的登出了。' +logout: '&8[&6用戶系統&8] &b你成功登出了。' same_nick: '&8[&6用戶系統&8] &f同名玩家已在遊玩。' -registered: '&8[&6用戶系統&8] &b你成功的註冊了。' +registered: '&8[&6用戶系統&8] &b你成功註冊了。' pass_len: '&8[&6用戶系統&8] &f你的密碼並不符合規定長度。' reload: '&8[&6用戶系統&8] &b登入系統設定及資料庫重新載入完畢。' timeout: '&8[&6用戶系統&8] &f登入逾時。' usage_changepassword: '&8[&6用戶系統&8] &f用法: 《 /changepassword <舊密碼> <新密碼> 》' name_len: '&8[&6用戶系統&8] &c你的用戶名不符合規定長度。' -regex: '&8[&6用戶系統&8] &c你的用戶名含有不容許之字符。以下為准許之字母: REG_EX' +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] &c用法: 《 /captcha <驗證碼> 》' -wrong_captcha: '&8[&6用戶系統&8] &c你輸入了錯誤的驗證碼,請使用 《 /captcha <驗證碼> 》 再次輸入。' -valid_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼是無效的 !' +recovery_email: '&8[&6用戶系統&8] &c忘記密碼 ? 請使用這個指令來更新密碼: 《 /email recovery <電郵地址> 》' +usage_captcha: '&8[&6用戶系統&8] &f用法: 《 /captcha <驗證碼> 》' +wrong_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼無效,請使用 《 /captcha <驗證碼> 》 再次輸入。' +valid_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼無效 !' kick_forvip: '&c因為有VIP玩家登入了伺服器。' kick_fullserver: '&c抱歉! 因為伺服器滿人了,所以你目前未能登入伺服器。' usage_email_add: '&8[&6用戶系統&8] &f用法: 《 /email add <電郵> <重覆電郵> 》' @@ -50,10 +51,10 @@ usage_email_recovery: '&8[&6用戶系統&8] &f用法: 《 /email recovery <電 new_email_invalid: '&8[&6用戶系統&8] 你所填寫的新電郵地址並不正確。' old_email_invalid: '&8[&6用戶系統&8] 你所填寫的舊電郵地址並不正確。' email_invalid: '&8[&6用戶系統&8] 你所填寫的電郵地址並不正確。' -email_added: '&8[&6用戶系統&8] 已加入你的電郵地址記錄。' +email_added: '&8[&6用戶系統&8] 已新增你的電郵地址。' email_confirm: '&8[&6用戶系統&8] 請重覆輸入你的電郵地址。' -email_changed: '&8[&6用戶系統&8] 你的電郵地址記錄已更改。' +email_changed: '&8[&6用戶系統&8] 你的電郵地址已更改。' email_send: '&8[&6用戶系統&8] 忘記密碼信件已寄出,請查收。' country_banned: '&8[&6用戶系統&8] 本伺服器已停止對你的國家提供遊戲服務。' -antibot_auto_enabled: '&8[&6用戶系統&8] 防止機械人程序已因應現時大量不尋常的連線而啟用。' -antibot_auto_disabled: '&8[&6用戶系統&8] 防止機械人程序檢查到不正常連接數已減少,並於 %m 分鐘後停止運作。' +antibot_auto_enabled: '&8[&6用戶系統&8] 防止機械人程序已因應現時大量不尋常連線而啟用。' +antibot_auto_disabled: '&8[&6用戶系統&8] 不正常連接數已減少,防止機械人程序將於 %m 分鐘後停止。' From 47f0f0e9271bb3c3bfe4c031a51746b93c6ddfac Mon Sep 17 00:00:00 2001 From: games647 Date: Mon, 28 Sep 2015 20:08:51 +0200 Subject: [PATCH 235/427] Fix duplicate registers --- pom.xml | 4 ++-- .../authme/process/register/AsyncronousRegister.java | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 87feaae4..da80a0d8 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ ess-repo - https://ci.drtshock.net/plugin/repository/everything + http://ci.drtshock.net/plugin/repository/everything @@ -257,7 +257,7 @@ - org.bukkit 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 255c696d..cc516697 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java @@ -67,14 +67,10 @@ public class AsyncronousRegister { 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)) { + else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) { + m.send(player, "password_error_unsafe"); + allowRegister = false; + } else if (database.isAuthAvailable(name)) { m.send(player, "user_regged"); allowRegister = false; } From d90183ca02b77bacafd5346f1776f0782de6bd46 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Mon, 28 Sep 2015 21:28:58 +0200 Subject: [PATCH 236/427] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3f12a0cc..bed52462 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@


    #####Development tools: +- DEVELOPMENT TEAM REPO (please send PRs here!): Github Development Page + - Developers ChatRoom: [![Join the chat at https://gitter.im/Xephi/AuthMeReloaded](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Xephi/AuthMeReloaded?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - Build status: [![Build Status](https://travis-ci.org/Xephi/AuthMeReloaded.svg?branch=master)](https://travis-ci.org/Xephi/AuthMeReloaded) [![Dependency Status](https://www.versioneye.com/user/projects/55bab9e8653762002000190a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55bab9e8653762002000190a) From 646eaad2ce7823a20cf7b163ddfbba4ae2da5bb8 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 28 Sep 2015 21:33:29 +0200 Subject: [PATCH 237/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 1 + src/main/java/fr/xephi/authme/datasource/CacheDataSource.java | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 77a0e5c1..58d7b39d 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -107,6 +107,7 @@ public class AuthMe extends JavaPlugin { // TODO: split the plugin in more modules moduleManager = new ModuleManager(this); + @SuppressWarnings("unused") int loaded = moduleManager.loadModules(); // TODO: remove vault as hard dependency diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 08419710..f1298065 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -16,12 +16,10 @@ import java.util.concurrent.Executors; public class CacheDataSource implements DataSource { private final DataSource source; - private final AuthMe plugin; private final ExecutorService exec; private final ConcurrentHashMap cache = new ConcurrentHashMap<>(); public CacheDataSource(AuthMe pl, DataSource src) { - this.plugin = pl; this.source = src; this.exec = Executors.newCachedThreadPool(); From 4b1854c7e26166fda07163e22089718b262e528b Mon Sep 17 00:00:00 2001 From: games647 Date: Mon, 28 Sep 2015 20:06:36 +0200 Subject: [PATCH 238/427] Fix duplicate registers --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index da80a0d8..537a3084 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public + http://hub.spigotmc.org/nexus/content/groups/public From 34cc4ce78e045167b6ff92c12885eafeb25922ac Mon Sep 17 00:00:00 2001 From: games647 Date: Fri, 2 Oct 2015 21:56:46 +0200 Subject: [PATCH 239/427] Fix same nick kick if the name contains an upper case letter --- .../fr/xephi/authme/listener/AuthMePlayerListener.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 882ddcbd..6da8fb9d 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -208,13 +208,12 @@ public class AuthMePlayerListener implements Listener { public void onPreLogin(AsyncPlayerPreLoginEvent event) { final String name = event.getName().toLowerCase(); final Player player = Bukkit.getServer().getPlayer(name); - if (player == null) return; // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player - if (plugin.dataManager.isOnline(player, name) && Settings.isForceSingleSessionEnabled) { + if (Settings.isForceSingleSessionEnabled && plugin.dataManager.isOnline(player, name)) { event.setKickMessage(m.send("same_nick")[0]); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); if (LimboCache.getInstance().hasLimboPlayer(name)) @@ -228,7 +227,6 @@ public class AuthMePlayerListener implements Listener { LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); } } - }); } } @@ -283,7 +281,8 @@ public class AuthMePlayerListener implements Listener { if (isAuthAvailable && plugin.database.getType() != DataSource.DataSourceType.FILE) { PlayerAuth auth = plugin.database.getAuth(name); - if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) { + if (auth.getRealName() != null && !auth.getRealName().isEmpty() + && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equalsIgnoreCase(name)) { event.setKickMessage(m.send("same_nick")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); if (Settings.banUnsafeIp) From ac92a58b759731459afa56f1e187a543abe0fdf3 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Fri, 2 Oct 2015 23:59:34 +0200 Subject: [PATCH 240/427] Update pom.xml --- pom.xml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 537a3084..7f69ac97 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ . true - ${basedir}/src/main/resources/ + src/main/resources/ *.yml @@ -64,7 +64,7 @@ ./messages/ false - ${basedir}/src/main/resources/messages/ + src/main/resources/messages/ *.yml @@ -190,12 +190,14 @@ org.slf4j + true org.slf4j slf4j-simple 1.7.12 compile + true @@ -204,6 +206,7 @@ sqlite-jdbc 3.8.11.1 compile + true @@ -212,6 +215,7 @@ gson 2.3.1 compile + true @@ -220,6 +224,7 @@ javax.mail-api 1.5.4 compile + true com.sun.mail @@ -232,6 +237,7 @@ javax.activation + true @@ -241,6 +247,7 @@ geoip-api 1.2.15 compile + true @@ -255,6 +262,7 @@ bukkit + true @@ -282,6 +291,7 @@ craftbukkit + true @@ -300,6 +310,7 @@ craftbukkit + true @@ -331,6 +342,7 @@ com.pneumaticraft.commandhandler + true @@ -345,6 +357,7 @@ spigot-api + true @@ -419,6 +432,7 @@ org.mcstats.bukkit + true @@ -457,6 +471,7 @@ com.mojang + true @@ -551,6 +566,7 @@ org.yi.acru.bukkit.lockette + true From 683ec09ecf8b1b470aa5f33109f57047f36315ed Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sat, 3 Oct 2015 00:49:59 +0200 Subject: [PATCH 241/427] Update team.txt --- team.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/team.txt b/team.txt index bb264888..427516ce 100644 --- a/team.txt +++ b/team.txt @@ -1,9 +1,12 @@ AuthMe-Team: Active staff: -Xephi (Xephi59) - Leader, Main developer -Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor +Xephi (Xephi59) - Leader, Main developer (temporary inactive) DNx5 - Developer +games647 - Developer +Gabriele C. (sgdc3) - Project Manager, Contributor + +Staff to contact: CryLegend - Contributor, AuthMeBridge Developer (Need activation) External Contributors: From a013a6c54f747d469e5bcd13fd1a202b88c5c2ba Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sat, 3 Oct 2015 13:01:44 +0700 Subject: [PATCH 242/427] update Settings --- src/main/java/fr/xephi/authme/Utils.java | 3 ++- src/main/java/fr/xephi/authme/settings/Settings.java | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index bdd156ff..4abde79f 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -189,7 +189,8 @@ public class Utils { } public static boolean isUnrestricted(Player player) { - return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName())); + return Settings.isAllowRestrictedIp && !Settings.getUnrestrictedName.isEmpty() + && (Settings.getUnrestrictedName.contains(player.getName())); } private static boolean useGroupSystem() { diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 24a72173..b43cf29b 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -119,7 +119,6 @@ public final class Settings extends YamlConfiguration { } - @SuppressWarnings("unchecked") public static void loadVariables() { messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en").toLowerCase()); isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false); @@ -185,7 +184,7 @@ public final class Settings extends YamlConfiguration { backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); - allowCommands = (List) configFile.getList("settings.restrictions.allowCommands"); + allowCommands = configFile.getStringList("settings.restrictions.allowCommands"); if (configFile.contains("allowCommands")) { if (!allowCommands.contains("/login")) allowCommands.add("/login"); @@ -210,7 +209,7 @@ public final class Settings extends YamlConfiguration { getmailSMTP = configFile.getString("Email.mailSMTP", "smtp.gmail.com"); getMailPort = configFile.getInt("Email.mailPort", 465); getRecoveryPassLength = configFile.getInt("Email.RecoveryPasswordLength", 8); - getMySQLOtherUsernameColumn = (List) configFile.getList("ExternalBoardOptions.mySQLOtherUsernameColumns", new ArrayList()); + getMySQLOtherUsernameColumn = configFile.getStringList("ExternalBoardOptions.mySQLOtherUsernameColumns"); displayOtherAccounts = configFile.getBoolean("settings.restrictions.displayOtherAccounts", true); getMySQLColumnId = configFile.getString("DataSource.mySQLColumnId", "id"); getmailSenderName = configFile.getString("Email.mailSenderName", ""); @@ -274,7 +273,7 @@ public final class Settings extends YamlConfiguration { emailBlacklist = configFile.getStringList("Email.emailBlacklisted"); emailWhitelist = configFile.getStringList("Email.emailWhitelisted"); forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands"); - forceRegisterCommandsAsConsole = (List) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList()); + forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole"); customAttributes = configFile.getBoolean("Hooks.customAttributes"); generateImage = configFile.getBoolean("Email.generateImage", true); @@ -289,7 +288,8 @@ public final class Settings extends YamlConfiguration { set("Xenoforo.predefinedSalt", null); changes = true; } - if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") || configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) { + if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") || + configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) { set("settings.security.passwordHash", "XENFORO"); changes = true; } @@ -462,7 +462,7 @@ public final class Settings extends YamlConfiguration { changes = true; } if (contains("Hooks.chestshop")) { - if(getBoolean("Hooks.chestshop")) { + if (getBoolean("Hooks.chestshop")) { set("Hooks.legacyChestshop", true); } set("Hooks.chestshop", null); From 86ff20b6c904a4d86c54ec52b5939c952b85443a Mon Sep 17 00:00:00 2001 From: games647 Date: Wed, 30 Sep 2015 18:55:41 +0200 Subject: [PATCH 243/427] Replacing old inventory protecting with safe packet modifications using ProtocolLib. Instead of clearing the inventory of players and storing it's contents in a file, we now prevent the server from sending the inventory packet if the player is not logged in. The player will see a empty inventory, but has still his items stored on the server. Therefore we don't need to modify the player's inventory and we won't make any inventory corrupted. Fixes Xephi/AuthMeReloaded#203, Fixes Xephi/AuthMeReloaded#193, Fixes Xephi/AuthMeReloaded#191, Fixes Xephi/AuthMeReloaded#148 Remove dead code + Fix empty inventory on the unregister command Fix NPE if ProtocolLib isn't enabled or installed --- pom.xml | 8 + src/main/java/fr/xephi/authme/AuthMe.java | 1571 +++++++++-------- .../authme/cache/backup/DataFileCache.java | 21 +- .../xephi/authme/cache/backup/JsonCache.java | 92 +- .../xephi/authme/cache/limbo/LimboCache.java | 23 +- .../xephi/authme/cache/limbo/LimboPlayer.java | 33 - .../authme/commands/UnregisterCommand.java | 6 +- .../authme/events/ProtectInventoryEvent.java | 9 +- .../authme/events/RestoreInventoryEvent.java | 16 +- .../authme/events/StoreInventoryEvent.java | 12 +- .../listener/AuthMeInventoryListener.java | 101 ++ .../authme/listener/AuthMeServerListener.java | 7 + .../authme/process/join/AsyncronousJoin.java | 611 ++++--- .../login/ProcessSyncronousPlayerLogin.java | 7 +- .../process/logout/AsyncronousLogout.java | 172 +- .../authme/process/quit/AsyncronousQuit.java | 203 +-- .../quit/ProcessSyncronousPlayerQuit.java | 97 +- .../ProcessSyncronousPasswordRegister.java | 8 +- src/main/resources/plugin.yml | 4 +- 19 files changed, 1464 insertions(+), 1537 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java diff --git a/pom.xml b/pom.xml index 7f69ac97..f797a2c6 100644 --- a/pom.xml +++ b/pom.xml @@ -294,6 +294,14 @@ true + + + com.comphenix.protocol + ProtocolLib + 3.4.0 + true + + net.milkbowl.vault diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 58d7b39d..efabc5de 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -1,781 +1,790 @@ -package fr.xephi.authme; - -import com.earth2me.essentials.Essentials; -import com.onarandombox.MultiverseCore.MultiverseCore; -import fr.xephi.authme.api.API; -import fr.xephi.authme.api.NewAPI; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.backup.JsonCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.commands.*; -import fr.xephi.authme.converter.Converter; -import fr.xephi.authme.converter.ForceFlatToSqlite; -import fr.xephi.authme.datasource.*; -import fr.xephi.authme.listener.*; -import fr.xephi.authme.modules.ModuleManager; -import fr.xephi.authme.plugin.manager.BungeeCordMessage; -import fr.xephi.authme.plugin.manager.EssSpawn; -import fr.xephi.authme.process.Management; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.OtherAccounts; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.settings.Spawn; -import net.milkbowl.vault.permission.Permission; -import net.minelink.ctplus.CombatTagPlus; -import org.apache.logging.log4j.LogManager; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitTask; -import org.mcstats.Metrics; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; - -public class AuthMe extends JavaPlugin { - - private static AuthMe authme; - - private final Server server = getServer(); - private final Logger authmeLogger = Logger.getLogger("AuthMe"); - public Management management; - public NewAPI api; - public SendMailSSL mail; - private Settings settings; - private Messages m; - public DataManager dataManager; - public DataSource database; - private JsonCache playerBackup; - public OtherAccounts otherAccounts; - public Location essentialsSpawn; - public boolean legacyChestShop = false; - public boolean antibotMod = false; - public boolean delayedAntiBot = true; - - // Hooks TODO: move into modules - public Permission permission; - public Essentials ess; - public MultiverseCore multiverse; - public CombatTagPlus combatTagPlus; - - // Manager - private ModuleManager moduleManager; - - // TODO: Create Manager for fields below - public ConcurrentHashMap sessions = new ConcurrentHashMap<>(); - public ConcurrentHashMap captcha = new ConcurrentHashMap<>(); - public ConcurrentHashMap cap = new ConcurrentHashMap<>(); - public ConcurrentHashMap realIp = new ConcurrentHashMap<>(); - - public static AuthMe getInstance() { - return authme; - } - - public Settings getSettings() { - return settings; - } - - public void setMessages(Messages m) { - this.m = m; - } - - public Messages getMessages() { - return m; - } - - - @Override - public void onEnable() { - // Set the Instance - authme = this; - - // TODO: split the plugin in more modules - moduleManager = new ModuleManager(this); - @SuppressWarnings("unused") - int loaded = moduleManager.loadModules(); - - // TODO: remove vault as hard dependency - PluginManager pm = server.getPluginManager(); - - // Setup the Logger - authmeLogger.setParent(this.getLogger()); - - // Load settings and custom configurations - // TODO: new configuration style (more files) - try { - settings = new Settings(this); - Settings.reload(); - } catch (Exception e) { - ConsoleLogger.writeStackTrace(e); - ConsoleLogger.showError("Can't load the configuration file... Something went wrong, to avoid security issues the server will shutdown!"); - server.shutdown(); - return; - } - - // Setup otherAccounts file - otherAccounts = OtherAccounts.getInstance(); - - // Setup messages - m = Messages.getInstance(); - - // Start the metrics service - // TODO: add a setting to disable metrics - try { - Metrics metrics = new Metrics(this); - metrics.start(); - ConsoleLogger.info("Metrics started successfully!"); - } catch (Exception e) { - // Failed to submit the metrics data - ConsoleLogger.writeStackTrace(e); - ConsoleLogger.showError("Can't start Metrics! The plugin will work anyway..."); - } - - // Set Console Filter - if (Settings.removePassword) { - ConsoleFilter filter = new ConsoleFilter(); - this.getLogger().setFilter(filter); - Bukkit.getLogger().setFilter(filter); - Logger.getLogger("Minecraft").setFilter(filter); - authmeLogger.setFilter(filter); - // Set Log4J Filter - try { - Class.forName("org.apache.logging.log4j.core.Filter"); - setLog4JFilter(); - } catch (ClassNotFoundException | NoClassDefFoundError e) { - ConsoleLogger.info("You're using Minecraft 1.6.x or older, Log4J support will be disabled"); - } - } - - // AntiBot delay - if (Settings.enableAntiBot) { - Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { - - @Override - public void run() { - delayedAntiBot = false; - } - }, 2400); - } - - // Download GeoIp.dat file - Utils.checkGeoIP(); - - // Load MailApi if needed - if (!Settings.getmailAccount.isEmpty() && !Settings.getmailPassword.isEmpty()) { - mail = new SendMailSSL(this); - } - - // Find Permissions - checkVault(); - - // Check Combat Tag Plus Version - checkCombatTagPlus(); - - // Check Multiverse - checkMultiverse(); - - // Check PerWorldInventories Version - checkPerWorldInventories(); - - // Check ChestShop - checkChestShop(); - - // Check Essentials - checkEssentials(); - - // Do backup on start if enabled - if (Settings.isBackupActivated && Settings.isBackupOnStart) { - // Do backup and check return value! - if (new PerformBackup(this).doBackup()) { - ConsoleLogger.info("Backup performed correctly"); - } else { - ConsoleLogger.showError("Error while performing the backup!"); - } - } - - // Connect to the database and setup tables - try { - setupDatabase(); - } catch (Exception e) { - ConsoleLogger.writeStackTrace(e); - ConsoleLogger.showError(e.getMessage()); - ConsoleLogger.showError("Fatal error occurred during database connection! Authme initialization ABORTED!"); - stopOrUnload(); - return; - } - - // Setup the inventory backup - playerBackup = new JsonCache(this); - - // Set the DataManager - dataManager = new DataManager(this); - - // Setup the new API - api = new NewAPI(this); - // Setup the old deprecated API - new API(this); - - // Setup Management - management = new Management(this); - - // Bungeecord hook - if (Settings.bungee) { - Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); - Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this)); - } - - // Legacy chestshop hook - if (legacyChestShop) { - pm.registerEvents(new AuthMeChestShopListener(this), this); - ConsoleLogger.info("Hooked successfully with ChestShop!"); - } - - // Reload support hook - if (Settings.reloadSupport) { - if (database != null) { - int playersOnline = Utils.getOnlinePlayers().size(); - if (playersOnline < 1) { - database.purgeLogged(); - } else { - for (PlayerAuth auth : database.getLoggedPlayers()) { - if (auth == null) - continue; - auth.setLastLogin(new Date().getTime()); - database.updateSession(auth); - PlayerCache.getInstance().addPlayer(auth); - } - } - } - } - - // Register events - pm.registerEvents(new AuthMePlayerListener(this), this); - pm.registerEvents(new AuthMeBlockListener(this), this); - pm.registerEvents(new AuthMeEntityListener(this), this); - pm.registerEvents(new AuthMeServerListener(this), this); - - // Register commands - getCommand("authme").setExecutor(new AdminCommand(this)); - getCommand("register").setExecutor(new RegisterCommand(this)); - getCommand("login").setExecutor(new LoginCommand(this)); - getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); - getCommand("logout").setExecutor(new LogoutCommand(this)); - getCommand("unregister").setExecutor(new UnregisterCommand(this)); - getCommand("email").setExecutor(new EmailCommand(this)); - getCommand("captcha").setExecutor(new CaptchaCommand(this)); - getCommand("converter").setExecutor(new ConverterCommand(this)); - - // Purge on start if enabled - autoPurge(); - - // Start Email recall task if needed - recallEmail(); - - // Configuration Security Warnings - if (!Settings.isForceSingleSessionEnabled) { - ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); - } - if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { - ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); - } - - // Sponsor messages - ConsoleLogger.info("AuthMe hooks perfectly with the VERYGAMES server hosting!"); - ConsoleLogger.info("Development builds are available on our jenkins, thanks to f14stelt."); - ConsoleLogger.info("Do you want a good gameserver? Look at our sponsor GameHosting.it leader in Italy as Game Server Provider!"); - - // Successful message - ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " correctly enabled!"); - } - - @Override - public void onDisable() { - // Save player data - Collection players = Utils.getOnlinePlayers(); - if (players != null) { - for (Player player : players) { - this.savePlayer(player); - } - } - - // Close the database - if (database != null) { - database.close(); - } - - // Do backup on stop if enabled - if (Settings.isBackupActivated && Settings.isBackupOnStop) { - boolean Backup = new PerformBackup(this).doBackup(); - if (Backup) - ConsoleLogger.info("Backup performed correctly."); - else ConsoleLogger.showError("Error while performing the backup!"); - } - - // Unload modules - moduleManager.unloadModules(); - - // Disabled correctly - ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " disabled!"); - } - - // Stop/unload the server/plugin as defined in the configuration - public void stopOrUnload() { - if (Settings.isStopEnabled) { - ConsoleLogger.showError("THE SERVER IS GOING TO SHUTDOWN AS DEFINED IN THE CONFIGURATION!"); - server.shutdown(); - } else { - server.getPluginManager().disablePlugin(AuthMe.getInstance()); - } - } - - // Show the exception message and stop/unload the server/plugin as defined in the configuration - public void stopOrUnload(Exception e) { - ConsoleLogger.showError(e.getMessage()); - stopOrUnload(); - } - - // Initialize and setup the database - public void setupDatabase() throws Exception { - // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI - boolean isSQLite = false; - switch (Settings.getDataSource) { - case FILE: - database = new FlatFile(); - break; - case MYSQL: - database = new MySQL(); - break; - case SQLITE: - database = new SQLite(); - isSQLite = true; - break; - case SQLITEHIKARI: - database = new SQLite_HIKARI(); - isSQLite = true; - break; - } - - if (isSQLite) { - server.getScheduler().runTaskAsynchronously(this, new Runnable() { - @Override - public void run() { - int accounts = database.getAccountsRegistered(); - if (accounts >= 4000) - ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); - } - }); - } - - if (Settings.isCachingEnabled) { - database = new CacheDataSource(this, database); - } else { - database = new DatabaseCalls(database); - } - - if (Settings.getDataSource == DataSource.DataSourceType.FILE) { - Converter converter = new ForceFlatToSqlite(database, this); - server.getScheduler().runTaskAsynchronously(this, converter); - ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated, next time server starts up, it will be changed to SQLite... Conversion will be started Asynchronously, it will not drop down your performance !"); - ConsoleLogger.showError("If you want to keep FlatFile, set file again into config at backend, but this message and this change will appear again at the next restart"); - } - } - - // Set the console filter to remove the passwords - private void setLog4JFilter() { - Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { - - @Override - public void run() { - org.apache.logging.log4j.core.Logger coreLogger = (org.apache.logging.log4j.core.Logger) LogManager.getRootLogger(); - coreLogger.addFilter(new Log4JFilter()); - } - }); - } - - // Check the presence of the Vault plugin and a permissions provider - public void checkVault() { - if (server.getPluginManager().isPluginEnabled("Vault")) { - RegisteredServiceProvider permissionProvider = server.getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); - if (permissionProvider != null) { - permission = permissionProvider.getProvider(); - ConsoleLogger.info("Vault detected, hooking with the " + permission.getName() + " permissions system..."); - } else { - ConsoleLogger.showError("Vault detected, but I can't find any permissions plugin to hook with!"); - } - } else { - permission = null; - } - } - - // Check the version of the ChestShop plugin - public void checkChestShop() { - if (Settings.legacyChestShop && server.getPluginManager().isPluginEnabled("ChestShop")) { - String rawver = com.Acrobot.ChestShop.ChestShop.getVersion(); - double version; - try { - version = Double.valueOf(rawver.split(" ")[0]); - } catch (NumberFormatException nfe) { - try { - version = Double.valueOf(rawver.split("t")[0]); - } catch (NumberFormatException nfee) { - legacyChestShop = false; - return; - } - } - if (version >= 3.813) { - return; - } - if (version < 3.50) { - ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); - return; - } - legacyChestShop = true; - } else { - legacyChestShop = false; - } - } - - // Check PerWorldInventories version - public void checkPerWorldInventories() { - if (server.getPluginManager().isPluginEnabled("PerWorldInventories")) { - double version = 0; - String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); - try { - version = Double.valueOf(ver.split(" ")[0]); - } catch (NumberFormatException nfe) { - try { - version = Double.valueOf(ver.split("t")[0]); - } catch (NumberFormatException ignore) { - } - } - if (version < 1.57) { - ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); - } - } - } - - // Get the Multiverse plugin - public void checkMultiverse() { - if (Settings.multiverse && server.getPluginManager().isPluginEnabled("Multiverse-Core")) { - try { - multiverse = (MultiverseCore) server.getPluginManager().getPlugin("Multiverse-Core"); - ConsoleLogger.info("Hooked correctly with Multiverse-Core"); - } catch (Exception | NoClassDefFoundError ignored) { - multiverse = null; - } - } else { - multiverse = null; - } - } - - // Get the Essentials plugin - public void checkEssentials() { - if (server.getPluginManager().isPluginEnabled("Essentials")) { - try { - ess = (Essentials) server.getPluginManager().getPlugin("Essentials"); - ConsoleLogger.info("Hooked correctly with Essentials"); - } catch (Exception | NoClassDefFoundError ingnored) { - ess = null; - } - } else { - ess = null; - } - if (server.getPluginManager().isPluginEnabled("EssentialsSpawn")) { - try { - essentialsSpawn = new EssSpawn().getLocation(); - ConsoleLogger.info("Hooked correctly with EssentialsSpawn"); - } catch (Exception e) { - essentialsSpawn = null; - ConsoleLogger.showError("Can't read the /plugins/Essentials/spawn.yml file!"); - } - } else { - essentialsSpawn = null; - } - } - - // Check the presence of CombatTag - public void checkCombatTagPlus() { - if (server.getPluginManager().isPluginEnabled("CombatTagPlus")) { - try { - combatTagPlus = (CombatTagPlus) server.getPluginManager().getPlugin("CombatTagPlus"); - ConsoleLogger.info("Hooked correctly with CombatTagPlus"); - } catch (Exception | NoClassDefFoundError ingnored) { - combatTagPlus = null; - } - } else { - combatTagPlus = null; - } - } - - // Check if a player/command sender have a permission - public boolean authmePermissible(Player player, String perm) { - if (player.hasPermission(perm)) { - return true; - } else if (permission != null) { - return permission.playerHas(player, perm); - } - return false; - } - - public boolean authmePermissible(CommandSender sender, String perm) { - if (sender.hasPermission(perm)) { - return true; - } else if (permission != null) { - return permission.has(sender, perm); - } - return false; - } - - // Save Player Data - public void savePlayer(Player player) { - if ((Utils.isNPC(player)) || (Utils.isUnrestricted(player))) { - return; - } - String name = player.getName().toLowerCase(); - if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead() && Settings.isSaveQuitLocationEnabled) { - final PlayerAuth auth = new PlayerAuth(player.getName().toLowerCase(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), player.getWorld().getName(), player.getName()); - database.updateQuitLoc(auth); - } - if (LimboCache.getInstance().hasLimboPlayer(name)) { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); - if (Settings.protectInventoryBeforeLogInEnabled) { - player.getInventory().setArmorContents(limbo.getArmour()); - player.getInventory().setContents(limbo.getInventory()); - } - if (!Settings.noTeleport) { - player.teleport(limbo.getLoc()); - } - Utils.addNormal(player, limbo.getGroup()); - player.setOp(limbo.getOperator()); - limbo.getTimeoutTaskId().cancel(); - LimboCache.getInstance().deleteLimboPlayer(name); - if (this.playerBackup.doesCacheExist(player)) { - this.playerBackup.removeCache(player); - } - } - PlayerCache.getInstance().removePlayer(name); - database.setUnlogged(name); - player.saveData(); - } - - // Select the player to kick when a vip player join the server when full - public Player generateKickPlayer(Collection collection) { - Player player = null; - for (Player p : collection) { - if (!(authmePermissible(p, "authme.vip"))) { - player = p; - break; - } - } - return player; - } - - // Purge inactive players from the database, as defined in the configuration - private void autoPurge() { - if (!Settings.usePurge) { - return; - } - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DATE, -(Settings.purgeDelay)); - long until = calendar.getTimeInMillis(); - List cleared = database.autoPurgeDatabase(until); - if (cleared == null) { - return; - } - if (cleared.isEmpty()) { - return; - } - ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); - if (Settings.purgeEssentialsFile && this.ess != null) - dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions - if (Settings.purgePlayerDat) - dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC - if (Settings.purgeLimitedCreative) - dataManager.purgeLimitedCreative(cleared); - if (Settings.purgeAntiXray) - dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) - if (Settings.purgePermissions) - dataManager.purgePermissions(cleared, permission); - } - - // Return the spawn location of a player - public Location getSpawnLocation(Player player) { - World world = player.getWorld(); - String[] spawnPriority = Settings.spawnPriority.split(","); - Location spawnLoc = world.getSpawnLocation(); - for (int i = spawnPriority.length - 1; i >= 0; i--) { - String s = spawnPriority[i]; - if (s.equalsIgnoreCase("default") && getDefaultSpawn(world) != null) - spawnLoc = getDefaultSpawn(world); - if (s.equalsIgnoreCase("multiverse") && getMultiverseSpawn(world) != null) - spawnLoc = getMultiverseSpawn(world); - if (s.equalsIgnoreCase("essentials") && getEssentialsSpawn() != null) - spawnLoc = getEssentialsSpawn(); - if (s.equalsIgnoreCase("authme") && getAuthMeSpawn(player) != null) - spawnLoc = getAuthMeSpawn(player); - } - if (spawnLoc == null) { - spawnLoc = world.getSpawnLocation(); - } - return spawnLoc; - } - - // Return the default spawnpoint of a world - private Location getDefaultSpawn(World world) { - return world.getSpawnLocation(); - } - - // Return the multiverse spawnpoint of a world - private Location getMultiverseSpawn(World world) { - if (multiverse != null && Settings.multiverse) { - try { - return multiverse.getMVWorldManager().getMVWorld(world).getSpawnLocation(); - } catch (Exception e) { - e.printStackTrace(); - } - } - return null; - } - - // Return the essentials spawnpoint - private Location getEssentialsSpawn() { - if (essentialsSpawn != null) { - return essentialsSpawn; - } - return null; - } - - // Return the authme soawnpoint - private Location getAuthMeSpawn(Player player) { - if ((!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) && (Spawn.getInstance().getFirstSpawn() != null)) { - return Spawn.getInstance().getFirstSpawn(); - } - if (Spawn.getInstance().getSpawn() != null) { - return Spawn.getInstance().getSpawn(); - } - return player.getWorld().getSpawnLocation(); - } - - public void switchAntiBotMod(boolean mode) { - this.antibotMod = mode; - Settings.switchAntiBotMod(mode); - } - - private void recallEmail() { - if (!Settings.recallEmail) - return; - Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { - - @Override - public void run() { - for (Player player : Utils.getOnlinePlayers()) { - if (player.isOnline()) { - String name = player.getName().toLowerCase(); - if (database.isAuthAvailable(name)) - if (PlayerCache.getInstance().isAuthenticated(name)) { - String email = database.getAuth(name).getEmail(); - if (email == null || email.isEmpty() || email.equalsIgnoreCase("your@email.com")) - m.send(player, "add_email"); - } - } - } - } - }, 1, 1200 * Settings.delayRecall); - } - - public String replaceAllInfos(String message, Player player) { - int playersOnline = Utils.getOnlinePlayers().size(); - message = message.replace("&", "\u00a7"); - message = message.replace("{PLAYER}", player.getName()); - message = message.replace("{ONLINE}", "" + playersOnline); - message = message.replace("{MAXPLAYERS}", "" + server.getMaxPlayers()); - message = message.replace("{IP}", getIP(player)); - message = message.replace("{LOGINS}", "" + PlayerCache.getInstance().getLogged()); - message = message.replace("{WORLD}", player.getWorld().getName()); - message = message.replace("{SERVER}", server.getServerName()); - message = message.replace("{VERSION}", server.getBukkitVersion()); - message = message.replace("{COUNTRY}", Utils.getCountryName(getIP(player))); - return message; - } - - public String getIP(Player player) { - String name = player.getName().toLowerCase(); - String ip = player.getAddress().getAddress().getHostAddress(); - if (Settings.bungee) { - if (realIp.containsKey(name)) - ip = realIp.get(name); - } - if (Settings.checkVeryGames) - if (getVeryGamesIP(player) != null) - ip = getVeryGamesIP(player); - return ip; - } - - public boolean isLoggedIp(String name, String ip) { - int count = 0; - for (Player player : Utils.getOnlinePlayers()) { - if (ip.equalsIgnoreCase(getIP(player)) && database.isLogged(player.getName().toLowerCase()) && !player.getName().equalsIgnoreCase(name)) - count++; - } - return count >= Settings.getMaxLoginPerIp; - } - - public boolean hasJoinedIp(String name, String ip) { - int count = 0; - for (Player player : Utils.getOnlinePlayers()) { - if (ip.equalsIgnoreCase(getIP(player)) && !player.getName().equalsIgnoreCase(name)) - count++; - } - return count >= Settings.getMaxJoinPerIp; - } - - /** - * Get Player real IP through VeryGames method - * - * @param player player - */ - @Deprecated - public String getVeryGamesIP(Player player) { - String realIP = player.getAddress().getAddress().getHostAddress(); - String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; - sUrl = sUrl.replace("%IP%", player.getAddress().getAddress().getHostAddress()).replace("%PORT%", "" + player.getAddress().getPort()); - try { - URL url = new URL(sUrl); - URLConnection urlc = url.openConnection(); - BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream())); - String inputLine = in.readLine(); - if (inputLine != null && !inputLine.isEmpty() && !inputLine.equalsIgnoreCase("error") && !inputLine.contains("error")) { - realIP = inputLine; - } - } catch (Exception ignored) { - } - return realIP; - } - - @Deprecated - public String getCountryCode(String ip) { - return Utils.getCountryCode(ip); - } - - @Deprecated - public String getCountryName(String ip) { - return Utils.getCountryName(ip); - } - -} +package fr.xephi.authme; + +import com.comphenix.protocol.ProtocolLibrary; +import com.earth2me.essentials.Essentials; +import com.onarandombox.MultiverseCore.MultiverseCore; +import fr.xephi.authme.api.API; +import fr.xephi.authme.api.NewAPI; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.cache.backup.JsonCache; +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; +import fr.xephi.authme.commands.*; +import fr.xephi.authme.converter.Converter; +import fr.xephi.authme.converter.ForceFlatToSqlite; +import fr.xephi.authme.datasource.*; +import fr.xephi.authme.listener.*; +import fr.xephi.authme.modules.ModuleManager; +import fr.xephi.authme.plugin.manager.BungeeCordMessage; +import fr.xephi.authme.plugin.manager.EssSpawn; +import fr.xephi.authme.process.Management; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.OtherAccounts; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.settings.Spawn; +import net.milkbowl.vault.permission.Permission; +import net.minelink.ctplus.CombatTagPlus; +import org.apache.logging.log4j.LogManager; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitTask; +import org.mcstats.Metrics; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; + +public class AuthMe extends JavaPlugin { + + private static AuthMe authme; + + private final Server server = getServer(); + private final Logger authmeLogger = Logger.getLogger("AuthMe"); + public Management management; + public NewAPI api; + public SendMailSSL mail; + private Settings settings; + private Messages m; + public DataManager dataManager; + public DataSource database; + private JsonCache playerBackup; + public OtherAccounts otherAccounts; + public Location essentialsSpawn; + public boolean legacyChestShop = false; + public boolean antibotMod = false; + public boolean delayedAntiBot = true; + + // Hooks TODO: move into modules + public Permission permission; + public Essentials ess; + public MultiverseCore multiverse; + public CombatTagPlus combatTagPlus; + public AuthMeInventoryListener inventoryProtector; + + // Manager + private ModuleManager moduleManager; + + // TODO: Create Manager for fields below + public ConcurrentHashMap sessions = new ConcurrentHashMap<>(); + public ConcurrentHashMap captcha = new ConcurrentHashMap<>(); + public ConcurrentHashMap cap = new ConcurrentHashMap<>(); + public ConcurrentHashMap realIp = new ConcurrentHashMap<>(); + + public static AuthMe getInstance() { + return authme; + } + + public Settings getSettings() { + return settings; + } + + public void setMessages(Messages m) { + this.m = m; + } + + public Messages getMessages() { + return m; + } + + + @Override + public void onEnable() { + // Set the Instance + authme = this; + + // TODO: split the plugin in more modules + moduleManager = new ModuleManager(this); + @SuppressWarnings("unused") + int loaded = moduleManager.loadModules(); + + // TODO: remove vault as hard dependency + PluginManager pm = server.getPluginManager(); + + // Setup the Logger + authmeLogger.setParent(this.getLogger()); + + // Load settings and custom configurations + // TODO: new configuration style (more files) + try { + settings = new Settings(this); + Settings.reload(); + } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); + ConsoleLogger.showError("Can't load the configuration file... Something went wrong, to avoid security issues the server will shutdown!"); + server.shutdown(); + return; + } + + // Setup otherAccounts file + otherAccounts = OtherAccounts.getInstance(); + + // Setup messages + m = Messages.getInstance(); + + // Start the metrics service + // TODO: add a setting to disable metrics + try { + Metrics metrics = new Metrics(this); + metrics.start(); + ConsoleLogger.info("Metrics started successfully!"); + } catch (Exception e) { + // Failed to submit the metrics data + ConsoleLogger.writeStackTrace(e); + ConsoleLogger.showError("Can't start Metrics! The plugin will work anyway..."); + } + + // Set Console Filter + if (Settings.removePassword) { + ConsoleFilter filter = new ConsoleFilter(); + this.getLogger().setFilter(filter); + Bukkit.getLogger().setFilter(filter); + Logger.getLogger("Minecraft").setFilter(filter); + authmeLogger.setFilter(filter); + // Set Log4J Filter + try { + Class.forName("org.apache.logging.log4j.core.Filter"); + setLog4JFilter(); + } catch (ClassNotFoundException | NoClassDefFoundError e) { + ConsoleLogger.info("You're using Minecraft 1.6.x or older, Log4J support will be disabled"); + } + } + + // AntiBot delay + if (Settings.enableAntiBot) { + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + + @Override + public void run() { + delayedAntiBot = false; + } + }, 2400); + } + + // Download GeoIp.dat file + Utils.checkGeoIP(); + + // Load MailApi if needed + if (!Settings.getmailAccount.isEmpty() && !Settings.getmailPassword.isEmpty()) { + mail = new SendMailSSL(this); + } + + // Find Permissions + checkVault(); + + // Check Combat Tag Plus Version + checkCombatTagPlus(); + + // Check Multiverse + checkMultiverse(); + + // Check PerWorldInventories Version + checkPerWorldInventories(); + + // Check ChestShop + checkChestShop(); + + // Check Essentials + checkEssentials(); + + //Check if the protocollib is available. If so we could listen for inventory protection + checkProtocolLib(); + + // Do backup on start if enabled + if (Settings.isBackupActivated && Settings.isBackupOnStart) { + // Do backup and check return value! + if (new PerformBackup(this).doBackup()) { + ConsoleLogger.info("Backup performed correctly"); + } else { + ConsoleLogger.showError("Error while performing the backup!"); + } + } + + // Connect to the database and setup tables + try { + setupDatabase(); + } catch (Exception e) { + ConsoleLogger.writeStackTrace(e); + ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.showError("Fatal error occurred during database connection! Authme initialization ABORTED!"); + stopOrUnload(); + return; + } + + // Setup the inventory backup + playerBackup = new JsonCache(); + + // Set the DataManager + dataManager = new DataManager(this); + + // Setup the new API + api = new NewAPI(this); + // Setup the old deprecated API + new API(this); + + // Setup Management + management = new Management(this); + + // Bungeecord hook + if (Settings.bungee) { + Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); + Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this)); + } + + // Legacy chestshop hook + if (legacyChestShop) { + pm.registerEvents(new AuthMeChestShopListener(this), this); + ConsoleLogger.info("Hooked successfully with ChestShop!"); + } + + // Reload support hook + if (Settings.reloadSupport) { + if (database != null) { + int playersOnline = Utils.getOnlinePlayers().size(); + if (playersOnline < 1) { + database.purgeLogged(); + } else { + for (PlayerAuth auth : database.getLoggedPlayers()) { + if (auth == null) + continue; + auth.setLastLogin(new Date().getTime()); + database.updateSession(auth); + PlayerCache.getInstance().addPlayer(auth); + } + } + } + } + + // Register events + pm.registerEvents(new AuthMePlayerListener(this), this); + pm.registerEvents(new AuthMeBlockListener(this), this); + pm.registerEvents(new AuthMeEntityListener(this), this); + pm.registerEvents(new AuthMeServerListener(this), this); + + // Register commands + getCommand("authme").setExecutor(new AdminCommand(this)); + getCommand("register").setExecutor(new RegisterCommand(this)); + getCommand("login").setExecutor(new LoginCommand(this)); + getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); + getCommand("logout").setExecutor(new LogoutCommand(this)); + getCommand("unregister").setExecutor(new UnregisterCommand(this)); + getCommand("email").setExecutor(new EmailCommand(this)); + getCommand("captcha").setExecutor(new CaptchaCommand(this)); + getCommand("converter").setExecutor(new ConverterCommand(this)); + + // Purge on start if enabled + autoPurge(); + + // Start Email recall task if needed + recallEmail(); + + // Configuration Security Warnings + if (!Settings.isForceSingleSessionEnabled) { + ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); + } + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { + ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + } + + // Sponsor messages + ConsoleLogger.info("AuthMe hooks perfectly with the VERYGAMES server hosting!"); + ConsoleLogger.info("Development builds are available on our jenkins, thanks to f14stelt."); + ConsoleLogger.info("Do you want a good gameserver? Look at our sponsor GameHosting.it leader in Italy as Game Server Provider!"); + + // Successful message + ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " correctly enabled!"); + } + + @Override + public void onDisable() { + // Save player data + Collection players = Utils.getOnlinePlayers(); + if (players != null) { + for (Player player : players) { + this.savePlayer(player); + } + } + + // Close the database + if (database != null) { + database.close(); + } + + // Do backup on stop if enabled + if (Settings.isBackupActivated && Settings.isBackupOnStop) { + boolean Backup = new PerformBackup(this).doBackup(); + if (Backup) + ConsoleLogger.info("Backup performed correctly."); + else ConsoleLogger.showError("Error while performing the backup!"); + } + + // Unload modules + moduleManager.unloadModules(); + + // Disabled correctly + ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " disabled!"); + } + + // Stop/unload the server/plugin as defined in the configuration + public void stopOrUnload() { + if (Settings.isStopEnabled) { + ConsoleLogger.showError("THE SERVER IS GOING TO SHUTDOWN AS DEFINED IN THE CONFIGURATION!"); + server.shutdown(); + } else { + server.getPluginManager().disablePlugin(AuthMe.getInstance()); + } + } + + // Show the exception message and stop/unload the server/plugin as defined in the configuration + public void stopOrUnload(Exception e) { + ConsoleLogger.showError(e.getMessage()); + stopOrUnload(); + } + + // Initialize and setup the database + public void setupDatabase() throws Exception { + // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI + boolean isSQLite = false; + switch (Settings.getDataSource) { + case FILE: + database = new FlatFile(); + break; + case MYSQL: + database = new MySQL(); + break; + case SQLITE: + database = new SQLite(); + isSQLite = true; + break; + case SQLITEHIKARI: + database = new SQLite_HIKARI(); + isSQLite = true; + break; + } + + if (isSQLite) { + server.getScheduler().runTaskAsynchronously(this, new Runnable() { + @Override + public void run() { + int accounts = database.getAccountsRegistered(); + if (accounts >= 4000) + ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE UPGRADE TO MYSQL!!"); + } + }); + } + + if (Settings.isCachingEnabled) { + database = new CacheDataSource(this, database); + } else { + database = new DatabaseCalls(database); + } + + if (Settings.getDataSource == DataSource.DataSourceType.FILE) { + Converter converter = new ForceFlatToSqlite(database, this); + server.getScheduler().runTaskAsynchronously(this, converter); + ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated, next time server starts up, it will be changed to SQLite... Conversion will be started Asynchronously, it will not drop down your performance !"); + ConsoleLogger.showError("If you want to keep FlatFile, set file again into config at backend, but this message and this change will appear again at the next restart"); + } + } + + // Set the console filter to remove the passwords + private void setLog4JFilter() { + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + + @Override + public void run() { + org.apache.logging.log4j.core.Logger coreLogger = (org.apache.logging.log4j.core.Logger) LogManager.getRootLogger(); + coreLogger.addFilter(new Log4JFilter()); + } + }); + } + + // Check the presence of the Vault plugin and a permissions provider + public void checkVault() { + if (server.getPluginManager().isPluginEnabled("Vault")) { + RegisteredServiceProvider permissionProvider = server.getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); + if (permissionProvider != null) { + permission = permissionProvider.getProvider(); + ConsoleLogger.info("Vault detected, hooking with the " + permission.getName() + " permissions system..."); + } else { + ConsoleLogger.showError("Vault detected, but I can't find any permissions plugin to hook with!"); + } + } else { + permission = null; + } + } + + // Check the version of the ChestShop plugin + public void checkChestShop() { + if (Settings.legacyChestShop && server.getPluginManager().isPluginEnabled("ChestShop")) { + String rawver = com.Acrobot.ChestShop.ChestShop.getVersion(); + double version; + try { + version = Double.valueOf(rawver.split(" ")[0]); + } catch (NumberFormatException nfe) { + try { + version = Double.valueOf(rawver.split("t")[0]); + } catch (NumberFormatException nfee) { + legacyChestShop = false; + return; + } + } + if (version >= 3.813) { + return; + } + if (version < 3.50) { + ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); + return; + } + legacyChestShop = true; + } else { + legacyChestShop = false; + } + } + + // Check PerWorldInventories version + public void checkPerWorldInventories() { + if (server.getPluginManager().isPluginEnabled("PerWorldInventories")) { + double version = 0; + String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); + try { + version = Double.valueOf(ver.split(" ")[0]); + } catch (NumberFormatException nfe) { + try { + version = Double.valueOf(ver.split("t")[0]); + } catch (NumberFormatException ignore) { + } + } + if (version < 1.57) { + ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + } + } + } + + // Get the Multiverse plugin + public void checkMultiverse() { + if (Settings.multiverse && server.getPluginManager().isPluginEnabled("Multiverse-Core")) { + try { + multiverse = (MultiverseCore) server.getPluginManager().getPlugin("Multiverse-Core"); + ConsoleLogger.info("Hooked correctly with Multiverse-Core"); + } catch (Exception | NoClassDefFoundError ignored) { + multiverse = null; + } + } else { + multiverse = null; + } + } + + // Get the Essentials plugin + public void checkEssentials() { + if (server.getPluginManager().isPluginEnabled("Essentials")) { + try { + ess = (Essentials) server.getPluginManager().getPlugin("Essentials"); + ConsoleLogger.info("Hooked correctly with Essentials"); + } catch (Exception | NoClassDefFoundError ingnored) { + ess = null; + } + } else { + ess = null; + } + if (server.getPluginManager().isPluginEnabled("EssentialsSpawn")) { + try { + essentialsSpawn = new EssSpawn().getLocation(); + ConsoleLogger.info("Hooked correctly with EssentialsSpawn"); + } catch (Exception e) { + essentialsSpawn = null; + ConsoleLogger.showError("Can't read the /plugins/Essentials/spawn.yml file!"); + } + } else { + essentialsSpawn = null; + } + } + + // Check the presence of CombatTag + public void checkCombatTagPlus() { + if (server.getPluginManager().isPluginEnabled("CombatTagPlus")) { + try { + combatTagPlus = (CombatTagPlus) server.getPluginManager().getPlugin("CombatTagPlus"); + ConsoleLogger.info("Hooked correctly with CombatTagPlus"); + } catch (Exception | NoClassDefFoundError ingnored) { + combatTagPlus = null; + } + } else { + combatTagPlus = null; + } + } + + public void checkProtocolLib() { + if (server.getPluginManager().isPluginEnabled("ProtocolLib")) { + inventoryProtector = new AuthMeInventoryListener(this); + ProtocolLibrary.getProtocolManager().addPacketListener(inventoryProtector); + } + } + + // Check if a player/command sender have a permission + public boolean authmePermissible(Player player, String perm) { + if (player.hasPermission(perm)) { + return true; + } else if (permission != null) { + return permission.playerHas(player, perm); + } + return false; + } + + public boolean authmePermissible(CommandSender sender, String perm) { + if (sender.hasPermission(perm)) { + return true; + } else if (permission != null) { + return permission.has(sender, perm); + } + return false; + } + + // Save Player Data + public void savePlayer(Player player) { + if ((Utils.isNPC(player)) || (Utils.isUnrestricted(player))) { + return; + } + String name = player.getName().toLowerCase(); + if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead() && Settings.isSaveQuitLocationEnabled) { + final PlayerAuth auth = new PlayerAuth(player.getName().toLowerCase(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), player.getWorld().getName(), player.getName()); + database.updateQuitLoc(auth); + } + if (LimboCache.getInstance().hasLimboPlayer(name)) { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); + if (!Settings.noTeleport) { + player.teleport(limbo.getLoc()); + } + + Utils.addNormal(player, limbo.getGroup()); + player.setOp(limbo.getOperator()); + limbo.getTimeoutTaskId().cancel(); + LimboCache.getInstance().deleteLimboPlayer(name); + if (this.playerBackup.doesCacheExist(player)) { + this.playerBackup.removeCache(player); + } + } + PlayerCache.getInstance().removePlayer(name); + database.setUnlogged(name); + player.saveData(); + } + + // Select the player to kick when a vip player join the server when full + public Player generateKickPlayer(Collection collection) { + Player player = null; + for (Player p : collection) { + if (!(authmePermissible(p, "authme.vip"))) { + player = p; + break; + } + } + return player; + } + + // Purge inactive players from the database, as defined in the configuration + private void autoPurge() { + if (!Settings.usePurge) { + return; + } + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -(Settings.purgeDelay)); + long until = calendar.getTimeInMillis(); + List cleared = database.autoPurgeDatabase(until); + if (cleared == null) { + return; + } + if (cleared.isEmpty()) { + return; + } + ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); + if (Settings.purgeEssentialsFile && this.ess != null) + dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions + if (Settings.purgePlayerDat) + dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC + if (Settings.purgeLimitedCreative) + dataManager.purgeLimitedCreative(cleared); + if (Settings.purgeAntiXray) + dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) + if (Settings.purgePermissions) + dataManager.purgePermissions(cleared, permission); + } + + // Return the spawn location of a player + public Location getSpawnLocation(Player player) { + World world = player.getWorld(); + String[] spawnPriority = Settings.spawnPriority.split(","); + Location spawnLoc = world.getSpawnLocation(); + for (int i = spawnPriority.length - 1; i >= 0; i--) { + String s = spawnPriority[i]; + if (s.equalsIgnoreCase("default") && getDefaultSpawn(world) != null) + spawnLoc = getDefaultSpawn(world); + if (s.equalsIgnoreCase("multiverse") && getMultiverseSpawn(world) != null) + spawnLoc = getMultiverseSpawn(world); + if (s.equalsIgnoreCase("essentials") && getEssentialsSpawn() != null) + spawnLoc = getEssentialsSpawn(); + if (s.equalsIgnoreCase("authme") && getAuthMeSpawn(player) != null) + spawnLoc = getAuthMeSpawn(player); + } + if (spawnLoc == null) { + spawnLoc = world.getSpawnLocation(); + } + return spawnLoc; + } + + // Return the default spawnpoint of a world + private Location getDefaultSpawn(World world) { + return world.getSpawnLocation(); + } + + // Return the multiverse spawnpoint of a world + private Location getMultiverseSpawn(World world) { + if (multiverse != null && Settings.multiverse) { + try { + return multiverse.getMVWorldManager().getMVWorld(world).getSpawnLocation(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + // Return the essentials spawnpoint + private Location getEssentialsSpawn() { + if (essentialsSpawn != null) { + return essentialsSpawn; + } + return null; + } + + // Return the authme soawnpoint + private Location getAuthMeSpawn(Player player) { + if ((!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) && (Spawn.getInstance().getFirstSpawn() != null)) { + return Spawn.getInstance().getFirstSpawn(); + } + if (Spawn.getInstance().getSpawn() != null) { + return Spawn.getInstance().getSpawn(); + } + return player.getWorld().getSpawnLocation(); + } + + public void switchAntiBotMod(boolean mode) { + this.antibotMod = mode; + Settings.switchAntiBotMod(mode); + } + + private void recallEmail() { + if (!Settings.recallEmail) + return; + Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { + + @Override + public void run() { + for (Player player : Utils.getOnlinePlayers()) { + if (player.isOnline()) { + String name = player.getName().toLowerCase(); + if (database.isAuthAvailable(name)) + if (PlayerCache.getInstance().isAuthenticated(name)) { + String email = database.getAuth(name).getEmail(); + if (email == null || email.isEmpty() || email.equalsIgnoreCase("your@email.com")) + m.send(player, "add_email"); + } + } + } + } + }, 1, 1200 * Settings.delayRecall); + } + + public String replaceAllInfos(String message, Player player) { + int playersOnline = Utils.getOnlinePlayers().size(); + message = message.replace("&", "\u00a7"); + message = message.replace("{PLAYER}", player.getName()); + message = message.replace("{ONLINE}", "" + playersOnline); + message = message.replace("{MAXPLAYERS}", "" + server.getMaxPlayers()); + message = message.replace("{IP}", getIP(player)); + message = message.replace("{LOGINS}", "" + PlayerCache.getInstance().getLogged()); + message = message.replace("{WORLD}", player.getWorld().getName()); + message = message.replace("{SERVER}", server.getServerName()); + message = message.replace("{VERSION}", server.getBukkitVersion()); + message = message.replace("{COUNTRY}", Utils.getCountryName(getIP(player))); + return message; + } + + public String getIP(Player player) { + String name = player.getName().toLowerCase(); + String ip = player.getAddress().getAddress().getHostAddress(); + if (Settings.bungee) { + if (realIp.containsKey(name)) + ip = realIp.get(name); + } + if (Settings.checkVeryGames) + if (getVeryGamesIP(player) != null) + ip = getVeryGamesIP(player); + return ip; + } + + public boolean isLoggedIp(String name, String ip) { + int count = 0; + for (Player player : Utils.getOnlinePlayers()) { + if (ip.equalsIgnoreCase(getIP(player)) && database.isLogged(player.getName().toLowerCase()) && !player.getName().equalsIgnoreCase(name)) + count++; + } + return count >= Settings.getMaxLoginPerIp; + } + + public boolean hasJoinedIp(String name, String ip) { + int count = 0; + for (Player player : Utils.getOnlinePlayers()) { + if (ip.equalsIgnoreCase(getIP(player)) && !player.getName().equalsIgnoreCase(name)) + count++; + } + return count >= Settings.getMaxJoinPerIp; + } + + /** + * Get Player real IP through VeryGames method + * + * @param player player + */ + @Deprecated + public String getVeryGamesIP(Player player) { + String realIP = player.getAddress().getAddress().getHostAddress(); + String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; + sUrl = sUrl.replace("%IP%", player.getAddress().getAddress().getHostAddress()).replace("%PORT%", "" + player.getAddress().getPort()); + try { + URL url = new URL(sUrl); + URLConnection urlc = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream())); + String inputLine = in.readLine(); + if (inputLine != null && !inputLine.isEmpty() && !inputLine.equalsIgnoreCase("error") && !inputLine.contains("error")) { + realIP = inputLine; + } + } catch (Exception ignored) { + } + return realIP; + } + + @Deprecated + public String getCountryCode(String ip) { + return Utils.getCountryCode(ip); + } + + @Deprecated + public String getCountryName(String ip) { + return Utils.getCountryName(ip); + } + +} diff --git a/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java b/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java index 6644166f..5aa40dde 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java @@ -1,36 +1,17 @@ package fr.xephi.authme.cache.backup; -import org.bukkit.inventory.ItemStack; - public class DataFileCache { - private ItemStack[] inventory; - private ItemStack[] armor; private String group; private boolean operator; private boolean flying; - public DataFileCache(ItemStack[] inventory, ItemStack[] armor) { - this(inventory, armor, "", false, false); - } - - public DataFileCache(ItemStack[] inventory, ItemStack[] armor, - String group, boolean operator, boolean flying) { - this.inventory = inventory; - this.armor = armor; + public DataFileCache(String group, boolean operator, boolean flying) { this.group = group; this.operator = operator; this.flying = flying; } - public ItemStack[] getInventory() { - return inventory; - } - - public ItemStack[] getArmour() { - return armor; - } - public String getGroup() { return group; } diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 760def96..1e66e0aa 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -3,20 +3,13 @@ package fr.xephi.authme.cache.backup; import com.google.common.base.Charsets; import com.google.common.io.Files; import com.google.gson.*; -import fr.xephi.authme.AuthMe; + import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.settings.Settings; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.util.io.BukkitObjectInputStream; -import org.bukkit.util.io.BukkitObjectOutputStream; -import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; +import org.bukkit.entity.Player; + import java.io.File; import java.io.IOException; import java.lang.reflect.Type; @@ -24,11 +17,9 @@ import java.lang.reflect.Type; public class JsonCache { private final Gson gson; - private final AuthMe plugin; private final File cacheDir; - public JsonCache(AuthMe plugin) { - this.plugin = plugin; + public JsonCache() { cacheDir = Settings.CACHE_FOLDER; if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { ConsoleLogger.showError("Failed to create cache directory."); @@ -99,49 +90,8 @@ public class JsonCache { jsonObject.addProperty("operator", dataFileCache.getOperator()); jsonObject.addProperty("flying", dataFileCache.isFlying()); - JsonArray arr; - ItemStack[] contents; - - // inventory - contents = dataFileCache.getInventory(); - arr = new JsonArray(); - putItems(contents, arr); - jsonObject.add("inventory", arr); - - // armour - contents = dataFileCache.getArmour(); - arr = new JsonArray(); - putItems(contents, arr); - jsonObject.add("armour", arr); - return jsonObject; } - - private void putItems(ItemStack[] contents, JsonArray target) { - for (ItemStack item : contents) { - if (item == null) { - item = new ItemStack(Material.AIR); - } - JsonObject val = new JsonObject(); - if (item.getType() == Material.SKULL_ITEM) { - SkullMeta meta = (SkullMeta) item.getItemMeta(); - if (meta.hasOwner() && (meta.getOwner() == null || meta.getOwner().isEmpty())) { - item.setItemMeta(plugin.getServer().getItemFactory().getItemMeta(Material.SKULL_ITEM)); - } - } - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos); - objectOut.writeObject(item); - objectOut.close(); - val.addProperty("item", Base64Coder.encodeLines(baos.toByteArray())); - } catch (IOException e) { - e.printStackTrace(); - continue; - } - target.add(val); - } - } } private static class PlayerDataDeserializer implements JsonDeserializer { @@ -166,39 +116,7 @@ public class JsonCache { flying = e.getAsBoolean(); } - JsonArray arr; - ItemStack[] inv = null; - ItemStack[] armour = null; - - if (jsonObject.has("inventory")) { - arr = jsonObject.get("inventory").getAsJsonArray(); - inv = getItems(arr); - } - - if (jsonObject.has("armour")) { - arr = jsonObject.get("armour").getAsJsonArray(); - armour = getItems(arr); - } - - return new DataFileCache(inv, armour, group, operator, flying); - } - - private ItemStack[] getItems(JsonArray arr) { - ItemStack[] contents = new ItemStack[arr.size()]; - for (int i = 0; i < arr.size(); i++) { - JsonObject item = arr.get(i).getAsJsonObject(); - String encoded = item.get("item").getAsString(); - byte[] decoded = Base64Coder.decodeLines(encoded); - try { - ByteArrayInputStream baos = new ByteArrayInputStream(decoded); - BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos); - contents[i] = (ItemStack) objectIn.readObject(); - objectIn.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - return contents; + return new DataFileCache(group, operator, flying); } } diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index 366bc60a..1ab123b6 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -11,7 +11,6 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import java.util.concurrent.ConcurrentHashMap; @@ -25,15 +24,13 @@ public class LimboCache { private LimboCache(AuthMe plugin) { this.plugin = plugin; this.cache = new ConcurrentHashMap<>(); - this.playerData = new JsonCache(plugin); + this.playerData = new JsonCache(); } public void addLimboPlayer(Player player) { String name = player.getName().toLowerCase(); Location loc = player.getLocation(); GameMode gameMode = player.getGameMode(); - ItemStack[] arm; - ItemStack[] inv; boolean operator = false; String playerGroup = ""; boolean flying = false; @@ -42,12 +39,10 @@ public class LimboCache { final StoreInventoryEvent event = new StoreInventoryEvent(player, playerData); Bukkit.getServer().getPluginManager().callEvent(event); if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) { - inv = event.getInventory(); - arm = event.getArmor(); - } else { - inv = null; - arm = null; + player.getInventory().setContents(event.getInventory()); + player.getInventory().setArmorContents(event.getArmor()); } + DataFileCache cache = playerData.readCache(player); if (cache != null) { playerGroup = cache.getGroup(); @@ -58,12 +53,10 @@ public class LimboCache { StoreInventoryEvent event = new StoreInventoryEvent(player); Bukkit.getServer().getPluginManager().callEvent(event); if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) { - inv = event.getInventory(); - arm = event.getArmor(); - } else { - inv = null; - arm = null; + player.getInventory().setContents(event.getInventory()); + player.getInventory().setArmorContents(event.getArmor()); } + operator = player.isOp(); flying = player.isFlying(); if (plugin.permission != null) { @@ -93,7 +86,7 @@ public class LimboCache { if (player.isDead()) { loc = plugin.getSpawnLocation(player); } - cache.put(name, new LimboPlayer(name, loc, inv, arm, gameMode, operator, playerGroup, flying)); + cache.put(name, new LimboPlayer(name, loc, gameMode, operator, playerGroup, flying)); } public void addLimboPlayer(Player player, String group) { diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java index 702ddb38..f4ae0466 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java @@ -2,14 +2,11 @@ package fr.xephi.authme.cache.limbo; import org.bukkit.GameMode; import org.bukkit.Location; -import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitTask; public class LimboPlayer { private String name; - private ItemStack[] inventory; - private ItemStack[] armour; private Location loc = null; private BukkitTask timeoutTaskId = null; private BukkitTask messageTaskId = null; @@ -18,19 +15,6 @@ public class LimboPlayer { private String group = ""; private boolean flying = false; - public LimboPlayer(String name, Location loc, ItemStack[] inventory, - ItemStack[] armour, GameMode gameMode, boolean operator, - String group, boolean flying) { - this.name = name; - this.loc = loc; - this.inventory = inventory; - this.armour = armour; - this.gameMode = gameMode; - this.operator = operator; - this.group = group; - this.flying = flying; - } - public LimboPlayer(String name, Location loc, GameMode gameMode, boolean operator, String group, boolean flying) { this.name = name; @@ -54,22 +38,6 @@ public class LimboPlayer { return loc; } - public ItemStack[] getArmour() { - return armour; - } - - public ItemStack[] getInventory() { - return inventory; - } - - public void setArmour(ItemStack[] armour) { - this.armour = armour; - } - - public void setInventory(ItemStack[] inventory) { - this.inventory = inventory; - } - public GameMode getGameMode() { return gameMode; } @@ -105,5 +73,4 @@ public class LimboPlayer { public boolean isFlying() { return flying; } - } diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 814757e1..06f9b147 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -18,7 +18,6 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitScheduler; @@ -34,7 +33,7 @@ public class UnregisterCommand implements CommandExecutor { public UnregisterCommand(AuthMe plugin) { this.plugin = plugin; - this.playerCache = new JsonCache(plugin); + this.playerCache = new JsonCache(); } @Override @@ -79,8 +78,7 @@ public class UnregisterCommand implements CommandExecutor { player.teleport(tpEvent.getTo()); } } - player.getInventory().setContents(new ItemStack[36]); - player.getInventory().setArmorContents(new ItemStack[4]); + player.saveData(); PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); if (!Settings.getRegisteredGroup.isEmpty()) diff --git a/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java b/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java index 10d5636b..a09ad4ea 100644 --- a/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; /** - * + * * This event is call just after store inventory into cache and will empty the * player inventory. * @@ -18,12 +18,11 @@ public class ProtectInventoryEvent extends CustomEvent { private ItemStack[] emptyArmor = null; private Player player; - public ProtectInventoryEvent(Player player, ItemStack[] storedinventory, - ItemStack[] storedarmor) { + public ProtectInventoryEvent(Player player) { super(true); this.player = player; - this.storedinventory = storedinventory; - this.storedarmor = storedarmor; + this.storedinventory = player.getInventory().getContents(); + this.storedarmor = player.getInventory().getArmorContents(); this.emptyInventory = new ItemStack[36]; this.emptyArmor = new ItemStack[4]; } diff --git a/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java index c2c36ba4..c3069788 100644 --- a/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java @@ -4,8 +4,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; /** - * - * This event restore the inventory from cache + * This event restore the inventory. * * @author Xephi59 */ @@ -15,16 +14,14 @@ public class RestoreInventoryEvent extends CustomEvent { private ItemStack[] armor; private Player player; - public RestoreInventoryEvent(Player player, ItemStack[] inventory, - ItemStack[] armor) { + public RestoreInventoryEvent(Player player) { this.player = player; - this.inventory = inventory; - this.armor = armor; + this.inventory = player.getInventory().getContents(); + this.armor = player.getInventory().getArmorContents(); } - public RestoreInventoryEvent(Player player, ItemStack[] inventory, - ItemStack[] armor, boolean b) { - super(b); + public RestoreInventoryEvent(Player player, boolean async) { + super(async); this.player = player; this.inventory = inventory; this.armor = armor; @@ -53,5 +50,4 @@ public class RestoreInventoryEvent extends CustomEvent { public void setPlayer(Player player) { this.player = player; } - } diff --git a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java index e8a78806..18476525 100644 --- a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java @@ -1,6 +1,5 @@ package fr.xephi.authme.events; -import fr.xephi.authme.cache.backup.DataFileCache; import fr.xephi.authme.cache.backup.JsonCache; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -24,14 +23,8 @@ public class StoreInventoryEvent extends CustomEvent { public StoreInventoryEvent(Player player, JsonCache jsonCache) { this.player = player; - DataFileCache cache = jsonCache.readCache(player); - if (cache != null) { - this.inventory = cache.getInventory(); - this.armor = cache.getArmour(); - } else { - this.inventory = player.getInventory().getContents(); - this.armor = player.getInventory().getArmorContents(); - } + this.inventory = player.getInventory().getContents(); + this.armor = player.getInventory().getArmorContents(); } public ItemStack[] getInventory() { @@ -57,5 +50,4 @@ public class StoreInventoryEvent extends CustomEvent { public void setPlayer(Player player) { this.player = player; } - } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java new file mode 100644 index 00000000..9b59a148 --- /dev/null +++ b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2015 AuthMe-Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package fr.xephi.authme.listener; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolManager; +import com.comphenix.protocol.events.PacketAdapter; +import com.comphenix.protocol.events.PacketContainer; +import com.comphenix.protocol.events.PacketEvent; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.settings.Settings; + +import java.lang.reflect.InvocationTargetException; + +import java.util.Arrays; +import java.util.Collections; +import java.util.logging.Level; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class AuthMeInventoryListener extends PacketAdapter { + + private static final int PLAYER_INVENTORY = 0; + //http://wiki.vg/Inventory#Inventory (0-4 crafting, 5-8 armor, 9-35 main inventory, 36-44 inventory) + //+1 because an index starts with 0 + private static final int PLAYER_CRAFTING_SIZE = 5; + private static final int HOTBAR_SIZE = 9; + + public AuthMeInventoryListener(AuthMe plugin) { + super(plugin, PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS); + } + + @Override + public void onPacketSending(PacketEvent packetEvent) { + Player player = packetEvent.getPlayer(); + PacketContainer packet = packetEvent.getPacket(); + + byte windowId = packet.getIntegers().read(0).byteValue(); + if (windowId == PLAYER_INVENTORY && Settings.protectInventoryBeforeLogInEnabled + && !PlayerCache.getInstance().isAuthenticated(player.getName())) { + packetEvent.setCancelled(true); + } + } + + public void sendInventoryPacket(Player player) { + ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); + PacketContainer inventoryPacket = protocolManager.createPacket(PacketType.Play.Server.WINDOW_ITEMS); + + //we are sending our own inventory + inventoryPacket.getIntegers().write(0, PLAYER_INVENTORY); + + ItemStack[] playerCrafting = new ItemStack[PLAYER_CRAFTING_SIZE]; + ItemStack[] armorContents = player.getInventory().getArmorContents(); + ItemStack[] mainInventory = player.getInventory().getContents(); + + //bukkit saves the armor in reversed order + Collections.reverse(Arrays.asList(armorContents)); + + //same main inventory. The hotbar is at the beginning but it should be at the end of the array + ItemStack[] hotbar = Arrays.copyOfRange(mainInventory, 0, HOTBAR_SIZE); + ItemStack[] storedInventory = Arrays.copyOfRange(mainInventory, HOTBAR_SIZE, mainInventory.length); + + //concat all parts of the inventory together + int inventorySize = playerCrafting.length + armorContents.length + mainInventory.length; + ItemStack[] completeInventory = new ItemStack[inventorySize]; + + System.arraycopy(playerCrafting, 0, completeInventory, 0, playerCrafting.length); + System.arraycopy(armorContents, 0, completeInventory, playerCrafting.length, armorContents.length); + + //storedInventory and hotbar + System.arraycopy(storedInventory, 0, completeInventory + , playerCrafting.length + armorContents.length, storedInventory.length); + System.arraycopy(hotbar, 0, completeInventory + , playerCrafting.length + armorContents.length + storedInventory.length, hotbar.length); + + inventoryPacket.getItemArrayModifier().write(0, completeInventory); + try { + protocolManager.sendServerPacket(player, inventoryPacket, false); + } catch (InvocationTargetException invocationExc) { + plugin.getLogger().log(Level.WARNING, "Error during inventory recovery", invocationExc); + } + } +} diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index d13e8738..22f71493 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -68,6 +68,10 @@ public class AuthMeServerListener implements Listener { plugin.permission = null; ConsoleLogger.showError("Vault has been disabled, unhook permissions!"); } + if (pluginName.equalsIgnoreCase("ProtocolLib")) { + plugin.inventoryProtector = null; + ConsoleLogger.showError("ProtocolLib has been disabled, unhook packet inventory protection!"); + } } @EventHandler(priority = EventPriority.HIGHEST) @@ -83,5 +87,8 @@ public class AuthMeServerListener implements Listener { plugin.checkCombatTagPlus(); if (pluginName.equalsIgnoreCase("Vault")) plugin.checkVault(); + if (pluginName.equalsIgnoreCase("ProtocolLib")) { + plugin.checkProtocolLib(); + } } } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 4df4928e..9a31b835 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -1,315 +1,296 @@ -package fr.xephi.authme.process.join; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -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.backup.DataFileCache; -import fr.xephi.authme.cache.backup.JsonCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.events.FirstSpawnTeleportEvent; -import fr.xephi.authme.events.ProtectInventoryEvent; -import fr.xephi.authme.events.SpawnTeleportEvent; -import fr.xephi.authme.listener.AuthMePlayerListener; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.settings.Spawn; -import fr.xephi.authme.task.MessageTask; -import fr.xephi.authme.task.TimeoutTask; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -public class AsyncronousJoin { - - protected Player player; - protected DataSource database; - protected AuthMe plugin; - protected String name; - private Messages m = Messages.getInstance(); - private JsonCache playerBackup; - - public AsyncronousJoin(Player player, AuthMe plugin, DataSource database) { - this.player = player; - this.plugin = plugin; - this.database = database; - this.playerBackup = new JsonCache(plugin); - this.name = player.getName().toLowerCase(); - } - - public void process() { - if (AuthMePlayerListener.gameMode.containsKey(name)) - AuthMePlayerListener.gameMode.remove(name); - AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode()); - BukkitScheduler sched = plugin.getServer().getScheduler(); - - if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { - return; - } - - if (plugin.ess != null && Settings.disableSocialSpy) { - plugin.ess.getUser(player).setSocialSpyEnabled(false); - } - - final String ip = plugin.getIP(player); - if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) { - final GameMode gM = AuthMePlayerListener.gameMode.get(name); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); - player.setGameMode(gM); - player.kickPlayer("You are not the Owner of this account, please try another name!"); - if (Settings.banUnsafeIp) - plugin.getServer().banIP(ip); - } - - }); - return; - } - if (Settings.getMaxJoinPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !ip.equalsIgnoreCase("127.0.0.1") && !ip.equalsIgnoreCase("localhost")) { - if (plugin.hasJoinedIp(player.getName(), ip)) { - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - player.kickPlayer("A player with the same IP is already in game!"); - } - - }); - return; - } - } - final Location spawnLoc = plugin.getSpawnLocation(player); - final boolean isAuthAvailable = database.isAuthAvailable(name); - if (isAuthAvailable) { - if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); - Utils.forceGM(player); - } - - }); - } - if (!Settings.noTeleport) - if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (player.isOnline() && tpEvent.getTo() != null) { - if (tpEvent.getTo().getWorld() != null) - player.teleport(tpEvent.getTo()); - } - } - } - - }); - } - placePlayerSafely(player, spawnLoc); - LimboCache.getInstance().updateLimboPlayer(player); - DataFileCache dataFile = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour()); - playerBackup.createCache(player, dataFile); - // protect inventory - if (Settings.protectInventoryBeforeLogInEnabled) { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); - ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); - plugin.getServer().getPluginManager().callEvent(ev); - if (ev.isCancelled()) { - if (!Settings.noConsoleSpam) - ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); - } else { - final ItemStack[] inv = ev.getEmptyArmor(); - final ItemStack[] armor = ev.getEmptyArmor(); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - plugin.api.setPlayerInventory(player, inv, armor); - } - - }); - } - } - } else { - if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); - Utils.forceGM(player); - } - - }); - } - if (!Settings.unRegisteredGroup.isEmpty()) { - Utils.setGroup(player, Utils.GroupType.UNREGISTERED); - } - if (!Settings.isForcedRegistrationEnabled) { - return; - } - if (!Settings.noTeleport) - if (!needFirstspawn() && Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (player.isOnline() && tpEvent.getTo() != null) { - if (tpEvent.getTo().getWorld() != null) - player.teleport(tpEvent.getTo()); - } - } - } - - }); - } - - } - String[] msg; - if (Settings.emailRegistration) { - msg = isAuthAvailable ? m.send("login_msg") : m.send("reg_email_msg"); - } else { - msg = isAuthAvailable ? m.send("login_msg") : m.send("reg_msg"); - } - int time = Settings.getRegistrationTimeout * 20; - int msgInterval = Settings.getWarnMessageInterval; - if (time != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); - if (!LimboCache.getInstance().hasLimboPlayer(name)) - LimboCache.getInstance().addLimboPlayer(player); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); - } - if (!LimboCache.getInstance().hasLimboPlayer(name)) - LimboCache.getInstance().addLimboPlayer(player); - if (isAuthAvailable) { - Utils.setGroup(player, GroupType.NOTLOGGEDIN); - } else { - Utils.setGroup(player, GroupType.UNREGISTERED); - } - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - if (player.isOp()) - player.setOp(false); - if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) { - player.setAllowFlight(true); - player.setFlying(true); - } - player.setNoDamageTicks(Settings.getRegistrationTimeout * 20); - if (Settings.useEssentialsMotd) - player.performCommand("motd"); - if (Settings.applyBlindEffect) - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - player.setWalkSpeed(0.0f); - player.setFlySpeed(0.0f); - } - } - - }); - if (Settings.isSessionsEnabled && isAuthAvailable && (PlayerCache.getInstance().isAuthenticated(name) || database.isLogged(name))) { - if (plugin.sessions.containsKey(name)) - plugin.sessions.get(name).cancel(); - plugin.sessions.remove(name); - PlayerAuth auth = database.getAuth(name); - if (auth != null && auth.getIp().equals(ip)) { - m.send(player, "valid_session"); - PlayerCache.getInstance().removePlayer(name); - database.setUnlogged(name); - plugin.management.performLogin(player, "dontneed", true); - } else if (Settings.sessionExpireOnIpChange) { - PlayerCache.getInstance().removePlayer(name); - database.setUnlogged(name); - m.send(player, "invalid_session"); - } - return; - } - BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval)); - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); - } - - private boolean needFirstspawn() { - if (player.hasPlayedBefore()) - return false; - if (Spawn.getInstance().getFirstSpawn() == null || Spawn.getInstance().getFirstSpawn().getWorld() == null) - return false; - FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), Spawn.getInstance().getFirstSpawn()); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { - final Location fLoc = tpEvent.getTo(); - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - player.teleport(fLoc); - } - - }); - } - } - return true; - - } - - private void placePlayerSafely(final Player player, - final Location spawnLoc) { - Location loc = null; - if (spawnLoc == null) - return; - if (!Settings.noTeleport) - return; - if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) - return; - if (!player.hasPlayedBefore()) - return; - Block b = player.getLocation().getBlock(); - if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) { - m.send(player, "unsafe_spawn"); - if (spawnLoc.getWorld() != null) - loc = spawnLoc; - } else { - Block c = player.getLocation().add(0D, 1D, 0D).getBlock(); - if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL) { - m.send(player, "unsafe_spawn"); - if (spawnLoc.getWorld() != null) - loc = spawnLoc; - } - } - if (loc != null) { - final Location floc = loc; - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - player.teleport(floc); - } - - }); - } - } - -} +package fr.xephi.authme.process.join; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +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.FirstSpawnTeleportEvent; +import fr.xephi.authme.events.ProtectInventoryEvent; +import fr.xephi.authme.events.SpawnTeleportEvent; +import fr.xephi.authme.listener.AuthMePlayerListener; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.settings.Spawn; +import fr.xephi.authme.task.MessageTask; +import fr.xephi.authme.task.TimeoutTask; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + +public class AsyncronousJoin { + + protected Player player; + protected DataSource database; + protected AuthMe plugin; + protected String name; + private Messages m = Messages.getInstance(); + + public AsyncronousJoin(Player player, AuthMe plugin, DataSource database) { + this.player = player; + this.plugin = plugin; + this.database = database; + this.name = player.getName().toLowerCase(); + } + + public void process() { + if (AuthMePlayerListener.gameMode.containsKey(name)) + AuthMePlayerListener.gameMode.remove(name); + AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode()); + BukkitScheduler sched = plugin.getServer().getScheduler(); + + if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { + return; + } + + if (plugin.ess != null && Settings.disableSocialSpy) { + plugin.ess.getUser(player).setSocialSpyEnabled(false); + } + + final String ip = plugin.getIP(player); + if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) { + final GameMode gM = AuthMePlayerListener.gameMode.get(name); + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); + player.setGameMode(gM); + player.kickPlayer("You are not the Owner of this account, please try another name!"); + if (Settings.banUnsafeIp) + plugin.getServer().banIP(ip); + } + + }); + return; + } + if (Settings.getMaxJoinPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !ip.equalsIgnoreCase("127.0.0.1") && !ip.equalsIgnoreCase("localhost")) { + if (plugin.hasJoinedIp(player.getName(), ip)) { + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + player.kickPlayer("A player with the same IP is already in game!"); + } + + }); + return; + } + } + final Location spawnLoc = plugin.getSpawnLocation(player); + final boolean isAuthAvailable = database.isAuthAvailable(name); + if (isAuthAvailable) { + if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); + Utils.forceGM(player); + } + + }); + } + if (!Settings.noTeleport) + if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (player.isOnline() && tpEvent.getTo() != null) { + if (tpEvent.getTo().getWorld() != null) + player.teleport(tpEvent.getTo()); + } + } + } + + }); + } + placePlayerSafely(player, spawnLoc); + LimboCache.getInstance().updateLimboPlayer(player); + // protect inventory + if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) { + ProtectInventoryEvent ev = new ProtectInventoryEvent(player); + plugin.getServer().getPluginManager().callEvent(ev); + if (ev.isCancelled()) { + plugin.inventoryProtector.sendInventoryPacket(player); + if (!Settings.noConsoleSpam) + ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); + } + } + } else { + if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); + Utils.forceGM(player); + } + + }); + } + if (!Settings.unRegisteredGroup.isEmpty()) { + Utils.setGroup(player, Utils.GroupType.UNREGISTERED); + } + if (!Settings.isForcedRegistrationEnabled) { + return; + } + if (!Settings.noTeleport) + if (!needFirstspawn() && Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + @Override + public void run() { + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (player.isOnline() && tpEvent.getTo() != null) { + if (tpEvent.getTo().getWorld() != null) + player.teleport(tpEvent.getTo()); + } + } + } + + }); + } + + } + String[] msg; + if (Settings.emailRegistration) { + msg = isAuthAvailable ? m.send("login_msg") : m.send("reg_email_msg"); + } else { + msg = isAuthAvailable ? m.send("login_msg") : m.send("reg_msg"); + } + int time = Settings.getRegistrationTimeout * 20; + int msgInterval = Settings.getWarnMessageInterval; + if (time != 0) { + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + if (!LimboCache.getInstance().hasLimboPlayer(name)) + LimboCache.getInstance().addLimboPlayer(player); + LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + } + if (!LimboCache.getInstance().hasLimboPlayer(name)) + LimboCache.getInstance().addLimboPlayer(player); + if (isAuthAvailable) { + Utils.setGroup(player, GroupType.NOTLOGGEDIN); + } else { + Utils.setGroup(player, GroupType.UNREGISTERED); + } + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + if (player.isOp()) + player.setOp(false); + if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) { + player.setAllowFlight(true); + player.setFlying(true); + } + player.setNoDamageTicks(Settings.getRegistrationTimeout * 20); + if (Settings.useEssentialsMotd) + player.performCommand("motd"); + if (Settings.applyBlindEffect) + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } + } + + }); + if (Settings.isSessionsEnabled && isAuthAvailable && (PlayerCache.getInstance().isAuthenticated(name) || database.isLogged(name))) { + if (plugin.sessions.containsKey(name)) + plugin.sessions.get(name).cancel(); + plugin.sessions.remove(name); + PlayerAuth auth = database.getAuth(name); + if (auth != null && auth.getIp().equals(ip)) { + m.send(player, "valid_session"); + PlayerCache.getInstance().removePlayer(name); + database.setUnlogged(name); + plugin.management.performLogin(player, "dontneed", true); + } else if (Settings.sessionExpireOnIpChange) { + PlayerCache.getInstance().removePlayer(name); + database.setUnlogged(name); + m.send(player, "invalid_session"); + } + return; + } + BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval)); + LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); + } + + private boolean needFirstspawn() { + if (player.hasPlayedBefore()) + return false; + if (Spawn.getInstance().getFirstSpawn() == null || Spawn.getInstance().getFirstSpawn().getWorld() == null) + return false; + FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), Spawn.getInstance().getFirstSpawn()); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { + final Location fLoc = tpEvent.getTo(); + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + player.teleport(fLoc); + } + + }); + } + } + return true; + + } + + private void placePlayerSafely(final Player player, + final Location spawnLoc) { + Location loc = null; + if (spawnLoc == null) + return; + if (!Settings.noTeleport) + return; + if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) + return; + if (!player.hasPlayedBefore()) + return; + Block b = player.getLocation().getBlock(); + if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) { + m.send(player, "unsafe_spawn"); + if (spawnLoc.getWorld() != null) + loc = spawnLoc; + } else { + Block c = player.getLocation().add(0D, 1D, 0D).getBlock(); + if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL) { + m.send(player, "unsafe_spawn"); + if (spawnLoc.getWorld() != null) + loc = spawnLoc; + } + } + if (loc != null) { + final Location floc = loc; + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + player.teleport(floc); + } + + }); + } + } + +} diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 28f9a861..da0a42b2 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -42,7 +42,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { this.name = player.getName().toLowerCase(); this.limbo = LimboCache.getInstance().getLimboPlayer(name); this.auth = database.getAuth(name); - this.playerCache = new JsonCache(plugin); + this.playerCache = new JsonCache(); } public LimboPlayer getLimbo() { @@ -92,10 +92,11 @@ public class ProcessSyncronousPlayerLogin implements Runnable { } protected void restoreInventory() { - RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); + RestoreInventoryEvent event = new RestoreInventoryEvent(player); Bukkit.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { plugin.api.setPlayerInventory(player, event.getInventory(), event.getArmor()); + plugin.inventoryProtector.sendInventoryPacket(player); } } @@ -128,7 +129,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable { // Inventory - Make it after restore GameMode , cause we need to // restore the // right inventory in the right gamemode - if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) { + if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) { restoreInventory(); } if (Settings.forceOnlyAfterLogin) { diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index d1f890ad..0d4e4002 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -1,91 +1,81 @@ -package fr.xephi.authme.process.logout; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitScheduler; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; -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.backup.DataFileCache; -import fr.xephi.authme.cache.backup.JsonCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.events.AuthMeTeleportEvent; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; - -public class AsyncronousLogout { - - protected Player player; - protected String name; - protected AuthMe plugin; - protected DataSource database; - protected boolean canLogout = true; - private Messages m = Messages.getInstance(); - private JsonCache playerBackup; - - public AsyncronousLogout(Player player, AuthMe plugin, - DataSource database) { - this.player = player; - this.plugin = plugin; - this.database = database; - this.name = player.getName().toLowerCase(); - this.playerBackup = new JsonCache(plugin); - } - - private void preLogout() { - if (!PlayerCache.getInstance().isAuthenticated(name)) { - m.send(player, "not_logged_in"); - canLogout = false; - } - } - - public void process() { - preLogout(); - if (!canLogout) - return; - final Player p = player; - BukkitScheduler sched = p.getServer().getScheduler(); - PlayerAuth auth = PlayerCache.getInstance().getAuth(name); - database.updateSession(auth); - auth.setQuitLocX(p.getLocation().getX()); - auth.setQuitLocY(p.getLocation().getY()); - auth.setQuitLocZ(p.getLocation().getZ()); - auth.setWorld(p.getWorld().getName()); - database.updateQuitLoc(auth); - - PlayerCache.getInstance().removePlayer(name); - database.setUnlogged(name); - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawnLoc = plugin.getSpawnLocation(p); - final AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(p, spawnLoc); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (tpEvent.getTo() != null) - p.teleport(tpEvent.getTo()); - } - } - }); - } - - if (LimboCache.getInstance().hasLimboPlayer(name)) - LimboCache.getInstance().deleteLimboPlayer(name); - LimboCache.getInstance().addLimboPlayer(player); - Utils.setGroup(player, GroupType.NOTLOGGEDIN); - if (Settings.protectInventoryBeforeLogInEnabled) { - player.getInventory().clear(); - // create cache file for handling lost of inventories on unlogged in - // status - DataFileCache playerData = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour()); - playerBackup.createCache(player, playerData); - } - sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin)); - } -} +package fr.xephi.authme.process.logout; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; +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.AuthMeTeleportEvent; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; + +public class AsyncronousLogout { + + protected Player player; + protected String name; + protected AuthMe plugin; + protected DataSource database; + protected boolean canLogout = true; + private Messages m = Messages.getInstance(); + + public AsyncronousLogout(Player player, AuthMe plugin, + DataSource database) { + this.player = player; + this.plugin = plugin; + this.database = database; + this.name = player.getName().toLowerCase(); + } + + private void preLogout() { + if (!PlayerCache.getInstance().isAuthenticated(name)) { + m.send(player, "not_logged_in"); + canLogout = false; + } + } + + public void process() { + preLogout(); + if (!canLogout) + return; + final Player p = player; + BukkitScheduler sched = p.getServer().getScheduler(); + PlayerAuth auth = PlayerCache.getInstance().getAuth(name); + database.updateSession(auth); + auth.setQuitLocX(p.getLocation().getX()); + auth.setQuitLocY(p.getLocation().getY()); + auth.setQuitLocZ(p.getLocation().getZ()); + auth.setWorld(p.getWorld().getName()); + database.updateQuitLoc(auth); + + PlayerCache.getInstance().removePlayer(name); + database.setUnlogged(name); + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawnLoc = plugin.getSpawnLocation(p); + final AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(p, spawnLoc); + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (tpEvent.getTo() != null) + p.teleport(tpEvent.getTo()); + } + } + }); + } + + if (LimboCache.getInstance().hasLimboPlayer(name)) + LimboCache.getInstance().deleteLimboPlayer(name); + LimboCache.getInstance().addLimboPlayer(player); + Utils.setGroup(player, GroupType.NOTLOGGEDIN); + + sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin)); + } +} diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index da594606..26917e63 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -1,110 +1,93 @@ -package fr.xephi.authme.process.quit; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitTask; - -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.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.events.RestoreInventoryEvent; -import fr.xephi.authme.listener.AuthMePlayerListener; -import fr.xephi.authme.settings.Settings; - -public class AsyncronousQuit { - - protected AuthMe plugin; - protected DataSource database; - protected Player player; - private String name; - private ItemStack[] armor = null; - private ItemStack[] inv = null; - private boolean isOp = false; - private boolean isFlying = false; - private boolean needToChange = false; - private boolean isKick = false; - - public AsyncronousQuit(Player p, AuthMe plugin, DataSource database, - boolean isKick) { - this.player = p; - this.plugin = plugin; - this.database = database; - this.name = p.getName().toLowerCase(); - this.isKick = isKick; - } - - public void process() { - if (player == null) - return; - if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { - return; - } - - String ip = plugin.getIP(player); - - if (PlayerCache.getInstance().isAuthenticated(name)) { - if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) { - Location loc = player.getLocation(); - PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName()); - database.updateQuitLoc(auth); - } - PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis(), player.getName()); - database.updateSession(auth); - } - - if (LimboCache.getInstance().hasLimboPlayer(name)) { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); - if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) { - inv = limbo.getInventory(); - armor = limbo.getArmour(); - } - if (limbo.getGroup() != null && !limbo.getGroup().equals("")) - Utils.addNormal(player, limbo.getGroup()); - needToChange = true; - isOp = limbo.getOperator(); - isFlying = limbo.isFlying(); - if (limbo.getTimeoutTaskId() != null) - limbo.getTimeoutTaskId().cancel(); - if (limbo.getMessageTaskId() != null) - limbo.getMessageTaskId().cancel(); - LimboCache.getInstance().deleteLimboPlayer(name); - } - if (Settings.isSessionsEnabled && !isKick) { - if (Settings.getSessionTimeout != 0) { - BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - PlayerCache.getInstance().removePlayer(name); - if (database.isLogged(name)) - database.setUnlogged(name); - plugin.sessions.remove(name); - } - - }, Settings.getSessionTimeout * 20 * 60); - plugin.sessions.put(name, task); - } - } else { - PlayerCache.getInstance().removePlayer(name); - database.setUnlogged(name); - } - AuthMePlayerListener.gameMode.remove(name); - final Player p = player; - RestoreInventoryEvent ev = new RestoreInventoryEvent(player, inv, armor, true); - Bukkit.getPluginManager().callEvent(ev); - if (ev.isCancelled()) { - inv = null; - armor = null; - } else { - inv = ev.getInventory(); - armor = ev.getArmor(); - } - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, p, inv, armor, isOp, isFlying, needToChange)); - } -} +package fr.xephi.authme.process.quit; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitTask; + +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.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; +import fr.xephi.authme.datasource.DataSource; +import fr.xephi.authme.listener.AuthMePlayerListener; +import fr.xephi.authme.settings.Settings; + +public class AsyncronousQuit { + + protected AuthMe plugin; + protected DataSource database; + protected Player player; + private String name; + private boolean isOp = false; + private boolean isFlying = false; + private boolean needToChange = false; + private boolean isKick = false; + + public AsyncronousQuit(Player p, AuthMe plugin, DataSource database, + boolean isKick) { + this.player = p; + this.plugin = plugin; + this.database = database; + this.name = p.getName().toLowerCase(); + this.isKick = isKick; + } + + public void process() { + if (player == null) + return; + if (Utils.isNPC(player) || Utils.isUnrestricted(player)) { + return; + } + + String ip = plugin.getIP(player); + + if (PlayerCache.getInstance().isAuthenticated(name)) { + if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) { + Location loc = player.getLocation(); + PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName()); + database.updateQuitLoc(auth); + } + PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis(), player.getName()); + database.updateSession(auth); + } + + if (LimboCache.getInstance().hasLimboPlayer(name)) { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); + if (limbo.getGroup() != null && !limbo.getGroup().equals("")) + Utils.addNormal(player, limbo.getGroup()); + needToChange = true; + isOp = limbo.getOperator(); + isFlying = limbo.isFlying(); + if (limbo.getTimeoutTaskId() != null) + limbo.getTimeoutTaskId().cancel(); + if (limbo.getMessageTaskId() != null) + limbo.getMessageTaskId().cancel(); + LimboCache.getInstance().deleteLimboPlayer(name); + } + if (Settings.isSessionsEnabled && !isKick) { + if (Settings.getSessionTimeout != 0) { + BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + PlayerCache.getInstance().removePlayer(name); + if (database.isLogged(name)) + database.setUnlogged(name); + plugin.sessions.remove(name); + } + + }, Settings.getSessionTimeout * 20 * 60); + plugin.sessions.put(name, task); + } + } else { + PlayerCache.getInstance().removePlayer(name); + database.setUnlogged(name); + } + + AuthMePlayerListener.gameMode.remove(name); + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, player, isOp, isFlying, needToChange)); + } +} diff --git a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java index 48813409..ea644270 100644 --- a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java @@ -1,48 +1,49 @@ -package fr.xephi.authme.process.quit; - -import org.bukkit.GameMode; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.settings.Settings; - -public class ProcessSyncronousPlayerQuit implements Runnable { - - protected AuthMe plugin; - protected Player player; - protected boolean isOp; - protected boolean isFlying; - protected ItemStack[] inv; - protected ItemStack[] armor; - protected boolean needToChange; - - public ProcessSyncronousPlayerQuit(AuthMe plugin, Player player, - ItemStack[] inv, ItemStack[] armor, boolean isOp, boolean isFlying, - boolean needToChange) { - this.plugin = plugin; - this.player = player; - this.isOp = isOp; - this.isFlying = isFlying; - this.armor = armor; - this.inv = inv; - this.needToChange = needToChange; - } - - @Override - public void run() { - if (inv != null && armor != null) - plugin.api.setPlayerInventory(player, inv, armor); - if (needToChange) { - player.setOp(isOp); - if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) { - player.setAllowFlight(isFlying); - player.setFlying(isFlying); - } - } - try { - player.getVehicle().eject(); - } catch (Exception e) { - } - } -} +package fr.xephi.authme.process.quit; + +import org.bukkit.GameMode; +import org.bukkit.entity.Player; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.events.RestoreInventoryEvent; +import fr.xephi.authme.settings.Settings; +import org.bukkit.Bukkit; + +public class ProcessSyncronousPlayerQuit implements Runnable { + + protected AuthMe plugin; + protected Player player; + protected boolean isOp; + protected boolean isFlying; + protected boolean needToChange; + + public ProcessSyncronousPlayerQuit(AuthMe plugin, Player player + , boolean isOp, boolean isFlying + , boolean needToChange) { + this.plugin = plugin; + this.player = player; + this.isOp = isOp; + this.isFlying = isFlying; + this.needToChange = needToChange; + } + + @Override + public void run() { + RestoreInventoryEvent ev = new RestoreInventoryEvent(player); + Bukkit.getPluginManager().callEvent(ev); + if (!ev.isCancelled()) { + plugin.api.setPlayerInventory(player, ev.getInventory(), ev.getArmor()); + } + + if (needToChange) { + player.setOp(isOp); + if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) { + player.setAllowFlight(isFlying); + player.setFlying(isFlying); + } + } + try { + player.getVehicle().eject(); + } catch (Exception e) { + } + } +} diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 5a7a1353..ab0612d5 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -91,14 +91,17 @@ public class ProcessSyncronousPasswordRegister implements Runnable { player.teleport(tpEvent.getTo()); } } - if (Settings.protectInventoryBeforeLogInEnabled && limbo.getInventory() != null && limbo.getArmour() != null) { - RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); + + if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) { + RestoreInventoryEvent event = new RestoreInventoryEvent(player); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled() && event.getArmor() != null && event.getInventory() != null) { player.getInventory().setContents(event.getInventory()); player.getInventory().setArmorContents(event.getArmor()); + plugin.inventoryProtector.sendInventoryPacket(player); } } + limbo.getTimeoutTaskId().cancel(); limbo.getMessageTaskId().cancel(); LimboCache.getInstance().deleteLimboPlayer(name); @@ -153,6 +156,5 @@ public class ProcessSyncronousPasswordRegister implements Runnable { // Register is now finish , we can force all commands forceCommands(); - } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6b2e6174..276773ca 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the player. main: fr.xephi.authme.AuthMe version: ${project.version} -softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories] +softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories, ProtocolLib] commands: register: description: Register an account @@ -22,7 +22,7 @@ commands: usage: /logout unregister: description: unregister your account - usage: /unregister password + usage: /unregister password authme: description: AuthMe op commands usage: '/authme reload|register playername password|changepassword playername password|unregister playername|version' From 63abcc03a9b3e875a3defe38c20349355ccdd5af Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sat, 3 Oct 2015 10:57:47 +0200 Subject: [PATCH 244/427] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bed52462..3a8a92d1 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ McStats: http://mcstats.org/plugin/AuthMe #####Running Requirements: >- Java 1.7 (should work also with Java 1.8) >- Spigot or CraftBukkit (1.7.10 or 1.8.X) +>- Vault +>- Protocollib
    ###Plugin Description: From aed42670f66db529f5302a9c0fb6017877a10253 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 3 Oct 2015 11:42:29 +0200 Subject: [PATCH 245/427] Added exclusions --- pom.xml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index f797a2c6..605e94fe 100644 --- a/pom.xml +++ b/pom.xml @@ -200,6 +200,15 @@ true
    + + + org.apache.logging.log4j + log4j-core + 2.0-beta9 + provided + true + + org.xerial @@ -209,15 +218,6 @@ true - - - com.google.code.gson - gson - 2.3.1 - compile - true - - javax.mail @@ -273,6 +273,20 @@ ${bukkitVersion} provided true + + + junit + junit + + + json-simple + com.googlecode.json-simple + + + persistence-api + javax.persistence + + @@ -349,6 +363,26 @@ CommandHandler com.pneumaticraft.commandhandler + + SerializationConfig + me.main__.util + + + Logging + com.dumptruckman.minecraft + + + metrics + org.mcstats.bukkit + + + buscript + com.dumptruckman.minecraft + + + junit + junit + true @@ -478,6 +512,10 @@ AccountsClient com.mojang + + log4j-core + org.apache.logging.log4j + true @@ -573,6 +611,10 @@ lockette org.yi.acru.bukkit.lockette + + log4j-core + org.apache.logging.log4j + true From 4c2348e6e3eaa4e20eca2b8a7c1220f18d9cc0d6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 3 Oct 2015 12:19:49 +0200 Subject: [PATCH 246/427] CleanUp (removed setinventory api method --- pom.xml | 30 ++++++++++++------- src/main/java/fr/xephi/authme/Utils.java | 1 - src/main/java/fr/xephi/authme/api/NewAPI.java | 12 -------- .../authme/events/RestoreInventoryEvent.java | 23 -------------- .../login/ProcessSyncronousPlayerLogin.java | 1 - .../quit/ProcessSyncronousPlayerQuit.java | 7 ----- .../ProcessSyncronousPasswordRegister.java | 4 +-- 7 files changed, 21 insertions(+), 57 deletions(-) diff --git a/pom.xml b/pom.xml index 605e94fe..26ecd2ac 100644 --- a/pom.xml +++ b/pom.xml @@ -6,6 +6,7 @@ fr.xephi authme 5.1-SNAPSHOT + jar AuthMeReloaded Authentication plugin for CraftBukkit/Spigot! @@ -88,9 +89,8 @@ com.zaxxer:HikariCP - org.slf4j:slf4j-simple + org.slf4j:slf4j-jdk14 org.slf4j:slf4j-api - com.google.code.gson:gson com.maxmind.geoip:geoip-api com.sun.mail:javax.mail com.comphenix.attribute:AttributeStorage @@ -194,7 +194,7 @@ org.slf4j - slf4j-simple + slf4j-jdk14 1.7.12 compile true @@ -308,13 +308,23 @@ true - - - com.comphenix.protocol - ProtocolLib - 3.4.0 - true - + + + com.comphenix.protocol + ProtocolLib + 3.4.0 + true + + + cglib-nodep + cglib + + + BukkitExecutors + com.comphenix.executors + + + diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 4abde79f..70171dc0 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -160,7 +160,6 @@ public class Utils { } // TODO: remove if not needed - @SuppressWarnings("unused") public static void hasPermOnJoin(Player player) { if (plugin.permission == null) return; diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 937a8abe..ab7d7cb4 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -6,11 +6,9 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; @@ -94,16 +92,6 @@ public class NewAPI { } } - public void setPlayerInventory(Player player, ItemStack[] content, - ItemStack[] armor) { - try { - player.getInventory().setContents(content); - player.getInventory().setArmorContents(armor); - } catch (Exception npe) { - ConsoleLogger.showError("Some error appear while trying to set inventory for " + player.getName()); - } - } - /** * * @param playerName diff --git a/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java index c3069788..b73c123b 100644 --- a/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java @@ -1,7 +1,6 @@ package fr.xephi.authme.events; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; /** * This event restore the inventory. @@ -10,37 +9,15 @@ import org.bukkit.inventory.ItemStack; */ public class RestoreInventoryEvent extends CustomEvent { - private ItemStack[] inventory; - private ItemStack[] armor; private Player player; public RestoreInventoryEvent(Player player) { this.player = player; - this.inventory = player.getInventory().getContents(); - this.armor = player.getInventory().getArmorContents(); } public RestoreInventoryEvent(Player player, boolean async) { super(async); this.player = player; - this.inventory = inventory; - this.armor = armor; - } - - public ItemStack[] getInventory() { - return this.inventory; - } - - public void setInventory(ItemStack[] inventory) { - this.inventory = inventory; - } - - public ItemStack[] getArmor() { - return this.armor; - } - - public void setArmor(ItemStack[] armor) { - this.armor = armor; } public Player getPlayer() { diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index da0a42b2..20eacdf2 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -95,7 +95,6 @@ public class ProcessSyncronousPlayerLogin implements Runnable { RestoreInventoryEvent event = new RestoreInventoryEvent(player); Bukkit.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { - plugin.api.setPlayerInventory(player, event.getInventory(), event.getArmor()); plugin.inventoryProtector.sendInventoryPacket(player); } } diff --git a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java index ea644270..1b661b6f 100644 --- a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java @@ -4,9 +4,7 @@ import org.bukkit.GameMode; import org.bukkit.entity.Player; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.settings.Settings; -import org.bukkit.Bukkit; public class ProcessSyncronousPlayerQuit implements Runnable { @@ -28,11 +26,6 @@ public class ProcessSyncronousPlayerQuit implements Runnable { @Override public void run() { - RestoreInventoryEvent ev = new RestoreInventoryEvent(player); - Bukkit.getPluginManager().callEvent(ev); - if (!ev.isCancelled()) { - plugin.api.setPlayerInventory(player, ev.getInventory(), ev.getArmor()); - } if (needToChange) { player.setOp(isOp); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index ab0612d5..1e20f2ba 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -95,9 +95,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) { RestoreInventoryEvent event = new RestoreInventoryEvent(player); Bukkit.getPluginManager().callEvent(event); - if (!event.isCancelled() && event.getArmor() != null && event.getInventory() != null) { - player.getInventory().setContents(event.getInventory()); - player.getInventory().setArmorContents(event.getArmor()); + if (!event.isCancelled()) { plugin.inventoryProtector.sendInventoryPacket(player); } } From e9f299fca8885dd3d6dea5059029a3a846fd7cc2 Mon Sep 17 00:00:00 2001 From: games647 Date: Sat, 3 Oct 2015 18:22:13 +0200 Subject: [PATCH 247/427] Fix PlayerAuth constructor calls --- src/main/java/fr/xephi/authme/api/API.java | 366 ++-- src/main/java/fr/xephi/authme/api/NewAPI.java | 306 ++-- .../xephi/authme/commands/AdminCommand.java | 2 +- .../xephi/authme/commands/EmailCommand.java | 5 +- .../authme/converter/CrazyLoginConverter.java | 4 +- .../authme/converter/RakamakConverter.java | 12 +- .../authme/converter/RoyalAuthConverter.java | 2 +- .../authme/converter/vAuthFileReader.java | 4 +- .../xephi/authme/converter/xAuthToFlat.java | 2 +- .../fr/xephi/authme/datasource/FlatFile.java | 1501 ++++++++--------- .../xephi/authme/plugin/manager/EssSpawn.java | 4 +- .../authme/security/crypts/PHPFUSION.java | 6 +- .../fr/xephi/authme/security/crypts/XF.java | 2 +- .../authme/security/pbkdf2/MacBasedPRF.java | 10 +- .../xephi/authme/settings/OtherAccounts.java | 9 +- .../java/fr/xephi/authme/settings/Spawn.java | 8 +- 16 files changed, 1115 insertions(+), 1128 deletions(-) diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index 11eba861..79eaeaff 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -1,183 +1,183 @@ -package fr.xephi.authme.api; - -import java.security.NoSuchAlgorithmException; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -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.security.PasswordSecurity; -import fr.xephi.authme.settings.Settings; - -public class API { - - public static final String newline = System.getProperty("line.separator"); - public static AuthMe instance; - - @Deprecated - public API(AuthMe instance) { - API.instance = instance; - } - - /** - * Hook into AuthMe - * - * @return AuthMe instance - */ - @Deprecated - public static AuthMe hookAuthMe() { - if (instance != null) - return instance; - Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe"); - if (plugin == null || !(plugin instanceof AuthMe)) { - return null; - } - instance = (AuthMe) plugin; - return instance; - } - - @Deprecated - public AuthMe getPlugin() { - return instance; - } - - /** - * - * @param player - * @return true if player is authenticate - */ - @Deprecated - public static boolean isAuthenticated(Player player) { - return PlayerCache.getInstance().isAuthenticated(player.getName()); - } - - /** - * - * @param player - * @return true if player is a npc - */ - @Deprecated - public boolean isaNPC(Player player) { - return Utils.isNPC(player); - } - - /** - * - * @param player - * @return true if player is a npc - */ - @Deprecated - public boolean isNPC(Player player) { - return Utils.isNPC(player); - } - - /** - * - * @param player - * @return true if the player is unrestricted - */ - @Deprecated - public static boolean isUnrestricted(Player player) { - return Utils.isUnrestricted(player); - } - - @Deprecated - public static Location getLastLocation(Player player) { - try { - PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase()); - - if (auth != null) { - Location loc = new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ()); - return loc; - } else { - return null; - } - - } catch (NullPointerException ex) { - return null; - } - } - - @Deprecated - public static void setPlayerInventory(Player player, ItemStack[] content, - ItemStack[] armor) { - try { - player.getInventory().setContents(content); - player.getInventory().setArmorContents(armor); - } catch (NullPointerException npe) { - } - } - - /** - * - * @param playerName - * @return true if player is registered - */ - @Deprecated - public static boolean isRegistered(String playerName) { - String player = playerName.toLowerCase(); - return instance.database.isAuthAvailable(player); - } - - /** - * @param String - * playerName, String passwordToCheck - * @return true if the password is correct , false else - */ - @Deprecated - public static boolean checkPassword(String playerName, - String passwordToCheck) { - if (!isRegistered(playerName)) - return false; - String player = playerName.toLowerCase(); - PlayerAuth auth = instance.database.getAuth(player); - try { - return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName); - } catch (NoSuchAlgorithmException e) { - return false; - } - } - - /** - * Register a player - * - * @param String - * playerName, String password - * @return true if the player is register correctly - */ - @Deprecated - public static boolean registerPlayer(String playerName, String password) { - try { - String name = playerName.toLowerCase(); - String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); - if (isRegistered(name)) { - return false; - } - PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com"); - if (!instance.database.saveAuth(auth)) { - return false; - } - return true; - } catch (NoSuchAlgorithmException ex) { - return false; - } - } - - /** - * Force a player to login - * - * @param Player - * player - */ - @Deprecated - public static void forceLogin(Player player) { - instance.management.performLogin(player, "dontneed", true); - } - -} +package fr.xephi.authme.api; + +import java.security.NoSuchAlgorithmException; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +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.security.PasswordSecurity; +import fr.xephi.authme.settings.Settings; + +public class API { + + public static final String newline = System.getProperty("line.separator"); + public static AuthMe instance; + + @Deprecated + public API(AuthMe instance) { + API.instance = instance; + } + + /** + * Hook into AuthMe + * + * @return AuthMe instance + */ + @Deprecated + public static AuthMe hookAuthMe() { + if (instance != null) + return instance; + Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe"); + if (plugin == null || !(plugin instanceof AuthMe)) { + return null; + } + instance = (AuthMe) plugin; + return instance; + } + + @Deprecated + public AuthMe getPlugin() { + return instance; + } + + /** + * + * @param player + * @return true if player is authenticate + */ + @Deprecated + public static boolean isAuthenticated(Player player) { + return PlayerCache.getInstance().isAuthenticated(player.getName()); + } + + /** + * + * @param player + * @return true if player is a npc + */ + @Deprecated + public boolean isaNPC(Player player) { + return Utils.isNPC(player); + } + + /** + * + * @param player + * @return true if player is a npc + */ + @Deprecated + public boolean isNPC(Player player) { + return Utils.isNPC(player); + } + + /** + * + * @param player + * @return true if the player is unrestricted + */ + @Deprecated + public static boolean isUnrestricted(Player player) { + return Utils.isUnrestricted(player); + } + + @Deprecated + public static Location getLastLocation(Player player) { + try { + PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase()); + + if (auth != null) { + Location loc = new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ()); + return loc; + } else { + return null; + } + + } catch (NullPointerException ex) { + return null; + } + } + + @Deprecated + public static void setPlayerInventory(Player player, ItemStack[] content, + ItemStack[] armor) { + try { + player.getInventory().setContents(content); + player.getInventory().setArmorContents(armor); + } catch (NullPointerException npe) { + } + } + + /** + * + * @param playerName + * @return true if player is registered + */ + @Deprecated + public static boolean isRegistered(String playerName) { + String player = playerName.toLowerCase(); + return instance.database.isAuthAvailable(player); + } + + /** + * @param String + * playerName, String passwordToCheck + * @return true if the password is correct , false else + */ + @Deprecated + public static boolean checkPassword(String playerName, + String passwordToCheck) { + if (!isRegistered(playerName)) + return false; + String player = playerName.toLowerCase(); + PlayerAuth auth = instance.database.getAuth(player); + try { + return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName); + } catch (NoSuchAlgorithmException e) { + return false; + } + } + + /** + * Register a player + * + * @param String + * playerName, String password + * @return true if the player is register correctly + */ + @Deprecated + public static boolean registerPlayer(String playerName, String password) { + try { + String name = playerName.toLowerCase(); + String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); + if (isRegistered(name)) { + return false; + } + PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com", playerName); + if (!instance.database.saveAuth(auth)) { + return false; + } + return true; + } catch (NoSuchAlgorithmException ex) { + return false; + } + } + + /** + * Force a player to login + * + * @param Player + * player + */ + @Deprecated + public static void forceLogin(Player player) { + instance.management.performLogin(player, "dontneed", true); + } + +} diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index ab7d7cb4..4a6eb301 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -1,153 +1,153 @@ -package fr.xephi.authme.api; - -import java.security.NoSuchAlgorithmException; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -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.security.PasswordSecurity; -import fr.xephi.authme.settings.Settings; - -public class NewAPI { - - public static final String newline = System.getProperty("line.separator"); - public static NewAPI singleton; - public AuthMe plugin; - - public NewAPI(AuthMe plugin) { - this.plugin = plugin; - } - - public NewAPI(Server serv) { - this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe"); - } - - /** - * Hook into AuthMe - * - * @return AuthMe plugin - */ - public static NewAPI getInstance() { - if (singleton != null) - return singleton; - Plugin p = Bukkit.getServer().getPluginManager().getPlugin("AuthMe"); - if (p == null || !(p instanceof AuthMe)) { - return null; - } - AuthMe authme = (AuthMe) p; - singleton = (new NewAPI(authme)); - return singleton; - } - - public AuthMe getPlugin() { - return plugin; - } - - /** - * - * @param player - * @return true if player is authenticate - */ - public boolean isAuthenticated(Player player) { - return PlayerCache.getInstance().isAuthenticated(player.getName()); - } - - /** - * - * @param player - * @return true if player is a npc - */ - public boolean isNPC(Player player) { - return Utils.isNPC(player); - } - - /** - * - * @param player - * @return true if the player is unrestricted - */ - public boolean isUnrestricted(Player player) { - return Utils.isUnrestricted(player); - } - - public Location getLastLocation(Player player) { - try { - PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase()); - - if (auth != null) { - return new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ()); - } else { - return null; - } - - } catch (NullPointerException ex) { - return null; - } - } - - /** - * - * @param playerName - * @return true if player is registered - */ - public boolean isRegistered(String playerName) { - String player = playerName.toLowerCase(); - return plugin.database.isAuthAvailable(player); - } - - /** - * @param String - * playerName, String passwordToCheck - * @return true if the password is correct , false else - */ - public boolean checkPassword(String playerName, String passwordToCheck) { - if (!isRegistered(playerName)) - return false; - String player = playerName.toLowerCase(); - PlayerAuth auth = plugin.database.getAuth(player); - try { - return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName); - } catch (NoSuchAlgorithmException e) { - return false; - } - } - - /** - * Register a player - * - * @param String - * playerName, String password - * @return true if the player is register correctly - */ - public boolean registerPlayer(String playerName, String password) { - try { - String name = playerName.toLowerCase(); - String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); - if (isRegistered(name)) { - return false; - } - PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com"); - return plugin.database.saveAuth(auth); - } catch (NoSuchAlgorithmException ex) { - return false; - } - } - - /** - * Force a player to login - * - * @param Player - * player - */ - public void forceLogin(Player player) { - plugin.management.performLogin(player, "dontneed", true); - } - -} +package fr.xephi.authme.api; + +import java.security.NoSuchAlgorithmException; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +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.security.PasswordSecurity; +import fr.xephi.authme.settings.Settings; + +public class NewAPI { + + public static final String newline = System.getProperty("line.separator"); + public static NewAPI singleton; + public AuthMe plugin; + + public NewAPI(AuthMe plugin) { + this.plugin = plugin; + } + + public NewAPI(Server serv) { + this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe"); + } + + /** + * Hook into AuthMe + * + * @return AuthMe plugin + */ + public static NewAPI getInstance() { + if (singleton != null) + return singleton; + Plugin p = Bukkit.getServer().getPluginManager().getPlugin("AuthMe"); + if (p == null || !(p instanceof AuthMe)) { + return null; + } + AuthMe authme = (AuthMe) p; + singleton = (new NewAPI(authme)); + return singleton; + } + + public AuthMe getPlugin() { + return plugin; + } + + /** + * + * @param player + * @return true if player is authenticate + */ + public boolean isAuthenticated(Player player) { + return PlayerCache.getInstance().isAuthenticated(player.getName()); + } + + /** + * + * @param player + * @return true if player is a npc + */ + public boolean isNPC(Player player) { + return Utils.isNPC(player); + } + + /** + * + * @param player + * @return true if the player is unrestricted + */ + public boolean isUnrestricted(Player player) { + return Utils.isUnrestricted(player); + } + + public Location getLastLocation(Player player) { + try { + PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase()); + + if (auth != null) { + return new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ()); + } else { + return null; + } + + } catch (NullPointerException ex) { + return null; + } + } + + /** + * + * @param playerName + * @return true if player is registered + */ + public boolean isRegistered(String playerName) { + String player = playerName.toLowerCase(); + return plugin.database.isAuthAvailable(player); + } + + /** + * @param String + * playerName, String passwordToCheck + * @return true if the password is correct , false else + */ + public boolean checkPassword(String playerName, String passwordToCheck) { + if (!isRegistered(playerName)) + return false; + String player = playerName.toLowerCase(); + PlayerAuth auth = plugin.database.getAuth(player); + try { + return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName); + } catch (NoSuchAlgorithmException e) { + return false; + } + } + + /** + * Register a player + * + * @param String + * playerName, String password + * @return true if the player is register correctly + */ + public boolean registerPlayer(String playerName, String password) { + try { + String name = playerName.toLowerCase(); + String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); + if (isRegistered(name)) { + return false; + } + PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com", playerName); + return plugin.database.saveAuth(auth); + } catch (NoSuchAlgorithmException ex) { + return false; + } + } + + /** + * Force a player to login + * + * @param Player + * player + */ + public void forceLogin(Player player) { + plugin.management.performLogin(player, "dontneed", true); + } + +} diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index eab60353..573d956f 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -260,7 +260,7 @@ public class AdminCommand implements CommandExecutor { return; } String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name); - PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com"); + PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com", name); if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) auth.setSalt(PasswordSecurity.userSalt.get(name)); else auth.setSalt(""); diff --git a/src/main/java/fr/xephi/authme/commands/EmailCommand.java b/src/main/java/fr/xephi/authme/commands/EmailCommand.java index b81627ed..241d543d 100644 --- a/src/main/java/fr/xephi/authme/commands/EmailCommand.java +++ b/src/main/java/fr/xephi/authme/commands/EmailCommand.java @@ -173,12 +173,9 @@ public class EmailCommand implements CommandExecutor { plugin.database.updatePassword(auth); plugin.mail.main(auth, thePass); m.send(player, "email_send"); - } catch (NoSuchAlgorithmException ex) { + } catch (NoSuchAlgorithmException | NoClassDefFoundError ex) { ConsoleLogger.showError(ex.getMessage()); m.send(sender, "error"); - } catch (NoClassDefFoundError ncdfe) { - ConsoleLogger.showError(ncdfe.getMessage()); - m.send(sender, "error"); } } else { m.send(player, "reg_email_msg"); diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index 7ba5742a..c598f518 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -49,10 +49,10 @@ public class CrazyLoginConverter implements Converter { continue; if (args[0].equalsIgnoreCase("name")) continue; - String player = args[0].toLowerCase(); + String playerName = args[0].toLowerCase(); String psw = args[1]; if (psw != null) { - PlayerAuth auth = new PlayerAuth(player, psw, "127.0.0.1", System.currentTimeMillis(), player); + PlayerAuth auth = new PlayerAuth(playerName, psw, "127.0.0.1", System.currentTimeMillis(), playerName); database.saveAuth(auth); } } diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index 3f8cc0c0..b2ddf704 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -74,17 +74,17 @@ public class RakamakConverter implements Converter { } users.close(); for (Entry m : playerPSW.entrySet()) { - String player = m.getKey(); - String psw = playerPSW.get(player); + String playerName = m.getKey(); + String psw = playerPSW.get(playerName); String ip; if (useIP) { - ip = playerIP.get(player); + ip = playerIP.get(playerName); } else { ip = "127.0.0.1"; } - PlayerAuth auth = new PlayerAuth(player, psw, ip, System.currentTimeMillis(), player); - if (PasswordSecurity.userSalt.containsKey(player)) - auth.setSalt(PasswordSecurity.userSalt.get(player)); + PlayerAuth auth = new PlayerAuth(playerName, psw, ip, System.currentTimeMillis(), playerName); + if (PasswordSecurity.userSalt.containsKey(playerName)) + auth.setSalt(PasswordSecurity.userSalt.get(playerName)); database.saveAuth(auth); } ConsoleLogger.info("Rakamak database has been imported correctly"); diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java index 78a32aee..4af9f1bd 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java @@ -30,7 +30,7 @@ public class RoyalAuthConverter implements Converter { if (!file.exists()) continue; RoyalAuthYamlReader ra = new RoyalAuthYamlReader(file); - PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com"); + PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com", o.getName()); data.saveAuth(auth); } catch (Exception e) { ConsoleLogger.writeStackTrace(e); diff --git a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java index 0fb2c73e..4a193e15 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java @@ -44,9 +44,9 @@ public class vAuthFileReader { } if (pname == null) continue; - auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com"); + auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", pname); } else { - auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com"); + auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", name); } database.saveAuth(auth); } diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index 0c6d62fd..d9823562 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -47,7 +47,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, "192.168.0.1", 0, "your@email.com"); + PlayerAuth auth = new PlayerAuth(pl, psw, "192.168.0.1", 0, "your@email.com", pl); database.saveAuth(auth); } } diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 22fee78c..0f3872b4 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -1,751 +1,750 @@ -package fr.xephi.authme.datasource; - -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.Settings; - -import java.io.*; -import java.util.ArrayList; -import java.util.List; - -public class FlatFile implements DataSource { - - /* - * file layout: - * - * PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ: - * LASTPOSWORLD:EMAIL - * - * Old but compatible: - * PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY - * :LASTPOSZ:LASTPOSWORLD PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS - * PLAYERNAME:HASHSUM:IP PLAYERNAME:HASHSUM - */ - private File source; - - public FlatFile() { - source = Settings.AUTH_FILE; - try { - source.createNewFile(); - } catch (IOException e) { - ConsoleLogger.showError(e.getMessage()); - if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use FLAT FILE... SHUTDOWN..."); - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) { - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - e.printStackTrace(); - } - } - - @Override - public synchronized boolean isAuthAvailable(String user) { - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length > 1 && args[0].equalsIgnoreCase(user)) { - return true; - } - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - return false; - } - - @Override - public synchronized boolean saveAuth(PlayerAuth auth) { - if (isAuthAvailable(auth.getNickname())) { - return false; - } - BufferedWriter bw = null; - try { - bw = new BufferedWriter(new FileWriter(source, true)); - bw.write(auth.getNickname() + ":" + auth.getHash() + ":" + auth.getIp() + ":" + auth.getLastLogin() + ":" + auth.getQuitLocX() + ":" + auth.getQuitLocY() + ":" + auth.getQuitLocZ() + ":" + auth.getWorld() + ":" + auth.getEmail() + "\n"); - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - if (bw != null) { - try { - bw.close(); - } catch (IOException ex) { - } - } - } - return true; - } - - @Override - public synchronized boolean updatePassword(PlayerAuth auth) { - if (!isAuthAvailable(auth.getNickname())) { - return false; - } - PlayerAuth newAuth = null; - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args[0].equals(auth.getNickname())) { - switch (args.length) { - case 4: { - newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), 0, 0, 0, "world", "your@email.com", args[0]); - break; - } - case 7: { - newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", args[0]); - break; - } - case 8: { - newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0]); - break; - } - case 9: { - newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0]); - break; - } - default: { - newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0, 0, 0, "world", "your@email.com", args[0]); - break; - } - } - break; - } - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - if (newAuth != null) { - removeAuth(auth.getNickname()); - saveAuth(newAuth); - } - return true; - } - - @Override - public boolean updateSession(PlayerAuth auth) { - if (!isAuthAvailable(auth.getNickname())) { - return false; - } - PlayerAuth newAuth = null; - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args[0].equalsIgnoreCase(auth.getNickname())) { - switch (args.length) { - case 4: { - newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", args[0]); - break; - } - case 7: { - newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", args[0]); - break; - } - case 8: { - newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0]); - break; - } - case 9: { - newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0]); - break; - } - default: { - newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", args[0]); - break; - } - } - break; - } - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - if (newAuth != null) { - removeAuth(auth.getNickname()); - saveAuth(newAuth); - } - return true; - } - - @Override - public boolean updateQuitLoc(PlayerAuth auth) { - if (!isAuthAvailable(auth.getNickname())) { - return false; - } - PlayerAuth newAuth = null; - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args[0].equalsIgnoreCase(auth.getNickname())) { - newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), auth.getEmail(), args[0]); - break; - } - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - if (newAuth != null) { - removeAuth(auth.getNickname()); - saveAuth(newAuth); - } - return true; - } - - @Override - public int getIps(String ip) { - BufferedReader br = null; - int countIp = 0; - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length > 3 && args[2].equals(ip)) { - countIp++; - } - } - return countIp; - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return 0; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return 0; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - } - - @Override - public int purgeDatabase(long until) { - BufferedReader br = null; - BufferedWriter bw = null; - ArrayList lines = new ArrayList(); - int cleared = 0; - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length >= 4) { - if (Long.parseLong(args[3]) >= until) { - lines.add(line); - continue; - } - } - cleared++; - } - bw = new BufferedWriter(new FileWriter(source)); - for (String l : lines) { - bw.write(l + "\n"); - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return cleared; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return cleared; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - if (bw != null) { - try { - bw.close(); - } catch (IOException ex) { - } - } - } - return cleared; - } - - @Override - public List autoPurgeDatabase(long until) { - BufferedReader br = null; - BufferedWriter bw = null; - ArrayList lines = new ArrayList(); - List cleared = new ArrayList(); - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length >= 4) { - if (Long.parseLong(args[3]) >= until) { - lines.add(line); - continue; - } - } - cleared.add(args[0]); - } - bw = new BufferedWriter(new FileWriter(source)); - for (String l : lines) { - bw.write(l + "\n"); - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return cleared; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return cleared; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - if (bw != null) { - try { - bw.close(); - } catch (IOException ex) { - } - } - } - return cleared; - } - - @Override - public synchronized boolean removeAuth(String user) { - if (!isAuthAvailable(user)) { - return false; - } - BufferedReader br = null; - BufferedWriter bw = null; - ArrayList lines = new ArrayList(); - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length > 1 && !args[0].equals(user)) { - lines.add(line); - } - } - bw = new BufferedWriter(new FileWriter(source)); - for (String l : lines) { - bw.write(l + "\n"); - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - if (bw != null) { - try { - bw.close(); - } catch (IOException ex) { - } - } - } - return true; - } - - @Override - public synchronized PlayerAuth getAuth(String user) { - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args[0].equalsIgnoreCase(user)) { - switch (args.length) { - case 2: - return new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com", args[0]); - case 3: - return new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com", args[0]); - case 4: - return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", args[0]); - case 7: - return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "unavailableworld", "your@email.com", args[0]); - case 8: - return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0]); - case 9: - return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0]); - } - } - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return null; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return null; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - return null; - } - - @Override - public synchronized void close() { - } - - @Override - public void reload() { - } - - @Override - public boolean updateEmail(PlayerAuth auth) { - if (!isAuthAvailable(auth.getNickname())) { - return false; - } - PlayerAuth newAuth = null; - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(source)); - String line = ""; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args[0].equals(auth.getNickname())) { - newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], auth.getEmail(), args[0]); - break; - } - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - if (newAuth != null) { - removeAuth(auth.getNickname()); - saveAuth(newAuth); - } - return true; - } - - @Override - public boolean updateSalt(PlayerAuth auth) { - return false; - } - - @Override - public List getAllAuthsByName(PlayerAuth auth) { - BufferedReader br = null; - List countIp = new ArrayList(); - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length > 3 && args[2].equals(auth.getIp())) { - countIp.add(args[0]); - } - } - return countIp; - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - } - - @Override - public List getAllAuthsByIp(String ip) { - BufferedReader br = null; - List countIp = new ArrayList(); - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length > 3 && args[2].equals(ip)) { - countIp.add(args[0]); - } - } - return countIp; - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - } - - @Override - public List getAllAuthsByEmail(String email) { - BufferedReader br = null; - List countEmail = new ArrayList(); - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - if (args.length > 8 && args[8].equals(email)) { - countEmail.add(args[0]); - } - } - return countEmail; - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList(); - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - } - - @Override - public void purgeBanned(List banned) { - BufferedReader br = null; - BufferedWriter bw = null; - ArrayList lines = new ArrayList(); - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - try { - if (banned.contains(args[0])) { - lines.add(line); - } - } catch (NullPointerException npe) { - } catch (ArrayIndexOutOfBoundsException aioobe) { - } - } - bw = new BufferedWriter(new FileWriter(source)); - for (String l : lines) { - bw.write(l + "\n"); - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - if (bw != null) { - try { - bw.close(); - } catch (IOException ex) { - } - } - } - return; - } - - @Override - public DataSourceType getType() { - return DataSourceType.FILE; - } - - @Override - public boolean isLogged(String user) { - return PlayerCache.getInstance().isAuthenticated(user); - } - - @Override - public void setLogged(String user) { - } - - @Override - public void setUnlogged(String user) { - } - - @Override - public void purgeLogged() { - } - - @Override - public int getAccountsRegistered() { - BufferedReader br = null; - int result = 0; - try { - br = new BufferedReader(new FileReader(source)); - while ((br.readLine()) != null) { - result++; - } - } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); - return result; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - return result; - } - - @Override - public void updateName(String oldone, String newone) { - PlayerAuth auth = this.getAuth(oldone); - auth.setName(newone); - this.saveAuth(auth); - this.removeAuth(oldone); - } - - @Override - public List getAllAuths() { - BufferedReader br = null; - List auths = new ArrayList(); - try { - br = new BufferedReader(new FileReader(source)); - String line; - while ((line = br.readLine()) != null) { - String[] args = line.split(":"); - switch (args.length) { - case 2: - auths.add(new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com", args[0])); - break; - case 3: - auths.add(new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com", args[0])); - break; - case 4: - auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", args[0])); - break; - case 7: - auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "unavailableworld", "your@email.com", args[0])); - break; - case 8: - auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0])); - break; - case 9: - auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0])); - break; - } - } - } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); - return auths; - } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); - return auths; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - } - } - } - return auths; - } - - @Override - public List getLoggedPlayers() { - return new ArrayList(); - } -} +package fr.xephi.authme.datasource; + +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.Settings; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; + +public class FlatFile implements DataSource { + + /* + * file layout: + * + * PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ: + * LASTPOSWORLD:EMAIL + * + * Old but compatible: + * PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY + * :LASTPOSZ:LASTPOSWORLD PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS + * PLAYERNAME:HASHSUM:IP PLAYERNAME:HASHSUM + */ + private File source; + + public FlatFile() { + source = Settings.AUTH_FILE; + try { + source.createNewFile(); + } catch (IOException e) { + ConsoleLogger.showError(e.getMessage()); + if (Settings.isStopEnabled) { + ConsoleLogger.showError("Can't use FLAT FILE... SHUTDOWN..."); + AuthMe.getInstance().getServer().shutdown(); + } + if (!Settings.isStopEnabled) { + AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); + } + e.printStackTrace(); + } + } + + @Override + public synchronized boolean isAuthAvailable(String user) { + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length > 1 && args[0].equalsIgnoreCase(user)) { + return true; + } + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + return false; + } + + @Override + public synchronized boolean saveAuth(PlayerAuth auth) { + if (isAuthAvailable(auth.getNickname())) { + return false; + } + BufferedWriter bw = null; + try { + bw = new BufferedWriter(new FileWriter(source, true)); + bw.write(auth.getNickname() + ":" + auth.getHash() + ":" + auth.getIp() + ":" + auth.getLastLogin() + ":" + auth.getQuitLocX() + ":" + auth.getQuitLocY() + ":" + auth.getQuitLocZ() + ":" + auth.getWorld() + ":" + auth.getEmail() + "\n"); + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } finally { + if (bw != null) { + try { + bw.close(); + } catch (IOException ex) { + } + } + } + return true; + } + + @Override + public synchronized boolean updatePassword(PlayerAuth auth) { + if (!isAuthAvailable(auth.getNickname())) { + return false; + } + PlayerAuth newAuth = null; + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args[0].equals(auth.getNickname())) { + switch (args.length) { + case 4: { + newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), 0, 0, 0, "world", "your@email.com", args[0]); + break; + } + case 7: { + newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", args[0]); + break; + } + case 8: { + newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0]); + break; + } + case 9: { + newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0]); + break; + } + default: { + newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0, 0, 0, "world", "your@email.com", args[0]); + break; + } + } + break; + } + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + if (newAuth != null) { + removeAuth(auth.getNickname()); + saveAuth(newAuth); + } + return true; + } + + @Override + public boolean updateSession(PlayerAuth auth) { + if (!isAuthAvailable(auth.getNickname())) { + return false; + } + PlayerAuth newAuth = null; + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args[0].equalsIgnoreCase(auth.getNickname())) { + switch (args.length) { + case 4: { + newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", args[0]); + break; + } + case 7: { + newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", args[0]); + break; + } + case 8: { + newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0]); + break; + } + case 9: { + newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0]); + break; + } + default: { + newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", args[0]); + break; + } + } + break; + } + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + if (newAuth != null) { + removeAuth(auth.getNickname()); + saveAuth(newAuth); + } + return true; + } + + @Override + public boolean updateQuitLoc(PlayerAuth auth) { + if (!isAuthAvailable(auth.getNickname())) { + return false; + } + PlayerAuth newAuth = null; + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args[0].equalsIgnoreCase(auth.getNickname())) { + newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), auth.getEmail(), args[0]); + break; + } + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + if (newAuth != null) { + removeAuth(auth.getNickname()); + saveAuth(newAuth); + } + return true; + } + + @Override + public int getIps(String ip) { + BufferedReader br = null; + int countIp = 0; + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length > 3 && args[2].equals(ip)) { + countIp++; + } + } + return countIp; + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return 0; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return 0; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + } + + @Override + public int purgeDatabase(long until) { + BufferedReader br = null; + BufferedWriter bw = null; + ArrayList lines = new ArrayList<>(); + int cleared = 0; + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length >= 4) { + if (Long.parseLong(args[3]) >= until) { + lines.add(line); + continue; + } + } + cleared++; + } + bw = new BufferedWriter(new FileWriter(source)); + for (String l : lines) { + bw.write(l + "\n"); + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return cleared; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return cleared; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + if (bw != null) { + try { + bw.close(); + } catch (IOException ex) { + } + } + } + return cleared; + } + + @Override + public List autoPurgeDatabase(long until) { + BufferedReader br = null; + BufferedWriter bw = null; + ArrayList lines = new ArrayList<>(); + List cleared = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length >= 4) { + if (Long.parseLong(args[3]) >= until) { + lines.add(line); + continue; + } + } + cleared.add(args[0]); + } + bw = new BufferedWriter(new FileWriter(source)); + for (String l : lines) { + bw.write(l + "\n"); + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return cleared; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return cleared; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + if (bw != null) { + try { + bw.close(); + } catch (IOException ex) { + } + } + } + return cleared; + } + + @Override + public synchronized boolean removeAuth(String user) { + if (!isAuthAvailable(user)) { + return false; + } + BufferedReader br = null; + BufferedWriter bw = null; + ArrayList lines = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length > 1 && !args[0].equals(user)) { + lines.add(line); + } + } + bw = new BufferedWriter(new FileWriter(source)); + for (String l : lines) { + bw.write(l + "\n"); + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + if (bw != null) { + try { + bw.close(); + } catch (IOException ex) { + } + } + } + return true; + } + + @Override + public synchronized PlayerAuth getAuth(String user) { + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args[0].equalsIgnoreCase(user)) { + switch (args.length) { + case 2: + return new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com", args[0]); + case 3: + return new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com", args[0]); + case 4: + return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", args[0]); + case 7: + return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "unavailableworld", "your@email.com", args[0]); + case 8: + return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0]); + case 9: + return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0]); + } + } + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return null; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return null; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + return null; + } + + @Override + public synchronized void close() { + } + + @Override + public void reload() { + } + + @Override + public boolean updateEmail(PlayerAuth auth) { + if (!isAuthAvailable(auth.getNickname())) { + return false; + } + PlayerAuth newAuth = null; + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(source)); + String line = ""; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args[0].equals(auth.getNickname())) { + newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], auth.getEmail(), args[0]); + break; + } + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return false; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + if (newAuth != null) { + removeAuth(auth.getNickname()); + saveAuth(newAuth); + } + return true; + } + + @Override + public boolean updateSalt(PlayerAuth auth) { + return false; + } + + @Override + public List getAllAuthsByName(PlayerAuth auth) { + BufferedReader br = null; + List countIp = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length > 3 && args[2].equals(auth.getIp())) { + countIp.add(args[0]); + } + } + return countIp; + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return new ArrayList<>(); + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return new ArrayList<>(); + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + } + + @Override + public List getAllAuthsByIp(String ip) { + BufferedReader br = null; + List countIp = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length > 3 && args[2].equals(ip)) { + countIp.add(args[0]); + } + } + return countIp; + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return new ArrayList<>(); + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return new ArrayList<>(); + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + } + + @Override + public List getAllAuthsByEmail(String email) { + BufferedReader br = null; + List countEmail = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + if (args.length > 8 && args[8].equals(email)) { + countEmail.add(args[0]); + } + } + return countEmail; + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return new ArrayList<>(); + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return new ArrayList<>(); + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + } + + @Override + public void purgeBanned(List banned) { + BufferedReader br = null; + BufferedWriter bw = null; + ArrayList lines = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + try { + if (banned.contains(args[0])) { + lines.add(line); + } + } catch (NullPointerException | ArrayIndexOutOfBoundsException exc) { + } + } + bw = new BufferedWriter(new FileWriter(source)); + for (String l : lines) { + bw.write(l + "\n"); + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + if (bw != null) { + try { + bw.close(); + } catch (IOException ex) { + } + } + } + return; + } + + @Override + public DataSourceType getType() { + return DataSourceType.FILE; + } + + @Override + public boolean isLogged(String user) { + return PlayerCache.getInstance().isAuthenticated(user); + } + + @Override + public void setLogged(String user) { + } + + @Override + public void setUnlogged(String user) { + } + + @Override + public void purgeLogged() { + } + + @Override + public int getAccountsRegistered() { + BufferedReader br = null; + int result = 0; + try { + br = new BufferedReader(new FileReader(source)); + while ((br.readLine()) != null) { + result++; + } + } catch (Exception ex) { + ConsoleLogger.showError(ex.getMessage()); + return result; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + return result; + } + + @Override + public void updateName(String oldone, String newone) { + PlayerAuth auth = this.getAuth(oldone); + auth.setName(newone); + this.saveAuth(auth); + this.removeAuth(oldone); + } + + @Override + public List getAllAuths() { + BufferedReader br = null; + List auths = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(source)); + String line; + while ((line = br.readLine()) != null) { + String[] args = line.split(":"); + switch (args.length) { + case 2: + auths.add(new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com", args[0])); + break; + case 3: + auths.add(new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com", args[0])); + break; + case 4: + auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", args[0])); + break; + case 7: + auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "unavailableworld", "your@email.com", args[0])); + break; + case 8: + auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", args[0])); + break; + case 9: + auths.add(new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], args[0])); + break; + } + } + } catch (FileNotFoundException ex) { + ConsoleLogger.showError(ex.getMessage()); + return auths; + } catch (IOException ex) { + ConsoleLogger.showError(ex.getMessage()); + return auths; + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + } + } + } + return auths; + } + + @Override + public List getLoggedPlayers() { + return new ArrayList<>(); + } +} diff --git a/src/main/java/fr/xephi/authme/plugin/manager/EssSpawn.java b/src/main/java/fr/xephi/authme/plugin/manager/EssSpawn.java index 673d7450..cd422b48 100644 --- a/src/main/java/fr/xephi/authme/plugin/manager/EssSpawn.java +++ b/src/main/java/fr/xephi/authme/plugin/manager/EssSpawn.java @@ -32,9 +32,7 @@ public class EssSpawn extends CustomConfiguration { return null; Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch"))); return location; - } catch (NullPointerException npe) { - return null; - } catch (NumberFormatException nfe) { + } catch (NullPointerException | NumberFormatException npe) { return null; } } diff --git a/src/main/java/fr/xephi/authme/security/crypts/PHPFUSION.java b/src/main/java/fr/xephi/authme/security/crypts/PHPFUSION.java index d9f50084..25d9897b 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/PHPFUSION.java +++ b/src/main/java/fr/xephi/authme/security/crypts/PHPFUSION.java @@ -33,10 +33,10 @@ public class PHPFUSION implements EncryptionMethod { hash.append(hex); } digest = hash.toString(); - } catch (UnsupportedEncodingException e) { - } catch (InvalidKeyException e) { - } catch (NoSuchAlgorithmException e) { + } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { + //ingore } + return digest; } diff --git a/src/main/java/fr/xephi/authme/security/crypts/XF.java b/src/main/java/fr/xephi/authme/security/crypts/XF.java index 54ba7035..b6ad9bde 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/XF.java +++ b/src/main/java/fr/xephi/authme/security/crypts/XF.java @@ -44,7 +44,7 @@ public class XF implements EncryptionMethod { } public String regmatch(String pattern, String line) { - List allMatches = new ArrayList(); + List allMatches = new ArrayList<>(); Matcher m = Pattern.compile(pattern).matcher(line); while (m.find()) { allMatches.add(m.group(1)); diff --git a/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java b/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java index 27f8bc0c..b7d80382 100644 --- a/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java +++ b/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java @@ -9,7 +9,7 @@ import javax.crypto.spec.SecretKeySpec; /** * Default PRF implementation based on standard javax.crypt.Mac mechanisms. - * + * *
    *

    * A free Java implementation of Password Based Key Derivation Function 2 as @@ -37,7 +37,7 @@ import javax.crypto.spec.SecretKeySpec; * href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" * >http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. *

    - * + * * @author Matthias Gärtner * @version 1.0 */ @@ -51,7 +51,7 @@ public class MacBasedPRF implements PRF { /** * Create Mac-based Pseudo Random Function. - * + * * @param macAlgorithm * Mac algorithm to use, i.e. HMacSHA1 or HMacMD5. */ @@ -70,9 +70,7 @@ public class MacBasedPRF implements PRF { try { mac = Mac.getInstance(macAlgorithm, provider); hLen = mac.getMacLength(); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } catch (NoSuchProviderException e) { + } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw new RuntimeException(e); } } diff --git a/src/main/java/fr/xephi/authme/settings/OtherAccounts.java b/src/main/java/fr/xephi/authme/settings/OtherAccounts.java index 4da7b677..697104d4 100644 --- a/src/main/java/fr/xephi/authme/settings/OtherAccounts.java +++ b/src/main/java/fr/xephi/authme/settings/OtherAccounts.java @@ -44,8 +44,8 @@ public class OtherAccounts extends CustomConfiguration { this.getStringList(uuid.toString()).add(player.getName()); save(); } - } catch (NoSuchMethodError e) { - } catch (Exception e) { + } catch (NoSuchMethodError | Exception e) { + //ingore } } @@ -58,10 +58,9 @@ public class OtherAccounts extends CustomConfiguration { this.getStringList(uuid.toString()).remove(player.getName()); save(); } - } catch (NoSuchMethodError e) { - } catch (Exception e) { + } catch (NoSuchMethodError | Exception e) { + //ignore } - } public List getAllPlayersByUUID(UUID uuid) { diff --git a/src/main/java/fr/xephi/authme/settings/Spawn.java b/src/main/java/fr/xephi/authme/settings/Spawn.java index 6827387a..81b0891e 100644 --- a/src/main/java/fr/xephi/authme/settings/Spawn.java +++ b/src/main/java/fr/xephi/authme/settings/Spawn.java @@ -90,9 +90,7 @@ public class Spawn extends CustomConfiguration { return null; Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch"))); return location; - } catch (NullPointerException npe) { - return null; - } catch (NumberFormatException nfe) { + } catch (NullPointerException | NumberFormatException npe) { return null; } } @@ -103,9 +101,7 @@ public class Spawn extends CustomConfiguration { return null; Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch"))); return location; - } catch (NullPointerException npe) { - return null; - } catch (NumberFormatException nfe) { + } catch (NullPointerException | NumberFormatException npe) { return null; } } From c8b13184491a01c25a3a60d65f93c70bd05ea9a5 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sat, 3 Oct 2015 23:00:00 +0200 Subject: [PATCH 248/427] Update AuthMePlayerListener.java --- src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 6da8fb9d..5c213820 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -271,6 +271,7 @@ public class AuthMePlayerListener implements Listener { } } + // TODO: Add message to the messages file!!! if (Settings.antiBotInAction) { if (!isAuthAvailable) { event.setKickMessage("AntiBot service in action! You actually need to be registered!"); From 33d897ea376609b72bcf2fd3f10a91204892c9aa Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sat, 3 Oct 2015 23:08:11 +0200 Subject: [PATCH 249/427] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a8a92d1..056700d3 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,6 @@ GameHosting.it is leader in Italy as Game Server Provider. With its own DataCent [![GameHosting](http://www.gamehosting.it/images/bn3.png)](http://www.gamehosting.it) #####Credits -

    Team members: Xephi(Main Developer, Author), Maxetto(Contributor) and sgdc3(Contributor) +

    Team members: look at the team.txt file

    Credit for old version of the plugin to: d4rkwarriors, fabe1337 , Whoami2 and pomo4ka

    Thanks also to: AS1LV3RN1NJA, Hoeze and eprimex

    From 06e098ab392d496e400ab946300bb90b983d350d Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sun, 4 Oct 2015 02:02:45 +0200 Subject: [PATCH 250/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index efabc5de..5611fec6 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -192,9 +192,6 @@ public class AuthMe extends JavaPlugin { // Check Multiverse checkMultiverse(); - // Check PerWorldInventories Version - checkPerWorldInventories(); - // Check ChestShop checkChestShop(); @@ -456,25 +453,6 @@ public class AuthMe extends JavaPlugin { } } - // Check PerWorldInventories version - public void checkPerWorldInventories() { - if (server.getPluginManager().isPluginEnabled("PerWorldInventories")) { - double version = 0; - String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); - try { - version = Double.valueOf(ver.split(" ")[0]); - } catch (NumberFormatException nfe) { - try { - version = Double.valueOf(ver.split("t")[0]); - } catch (NumberFormatException ignore) { - } - } - if (version < 1.57) { - ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); - } - } - } - // Get the Multiverse plugin public void checkMultiverse() { if (Settings.multiverse && server.getPluginManager().isPluginEnabled("Multiverse-Core")) { From 8bda788a783475d3133e6932e0da9080fad71fc2 Mon Sep 17 00:00:00 2001 From: games647 Date: Sun, 4 Oct 2015 10:49:17 +0200 Subject: [PATCH 251/427] Improve performance by correct order of some checks. (i.e. check if the minor things before making a blocking call instead of reverse order) --- src/main/java/fr/xephi/authme/Utils.java | 7 ++- .../authme/listener/AuthMePlayerListener.java | 47 ++++++------------- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 70171dc0..2a9e8c6e 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -175,15 +175,18 @@ public class Utils { if (player == null || Utils.isUnrestricted(player)) { return true; } + String name = player.getName().toLowerCase(); if (PlayerCache.getInstance().isAuthenticated(name)) { return true; } - if (!plugin.database.isAuthAvailable(name)) { - if (!Settings.isForcedRegistrationEnabled) { + + if (!Settings.isForcedRegistrationEnabled) { + if (!plugin.database.isAuthAvailable(name)) { return true; } } + return false; } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 5c213820..900a01cf 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -9,7 +9,6 @@ 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.cache.limbo.LimboPlayer; -import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import org.bukkit.Bukkit; @@ -66,9 +65,6 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - if (Utils.checkAuth(event.getPlayer())) - return; - String msg = event.getMessage(); if (msg.equalsIgnoreCase("/worldedit cui")) return; @@ -81,8 +77,10 @@ public class AuthMePlayerListener implements Listener { if (Settings.allowCommands.contains(cmd)) return; - event.setMessage("/notloggedin"); - event.setCancelled(true); + if (!Utils.checkAuth(event.getPlayer())) { + event.setMessage("/notloggedin"); + event.setCancelled(true); + } } @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) @@ -246,48 +244,34 @@ public class AuthMePlayerListener implements Listener { if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) return; - if (!Settings.countriesBlacklist.isEmpty()) { + if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable + && !plugin.authmePermissible(player, "authme.bypassantibot")) { String code = Utils.getCountryCode(event.getAddress().getHostAddress()); - if (((code == null) || (Settings.countriesBlacklist.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { + if (((code == null) || Settings.countriesBlacklist.contains(code))) { event.setKickMessage(m.send("country_banned")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } } - if (Settings.enableProtection && !Settings.countries.isEmpty()) { + if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable + && !plugin.authmePermissible(player, "authme.bypassantibot")) { String code = Utils.getCountryCode(event.getAddress().getHostAddress()); - if (((code == null) || (!Settings.countries.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { + if (((code == null) || !Settings.countries.contains(code))) { event.setKickMessage(m.send("country_banned")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } } - if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction) { - if (!isAuthAvailable) { - event.setKickMessage(m.send("reg_only")[0]); - event.setResult(PlayerLoginEvent.Result.KICK_OTHER); - return; - } - } - // TODO: Add message to the messages file!!! - if (Settings.antiBotInAction) { - if (!isAuthAvailable) { + if (Settings.isKickNonRegisteredEnabled && !isAuthAvailable) { + if (Settings.antiBotInAction) { event.setKickMessage("AntiBot service in action! You actually need to be registered!"); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; - } - } - - if (isAuthAvailable && plugin.database.getType() != DataSource.DataSourceType.FILE) { - PlayerAuth auth = plugin.database.getAuth(name); - if (auth.getRealName() != null && !auth.getRealName().isEmpty() - && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equalsIgnoreCase(name)) { - event.setKickMessage(m.send("same_nick")[0]); + } else { + event.setKickMessage(m.send("reg_only")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); - if (Settings.banUnsafeIp) - plugin.getServer().banIP(player.getAddress().getAddress().getHostAddress()); return; } } @@ -372,7 +356,7 @@ public class AuthMePlayerListener implements Listener { plugin.management.performQuit(player, false); - if (plugin.database.isAuthAvailable(name) && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection) + if (!PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection) event.setQuitMessage(null); } @@ -430,7 +414,6 @@ public class AuthMePlayerListener implements Listener { public void run() { player.closeInventory(); } - }, 1); } From 5576b117c98c7bd697b1a42ae0ee6691ec49e74d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 4 Oct 2015 14:33:21 +0200 Subject: [PATCH 252/427] cleanup + moved legacy chestshop support --- .../NewConfiguration/actions.yml | 33 ----- .../NewConfiguration/advanced.yml | 113 ------------------ .../NewConfiguration/database.yml | 68 ----------- .../NewConfiguration/email.yml | 40 ------- .../NewConfiguration/general.yml | 100 ---------------- .../converters.txt | 21 ---- pom.xml | 102 +--------------- src/main/java/fr/xephi/authme/AuthMe.java | 50 ++------ .../listener/AuthMeChestShopListener.java | 25 ---- .../authme/listener/AuthMeServerListener.java | 6 - .../fr/xephi/authme/settings/Settings.java | 10 +- src/main/resources/config.yml | 2 - 12 files changed, 16 insertions(+), 554 deletions(-) delete mode 100644 PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml delete mode 100644 PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml delete mode 100644 PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml delete mode 100644 PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml delete mode 100644 PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml delete mode 100644 PROTOTYPE AREA (future stuff and etc...)/converters.txt delete mode 100644 src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml deleted file mode 100644 index 86a03270..00000000 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml +++ /dev/null @@ -1,33 +0,0 @@ -# ForcedActions AuthMeReloaded configuration file - -forcedActions: - -# example1: -# at: firstlogin -# executedBy: console -# commands: -# - 'msg %p Welcome!' -# - pex user set group Player - -# example2: -# at: connection -# executedBy: console -# commands: -# - 'msg %p You need to register yourself to play this server!' - -# -# Avariable events: -# connection -# firstconnection -# login -# firstlogin -# wrongpassword -# disconnection -# logout -# serverstop -# serverstart -# pluginreload -# mysqlerror -# antiboton -# antibotoff -# \ No newline at end of file diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml deleted file mode 100644 index a432ec9c..00000000 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml +++ /dev/null @@ -1,113 +0,0 @@ -# Advanced AuthMeReloaded configuration file - -sessionLogin: - # Do you want to enable session? When enabled - # the ip of a player will be bound to the nickname - # of the player on login. As long as neither of those - # two change players don't have to login on a reconnect - enabled: false - # After how many minutes a session should timeout? - # 0 for unlimitted sessions, use 0 at your own risk! - # consider that session will end only after timeout, and - # if player's ip is changed but the timeout treshould isent - # ended, player will kick out of sever for invalidSession! - timeout: 10 - # Do we need to timeout the session if the player is offline - # And try to login with an another IP Address? - sessionExpireOnIpChange: true - -security: - # Online players aren't kicked out for "Logged in from another location!", this option should always be set to true! - forceSingleSession: true - # Should we display all other accounts from a player when he joins? - # permission: /authme.admin.accounts - displayOtherAccounts: true - - # Should the purge command can be performed only from the console? - purgeOnlyFromConsole: true - - # Minimum value for the purge ingame command (if enabled), prevent the destruction of the entire database. - minIngamePurgeDays: 30 - - captcha: - # Do players need to write a captcha code if they use too many times a wrong password - useCaptcha: false - # Max allowed tries before request a captcha - maxLoginTry: 5 - # Captcha length - captchaLength: 5 - - # Restricted users will be kicked if their IP aren't the same specified below. - # Usage: - username;ip - RestrictedUsers: - - playername;127.0.0.1 - - # User listed below will bypass every login/registration system. CASE SENSITIVE!!! - # Use this at your own risk!!! USE ONLY WITH ONLINE MODE SERVERS!!! - # This option can add compatibility with BuildCraft and some other mods. - UnrestrictedName: [] - - passwordEncryption: - # possible values: MD5, SHA1, SHA256, WHIRLPOOL, XAUTH, MD5VB, PHPBB, - # PLAINTEXT ( unhashed password), - # MYBB, IPB3, PHPFUSION, SMF, XENFORO, SALTED2MD5, JOOMLA, BCRYPT, WBB3, SHA512, - # DOUBLEMD5, PBKDF2, WORDPRESS, ROYALAUTH, CUSTOM(for developpers only) - passwordHash: SHA256 - # salt length for the SALTED2MD5 MD5(MD5(password)+salt) - doubleMD5SaltLength: 8 - # If password checking return false , do we need to check with all - # other password algorithm to check an old password ? - # AuthMe will update the password to the new passwordHash ! - supportOldPasswordHash: false - - SQLProblem: - # Stop the server if we can't contact the sql database - # Take care with this, if you set that to false, - # AuthMe automatically disable and the server is not protected! - stopServer: true - ReloadCommand: - # /reload support - useReloadCommandSupport: true - console: - # Remove spam console - noConsoleSpam: false - # Replace passwords in the console when player type a command like /login - removePassword: true - -externalBoard: - # MySQL column for the salt , needed for some forum/cms support - mySQLColumnSalt: '' - # MySQL column for the group, needed for some forum/cms support - mySQLColumnGroup: '' - # -1 mean disabled. If u want that only - # activated player can login in your server - # u can put in this options the group number - # of unactivated user, needed for some forum/cms support - nonActivedUserGroup: -1 - # Other MySQL columns where we need to put the Username (case sensitive) - mySQLOtherUsernameColumns: [] - # How much Log to Round needed in BCrypt(do not change it if you do not know what's your doing) - bCryptLog2Round: 10 - # phpBB prefix defined during phpbb installation process - phpbbTablePrefix: 'phpbb_' - # phpBB activated group id , 2 is default registered group defined by phpbb - phpbbActivatedGroupId: 2 - # WordPress prefix defined during WordPress installation process - wordpressTablePrefix: 'wp_' - -hooks: - # Do we need to hook with multiverse for spawn checking? - multiverse: true - # Do we need to hook with ChestShop for prevent buy or selling ? - chestshop: true - # Do we need to hook with BungeeCord for get the real Player ip ? - bungeecord: false - # Do we need to disable Essentials SocialSpy on join ? - disableSocialSpy: true - # Do we need to cache custom Attributes ? - customAttributes: false - -# Spawn Priority, Values : authme, essentials, multiverse, default -spawnPriority: authme,essentials,multiverse,default -# AuthMe will NEVER teleport players ! -noTeleport: false diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml deleted file mode 100644 index 6c26091b..00000000 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Database AuthMeReloaded configuration file - -# What type of database do you want to use? Avariable options: sqlite, mysql, redis -backend: sqlite -# Do you like to cache all the queries? (Performance Boost) -caching: true - -# Database Name -databaseName: authme -# Table of the database -tableName: authme - -# MySql Database connection settings -# Avariable only if the AuthMeReloaded-Mysql module is installed! -mysql: - port: '3306' - host: 127.0.0.1 - username: authme - password: '12345' - -# Redis Database connection settings -# Avariable only if the AuthMeReloaded-Redis module is installed! -redis: - # Get Redis from http://redis.io/ - host: 127.0.0.1 - port: 6379 - # If your Redis server uses AUTH, set here the password. - password: "" - -# Database column names -columnNames: - idColumn: id - nameColumn: username - realNameColumn: realname - passwordColumn: password - ipColumn: ip - emailColumn: email - loginStatusColumn: loginstatus - lastLoginColumn: lastlogin - lastlLocationXColumn: x - lastLocationYColumn: y - lastLocationZColumn: z - lastLocationWorldColumn: world - -backup: - # Enable or disable Automatic Backup of the SQLite database, destination path: "/AuthMe/backups/%date%/%timestamp%.sql" - ActivateBackup: false - # Interval time (in minutes), set to 0 to disable periodic backup - Interval: 300 - # Do you want to perform a Backup when the server starts? - OnServerStart: false - # Do you want to perform a Backup when the server stops? - OnServerStop: true - -purge: - # Does AuthMe need to purge automatically old unused accounts? - useAutoPurge: false - # Number of Days required to mark an account as Unused - daysBeforeRemovePlayer: 60 - # What to remove - remove: - playerInventoryFile: true - essentialsFiles: true - permissions: true - limitedCreativesInventories: true - antiXRayFiles: true - # World where players.dat are stored (necessary to remove inventory files) - defaultWorld: 'world' diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml deleted file mode 100644 index 48c9b59a..00000000 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml +++ /dev/null @@ -1,40 +0,0 @@ -emailSystem: - # Do you want to replace the Password registration with an Email registration method? - enableEmailRegistration: false - # Do you want to enable the double check of the email address during a player registration? - # When it's true, registration require that kind of command: - # /register - doubleEmailCheck: true - # Like maxRegPerIp but with emails - maxRegPerEmail: 1 - # Do you want to recall players to add an email to their accounts? - recallPlayers: true - # Delay in minute for the recall scheduler - delayRecall: 5 - - passwordRecovery: - # Recovery password length - RecoveryPasswordLength: 8 - # Recovery Email subject - mailSubject: 'Your new AuthMe Password' - # Recovery Email text - mailText: 'Dear ,

    This is your new AuthMe password for the server

    :



    Do not forget to change password after login!
    /changepassword newPassword' - - smtpOptions: - # SMTP server host - mailSMTP: smtp.gmail.com - # SMTP server port - mailPort: 465 - # Email account that sends the mails - mailAccount: '' - # Email account's password - mailPassword: '' - # Custom SenderName, that replace the mailAccount name in the emails - mailSenderName: '' - - emailSecurity: - # Blacklisted domains for emails - emailBlacklist: - - 10minutemail.com - # Do you like a Whitelist instead of a Blacklist? - blacklistAsWhitelist: false diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml deleted file mode 100644 index 48931ea4..00000000 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml +++ /dev/null @@ -1,100 +0,0 @@ -# █████╗ ██╗ ██╗████████╗██╗ ██╗ ███╗ ███╗███████╗ ██████╗ ███████╗██╗ ██████╗ ██████╗ ███████╗██████╗ -# ██╔══██╗██║ ██║╚══██╔══╝██║ ██║ ████╗ ████║██╔════╝ ██╔══██╗██╔════╝██║ ██╔═══██╗██╔══██╗██╔════╝██╔══██╗ -# ███████║██║ ██║ ██║ ███████║ ██╔████╔██║█████╗ ██████╔╝█████╗ ██║ ██║ ██║██║ ██║█████╗ ██║ ██║ -# ██╔══██║██║ ██║ ██║ ██╔══██║ ██║╚██╔╝██║██╔══╝ ██╔══██╗██╔══╝ ██║ ██║ ██║██║ ██║██╔══╝ ██║ ██║ -# ██║ ██║╚██████╔╝ ██║ ██║ ██║ ██║ ╚═╝ ██║███████╗ ██║ ██║███████╗███████╗╚██████╔╝██████╔╝███████╗██████╔╝ -# ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝ - -# Welcome to the AuthMeReloaded main configuration file! - -# Available languages: en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt -language: en - -registration: - # Do you want to enable the registration on the server? - enabled: true - # Do you want to force players to register before playing? - force: true - # Maximum Registration per IP - maxRegPerIp: 1 - # Maximum allowed username length - maxUsernameLength: 30 - # Minimum required username length - minUsernameLength: 4 - # Regex syntax allowed in player's username - allowedNicknameCharacters: '[a-zA-Z0-9_]*' - # Do you want to kick players after a successful registration? - # Do not use this option with the loginAfterRegister feature below! - kickAfterRegistration: false - # Do you want to force the player to login after a successful registration? - loginAfterRegister: false - -login: - # How many players per IP can join the server concurrently? - maxInstanceForIP: 1 - # Should not registered players be kicked immediately? - kickNonRegistered: false - # Should the players be kicked immediately on wrong password? - kickOnWrongPassword: false - # Send every X seconds a message to a player to remind him that he has to login/register - messageInterval: 5 - # How many second a player can login or register before being kicked? Set this to 0 to disable. - timeout: 30 - # Teleport the player to the world's Spawn after login - teleportToSpawnAfterLogin: true - # Teleport provisionally not logged player to world's Spawn. - # After the login, if teleportToSpawnAfterLogin is set to false the player will be teleported to his last location. - teleportToSpawnBeforeLogin: true - - # ForceSurvivalMode to player when join? - forceSurvivalMode: false - # Do we need to force the survival mode ONLY after /login process? - forceSurvivalOnlyAfterLogin: false - - # Reset every time the player's inventory? - resetInventory: false - # If player join with CreativeMode and ForceSurvivalMode: true inventory will be wiped. - resetInventoryIfCreative: false - # Should we protect the player inventory before logging in? - protectInventoryBeforeLogIn: true - -password: - # minimum Length of password - minPasswordLength: 5 - # Regex sintax for allowed Chars in passwords. - allowedPasswordCharacters: '[\x21-\x7E]*' - # Enable double check of password when you register or change password. - # When it's true, registration require that kind of command: - # /register - doublePasswordCheck: true - # Deny unsafe passwords for being used, put them on lowercase! - unsafePasswords: - - '123456' - - '12345' - - 'qwerty' - - 'password' - -protection: - # Enable some server protection systems (country based login, antibot) - enableProtection: false - # Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes - countries: - - US - - GB - # Countries blacklisted automatically (It works also with enableProtection set to false) - countriesBlacklist: - - A1 - - antiBot: - # Do you like to enable the automatic antibot system? - enableAntiBot: false - # Do you want to show AntiBot messages to every player or only to person with the "authme.antibotmessages" permission node? - broadcastMessages: true - # Max number of player allowed to join in 5 secs before the AntiBot activates - antiBotSensibility: 5 - # Duration in minutes of the antibot protection - antiBotDuration: 10 - -# These features are only available on the VeryGames Server Provider -veryGames: - enableIpCheck: false diff --git a/PROTOTYPE AREA (future stuff and etc...)/converters.txt b/PROTOTYPE AREA (future stuff and etc...)/converters.txt deleted file mode 100644 index 0290f672..00000000 --- a/PROTOTYPE AREA (future stuff and etc...)/converters.txt +++ /dev/null @@ -1,21 +0,0 @@ -_________________________________________________________________________________ -> < -> WARNING: Conversions can't be undone! DO ALWAYS A BACKUP BEFORE!!! < -> < -_________________________________________________________________________________ -> AuthMe Reloaded converters description file < -_________________________________________________________________________________ - -Built-in converters (Into the Plugin's core module): - Old File Backend ("file") >>> SQLite ("/authme converter flatfiletosqlite") THIS CONVERTER WILL BE REMOVED FROM THE CORE IN FUTURE VERSIONS!!! - -Converters in the Converters module (Into the Converters module avariable at: NEED LINK): - SQlite >>> MySql ("/authme converter sqlitetomysql") - MySql >>> Redis ("/authme converter mysqltoredis") - Rakamak >>> SQlite ("/authme converter rakamaktosqlite [databasefile.rak] [(ip-mode) (ipdatabasefle.rak)]") - CrazyLogin >>> SQlite ("/authme converter crazylogintosqlite [databasefile.db]") - xAuth (Min version 2.6) >>> SQlite ("/authme converter xauthtosqlite") NOTE: xAUTH MUST BE INSTALLED AND CONFIGURED IN THE SERVER, it works with all the xAuth backends! - -Discontinued Converters (use an old AuthMe version like 3.4): - RoyalAuth >>> SQlite - vAuth >>> SQlite diff --git a/pom.xml b/pom.xml index 26ecd2ac..86fe315e 100644 --- a/pom.xml +++ b/pom.xml @@ -160,11 +160,12 @@ http://repo.luricos.de/content/repositories/releases - + @@ -530,104 +531,5 @@ true
    - - - com.acrobot.chestshop - chestshop - 3.8.12 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - Vault - net.milkbowl.vault - - - odditem - info.somethingodd - - - scrollingmenusign - me.desht - - - truezip - de.schlichtherle - - - residence - net.t00thpick1 - - - Heroes - com.herocraftonline.heroes - - - HeroChat - com.dthielke.herochat - - - worldguard - com.sk89q - - - worldedit - com.sk89q - - - lwc - com.griefcraft.lwc - - - js - rhino - - - jchronic - com.sk89q - - - deadbolt - com.daemitus.deadbolt - - - bukkit-classloader-check - com.sk89q.spigot - - - jsr305 - com.google.code.findbugs - - - opencsv - net.sf.opencsv - - - simplechestlock - com.webkonsept.bukkit.simplechestlock - - - commandbook - com.sk89q - - - lockette - org.yi.acru.bukkit.lockette - - - log4j-core - org.apache.logging.log4j - - - true - - diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 5611fec6..8ea2a79d 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -65,7 +65,6 @@ public class AuthMe extends JavaPlugin { private JsonCache playerBackup; public OtherAccounts otherAccounts; public Location essentialsSpawn; - public boolean legacyChestShop = false; public boolean antibotMod = false; public boolean delayedAntiBot = true; @@ -192,9 +191,6 @@ public class AuthMe extends JavaPlugin { // Check Multiverse checkMultiverse(); - // Check ChestShop - checkChestShop(); - // Check Essentials checkEssentials(); @@ -242,12 +238,6 @@ public class AuthMe extends JavaPlugin { Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this)); } - // Legacy chestshop hook - if (legacyChestShop) { - pm.registerEvents(new AuthMeChestShopListener(this), this); - ConsoleLogger.info("Hooked successfully with ChestShop!"); - } - // Reload support hook if (Settings.reloadSupport) { if (database != null) { @@ -425,34 +415,6 @@ public class AuthMe extends JavaPlugin { } } - // Check the version of the ChestShop plugin - public void checkChestShop() { - if (Settings.legacyChestShop && server.getPluginManager().isPluginEnabled("ChestShop")) { - String rawver = com.Acrobot.ChestShop.ChestShop.getVersion(); - double version; - try { - version = Double.valueOf(rawver.split(" ")[0]); - } catch (NumberFormatException nfe) { - try { - version = Double.valueOf(rawver.split("t")[0]); - } catch (NumberFormatException nfee) { - legacyChestShop = false; - return; - } - } - if (version >= 3.813) { - return; - } - if (version < 3.50) { - ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!"); - return; - } - legacyChestShop = true; - } else { - legacyChestShop = false; - } - } - // Get the Multiverse plugin public void checkMultiverse() { if (Settings.multiverse && server.getPluginManager().isPluginEnabled("Multiverse-Core")) { @@ -506,10 +468,16 @@ public class AuthMe extends JavaPlugin { } } + // Check the presence of the ProtocolLib plugin public void checkProtocolLib() { - if (server.getPluginManager().isPluginEnabled("ProtocolLib")) { - inventoryProtector = new AuthMeInventoryListener(this); - ProtocolLibrary.getProtocolManager().addPacketListener(inventoryProtector); + if (Settings.protectInventoryBeforeLogInEnabled) { + if (server.getPluginManager().isPluginEnabled("ProtocolLib")) { + inventoryProtector = new AuthMeInventoryListener(this); + ProtocolLibrary.getProtocolManager().addPacketListener(inventoryProtector); + } else { + ConsoleLogger.showError("WARNING!!! The protectInventory feature requires ProtocolLib! Disabling it..."); + Settings.protectInventoryBeforeLogInEnabled = false; + } } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java deleted file mode 100644 index 476f2586..00000000 --- a/src/main/java/fr/xephi/authme/listener/AuthMeChestShopListener.java +++ /dev/null @@ -1,25 +0,0 @@ -package fr.xephi.authme.listener; - -import com.Acrobot.ChestShop.Events.PreTransactionEvent; -import com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; - -public class AuthMeChestShopListener implements Listener { - - public AuthMe plugin; - - public AuthMeChestShopListener(AuthMe plugin) { - this.plugin = plugin; - } - - @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) - public void onPreTransaction(PreTransactionEvent event) { - if (Utils.checkAuth(event.getClient())) - return; - event.setCancelled(TransactionOutcome.OTHER); - } -} diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 22f71493..6581f510 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -56,10 +56,6 @@ public class AuthMeServerListener implements Listener { ConsoleLogger.info("Multiverse-Core has been disabled, unhook!"); return; } - if (pluginName.equalsIgnoreCase("ChestShop")) { - plugin.legacyChestShop = false; - ConsoleLogger.info("ChestShop has been disabled, unhook!"); - } if (pluginName.equalsIgnoreCase("CombatTagPlus")) { plugin.combatTagPlus = null; ConsoleLogger.info("CombatTagPlus has been disabled, unhook!"); @@ -81,8 +77,6 @@ public class AuthMeServerListener implements Listener { plugin.checkEssentials(); if (pluginName.equalsIgnoreCase("Multiverse-Core")) plugin.checkMultiverse(); - if (pluginName.equalsIgnoreCase("ChestShop")) - plugin.checkChestShop(); if (pluginName.equalsIgnoreCase("CombatTagPlus")) plugin.checkCombatTagPlus(); if (pluginName.equalsIgnoreCase("Vault")) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index b43cf29b..9264ae54 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -60,7 +60,7 @@ public final class Settings extends YamlConfiguration { protectInventoryBeforeLogInEnabled, isBackupActivated, isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, - useCaptcha, emailRegistration, multiverse, legacyChestShop, bungee, + useCaptcha, emailRegistration, multiverse, bungee, banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange, disableSocialSpy, forceOnlyAfterLogin, useEssentialsMotd, usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword, @@ -222,7 +222,6 @@ public final class Settings extends YamlConfiguration { saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8); getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1); multiverse = configFile.getBoolean("Hooks.multiverse", true); - legacyChestShop = configFile.getBoolean("Hooks.legacyChestshop", false); bungee = configFile.getBoolean("Hooks.bungeecord", false); getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds"); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); @@ -462,12 +461,13 @@ public final class Settings extends YamlConfiguration { changes = true; } if (contains("Hooks.chestshop")) { - if (getBoolean("Hooks.chestshop")) { - set("Hooks.legacyChestshop", true); - } set("Hooks.chestshop", null); changes = true; } + if (contains("Hooks.legacyChestshop")) { + set("Hooks.legacyChestshop", null); + changes = true; + } if (!contains("Email.generateImage")) { set("Email.generateImage", true); changes = true; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 19753d80..c10c977e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -353,8 +353,6 @@ Email: Hooks: # Do we need to hook with multiverse for spawn checking? multiverse: true - # Do we need to hook with legacy ChestShop < 3.8.13 for prevent buy or selling ? - legacyChestshop: false # Do we need to hook with BungeeCord for get the real Player ip ? bungeecord: false # Do we need to disable Essentials SocialSpy on join ? From 4a22c916b1697b7cb530048d173f97afd1504614 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 4 Oct 2015 14:37:06 +0200 Subject: [PATCH 253/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 53 ++++++++++++----------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 8ea2a79d..dcff35fd 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -1,8 +1,35 @@ package fr.xephi.authme; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitTask; +import org.apache.logging.log4j.LogManager; + +import org.mcstats.Metrics; import com.comphenix.protocol.ProtocolLibrary; import com.earth2me.essentials.Essentials; import com.onarandombox.MultiverseCore.MultiverseCore; +import net.milkbowl.vault.permission.Permission; +import net.minelink.ctplus.CombatTagPlus; + import fr.xephi.authme.api.API; import fr.xephi.authme.api.NewAPI; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -23,31 +50,6 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.OtherAccounts; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; -import net.milkbowl.vault.permission.Permission; -import net.minelink.ctplus.CombatTagPlus; -import org.apache.logging.log4j.LogManager; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitTask; -import org.mcstats.Metrics; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; public class AuthMe extends JavaPlugin { @@ -136,7 +138,6 @@ public class AuthMe extends JavaPlugin { m = Messages.getInstance(); // Start the metrics service - // TODO: add a setting to disable metrics try { Metrics metrics = new Metrics(this); metrics.start(); From de5ecfcb933eff5514c90311bf3586aa6bbcc7c7 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 5 Oct 2015 22:28:31 +0200 Subject: [PATCH 254/427] Fix compatibility issues --- pom.xml | 10 ++++++++++ src/main/java/fr/xephi/authme/AuthMe.java | 3 +-- .../xephi/authme/listener/AuthMeInventoryListener.java | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 86fe315e..cca09242 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,7 @@ com.sun.mail:javax.mail com.comphenix.attribute:AttributeStorage org.mcstats.bukkit:metrics + com.google.code.gson:gson
    @@ -241,6 +242,15 @@ true + + + com.google.code.gson + gson + 2.4 + compile + true + + diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index dcff35fd..086e16ec 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -24,7 +24,6 @@ import org.bukkit.scheduler.BukkitTask; import org.apache.logging.log4j.LogManager; import org.mcstats.Metrics; -import com.comphenix.protocol.ProtocolLibrary; import com.earth2me.essentials.Essentials; import com.onarandombox.MultiverseCore.MultiverseCore; import net.milkbowl.vault.permission.Permission; @@ -474,7 +473,7 @@ public class AuthMe extends JavaPlugin { if (Settings.protectInventoryBeforeLogInEnabled) { if (server.getPluginManager().isPluginEnabled("ProtocolLib")) { inventoryProtector = new AuthMeInventoryListener(this); - ProtocolLibrary.getProtocolManager().addPacketListener(inventoryProtector); + inventoryProtector.register(); } else { ConsoleLogger.showError("WARNING!!! The protectInventory feature requires ProtocolLib! Disabling it..."); Settings.protectInventoryBeforeLogInEnabled = false; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java index 9b59a148..bbaafbfa 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java @@ -60,6 +60,10 @@ public class AuthMeInventoryListener extends PacketAdapter { } } + public void register() { + ProtocolLibrary.getProtocolManager().addPacketListener(this); + } + public void sendInventoryPacket(Player player) { ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); PacketContainer inventoryPacket = protocolManager.createPacket(PacketType.Play.Server.WINDOW_ITEMS); From 9c477c590c4d3403dcb54d99fdc5792435688b82 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 5 Oct 2015 22:57:33 +0200 Subject: [PATCH 255/427] fix 1.7.10 compatibility issue --- src/main/java/fr/xephi/authme/AuthMe.java | 4 +++ .../authme/listener/AuthMePlayerListener.java | 8 ------ .../listener/AuthMePlayerListener18.java | 27 +++++++++++++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 086e16ec..4d2421e7 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -258,6 +258,10 @@ public class AuthMe extends JavaPlugin { // Register events pm.registerEvents(new AuthMePlayerListener(this), this); + // Try to register 1.8 player listeners + ConsoleLogger.info("Trying to register bukkit 1.8 listeners, if an error is shown below please don't report it!"); + ConsoleLogger.info("It only means that you're using a previous version of the server."); + pm.registerEvents(new AuthMePlayerListener18(this), this); pm.registerEvents(new AuthMeBlockListener(this), this); pm.registerEvents(new AuthMeEntityListener(this), this); pm.registerEvents(new AuthMeServerListener(this), this); diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 900a01cf..801502e5 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -448,14 +448,6 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) - public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { - Player player = event.getPlayer(); - if (player == null || Utils.checkAuth(player)) - return; - event.setCancelled(true); - } - @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerDropItem(PlayerDropItemEvent event) { if (Utils.checkAuth(event.getPlayer())) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java new file mode 100644 index 00000000..0b88b4d1 --- /dev/null +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java @@ -0,0 +1,27 @@ +package fr.xephi.authme.listener; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.*; + +public class AuthMePlayerListener18 implements Listener { + + public AuthMe plugin; + + public AuthMePlayerListener18(AuthMe plugin) { + this.plugin = plugin; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) + return; + event.setCancelled(true); + } + +} From d7dfa3e4ac3b38b57a61b107a655dd9cecc006b0 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 6 Oct 2015 03:57:17 +0700 Subject: [PATCH 256/427] fill with air --- .../xephi/authme/listener/AuthMeInventoryListener.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java index bbaafbfa..08ccacff 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java @@ -22,20 +22,18 @@ import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.settings.Settings; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import java.lang.reflect.InvocationTargetException; - import java.util.Arrays; import java.util.Collections; import java.util.logging.Level; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - public class AuthMeInventoryListener extends PacketAdapter { private static final int PLAYER_INVENTORY = 0; @@ -72,6 +70,7 @@ public class AuthMeInventoryListener extends PacketAdapter { inventoryPacket.getIntegers().write(0, PLAYER_INVENTORY); ItemStack[] playerCrafting = new ItemStack[PLAYER_CRAFTING_SIZE]; + Arrays.fill(playerCrafting, new ItemStack(Material.AIR)); ItemStack[] armorContents = player.getInventory().getArmorContents(); ItemStack[] mainInventory = player.getInventory().getContents(); From 157b028712668abc184d0924f0c54784bee8a0e0 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 6 Oct 2015 04:07:49 +0700 Subject: [PATCH 257/427] check the class is exist --- src/main/java/fr/xephi/authme/AuthMe.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 4d2421e7..7821fa89 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -259,9 +259,11 @@ public class AuthMe extends JavaPlugin { // Register events pm.registerEvents(new AuthMePlayerListener(this), this); // Try to register 1.8 player listeners - ConsoleLogger.info("Trying to register bukkit 1.8 listeners, if an error is shown below please don't report it!"); - ConsoleLogger.info("It only means that you're using a previous version of the server."); - pm.registerEvents(new AuthMePlayerListener18(this), this); + try { + Class.forName("org.bukkit.event.player.PlayerInteractAtEntityEvent"); + pm.registerEvents(new AuthMePlayerListener18(this), this); + } catch (ClassNotFoundException ignore) { + } pm.registerEvents(new AuthMeBlockListener(this), this); pm.registerEvents(new AuthMeEntityListener(this), this); pm.registerEvents(new AuthMeServerListener(this), this); From 494281c3659c68f86059219ca49be4eb9d8ea83f Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Tue, 6 Oct 2015 01:11:24 +0200 Subject: [PATCH 258/427] Fix for older version of Bukkit --- src/main/java/fr/xephi/authme/AuthMe.java | 116 ++++++++++++++-------- 1 file changed, 72 insertions(+), 44 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 8ea2a79d..43656e33 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -1,30 +1,16 @@ package fr.xephi.authme; -import com.comphenix.protocol.ProtocolLibrary; -import com.earth2me.essentials.Essentials; -import com.onarandombox.MultiverseCore.MultiverseCore; -import fr.xephi.authme.api.API; -import fr.xephi.authme.api.NewAPI; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.backup.JsonCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.commands.*; -import fr.xephi.authme.converter.Converter; -import fr.xephi.authme.converter.ForceFlatToSqlite; -import fr.xephi.authme.datasource.*; -import fr.xephi.authme.listener.*; -import fr.xephi.authme.modules.ModuleManager; -import fr.xephi.authme.plugin.manager.BungeeCordMessage; -import fr.xephi.authme.plugin.manager.EssSpawn; -import fr.xephi.authme.process.Management; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.OtherAccounts; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.settings.Spawn; -import net.milkbowl.vault.permission.Permission; -import net.minelink.ctplus.CombatTagPlus; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; + import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -38,23 +24,56 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; import org.mcstats.Metrics; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; +import com.earth2me.essentials.Essentials; +import com.onarandombox.MultiverseCore.MultiverseCore; + +import fr.xephi.authme.api.API; +import fr.xephi.authme.api.NewAPI; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.cache.backup.JsonCache; +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; +import fr.xephi.authme.commands.AdminCommand; +import fr.xephi.authme.commands.CaptchaCommand; +import fr.xephi.authme.commands.ChangePasswordCommand; +import fr.xephi.authme.commands.ConverterCommand; +import fr.xephi.authme.commands.EmailCommand; +import fr.xephi.authme.commands.LoginCommand; +import fr.xephi.authme.commands.LogoutCommand; +import fr.xephi.authme.commands.RegisterCommand; +import fr.xephi.authme.commands.UnregisterCommand; +import fr.xephi.authme.converter.Converter; +import fr.xephi.authme.converter.ForceFlatToSqlite; +import fr.xephi.authme.datasource.CacheDataSource; +import fr.xephi.authme.datasource.DataSource; +import fr.xephi.authme.datasource.DatabaseCalls; +import fr.xephi.authme.datasource.FlatFile; +import fr.xephi.authme.datasource.MySQL; +import fr.xephi.authme.datasource.SQLite; +import fr.xephi.authme.datasource.SQLite_HIKARI; +import fr.xephi.authme.listener.AuthMeBlockListener; +import fr.xephi.authme.listener.AuthMeEntityListener; +import fr.xephi.authme.listener.AuthMeInventoryListener; +import fr.xephi.authme.listener.AuthMePlayerListener; +import fr.xephi.authme.listener.AuthMeServerListener; +import fr.xephi.authme.modules.ModuleManager; +import fr.xephi.authme.plugin.manager.BungeeCordMessage; +import fr.xephi.authme.plugin.manager.EssSpawn; +import fr.xephi.authme.process.Management; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.OtherAccounts; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.settings.Spawn; +import net.milkbowl.vault.permission.Permission; +import net.minelink.ctplus.CombatTagPlus; public class AuthMe extends JavaPlugin { private static AuthMe authme; private final Server server = getServer(); - private final Logger authmeLogger = Logger.getLogger("AuthMe"); + private Logger authmeLogger = Logger.getLogger("AuthMe"); public Management management; public NewAPI api; public SendMailSSL mail; @@ -100,7 +119,6 @@ public class AuthMe extends JavaPlugin { return m; } - @Override public void onEnable() { // Set the Instance @@ -115,7 +133,9 @@ public class AuthMe extends JavaPlugin { PluginManager pm = server.getPluginManager(); // Setup the Logger - authmeLogger.setParent(this.getLogger()); + if (authmeLogger == null) + authmeLogger = this.getLogger(); + else authmeLogger.setParent(this.getLogger()); // Load settings and custom configurations // TODO: new configuration style (more files) @@ -194,7 +214,8 @@ public class AuthMe extends JavaPlugin { // Check Essentials checkEssentials(); - //Check if the protocollib is available. If so we could listen for inventory protection + // Check if the protocollib is available. If so we could listen for + // inventory protection checkProtocolLib(); // Do backup on start if enabled @@ -336,7 +357,8 @@ public class AuthMe extends JavaPlugin { } } - // Show the exception message and stop/unload the server/plugin as defined in the configuration + // Show the exception message and stop/unload the server/plugin as defined + // in the configuration public void stopOrUnload(Exception e) { ConsoleLogger.showError(e.getMessage()); stopOrUnload(); @@ -365,6 +387,7 @@ public class AuthMe extends JavaPlugin { if (isSQLite) { server.getScheduler().runTaskAsynchronously(this, new Runnable() { + @Override public void run() { int accounts = database.getAccountsRegistered(); @@ -558,13 +581,17 @@ public class AuthMe extends JavaPlugin { } ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); if (Settings.purgeEssentialsFile && this.ess != null) - dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions + dataManager.purgeEssentials(cleared); // name to UUID convertion + // needed with latest versions if (Settings.purgePlayerDat) - dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC + dataManager.purgeDat(cleared); // name to UUID convertion needed + // with latest versions of MC if (Settings.purgeLimitedCreative) dataManager.purgeLimitedCreative(cleared); if (Settings.purgeAntiXray) - dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) + dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or + // names... (Actually it purges + // only names!) if (Settings.purgePermissions) dataManager.purgePermissions(cleared, permission); } @@ -703,7 +730,8 @@ public class AuthMe extends JavaPlugin { /** * Get Player real IP through VeryGames method * - * @param player player + * @param player + * player */ @Deprecated public String getVeryGamesIP(Player player) { From 3f179ade81580ff32c97f47dea031fde3e49df23 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 6 Oct 2015 07:11:51 +0700 Subject: [PATCH 259/427] rename inventory listener class --- src/main/java/fr/xephi/authme/AuthMe.java | 56 +++++++++---------- ...java => AuthMeInventoryPacketAdapter.java} | 4 +- 2 files changed, 29 insertions(+), 31 deletions(-) rename src/main/java/fr/xephi/authme/listener/{AuthMeInventoryListener.java => AuthMeInventoryPacketAdapter.java} (97%) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 7821fa89..b252d5ba 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -1,34 +1,7 @@ package fr.xephi.authme; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitTask; -import org.apache.logging.log4j.LogManager; - -import org.mcstats.Metrics; import com.earth2me.essentials.Essentials; import com.onarandombox.MultiverseCore.MultiverseCore; -import net.milkbowl.vault.permission.Permission; -import net.minelink.ctplus.CombatTagPlus; - import fr.xephi.authme.api.API; import fr.xephi.authme.api.NewAPI; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -49,6 +22,31 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.OtherAccounts; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; +import net.milkbowl.vault.permission.Permission; +import net.minelink.ctplus.CombatTagPlus; +import org.apache.logging.log4j.LogManager; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitTask; +import org.mcstats.Metrics; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; public class AuthMe extends JavaPlugin { @@ -74,7 +72,7 @@ public class AuthMe extends JavaPlugin { public Essentials ess; public MultiverseCore multiverse; public CombatTagPlus combatTagPlus; - public AuthMeInventoryListener inventoryProtector; + public AuthMeInventoryPacketAdapter inventoryProtector; // Manager private ModuleManager moduleManager; @@ -478,7 +476,7 @@ public class AuthMe extends JavaPlugin { public void checkProtocolLib() { if (Settings.protectInventoryBeforeLogInEnabled) { if (server.getPluginManager().isPluginEnabled("ProtocolLib")) { - inventoryProtector = new AuthMeInventoryListener(this); + inventoryProtector = new AuthMeInventoryPacketAdapter(this); inventoryProtector.register(); } else { ConsoleLogger.showError("WARNING!!! The protectInventory feature requires ProtocolLib! Disabling it..."); diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryPacketAdapter.java similarity index 97% rename from src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java rename to src/main/java/fr/xephi/authme/listener/AuthMeInventoryPacketAdapter.java index 08ccacff..c045a94e 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryPacketAdapter.java @@ -34,7 +34,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.logging.Level; -public class AuthMeInventoryListener extends PacketAdapter { +public class AuthMeInventoryPacketAdapter extends PacketAdapter { private static final int PLAYER_INVENTORY = 0; //http://wiki.vg/Inventory#Inventory (0-4 crafting, 5-8 armor, 9-35 main inventory, 36-44 inventory) @@ -42,7 +42,7 @@ public class AuthMeInventoryListener extends PacketAdapter { private static final int PLAYER_CRAFTING_SIZE = 5; private static final int HOTBAR_SIZE = 9; - public AuthMeInventoryListener(AuthMe plugin) { + public AuthMeInventoryPacketAdapter(AuthMe plugin) { super(plugin, PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS); } From 4d4931af3f74daf86d23c1a935f56e85ae940aea Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 6 Oct 2015 08:08:32 +0700 Subject: [PATCH 260/427] added reload function into module manager --- src/main/java/fr/xephi/authme/AuthMe.java | 6 +++++- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 3 ++- src/main/java/fr/xephi/authme/modules/ModuleManager.java | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index b252d5ba..94c7b494 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -348,6 +348,7 @@ public class AuthMe extends JavaPlugin { // Initialize and setup the database public void setupDatabase() throws Exception { + if (database != null) database.close(); // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI boolean isSQLite = false; switch (Settings.getDataSource) { @@ -704,6 +705,10 @@ public class AuthMe extends JavaPlugin { return count >= Settings.getMaxJoinPerIp; } + public ModuleManager getModuleManager() { + return moduleManager; + } + /** * Get Player real IP through VeryGames method * @@ -736,5 +741,4 @@ public class AuthMe extends JavaPlugin { public String getCountryName(String ip) { return Utils.getCountryName(ip); } - } diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 573d956f..49042a43 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -110,11 +110,12 @@ public class AdminCommand implements CommandExecutor { } else if (args[0].equalsIgnoreCase("reload")) { try { Settings.reload(); + plugin.getModuleManager().reloadModules(); m.reloadMessages(); - plugin.database.close(); plugin.setupDatabase(); } catch (Exception e) { ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); + ConsoleLogger.writeStackTrace(e); plugin.stopOrUnload(); return false; } diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index 32d4d1fa..0d598fc4 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -112,6 +112,11 @@ public class ModuleManager { return count; } + public void reloadModules(){ + unloadModules(); + loadModules(); + } + public void unloadModule(String name) { Iterator it = modules.iterator(); while (it.hasNext()) { From 99fca1cb20a99ab6fcc7579770c2d9832e8e1d40 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Tue, 6 Oct 2015 12:32:12 +0200 Subject: [PATCH 261/427] Fix Import --- src/main/java/fr/xephi/authme/AuthMe.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 43656e33..9e199f7e 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -24,6 +24,7 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; import org.mcstats.Metrics; +import com.comphenix.protocol.ProtocolLibrary; import com.earth2me.essentials.Essentials; import com.onarandombox.MultiverseCore.MultiverseCore; From aac4320f4698411ab09be28e683d2b05713eccd5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 6 Oct 2015 17:11:14 +0200 Subject: [PATCH 262/427] Fix build --- src/main/java/fr/xephi/authme/AuthMe.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 894f1725..6d5f8ab5 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -24,7 +24,6 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; import org.mcstats.Metrics; -import com.comphenix.protocol.ProtocolLibrary; import net.milkbowl.vault.permission.Permission; import com.onarandombox.MultiverseCore.MultiverseCore; import com.earth2me.essentials.Essentials; @@ -57,8 +56,9 @@ import fr.xephi.authme.datasource.SQLite; import fr.xephi.authme.datasource.SQLite_HIKARI; import fr.xephi.authme.listener.AuthMeBlockListener; import fr.xephi.authme.listener.AuthMeEntityListener; -import fr.xephi.authme.listener.AuthMeInventoryListener; +import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter; import fr.xephi.authme.listener.AuthMePlayerListener; +import fr.xephi.authme.listener.AuthMePlayerListener18; import fr.xephi.authme.listener.AuthMeServerListener; import fr.xephi.authme.modules.ModuleManager; import fr.xephi.authme.plugin.manager.BungeeCordMessage; From 807d302b608dfc79179284bc49be41731143753a Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 6 Oct 2015 19:17:03 +0200 Subject: [PATCH 263/427] 1.5.2 compatibility --- pom.xml | 4 +- src/main/java/fr/xephi/authme/AuthMe.java | 7 ++++ .../java/fr/xephi/authme/DataManager.java | 32 +++++++++------ .../authme/listener/AuthMeEntityListener.java | 41 +++++++++++++++---- .../authme/listener/AuthMePlayerListener.java | 7 ---- .../listener/AuthMePlayerListener16.java | 27 ++++++++++++ .../xephi/authme/settings/OtherAccounts.java | 2 +- 7 files changed, 89 insertions(+), 31 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java diff --git a/pom.xml b/pom.xml index cca09242..7bdad8cf 100644 --- a/pom.xml +++ b/pom.xml @@ -276,8 +276,7 @@ true - + org.bukkit bukkit @@ -324,6 +323,7 @@ com.comphenix.protocol ProtocolLib 3.4.0 + provided true diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 6d5f8ab5..23c556c8 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -58,6 +58,7 @@ import fr.xephi.authme.listener.AuthMeBlockListener; import fr.xephi.authme.listener.AuthMeEntityListener; import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter; import fr.xephi.authme.listener.AuthMePlayerListener; +import fr.xephi.authme.listener.AuthMePlayerListener16; import fr.xephi.authme.listener.AuthMePlayerListener18; import fr.xephi.authme.listener.AuthMeServerListener; import fr.xephi.authme.modules.ModuleManager; @@ -279,6 +280,12 @@ public class AuthMe extends JavaPlugin { // Register events pm.registerEvents(new AuthMePlayerListener(this), this); + // Try to register 1.6 player listeners + try { + Class.forName("org.bukkit.event.player.PlayerEditBookEvent"); + pm.registerEvents(new AuthMePlayerListener16(this), this); + } catch (ClassNotFoundException ignore) { + } // Try to register 1.8 player listeners try { Class.forName("org.bukkit.event.player.PlayerInteractAtEntityEvent"); diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 43782c5b..9263443f 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -103,21 +103,26 @@ public class DataManager { for (String name : cleared) { try { org.bukkit.OfflinePlayer player = getOfflinePlayer(name); - if (player == null) + File playerFile = null; + if (player == null) { continue; - String playerName = player.getName(); - File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + playerName + ".dat"); + } + + try { + playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); + } catch(Exception ignore) { + } if (playerFile.exists()) { playerFile.delete(); i++; } else { - playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); + playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getName() + ".dat"); if (playerFile.exists()) { playerFile.delete(); i++; } } - } catch (Exception e) { + } catch (Exception ignore) { } } ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files"); @@ -128,18 +133,19 @@ public class DataManager { int i = 0; for (String name : cleared) { try { - File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml"); + File playerFile = null; + try { + playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml"); + } catch(Exception ignore) { + } if (playerFile.exists()) { playerFile.delete(); i++; } else { - try { - playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml"); - if (playerFile.exists()) { - playerFile.delete(); - i++; - } - } catch (Exception e) { // Don't do nothing if the method getUniqueId() isn't avariable ( MC version < 1.7.5 ) + playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml"); + if (playerFile.exists()) { + playerFile.delete(); + i++; } } } catch (Exception e) { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 34b3b0f2..acd65e0c 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -2,7 +2,11 @@ package fr.xephi.authme.listener; import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; + +import java.lang.reflect.Method; + import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; @@ -14,9 +18,16 @@ import org.bukkit.projectiles.ProjectileSource; public class AuthMeEntityListener implements Listener { public AuthMe instance; + private static Method getShooter; + private static boolean shooterIsProjectileSource; public AuthMeEntityListener(AuthMe instance) { this.instance = instance; + try { + Method m = Projectile.class.getDeclaredMethod("getShooter"); + shooterIsProjectileSource = m.getReturnType() != LivingEntity.class; + } catch (Exception ignored) { + } } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) @@ -31,7 +42,7 @@ public class AuthMeEntityListener implements Listener { return; } player.setFireTicks(0); - event.setDamage(0.0); + event.setDamage(0); event.setCancelled(true); } @@ -90,7 +101,7 @@ public class AuthMeEntityListener implements Listener { return; } - event.setAmount(0.0); + event.setAmount(0); event.setCancelled(true); } @@ -126,15 +137,29 @@ public class AuthMeEntityListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onProjectileLaunch(ProjectileLaunchEvent event) { Projectile projectile = event.getEntity(); - if (projectile == null) - return; - - ProjectileSource shooter = projectile.getShooter(); - if (shooter == null || !(shooter instanceof Player)) { + Player player = null; + if (projectile == null) { return; } - if (Utils.checkAuth((Player) shooter)) { + if (shooterIsProjectileSource) { + ProjectileSource shooter = projectile.getShooter(); + if (shooter == null || !(shooter instanceof Player)) { + return; + } + player = (Player) shooter; + } else { + try { + if (getShooter == null) { + getShooter = Projectile.class.getMethod("getShooter"); + } + Object obj = getShooter.invoke(null); + player = (Player) obj; + } catch (Exception ignored) { + } + } + + if (Utils.checkAuth(player)) { return; } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 801502e5..5706ef66 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -519,11 +519,4 @@ public class AuthMePlayerListener implements Listener { event.setCancelled(true); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) - public void onPlayerEditBook(PlayerEditBookEvent event) { - Player player = event.getPlayer(); - if (player == null || Utils.checkAuth(player)) - return; - event.setCancelled(true); - } } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java new file mode 100644 index 00000000..2959b84f --- /dev/null +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java @@ -0,0 +1,27 @@ +package fr.xephi.authme.listener; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.*; + +public class AuthMePlayerListener16 implements Listener { + + public AuthMe plugin; + + public AuthMePlayerListener16(AuthMe plugin) { + this.plugin = plugin; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) + public void onPlayerEditBook(PlayerEditBookEvent event) { + Player player = event.getPlayer(); + if (player == null || Utils.checkAuth(player)) + return; + event.setCancelled(true); + } + +} diff --git a/src/main/java/fr/xephi/authme/settings/OtherAccounts.java b/src/main/java/fr/xephi/authme/settings/OtherAccounts.java index 697104d4..0154a337 100644 --- a/src/main/java/fr/xephi/authme/settings/OtherAccounts.java +++ b/src/main/java/fr/xephi/authme/settings/OtherAccounts.java @@ -45,7 +45,7 @@ public class OtherAccounts extends CustomConfiguration { save(); } } catch (NoSuchMethodError | Exception e) { - //ingore + //ignore } } From a502a479b8f1ebf7baec33f39ef34afbab47fb2b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 6 Oct 2015 21:04:06 +0200 Subject: [PATCH 264/427] Fix compatibility --- src/main/java/fr/xephi/authme/AuthMe.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 23c556c8..be4c104b 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -73,9 +73,9 @@ import fr.xephi.authme.settings.Spawn; public class AuthMe extends JavaPlugin { private static AuthMe authme; + private static Server server; + private Logger authmeLogger; - private final Server server = getServer(); - private Logger authmeLogger = Logger.getLogger("AuthMe"); public Management management; public NewAPI api; public SendMailSSL mail; @@ -96,7 +96,7 @@ public class AuthMe extends JavaPlugin { public CombatTagPlus combatTagPlus; public AuthMeInventoryPacketAdapter inventoryProtector; - // Manager + // Module manager private ModuleManager moduleManager; // TODO: Create Manager for fields below @@ -124,6 +124,8 @@ public class AuthMe extends JavaPlugin { @Override public void onEnable() { // Set the Instance + server = getServer(); + authmeLogger = Logger.getLogger("AuthMe"); authme = this; // TODO: split the plugin in more modules From 193c9eda4379c93b1a7d1d5250a2dcb05c6c0750 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Thu, 8 Oct 2015 20:19:43 +0200 Subject: [PATCH 265/427] Update sqlite driver --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7bdad8cf..bfdd8567 100644 --- a/pom.xml +++ b/pom.xml @@ -215,7 +215,7 @@ org.xerial sqlite-jdbc - 3.8.11.1 + 3.8.11.2 compile true From 3567fc909dd856fe33c1722b3badc90d4546bdf0 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 9 Oct 2015 19:18:24 +0200 Subject: [PATCH 266/427] Organize imports --- src/main/java/fr/xephi/authme/AuthMe.java | 10 ++-- .../java/fr/xephi/authme/ConsoleLogger.java | 9 ++-- .../java/fr/xephi/authme/DataManager.java | 13 ++--- src/main/java/fr/xephi/authme/Utils.java | 28 +++++----- .../xephi/authme/cache/backup/JsonCache.java | 28 ++++++---- .../xephi/authme/cache/limbo/LimboCache.java | 13 ++--- .../xephi/authme/commands/AdminCommand.java | 35 ++++++------ .../commands/ChangePasswordCommand.java | 9 ++-- .../authme/commands/RegisterCommand.java | 9 ++-- .../authme/commands/UnregisterCommand.java | 23 ++++---- .../authme/converter/CrazyLoginConverter.java | 13 ++--- .../fr/xephi/authme/converter/FlatToSql.java | 9 +++- .../xephi/authme/converter/FlatToSqlite.java | 16 ++++-- .../authme/converter/RakamakConverter.java | 19 +++---- .../authme/converter/RoyalAuthConverter.java | 7 +-- .../authme/converter/RoyalAuthYamlReader.java | 4 +- .../fr/xephi/authme/converter/SqlToFlat.java | 7 +-- .../authme/converter/vAuthConverter.java | 3 +- .../authme/converter/vAuthFileReader.java | 17 +++--- .../authme/converter/xAuthConverter.java | 3 +- .../xephi/authme/converter/xAuthToFlat.java | 17 +++--- .../authme/datasource/CacheDataSource.java | 13 ++--- .../xephi/authme/datasource/DataSource.java | 4 +- .../authme/datasource/DatabaseCalls.java | 4 +- .../fr/xephi/authme/datasource/FlatFile.java | 14 +++-- .../fr/xephi/authme/datasource/MySQL.java | 14 +++-- .../fr/xephi/authme/datasource/SQLite.java | 13 +++-- .../authme/datasource/SQLite_HIKARI.java | 13 +++-- .../authme/events/StoreInventoryEvent.java | 3 +- .../authme/listener/AuthMeBlockListener.java | 5 +- .../authme/listener/AuthMeEntityListener.java | 15 ++++-- .../AuthMeInventoryPacketAdapter.java | 18 ++++--- .../authme/listener/AuthMePlayerListener.java | 53 +++++++++++++------ .../listener/AuthMePlayerListener16.java | 7 +-- .../listener/AuthMePlayerListener18.java | 7 +-- .../authme/listener/AuthMeServerListener.java | 11 ++-- .../xephi/authme/modules/ModuleManager.java | 8 +-- .../plugin/manager/BungeeCordMessage.java | 6 ++- .../authme/process/join/AsyncronousJoin.java | 21 ++++---- .../process/login/AsyncronousLogin.java | 13 ++--- .../ProcessSyncronousPasswordRegister.java | 15 +++--- .../authme/security/PasswordSecurity.java | 15 +++--- .../security/crypts/CryptPBKDF2Django.java | 7 +-- .../authme/settings/CustomConfiguration.java | 11 ++-- .../fr/xephi/authme/settings/Messages.java | 6 ++- .../fr/xephi/authme/settings/Settings.java | 18 ++++--- .../xephi/authme/task/ChangePasswordTask.java | 7 +-- .../fr/xephi/authme/task/MessageTask.java | 5 +- 48 files changed, 364 insertions(+), 254 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index be4c104b..1b21b9b9 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -10,8 +10,8 @@ import java.util.Date; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; -import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Server; @@ -22,12 +22,10 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; - import org.mcstats.Metrics; -import net.milkbowl.vault.permission.Permission; -import com.onarandombox.MultiverseCore.MultiverseCore; + import com.earth2me.essentials.Essentials; -import net.minelink.ctplus.CombatTagPlus; +import com.onarandombox.MultiverseCore.MultiverseCore; import fr.xephi.authme.api.API; import fr.xephi.authme.api.NewAPI; @@ -69,6 +67,8 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.OtherAccounts; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; +import net.milkbowl.vault.permission.Permission; +import net.minelink.ctplus.CombatTagPlus; public class AuthMe extends JavaPlugin { diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index befffc68..b7e75790 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -1,9 +1,5 @@ package fr.xephi.authme; -import com.google.common.base.Throwables; -import fr.xephi.authme.api.NewAPI; -import fr.xephi.authme.settings.Settings; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardOpenOption; @@ -12,6 +8,11 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Logger; +import com.google.common.base.Throwables; + +import fr.xephi.authme.api.NewAPI; +import fr.xephi.authme.settings.Settings; + public class ConsoleLogger { private static final Logger log = AuthMe.getInstance().getLogger(); diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 9263443f..4fe81643 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -1,11 +1,5 @@ package fr.xephi.authme; -import fr.xephi.authme.settings.Settings; -import net.milkbowl.vault.permission.Permission; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - import java.io.File; import java.util.List; import java.util.concurrent.Callable; @@ -13,6 +7,13 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + +import fr.xephi.authme.settings.Settings; +import net.milkbowl.vault.permission.Permission; + public class DataManager { public AuthMe plugin; diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 2a9e8c6e..75d8ca61 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,18 +1,5 @@ package fr.xephi.authme; -import com.maxmind.geoip.LookupService; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.events.AuthMeTeleportEvent; -import fr.xephi.authme.settings.Settings; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; - import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; @@ -25,6 +12,21 @@ import java.util.Collection; import java.util.Collections; import java.util.zip.GZIPInputStream; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import com.maxmind.geoip.LookupService; + +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; +import fr.xephi.authme.events.AuthMeTeleportEvent; +import fr.xephi.authme.settings.Settings; + public class Utils { public static AuthMe plugin; diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 1e66e0aa..837bf45a 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -1,19 +1,27 @@ package fr.xephi.authme.cache.backup; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import com.google.gson.*; - -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -import fr.xephi.authme.settings.Settings; - -import org.bukkit.entity.Player; - import java.io.File; import java.io.IOException; import java.lang.reflect.Type; +import org.bukkit.entity.Player; + +import com.google.common.base.Charsets; +import com.google.common.io.Files; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; + +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +import fr.xephi.authme.settings.Settings; + public class JsonCache { private final Gson gson; diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index 1ab123b6..70614107 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -1,5 +1,12 @@ package fr.xephi.authme.cache.limbo; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.backup.DataFileCache; @@ -7,12 +14,6 @@ import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.events.ResetInventoryEvent; import fr.xephi.authme.events.StoreInventoryEvent; import fr.xephi.authme.settings.Settings; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.util.concurrent.ConcurrentHashMap; public class LimboCache { diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 49042a43..d21c5ba1 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -1,5 +1,23 @@ package fr.xephi.authme.commands; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -14,23 +32,6 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; public class AdminCommand implements CommandExecutor { diff --git a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java index 54626d77..4a668bfe 100644 --- a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java @@ -1,14 +1,15 @@ package fr.xephi.authme.commands; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.ChangePasswordTask; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class ChangePasswordCommand implements CommandExecutor { diff --git a/src/main/java/fr/xephi/authme/commands/RegisterCommand.java b/src/main/java/fr/xephi/authme/commands/RegisterCommand.java index 68f59b94..0707ee78 100644 --- a/src/main/java/fr/xephi/authme/commands/RegisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/RegisterCommand.java @@ -1,14 +1,15 @@ package fr.xephi.authme.commands; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class RegisterCommand implements CommandExecutor { diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 06f9b147..d51e148c 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -1,5 +1,17 @@ package fr.xephi.authme.commands; +import java.security.NoSuchAlgorithmException; + +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -13,17 +25,6 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; -import org.bukkit.Location; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -import java.security.NoSuchAlgorithmException; public class UnregisterCommand implements CommandExecutor { diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index c598f518..26dcff38 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -1,16 +1,17 @@ package fr.xephi.authme.converter; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; /** * @author Xephi59 diff --git a/src/main/java/fr/xephi/authme/converter/FlatToSql.java b/src/main/java/fr/xephi/authme/converter/FlatToSql.java index 17a5701a..08641926 100644 --- a/src/main/java/fr/xephi/authme/converter/FlatToSql.java +++ b/src/main/java/fr/xephi/authme/converter/FlatToSql.java @@ -1,11 +1,16 @@ package fr.xephi.authme.converter; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.settings.Settings; -import java.io.*; - /** * @author Xephi59 */ diff --git a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java index fb77d492..cc121b82 100644 --- a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java @@ -1,14 +1,20 @@ package fr.xephi.authme.converter; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import org.bukkit.command.CommandSender; + +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.settings.Settings; public class FlatToSqlite implements Converter { diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index b2ddf704..caeaccc7 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -1,14 +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; -import fr.xephi.authme.security.HashAlgorithm; -import fr.xephi.authme.security.PasswordSecurity; -import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -17,6 +8,16 @@ import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map.Entry; +import org.bukkit.command.CommandSender; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.datasource.DataSource; +import fr.xephi.authme.security.HashAlgorithm; +import fr.xephi.authme.security.PasswordSecurity; +import fr.xephi.authme.settings.Settings; + /** * @author Xephi59 */ diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java index 4af9f1bd..03e27813 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java @@ -1,12 +1,13 @@ package fr.xephi.authme.converter; +import java.io.File; + +import org.bukkit.OfflinePlayer; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; -import org.bukkit.OfflinePlayer; - -import java.io.File; public class RoyalAuthConverter implements Converter { diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java index f0510c75..cebbee0d 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthYamlReader.java @@ -1,9 +1,9 @@ package fr.xephi.authme.converter; -import fr.xephi.authme.settings.CustomConfiguration; - import java.io.File; +import fr.xephi.authme.settings.CustomConfiguration; + public class RoyalAuthYamlReader extends CustomConfiguration { public RoyalAuthYamlReader(File file) { diff --git a/src/main/java/fr/xephi/authme/converter/SqlToFlat.java b/src/main/java/fr/xephi/authme/converter/SqlToFlat.java index bc8b0834..484d2a6b 100644 --- a/src/main/java/fr/xephi/authme/converter/SqlToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/SqlToFlat.java @@ -1,14 +1,15 @@ package fr.xephi.authme.converter; +import java.util.List; + +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.FlatFile; import fr.xephi.authme.settings.Messages; -import org.bukkit.command.CommandSender; - -import java.util.List; public class SqlToFlat implements Converter { diff --git a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java index 1de9f104..1939c6c1 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java @@ -1,9 +1,10 @@ package fr.xephi.authme.converter; +import org.bukkit.command.CommandSender; + 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 { diff --git a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java index 4a193e15..8e2a1fc5 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java @@ -1,18 +1,19 @@ 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; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.CommandSender; - import java.io.File; import java.io.IOException; import java.util.Scanner; import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.datasource.DataSource; + public class vAuthFileReader { public AuthMe plugin; diff --git a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java index a5c063fd..1f813668 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java @@ -1,8 +1,9 @@ package fr.xephi.authme.converter; -import fr.xephi.authme.AuthMe; import org.bukkit.command.CommandSender; +import fr.xephi.authme.AuthMe; + public class xAuthConverter implements Converter { public AuthMe plugin; diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index d9823562..df45d80c 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -1,13 +1,5 @@ package fr.xephi.authme.converter; -import de.luricos.bukkit.xAuth.database.DatabaseTables; -import de.luricos.bukkit.xAuth.utils.xAuthLog; -import de.luricos.bukkit.xAuth.xAuth; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.datasource.DataSource; -import org.bukkit.command.CommandSender; - import java.io.File; import java.sql.Connection; import java.sql.PreparedStatement; @@ -16,6 +8,15 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import org.bukkit.command.CommandSender; + +import de.luricos.bukkit.xAuth.xAuth; +import de.luricos.bukkit.xAuth.database.DatabaseTables; +import de.luricos.bukkit.xAuth.utils.xAuthLog; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.datasource.DataSource; + public class xAuthToFlat { public AuthMe instance; diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index f1298065..56505649 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -1,11 +1,5 @@ package fr.xephi.authme.datasource; -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 org.bukkit.entity.Player; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -13,6 +7,13 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.bukkit.entity.Player; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; + public class CacheDataSource implements DataSource { private final DataSource source; diff --git a/src/main/java/fr/xephi/authme/datasource/DataSource.java b/src/main/java/fr/xephi/authme/datasource/DataSource.java index b89f13aa..184a4fe9 100644 --- a/src/main/java/fr/xephi/authme/datasource/DataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/DataSource.java @@ -1,9 +1,9 @@ package fr.xephi.authme.datasource; -import fr.xephi.authme.cache.auth.PlayerAuth; - import java.util.List; +import fr.xephi.authme.cache.auth.PlayerAuth; + public interface DataSource { enum DataSourceType { diff --git a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java index 20cd97df..5a263b28 100644 --- a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java +++ b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java @@ -1,13 +1,13 @@ package fr.xephi.authme.datasource; -import fr.xephi.authme.cache.auth.PlayerAuth; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import fr.xephi.authme.cache.auth.PlayerAuth; + public class DatabaseCalls implements DataSource { private DataSource database; diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 0f3872b4..052abe7f 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -1,15 +1,21 @@ package fr.xephi.authme.datasource; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +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.Settings; -import java.io.*; -import java.util.ArrayList; -import java.util.List; - public class FlatFile implements DataSource { /* diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 8e5d4cc1..28b85ee4 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -1,18 +1,24 @@ package fr.xephi.authme.datasource; +import java.sql.Blob; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.pool.PoolInitializationException; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.Settings; -import java.sql.*; -import java.util.ArrayList; -import java.util.List; - public class MySQL implements DataSource { private String host; diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 466dbe7f..80a75a64 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -1,13 +1,18 @@ package fr.xephi.authme.datasource; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.settings.Settings; -import java.sql.*; -import java.util.ArrayList; -import java.util.List; - public class SQLite implements DataSource { private String database; diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index d0b14026..4caecf26 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -1,16 +1,21 @@ package fr.xephi.authme.datasource; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.settings.Settings; -import java.sql.*; -import java.util.ArrayList; -import java.util.List; - public class SQLite_HIKARI implements DataSource { private String database; diff --git a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java index 18476525..9bfc8696 100644 --- a/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/StoreInventoryEvent.java @@ -1,9 +1,10 @@ package fr.xephi.authme.events; -import fr.xephi.authme.cache.backup.JsonCache; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import fr.xephi.authme.cache.backup.JsonCache; + /** * This event is call just before write inventory content to cache * diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index 678fbca2..3708b702 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -1,13 +1,14 @@ package fr.xephi.authme.listener; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; + public class AuthMeBlockListener implements Listener { public AuthMe instance; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index acd65e0c..51b953fc 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -1,8 +1,5 @@ package fr.xephi.authme.listener; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; - import java.lang.reflect.Method; import org.bukkit.entity.Entity; @@ -12,9 +9,19 @@ import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.*; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityInteractEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.projectiles.ProjectileSource; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; + public class AuthMeEntityListener implements Listener { public AuthMe instance; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryPacketAdapter.java b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryPacketAdapter.java index c045a94e..f3d9fba3 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeInventoryPacketAdapter.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeInventoryPacketAdapter.java @@ -16,23 +16,25 @@ */ package fr.xephi.authme.listener; +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.Collections; +import java.util.logging.Level; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.settings.Settings; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; -import java.util.Collections; -import java.util.logging.Level; public class AuthMeInventoryPacketAdapter extends PacketAdapter { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 5706ef66..420bee61 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -1,16 +1,11 @@ package fr.xephi.authme.listener; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -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.cache.limbo.LimboPlayer; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.PatternSyntaxException; + import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -23,13 +18,37 @@ import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerBedEnterEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerFishEvent; +import org.bukkit.event.player.PlayerGameModeChangeEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerShearEntityEvent; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.PatternSyntaxException; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +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.cache.limbo.LimboPlayer; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; public class AuthMePlayerListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java index 2959b84f..d535e351 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java @@ -1,12 +1,13 @@ package fr.xephi.authme.listener; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerEditBookEvent; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; public class AuthMePlayerListener16 implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java index 0b88b4d1..0ca2fb78 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java @@ -1,12 +1,13 @@ package fr.xephi.authme.listener; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.Utils; public class AuthMePlayerListener18 implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 6581f510..bde28732 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -1,10 +1,5 @@ package fr.xephi.authme.listener; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -12,6 +7,12 @@ import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.ServerListPingEvent; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; + public class AuthMeServerListener implements Listener { public AuthMe plugin; diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index 0d598fc4..3fa2e915 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -1,9 +1,5 @@ package fr.xephi.authme.modules; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.settings.Settings; - import java.io.File; import java.io.IOException; import java.net.URL; @@ -15,6 +11,10 @@ import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.settings.Settings; + public class ModuleManager { private List modules = new ArrayList<>(); diff --git a/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java b/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java index 59814738..a81745e7 100644 --- a/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java +++ b/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java @@ -1,10 +1,12 @@ package fr.xephi.authme.plugin.manager; +import org.bukkit.entity.Player; +import org.bukkit.plugin.messaging.PluginMessageListener; + import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; + import fr.xephi.authme.AuthMe; -import org.bukkit.entity.Player; -import org.bukkit.plugin.messaging.PluginMessageListener; public class BungeeCordMessage implements PluginMessageListener { diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 9a31b835..e628bc73 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -1,5 +1,16 @@ package fr.xephi.authme.process.join; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -17,16 +28,6 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; public class AsyncronousJoin { diff --git a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java index e25c8457..a3b43791 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java @@ -1,5 +1,12 @@ package fr.xephi.authme.process.login; +import java.util.Date; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -14,12 +21,6 @@ import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitTask; - -import java.util.Date; -import java.util.List; public class AsyncronousLogin { diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 1e20f2ba..bd299191 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -1,5 +1,13 @@ package fr.xephi.authme.process.register; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -13,13 +21,6 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; public class ProcessSyncronousPasswordRegister implements Runnable { diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index a95a848d..baf7ae5a 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -1,18 +1,19 @@ package fr.xephi.authme.security; +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.util.HashMap; + +import org.bukkit.Bukkit; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.events.PasswordEncryptionEvent; import fr.xephi.authme.security.crypts.BCRYPT; import fr.xephi.authme.security.crypts.EncryptionMethod; import fr.xephi.authme.settings.Settings; -import org.bukkit.Bukkit; - -import java.math.BigInteger; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.util.HashMap; public class PasswordSecurity { diff --git a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java index c1e119a3..574337ed 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java @@ -1,11 +1,12 @@ package fr.xephi.authme.security.crypts; +import java.security.NoSuchAlgorithmException; + +import javax.xml.bind.DatatypeConverter; + import fr.xephi.authme.security.pbkdf2.PBKDF2Engine; import fr.xephi.authme.security.pbkdf2.PBKDF2Parameters; -import javax.xml.bind.DatatypeConverter; -import java.security.NoSuchAlgorithmException; - public class CryptPBKDF2Django implements EncryptionMethod { @Override diff --git a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java index d9db941e..5ca9422f 100644 --- a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java +++ b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java @@ -1,10 +1,5 @@ package fr.xephi.authme.settings; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.YamlConfiguration; - import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -12,6 +7,12 @@ import java.io.InputStream; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.file.YamlConfiguration; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; + public class CustomConfiguration extends YamlConfiguration { private File configFile; diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index 81c6a038..3514c704 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -1,9 +1,11 @@ package fr.xephi.authme.settings; -import fr.xephi.authme.ConsoleLogger; -import org.bukkit.command.CommandSender; import java.io.File; +import org.bukkit.command.CommandSender; + +import fr.xephi.authme.ConsoleLogger; + public class Messages extends CustomConfiguration { private static Messages singleton = null; diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 9264ae54..930d6f28 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -1,16 +1,22 @@ package fr.xephi.authme.settings; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.configuration.file.YamlConfiguration; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource.DataSourceType; import fr.xephi.authme.security.HashAlgorithm; -import org.bukkit.configuration.file.YamlConfiguration; - -import java.io.*; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; public final class Settings extends YamlConfiguration { diff --git a/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java b/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java index 2cf21d19..2f795273 100644 --- a/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java +++ b/src/main/java/fr/xephi/authme/task/ChangePasswordTask.java @@ -1,5 +1,9 @@ package fr.xephi.authme.task; +import java.security.NoSuchAlgorithmException; + +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -7,9 +11,6 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.entity.Player; - -import java.security.NoSuchAlgorithmException; public class ChangePasswordTask implements Runnable { diff --git a/src/main/java/fr/xephi/authme/task/MessageTask.java b/src/main/java/fr/xephi/authme/task/MessageTask.java index e4ac9e3a..bbef229f 100644 --- a/src/main/java/fr/xephi/authme/task/MessageTask.java +++ b/src/main/java/fr/xephi/authme/task/MessageTask.java @@ -1,11 +1,12 @@ package fr.xephi.authme.task; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitTask; public class MessageTask implements Runnable { From 41bbbf0a961b2da4bb35b216f8515170cf780881 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 10 Oct 2015 00:31:47 +0200 Subject: [PATCH 267/427] custom graphs --- src/main/java/fr/xephi/authme/AuthMe.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 1b21b9b9..e96b5878 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -23,6 +23,7 @@ import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; import org.mcstats.Metrics; +import org.mcstats.Metrics.Graph; import com.earth2me.essentials.Essentials; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -162,6 +163,25 @@ public class AuthMe extends JavaPlugin { // Start the metrics service try { Metrics metrics = new Metrics(this); + Graph messagesLanguage = metrics.createGraph("Messages language"); + Graph databaseBackend = metrics.createGraph("Database backend"); + + // Custom graphs + if(Settings.messageFile.exists()) { + messagesLanguage.addPlotter(new Metrics.Plotter(Settings.messagesLanguage) { + @Override + public int getValue() { + return 1; + } + }); + } + databaseBackend.addPlotter(new Metrics.Plotter(Settings.getDataSource.toString()) { + @Override + public int getValue() { + return 1; + } + }); + metrics.start(); ConsoleLogger.info("Metrics started successfully!"); } catch (Exception e) { From 8ad2fde798cc02014b0858daf8da32a82704282a Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Mon, 12 Oct 2015 13:56:12 +0200 Subject: [PATCH 268/427] Remove REALLY old loading chunk system before teleport --- .../login/ProcessSyncronousPlayerLogin.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 20eacdf2..00322f68 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -69,12 +69,8 @@ public class ProcessSyncronousPlayerLogin implements Runnable { protected void teleportBackFromSpawn() { AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc()); pm.callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - Location fLoc = tpEvent.getTo(); - if (!fLoc.getChunk().isLoaded()) { - fLoc.getChunk().load(); - } - player.teleport(fLoc); + if (!tpEvent.isCancelled() && tpEvent.getTo() != null) { + player.teleport(tpEvent.getTo()); } } @@ -82,12 +78,8 @@ public class ProcessSyncronousPlayerLogin implements Runnable { Location spawnL = plugin.getSpawnLocation(player); SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnL, true); pm.callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - Location fLoc = tpEvent.getTo(); - if (!fLoc.getChunk().isLoaded()) { - fLoc.getChunk().load(); - } - player.teleport(fLoc); + if (!tpEvent.isCancelled() && tpEvent.getTo() != null) { + player.teleport(tpEvent.getTo()); } } From 3c0e6e06c70dc9af1b5c34c49ba24a4cefc99139 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Mon, 12 Oct 2015 14:57:56 +0200 Subject: [PATCH 269/427] Fix some case when connection is not available --- src/main/java/fr/xephi/authme/AuthMe.java | 10 +- .../fr/xephi/authme/datasource/MySQL.java | 100 +++++++++++++----- 2 files changed, 76 insertions(+), 34 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index be4c104b..98b8f1c2 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -342,11 +342,6 @@ public class AuthMe extends JavaPlugin { } } - // Close the database - if (database != null) { - database.close(); - } - // Do backup on stop if enabled if (Settings.isBackupActivated && Settings.isBackupOnStop) { boolean Backup = new PerformBackup(this).doBackup(); @@ -358,6 +353,11 @@ public class AuthMe extends JavaPlugin { // Unload modules moduleManager.unloadModules(); + // Close the database + if (database != null) { + database.close(); + } + // Disabled correctly ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " disabled!"); } diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 8e5d4cc1..30eba235 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -13,6 +13,8 @@ import java.sql.*; import java.util.ArrayList; import java.util.List; +import org.bukkit.Bukkit; + public class MySQL implements DataSource { private String host; @@ -122,9 +124,24 @@ public class MySQL implements DataSource { } private synchronized Connection getConnection() throws SQLException { - Connection con; - con = ds.getConnection(); - return con; + if (!ds.isClosed()) + { + Connection con; + con = ds.getConnection(); + return con; + } + ConsoleLogger.showError("Can't open a database connection!"); + if (Settings.isStopEnabled) + { + ConsoleLogger.showError("Server will ShuttingDown for Security reason"); + Bukkit.getScheduler().scheduleSyncDelayedTask(AuthMe.getInstance(), new Runnable(){ + @Override + public void run() { + AuthMe.getInstance().getServer().shutdown(); + } + }); + } + return null; } private synchronized void setupConnection() throws SQLException { @@ -132,7 +149,8 @@ public class MySQL implements DataSource { Statement st = null; ResultSet rs = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return; st = con.createStatement(); st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" + columnID + " INTEGER AUTO_INCREMENT," + columnName + " VARCHAR(255) NOT NULL UNIQUE," + columnPassword + " VARCHAR(255) NOT NULL," + columnIp + " VARCHAR(40) NOT NULL DEFAULT '127.0.0.1'," + columnLastLogin + " BIGINT NOT NULL DEFAULT '" + System.currentTimeMillis() + "'," + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT '" + Settings.defaultWorld + "'," + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com'," + columnLogged + " SMALLINT NOT NULL DEFAULT '0'," + "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));"); rs = con.getMetaData().getColumns(null, null, tableName, columnPassword); @@ -193,7 +211,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return true; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); pst.setString(1, user); rs = pst.executeQuery(); @@ -216,7 +235,8 @@ public class MySQL implements DataSource { PlayerAuth pAuth = null; int id; try { - con = getConnection(); + if ((con = getConnection()) == null) + return null; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); pst.setString(1, user); rs = pst.executeQuery(); @@ -266,7 +286,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return false; if ((columnSalt == null || columnSalt.isEmpty()) || (auth.getSalt() == null || auth.getSalt().isEmpty())) { pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnRealName + ") VALUES (?,?,?,?,?);"); pst.setString(1, auth.getNickname()); @@ -472,7 +493,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return false; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnPassword + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getHash()); pst.setString(2, auth.getNickname()); @@ -515,7 +537,8 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return false; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=?, " + columnRealName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getIp()); pst.setLong(2, auth.getLastLogin()); @@ -537,7 +560,8 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return 0; pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + " list = new ArrayList<>(); try { - con = getConnection(); + if ((con = getConnection()) == null) + return list; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + " countIp = new ArrayList<>(); try { - con = getConnection(); + if ((con = getConnection()) == null) + return countIp; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, auth.getIp()); rs = pst.executeQuery(); @@ -769,7 +800,8 @@ public class MySQL implements DataSource { ResultSet rs = null; List countIp = new ArrayList<>(); try { - con = getConnection(); + if ((con = getConnection()) == null) + return countIp; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, ip); rs = pst.executeQuery(); @@ -794,7 +826,8 @@ public class MySQL implements DataSource { ResultSet rs = null; List countEmail = new ArrayList<>(); try { - con = getConnection(); + if ((con = getConnection()) == null) + return countEmail; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); pst.setString(1, email); rs = pst.executeQuery(); @@ -817,8 +850,9 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { + if ((con = getConnection()) == null) + return; for (String name : banned) { - con = getConnection(); pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, name); pst.executeUpdate(); @@ -842,7 +876,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return false; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, user); rs = pst.executeQuery(); @@ -864,7 +899,8 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setInt(1, 1); pst.setString(2, user); @@ -883,7 +919,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; if (user != null) try { - con = getConnection(); + if ((con = getConnection()) == null) + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setInt(1, 0); pst.setString(2, user); @@ -901,7 +938,8 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnLogged + "=?;"); pst.setInt(1, 0); pst.setInt(2, 1); @@ -921,7 +959,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs; try { - con = getConnection(); + if ((con = getConnection()) == null) + return result; pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";"); rs = pst.executeQuery(); if (rs != null && rs.next()) { @@ -942,7 +981,8 @@ public class MySQL implements DataSource { Connection con = null; PreparedStatement pst = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, newone); pst.setString(2, oldone); @@ -962,7 +1002,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return auths; pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); rs = pst.executeQuery(); while (rs.next()) { @@ -1012,7 +1053,8 @@ public class MySQL implements DataSource { PreparedStatement pst = null; ResultSet rs = null; try { - con = getConnection(); + if ((con = getConnection()) == null) + return auths; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); rs = pst.executeQuery(); while (rs.next()) { From 5b98759b61611106b379ead6fb5f1de2287ff14a Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Mon, 12 Oct 2015 15:01:57 +0200 Subject: [PATCH 270/427] Change how purge logged works at starting/stopping server --- src/main/java/fr/xephi/authme/AuthMe.java | 25 ++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 98b8f1c2..6596ae53 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -263,19 +263,17 @@ public class AuthMe extends JavaPlugin { } // Reload support hook - if (Settings.reloadSupport) { - if (database != null) { - int playersOnline = Utils.getOnlinePlayers().size(); - if (playersOnline < 1) { - database.purgeLogged(); - } else { - for (PlayerAuth auth : database.getLoggedPlayers()) { - if (auth == null) - continue; - auth.setLastLogin(new Date().getTime()); - database.updateSession(auth); - PlayerCache.getInstance().addPlayer(auth); - } + if (database != null) { + int playersOnline = Utils.getOnlinePlayers().size(); + if (playersOnline < 1) { + database.purgeLogged(); + } else if (Settings.reloadSupport) { + for (PlayerAuth auth : database.getLoggedPlayers()) { + if (auth == null) + continue; + auth.setLastLogin(new Date().getTime()); + database.updateSession(auth); + PlayerCache.getInstance().addPlayer(auth); } } } @@ -564,7 +562,6 @@ public class AuthMe extends JavaPlugin { } } PlayerCache.getInstance().removePlayer(name); - database.setUnlogged(name); player.saveData(); } From 8e90a5f9a82aba9622bf81420394b8fbc767a976 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Mon, 12 Oct 2015 15:10:14 +0200 Subject: [PATCH 271/427] Force a player just registered by an admin to log again --- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 49042a43..a393a72e 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -233,6 +233,7 @@ public class AdminCommand implements CommandExecutor { return true; } final String name = args[1].toLowerCase(); + final String realName = args[1]; final 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(sender, "password_error"); @@ -269,6 +270,9 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "error"); return; } + plugin.database.setUnlogged(name); + if (Bukkit.getPlayerExact(realName) != null) + Bukkit.getPlayerExact(realName).kickPlayer("An admin just registered you, please log again"); m.send(sender, "registered"); ConsoleLogger.info(name + " registered"); } catch (NoSuchAlgorithmException ex) { From 5e991f7f420bc53244e1588a5d6eeb91f4b926c3 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Mon, 12 Oct 2015 15:12:01 +0200 Subject: [PATCH 272/427] realName here --- 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 a393a72e..52265467 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -262,7 +262,7 @@ public class AdminCommand implements CommandExecutor { return; } String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name); - PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com", name); + PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com", realName); if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) auth.setSalt(PasswordSecurity.userSalt.get(name)); else auth.setSalt(""); From 39ab41f542b87a749a71556a9fbddb52a7d90bce Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Mon, 12 Oct 2015 15:49:19 +0200 Subject: [PATCH 273/427] Add an option to disable all caching (useful if you use website registration system) --- .../fr/xephi/authme/datasource/MySQL.java | 14 +++++++-- .../fr/xephi/authme/settings/Settings.java | 7 ++++- src/main/resources/config.yml | 30 ++++++++++--------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 30eba235..82423bd4 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -102,9 +102,15 @@ public class MySQL implements DataSource { config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); - config.addDataSourceProperty("cachePrepStmts", "true"); - config.addDataSourceProperty("prepStmtCacheSize", "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + if (Settings.isMySQLWebsite) + { + config.addDataSourceProperty("cachePrepStmts", "false"); + } + else { + config.addDataSourceProperty("cachePrepStmts", "true"); + config.addDataSourceProperty("prepStmtCacheSize", "250"); + config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + } config.addDataSourceProperty("autoReconnect", false); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable config.setMaxLifetime(180000); // 3 Min @@ -197,6 +203,8 @@ public class MySQL implements DataSource { if (!rs.next()) { st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) NOT NULL DEFAULT 'Player' AFTER " + columnLogged + ";"); } + if (Settings.isMySQLWebsite) + st.execute("SET GLOBAL query_cache_size = 0; SET GLOBAL query_cache_type = 0;"); } finally { close(rs); close(st); diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 9264ae54..d185a4c1 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -68,7 +68,7 @@ public final class Settings extends YamlConfiguration { enableProtection, enableAntiBot, recallEmail, useWelcomeMessage, broadcastWelcomeMessage, forceRegKick, forceRegLogin, checkVeryGames, delayJoinMessage, noTeleport, applyBlindEffect, - customAttributes, generateImage, isRemoveSpeedEnabled; + customAttributes, generateImage, isRemoveSpeedEnabled, isMySQLWebsite; public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase, @@ -275,6 +275,7 @@ public final class Settings extends YamlConfiguration { forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole"); customAttributes = configFile.getBoolean("Hooks.customAttributes"); generateImage = configFile.getBoolean("Email.generateImage", true); + isMySQLWebsite = configFile.getBoolean("DataSource.mySQLWebsite", false); // Load the welcome message getWelcomeMessage(); @@ -476,6 +477,10 @@ public final class Settings extends YamlConfiguration { set("DataSource.mySQLRealName", "realname"); changes = true; } + if (!contains("DataSource.mySQLQueryCache")) { + set("DataSource.mySQLWebsite", false); + changes = true; + } if (changes) { plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me"); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c10c977e..ef9fd214 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -43,12 +43,14 @@ DataSource: mySQLlastlocWorld: world # Column for RealName mySQLRealName: realname + # Enable this when you allow registration through a website + mySQLWebsite: false settings: sessions: - # Do you want to enable the session feature? + # Do you want to enable the session feature? # If enabled, when a player authenticates successfully, # his IP and his nickname is saved. - # The next time the player joins the server, if his IP + # The next time the player joins the server, if his IP # is the same of the last time, and the timeout time # hasn't expired, he will not need to authenticate. enabled: false @@ -62,7 +64,7 @@ settings: # another IP Address? sessionExpireOnIpChange: true restrictions: - # Can not authenticated players chat and see the chat log? + # Can not authenticated players chat and see the chat log? # Care that this feature blocks also all the commands not # listed in the list below. allowChat: false @@ -109,7 +111,7 @@ settings: # After the authentication they will be teleported back to # their normal position. teleportUnAuthedToSpawn: false - # Minimum allowed nick length + # Minimum allowed nick length minNicknameLength: 4 # Can unregistered players walk around? allowMovement: false @@ -161,25 +163,25 @@ settings: security: # minimum Length of password minPasswordLength: 5 - # this is very important options, + # this is very important options, # every time player join the server, - # if they are registered, AuthMe will switch him + # if they are registered, AuthMe will switch him # to unLoggedInGroup, this - # should prevent all major exploit. + # should prevent all major exploit. # So you can set up on your Permission Plugin - # this special group with 0 permissions, or permissions to chat, + # this special group with 0 permissions, or permissions to chat, # or permission to - # send private message or all other perms that you want, + # send private message or all other perms that you want, # the better way is to set up # this group with few permissions, # so if player try to exploit some account, # they can # do anything except what you set in perm Group. - # After a correct logged-in player will be + # After a correct logged-in player will be # moved to his correct permissions group! - # Pay attention group name is case sensitive, - # so Admin is different from admin, - # otherwise your group will be wiped, + # Pay attention group name is case sensitive, + # so Admin is different from admin, + # otherwise your group will be wiped, # and player join in default group []! # Example unLoggedinGroup: NotLogged unLoggedinGroup: unLoggedinGroup @@ -244,7 +246,7 @@ settings: # Force these commands after /register as a server console, without any '/', use %p for replace with player name forceRegisterCommandsAsConsole: [] # Do we need to display the welcome message (welcome.txt) after a register or a login? - # You can use colors in this welcome.txt + some replaced strings : + # You can use colors in this welcome.txt + some replaced strings : # {PLAYER} : player name, {ONLINE} : display number of online players, {MAXPLAYERS} : display server slots, # {IP} : player ip, {LOGINS} : number of players logged, {WORLD} : player current world, {SERVER} : server name # {VERSION} : get current bukkit version, {COUNTRY} : player country From 92777cd383db71f4cac533336f916c6336476b93 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 12 Oct 2015 18:16:56 +0200 Subject: [PATCH 274/427] cleanup --- .../java/fr/xephi/authme/DataManager.java | 27 ++++++------------- .../xephi/authme/commands/AdminCommand.java | 1 + .../fr/xephi/authme/datasource/MySQL.java | 4 +-- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 4fe81643..9af22a22 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -104,20 +104,16 @@ public class DataManager { for (String name : cleared) { try { org.bukkit.OfflinePlayer player = getOfflinePlayer(name); - File playerFile = null; if (player == null) { continue; } try { - playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); - } catch(Exception ignore) { - } - if (playerFile.exists()) { + File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); playerFile.delete(); i++; - } else { - playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getName() + ".dat"); + } catch(Exception ignore) { + File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getName() + ".dat"); if (playerFile.exists()) { playerFile.delete(); i++; @@ -134,22 +130,15 @@ public class DataManager { int i = 0; for (String name : cleared) { try { - File playerFile = null; - try { - playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml"); - } catch(Exception ignore) { - } + File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml"); + playerFile.delete(); + i++; + } catch (Exception e) { + File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml"); if (playerFile.exists()) { playerFile.delete(); i++; - } else { - playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml"); - if (playerFile.exists()) { - playerFile.delete(); - i++; - } } - } catch (Exception e) { } } ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles"); diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index b7b6c698..a5c77430 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -255,6 +255,7 @@ public class AdminCommand implements CommandExecutor { } } plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @SuppressWarnings("deprecation") @Override public void run() { try { diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 1d76a68e..45c0f036 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -9,6 +9,8 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.List; +import org.bukkit.Bukkit; + import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.pool.PoolInitializationException; @@ -18,8 +20,6 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.Settings; - -import org.bukkit.Bukkit; public class MySQL implements DataSource { From c937338fc4e21a3a276acd36bdd03dfdfaf75c41 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 12 Oct 2015 18:47:15 +0200 Subject: [PATCH 275/427] remove speed if player moves --- .../fr/xephi/authme/listener/AuthMePlayerListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 420bee61..cc45c424 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -139,8 +139,13 @@ public class AuthMePlayerListener implements Listener { return; if (!Settings.isMovementAllowed) { - if (!event.getFrom().getBlock().equals(event.getTo().getBlock())) + if (Settings.isRemoveSpeedEnabled) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } + if (!event.getFrom().getBlock().equals(event.getTo().getBlock())) { event.setTo(event.getFrom()); + } return; } From 704b6966f3c946f2050ba3e6f5600ee780fbf5bf Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 13 Oct 2015 15:39:19 +0200 Subject: [PATCH 276/427] Update ProtocolLib version --- pom.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bfdd8567..8dac81b1 100644 --- a/pom.xml +++ b/pom.xml @@ -139,10 +139,16 @@ - comphenix-snapshots + comphenix-repo http://repo.comphenix.net/content/repositories/public + + + dmulloy2-repo + http://repo.dmulloy2.net/content/groups/public/ + + onarandombox @@ -322,7 +328,7 @@ com.comphenix.protocol ProtocolLib - 3.4.0 + 3.6.5-SNAPSHOT provided true From a2f5a7917d89be37bad1bf7c8dbe29e0734da556 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Fri, 16 Oct 2015 17:03:34 +0200 Subject: [PATCH 277/427] Whoops ? :') --- src/main/java/fr/xephi/authme/settings/Settings.java | 4 ++-- src/main/resources/config.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index d185a4c1..6e84a51f 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -274,7 +274,7 @@ public final class Settings extends YamlConfiguration { forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands"); forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole"); customAttributes = configFile.getBoolean("Hooks.customAttributes"); - generateImage = configFile.getBoolean("Email.generateImage", true); + generateImage = configFile.getBoolean("Email.generateImage", false); isMySQLWebsite = configFile.getBoolean("DataSource.mySQLWebsite", false); // Load the welcome message @@ -470,7 +470,7 @@ public final class Settings extends YamlConfiguration { changes = true; } if (!contains("Email.generateImage")) { - set("Email.generateImage", true); + set("Email.generateImage", false); changes = true; } if (!contains("DataSource.mySQLRealName")) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ef9fd214..6e3ad561 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -352,6 +352,8 @@ Email: - 10minutemail.com # WhiteList only these domains for emails emailWhitelisted: [] + # Do we need to send new password draw in an image ? + generateImage: false Hooks: # Do we need to hook with multiverse for spawn checking? multiverse: true From e1c1d18d050b51bfadf70b5f181cdf0c8b285866 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Mon, 19 Oct 2015 23:37:42 +0200 Subject: [PATCH 278/427] Fix Player Online check --- .../java/fr/xephi/authme/DataManager.java | 31 +++++--- .../java/fr/xephi/authme/SendMailSSL.java | 4 +- .../authme/listener/AuthMePlayerListener.java | 73 ++++++++++++------- 3 files changed, 68 insertions(+), 40 deletions(-) diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 9263443f..1fb82eb0 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -1,11 +1,5 @@ package fr.xephi.authme; -import fr.xephi.authme.settings.Settings; -import net.milkbowl.vault.permission.Permission; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - import java.io.File; import java.util.List; import java.util.concurrent.Callable; @@ -13,6 +7,13 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + +import fr.xephi.authme.settings.Settings; +import net.milkbowl.vault.permission.Permission; + public class DataManager { public AuthMe plugin; @@ -110,7 +111,7 @@ public class DataManager { try { playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); - } catch(Exception ignore) { + } catch (Exception ignore) { } if (playerFile.exists()) { playerFile.delete(); @@ -135,8 +136,8 @@ public class DataManager { try { File playerFile = null; try { - playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml"); - } catch(Exception ignore) { + playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml"); + } catch (Exception ignore) { } if (playerFile.exists()) { playerFile.delete(); @@ -155,7 +156,7 @@ public class DataManager { } public synchronized void purgePermissions(List cleared, - Permission permission) { + Permission permission) { int i = 0; for (String name : cleared) { try { @@ -175,6 +176,7 @@ public class DataManager { return true; ExecutorService executor = Executors.newSingleThreadExecutor(); Future result = executor.submit(new Callable() { + @Override public synchronized Boolean call() throws Exception { for (OfflinePlayer op : Utils.getOnlinePlayers()) @@ -192,4 +194,13 @@ public class DataManager { executor.shutdown(); } } + + public Player getOnlinePlayerLower(String name) { + name = name.toLowerCase(); + for (Player player : Bukkit.getOnlinePlayers()) { + if (player.getName().equalsIgnoreCase(name)) + return player; + } + return null; + } } diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index d7681ade..baac1955 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -95,14 +95,14 @@ public class SendMailSSL { ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); } } - + Transport transport = session.getTransport("smtp"); message.setContent(multipart); try { transport.connect(smtp, acc, password); } catch (Exception e) { - ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recorvery email to " + mail); + ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recovery email to " + mail); if (file != null) file.delete(); return; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 5706ef66..dfdce68b 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -1,16 +1,11 @@ package fr.xephi.authme.listener; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -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.cache.limbo.LimboPlayer; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.PatternSyntaxException; + import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -23,13 +18,37 @@ import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerBedEnterEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerFishEvent; +import org.bukkit.event.player.PlayerGameModeChangeEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerShearEntityEvent; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.PatternSyntaxException; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +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.cache.limbo.LimboPlayer; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; public class AuthMePlayerListener implements Listener { @@ -185,6 +204,7 @@ public class AuthMePlayerListener implements Listener { // Shedule login task so works after the prelogin // (Fix found by Koolaid5000) Bukkit.getScheduler().runTask(plugin, new Runnable() { + @Override public void run() { Player player = event.getPlayer(); @@ -201,28 +221,27 @@ public class AuthMePlayerListener implements Listener { }); } - @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST) public void onPreLogin(AsyncPlayerPreLoginEvent event) { final String name = event.getName().toLowerCase(); - final Player player = Bukkit.getServer().getPlayer(name); + final Player player = plugin.dataManager.getOnlinePlayerLower(name); if (player == null) return; // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player - if (Settings.isForceSingleSessionEnabled && plugin.dataManager.isOnline(player, name)) { - event.setKickMessage(m.send("same_nick")[0]); + if (Settings.isForceSingleSessionEnabled) { + event.setKickMessage(m.getString("same_nick")); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); if (LimboCache.getInstance().hasLimboPlayer(name)) Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { - LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); - if (limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); + if (limbo != null && PlayerCache.getInstance().isAuthenticated(name)) { Utils.addNormal(player, limbo.getGroup()); - LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); + LimboCache.getInstance().deleteLimboPlayer(name); } } }); @@ -244,8 +263,7 @@ public class AuthMePlayerListener implements Listener { if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) return; - if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable - && !plugin.authmePermissible(player, "authme.bypassantibot")) { + if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable && !plugin.authmePermissible(player, "authme.bypassantibot")) { String code = Utils.getCountryCode(event.getAddress().getHostAddress()); if (((code == null) || Settings.countriesBlacklist.contains(code))) { event.setKickMessage(m.send("country_banned")[0]); @@ -253,8 +271,7 @@ public class AuthMePlayerListener implements Listener { return; } } - if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable - && !plugin.authmePermissible(player, "authme.bypassantibot")) { + if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable && !plugin.authmePermissible(player, "authme.bypassantibot")) { String code = Utils.getCountryCode(event.getAddress().getHostAddress()); if (((code == null) || !Settings.countries.contains(code))) { event.setKickMessage(m.send("country_banned")[0]); From 63560063ecc08f5bfd5466239011bc1646ec3645 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 21 Oct 2015 18:22:23 +0200 Subject: [PATCH 279/427] Maven stuff --- pom.xml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 8dac81b1..f0c019c9 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,9 @@ maven-shade-plugin 2.4.1 - + false + true + org.mcstats @@ -167,18 +169,17 @@ http://repo.luricos.de/content/repositories/releases - xephi-repo http://ci.xephi.fr/plugin/repository/everything/ - --> - + @@ -212,6 +213,7 @@ org.apache.logging.log4j log4j-core + 2.0-beta9 provided true @@ -226,14 +228,14 @@ true - + com.sun.mail javax.mail @@ -298,6 +300,10 @@ json-simple com.googlecode.json-simple + + gson + com.google.code.gson + persistence-api javax.persistence From 391a2a123a4ca87a341e7286c52b9160b3dfed23 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 21 Oct 2015 18:34:46 +0200 Subject: [PATCH 280/427] Useless dependency -_- --- pom.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pom.xml b/pom.xml index f0c019c9..0745bccb 100644 --- a/pom.xml +++ b/pom.xml @@ -219,15 +219,6 @@ true - - - org.xerial - sqlite-jdbc - 3.8.11.2 - compile - true - - + com.sun.mail javax.mail From a2381fa02526e94206cc6666ea838dcf3599744f Mon Sep 17 00:00:00 2001 From: DNx5 Date: Fri, 23 Oct 2015 00:23:12 +0700 Subject: [PATCH 282/427] 1.7 compatibility --- src/main/java/fr/xephi/authme/DataManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 0202e11c..2d08489d 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -108,8 +108,8 @@ public class DataManager { continue; } - try { - File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); + try { + File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); playerFile.delete(); i++; } catch(Exception ignore) { @@ -129,12 +129,12 @@ public class DataManager { public void purgeEssentials(List cleared) { int i = 0; for (String name : cleared) { - try { + try { File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml"); playerFile.delete(); i++; } catch (Exception e) { - File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml"); + File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml"); if (playerFile.exists()) { playerFile.delete(); i++; @@ -186,7 +186,7 @@ public class DataManager { public Player getOnlinePlayerLower(String name) { name = name.toLowerCase(); - for (Player player : Bukkit.getOnlinePlayers()) { + for (Player player : Utils.getOnlinePlayers()) { if (player.getName().equalsIgnoreCase(name)) return player; } From 505bda79f0480c4c926c3d4dc113b0f42a568bf1 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Fri, 23 Oct 2015 00:37:57 +0200 Subject: [PATCH 283/427] Need to calcul position synchronously --- .../authme/process/join/AsyncronousJoin.java | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index e628bc73..a9aacdf4 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -153,6 +153,7 @@ public class AsyncronousJoin { if (!Settings.noTeleport) if (!needFirstspawn() && Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { + @Override public void run() { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); @@ -258,8 +259,7 @@ public class AsyncronousJoin { } private void placePlayerSafely(final Player player, - final Location spawnLoc) { - Location loc = null; + final Location spawnLoc) { if (spawnLoc == null) return; if (!Settings.noTeleport) @@ -268,30 +268,29 @@ public class AsyncronousJoin { return; if (!player.hasPlayedBefore()) return; - Block b = player.getLocation().getBlock(); - if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) { - m.send(player, "unsafe_spawn"); - if (spawnLoc.getWorld() != null) - loc = spawnLoc; - } else { - Block c = player.getLocation().add(0D, 1D, 0D).getBlock(); - if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL) { - m.send(player, "unsafe_spawn"); - if (spawnLoc.getWorld() != null) - loc = spawnLoc; - } - } - if (loc != null) { - final Location floc = loc; - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - player.teleport(floc); + @Override + public void run() { + Location loc = null; + Block b = player.getLocation().getBlock(); + if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) { + m.send(player, "unsafe_spawn"); + if (spawnLoc.getWorld() != null) + loc = spawnLoc; + } else { + Block c = player.getLocation().add(0D, 1D, 0D).getBlock(); + if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL) { + m.send(player, "unsafe_spawn"); + if (spawnLoc.getWorld() != null) + loc = spawnLoc; + } } + if (loc != null) + player.teleport(loc); + } - }); - } + }); } } From 9aee483cc311a3369c6a66a23310b137e93b231a Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 25 Oct 2015 12:23:40 +0100 Subject: [PATCH 284/427] Fix compatibility issues with plugins like factionschat --- src/main/java/fr/xephi/authme/settings/Settings.java | 5 ++++- 1 file changed, 4 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 3fd13b37..ed951d1d 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -55,9 +55,12 @@ public final class Settings extends YamlConfiguration { public static boolean useLogging = false; public static int purgeDelay = 60; + // Due to compatibility issues with plugins like FactionsChat + public static Boolean isChatAllowed; + public static boolean isPermissionCheckEnabled, isRegistrationEnabled, isForcedRegistrationEnabled, isTeleportToSpawnEnabled, - isSessionsEnabled, isChatAllowed, isAllowRestrictedIp, + isSessionsEnabled, isAllowRestrictedIp, isMovementAllowed, isKickNonRegisteredEnabled, isForceSingleSessionEnabled, isForceSpawnLocOnJoinEnabled, isSaveQuitLocationEnabled, isForceSurvivalModeEnabled, From 6d0099a977b87560b575fa042f21c9b1d94a2d46 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 25 Oct 2015 12:38:18 +0100 Subject: [PATCH 285/427] Dependencies cleanup --- pom.xml | 57 +++++++++------------------------------------------------ 1 file changed, 9 insertions(+), 48 deletions(-) diff --git a/pom.xml b/pom.xml index eee17d7d..17fd304c 100644 --- a/pom.xml +++ b/pom.xml @@ -88,18 +88,6 @@ false true - org.mcstats @@ -143,12 +131,6 @@ http://repo.minelink.net/content/repositories/public - - - comphenix-repo - http://repo.comphenix.net/content/repositories/public - - dmulloy2-repo @@ -179,18 +161,17 @@ http://ci.xephi.fr/plugin/repository/everything/ - + + --> - - com.zaxxer @@ -213,7 +194,7 @@ true - + org.apache.logging.log4j log4j-core @@ -223,7 +204,7 @@ true - + com.sun.mail javax.mail @@ -238,7 +219,7 @@ true - + com.google.code.gson gson @@ -247,7 +228,6 @@ true - com.maxmind.geoip @@ -299,26 +279,7 @@ - - - com.comphenix.attribute - AttributeStorage - 0.0.2-SNAPSHOT - compile - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - true - - - + com.comphenix.protocol ProtocolLib @@ -408,7 +369,7 @@ true - + net.ess3 EssentialsX @@ -423,7 +384,7 @@ true - + net.minelink CombatTagPlus From 3f2679860833adaac22109747846bccd61fd44e7 Mon Sep 17 00:00:00 2001 From: Alexandre Vanhecke Date: Fri, 30 Oct 2015 15:26:08 +0100 Subject: [PATCH 286/427] Update maven shade plugin --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 17fd304c..dcd0d36f 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.4.1 + 2.4.2 false true From f722fa161a0097fdb68dcc41eacd8d5aa1d8ec83 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Sat, 31 Oct 2015 17:34:16 +0100 Subject: [PATCH 287/427] Add a join blocker in case Cache Loading --- src/main/java/fr/xephi/authme/AuthMe.java | 13 ++++++++++++- .../xephi/authme/datasource/CacheDataSource.java | 4 +++- .../authme/process/join/AsyncronousJoin.java | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index fe23a67a..aae74c27 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -106,7 +106,18 @@ public class AuthMe extends JavaPlugin { public ConcurrentHashMap cap = new ConcurrentHashMap<>(); public ConcurrentHashMap realIp = new ConcurrentHashMap<>(); - public static AuthMe getInstance() { + // In case we need to cache PlayerAuths, prevent connection before it's done + private boolean canConnect = true; + + public boolean isCanConnect() { + return canConnect; + } + + public void setCanConnect(boolean canConnect) { + this.canConnect = canConnect; + } + + public static AuthMe getInstance() { return authme; } diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 56505649..12d52c2e 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -20,9 +20,10 @@ public class CacheDataSource implements DataSource { private final ExecutorService exec; private final ConcurrentHashMap cache = new ConcurrentHashMap<>(); - public CacheDataSource(AuthMe pl, DataSource src) { + public CacheDataSource(final AuthMe pl, DataSource src) { this.source = src; this.exec = Executors.newCachedThreadPool(); + pl.setCanConnect(false); /* * We need to load all players in cache ... It will took more time to @@ -35,6 +36,7 @@ public class CacheDataSource implements DataSource { for (PlayerAuth auth : source.getAllAuths()) { cache.put(auth.getNickname().toLowerCase(), auth); } + pl.setCanConnect(true); } }); } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index a9aacdf4..b52833e4 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -58,6 +58,21 @@ public class AsyncronousJoin { plugin.ess.getUser(player).setSocialSpyEnabled(false); } + if (!plugin.isCanConnect()) + { + final GameMode gM = AuthMePlayerListener.gameMode.get(name); + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true); + player.setGameMode(gM); + player.kickPlayer("Server is loading, please wait before joining!"); + } + + }); + } + final String ip = plugin.getIP(player); if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) { final GameMode gM = AuthMePlayerListener.gameMode.get(name); From 6007ffb8ef25222505210cdbc9f240d0ee165829 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Sat, 31 Oct 2015 18:40:31 +0100 Subject: [PATCH 288/427] Add some entry to api --- src/main/java/fr/xephi/authme/api/NewAPI.java | 35 ++++++ .../authme/commands/UnregisterCommand.java | 76 +---------- .../fr/xephi/authme/process/Management.java | 13 +- .../unregister/AsyncronousUnregister.java | 119 ++++++++++++++++++ 4 files changed, 168 insertions(+), 75 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 4a6eb301..8d5495f8 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -150,4 +150,39 @@ public class NewAPI { plugin.management.performLogin(player, "dontneed", true); } + /** + * Force a player to logout + * + * @param Player + * player + */ + public void forceLogout(Player player) + { + plugin.management.performLogout(player); + } + + /** + * Force a player to register + * + * @param Player + * player + * @param String + * password + */ + public void forceRegister(Player player, String password) + { + plugin.management.performRegister(player, password, null); + } + + /** + * Force a player to unregister + * + * @param Player + * player + */ + public void forceUnregister(Player player) + { + forceLogout(player); + plugin.management.performUnregister(player, "", true); + } } diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index d51e148c..9c881d02 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -61,80 +61,8 @@ public class UnregisterCommand implements CommandExecutor { m.send(player, "usage_unreg"); return true; } - plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { - @Override - public void run() { - try { - if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { - if (!plugin.database.removeAuth(name)) { - player.sendMessage("error"); - return; - } - if (Settings.isForcedRegistrationEnabled) { - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(player); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - player.teleport(tpEvent.getTo()); - } - } - - player.saveData(); - PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); - if (!Settings.getRegisteredGroup.isEmpty()) - Utils.setGroup(player, GroupType.UNREGISTERED); - LimboCache.getInstance().addLimboPlayer(player); - int delay = Settings.getRegistrationTimeout * 20; - int interval = Settings.getWarnMessageInterval; - BukkitScheduler sched = sender.getServer().getScheduler(); - if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); - } - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); - m.send(player, "unregistered"); - ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); - return; - } - if (!Settings.unRegisteredGroup.isEmpty()) { - Utils.setGroup(player, Utils.GroupType.UNREGISTERED); - } - PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); - // check if Player cache File Exist and delete it, preventing - // duplication of items - if (playerCache.doesCacheExist(player)) { - playerCache.removeCache(player); - } - if (Settings.applyBlindEffect) - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - player.setWalkSpeed(0.0f); - player.setFlySpeed(0.0f); - } - m.send(player, "unregistered"); - ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(player); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } - player.teleport(tpEvent.getTo()); - } - } - return; - } else { - m.send(player, "wrong_pwd"); - } - } catch (NoSuchAlgorithmException ex) { - ConsoleLogger.showError(ex.getMessage()); - sender.sendMessage("Internal Error please read the server log"); - } - } - }); + + plugin.management.performUnregister(player, args[0], false); return true; } } diff --git a/src/main/java/fr/xephi/authme/process/Management.java b/src/main/java/fr/xephi/authme/process/Management.java index 209e12a9..1276012a 100644 --- a/src/main/java/fr/xephi/authme/process/Management.java +++ b/src/main/java/fr/xephi/authme/process/Management.java @@ -10,11 +10,12 @@ import fr.xephi.authme.process.login.AsyncronousLogin; import fr.xephi.authme.process.logout.AsyncronousLogout; import fr.xephi.authme.process.quit.AsyncronousQuit; import fr.xephi.authme.process.register.AsyncronousRegister; +import fr.xephi.authme.process.unregister.AsyncronousUnregister; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Settings; /** - * + * * @authors Xephi59, * Possible * @@ -81,4 +82,14 @@ public class Management { }); } + + public void performUnregister(final Player player, final String password, final boolean force) { + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + new AsyncronousUnregister(player, password, force, plugin).process(); + } + }); + } } diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java new file mode 100644 index 00000000..1822eac8 --- /dev/null +++ b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java @@ -0,0 +1,119 @@ +package fr.xephi.authme.process.unregister; + +import java.security.NoSuchAlgorithmException; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +import fr.xephi.authme.Utils.GroupType; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.cache.backup.JsonCache; +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.events.SpawnTeleportEvent; +import fr.xephi.authme.security.PasswordSecurity; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.task.MessageTask; +import fr.xephi.authme.task.TimeoutTask; + +public class AsyncronousUnregister { + + protected Player player; + protected String name; + private AuthMe plugin; + private Messages m = Messages.getInstance(); + protected String password; + protected boolean force; + private JsonCache playerCache; + + public AsyncronousUnregister(Player player, String password, + boolean force, AuthMe plugin) { + this.player = player; + this.password = password; + this.force = force; + name = player.getName().toLowerCase(); + this.plugin = plugin; + this.playerCache = new JsonCache(); + } + + protected String getIp() { + return plugin.getIP(player); + } + + public void process() { + try { + if (force || PasswordSecurity.comparePasswordWithHash(password, PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { + if (!plugin.database.removeAuth(name)) { + player.sendMessage("error"); + return; + } + if (Settings.isForcedRegistrationEnabled) { + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawn = plugin.getSpawnLocation(player); + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + player.teleport(tpEvent.getTo()); + } + } + + player.saveData(); + PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); + if (!Settings.getRegisteredGroup.isEmpty()) + Utils.setGroup(player, GroupType.UNREGISTERED); + LimboCache.getInstance().addLimboPlayer(player); + int delay = Settings.getRegistrationTimeout * 20; + int interval = Settings.getWarnMessageInterval; + BukkitScheduler sched = plugin.getServer().getScheduler(); + if (delay != 0) { + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); + LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + } + LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); + m.send(player, "unregistered"); + ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); + return; + } + if (!Settings.unRegisteredGroup.isEmpty()) { + Utils.setGroup(player, Utils.GroupType.UNREGISTERED); + } + PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); + // check if Player cache File Exist and delete it, preventing + // duplication of items + if (playerCache.doesCacheExist(player)) { + playerCache.removeCache(player); + } + if (Settings.applyBlindEffect) + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } + m.send(player, "unregistered"); + ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawn = plugin.getSpawnLocation(player); + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { + tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); + } + player.teleport(tpEvent.getTo()); + } + } + return; + } else { + m.send(player, "wrong_pwd"); + } + } catch (NoSuchAlgorithmException ex) { + } + } +} From 9629ad15946b8239075d97f68ac4901291a33091 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Sat, 31 Oct 2015 18:41:57 +0100 Subject: [PATCH 289/427] Ooops, don't push test methods :') --- src/main/java/fr/xephi/authme/api/NewAPI.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 8d5495f8..e1426f6f 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -182,7 +182,6 @@ public class NewAPI { */ public void forceUnregister(Player player) { - forceLogout(player); plugin.management.performUnregister(player, "", true); } } From 69b874c8325f0a16dc18cea447c4e3edabd17349 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 01:58:25 +0100 Subject: [PATCH 290/427] Update AuthMePlayerListener.java --- .../xephi/authme/listener/AuthMePlayerListener.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 04937fd4..51b7933b 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -143,13 +143,11 @@ public class AuthMePlayerListener implements Listener { player.setWalkSpeed(0.0f); player.setFlySpeed(0.0f); } - if (!event.getFrom().getBlock().equals(event.getTo().getBlock())) { - event.setTo(event.getFrom()); - } + event.setTo(event.getFrom()); return; } - if (Settings.getMovementRadius == 0) { + if (Settings.getMovementRadius <= 0) { return; } @@ -218,7 +216,7 @@ public class AuthMePlayerListener implements Listener { plugin.management.performJoin(player); // Remove the join message while the player isn't logging in - if ((Settings.enableProtection || Settings.delayJoinMessage) && event.getJoinMessage() != null) { + if (Settings.delayJoinMessage && event.getJoinMessage() != null) { joinMessage.put(name, event.getJoinMessage()); event.setJoinMessage(null); } @@ -378,7 +376,8 @@ public class AuthMePlayerListener implements Listener { plugin.management.performQuit(player, false); - if (!PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection) + // TODO: rename delayjoinmessage setting + if (!PlayerCache.getInstance().isAuthenticated(name) && Settings.delayJoinMessages) event.setQuitMessage(null); } From b2bd3b0ab74916fe6bd2395d4b6c42a64726af3f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 12:00:45 +0100 Subject: [PATCH 291/427] cleanup --- .../authme/commands/UnregisterCommand.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 9c881d02..b7b58c2f 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -1,40 +1,20 @@ package fr.xephi.authme.commands; -import java.security.NoSuchAlgorithmException; - -import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.backup.JsonCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.events.SpawnTeleportEvent; -import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.task.MessageTask; -import fr.xephi.authme.task.TimeoutTask; public class UnregisterCommand implements CommandExecutor { private Messages m = Messages.getInstance(); public AuthMe plugin; - private JsonCache playerCache; public UnregisterCommand(AuthMe plugin) { this.plugin = plugin; - this.playerCache = new JsonCache(); } @Override From d478973fa5bd27de67508016aa0a31c6993e2c52 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 13:23:47 +0100 Subject: [PATCH 292/427] Enhance join/leave message delay --- .../authme/commands/UnregisterCommand.java | 1 + .../authme/listener/AuthMePlayerListener.java | 43 +++++++++---------- .../fr/xephi/authme/settings/Settings.java | 12 ++++-- src/main/resources/config.yml | 4 +- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index b7b58c2f..4a879f1b 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -4,6 +4,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.settings.Messages; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 51b7933b..4504a11d 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -52,10 +52,11 @@ import fr.xephi.authme.settings.Settings; public class AuthMePlayerListener implements Listener { + public AuthMe plugin; + private Messages m = Messages.getInstance(); + public static ConcurrentHashMap gameMode = new ConcurrentHashMap<>(); public static ConcurrentHashMap joinMessage = new ConcurrentHashMap<>(); - private Messages m = Messages.getInstance(); - public AuthMe plugin; public static ConcurrentHashMap causeByAuthMe = new ConcurrentHashMap<>(); private List antibot = new ArrayList<>(); @@ -67,9 +68,16 @@ public class AuthMePlayerListener implements Listener { Player player = event.getPlayer(); if (!Utils.checkAuth(player)) { String cmd = event.getMessage().split(" ")[0]; - if (!Settings.isChatAllowed && !(Settings.allowCommands.contains(cmd))) { - event.setCancelled(true); + if (cmd.startsWith("/")) { + if (Settings.allowCommands.contains(cmd)) { + return; + } + } else { + if (Settings.isChatAllowed) { + return; + } } + if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) { m.send(player, "login_msg"); } else { @@ -84,22 +92,14 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - String msg = event.getMessage(); - if (msg.equalsIgnoreCase("/worldedit cui")) - return; - - String cmd = msg.split(" ")[0]; - if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register") || cmd.equalsIgnoreCase("/l") || cmd.equalsIgnoreCase("/reg") || cmd.equalsIgnoreCase("/email") || cmd.equalsIgnoreCase("/captcha")) - return; + String cmd = event.getMessage().split(" ")[0]; if (Settings.useEssentialsMotd && cmd.equalsIgnoreCase("/motd")) return; if (Settings.allowCommands.contains(cmd)) return; - - if (!Utils.checkAuth(event.getPlayer())) { - event.setMessage("/notloggedin"); - event.setCancelled(true); - } + if (Utils.checkAuth(event.getPlayer())) + return; + event.setCancelled(true); } @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) @@ -216,7 +216,7 @@ public class AuthMePlayerListener implements Listener { plugin.management.performJoin(player); // Remove the join message while the player isn't logging in - if (Settings.delayJoinMessage && event.getJoinMessage() != null) { + if (Settings.delayJoinLeaveMessages && event.getJoinMessage() != null) { joinMessage.put(name, event.getJoinMessage()); event.setJoinMessage(null); } @@ -372,13 +372,12 @@ public class AuthMePlayerListener implements Listener { } Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); + + if (!Utils.checkAuth(player) && Settings.delayJoinLeaveMessages) { + event.setQuitMessage(null); + } plugin.management.performQuit(player, false); - - // TODO: rename delayjoinmessage setting - if (!PlayerCache.getInstance().isAuthenticated(name) && Settings.delayJoinMessages) - event.setQuitMessage(null); } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index ed951d1d..84672b38 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -76,7 +76,7 @@ public final class Settings extends YamlConfiguration { purgeLimitedCreative, purgeAntiXray, purgePermissions, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage, broadcastWelcomeMessage, forceRegKick, forceRegLogin, - checkVeryGames, delayJoinMessage, noTeleport, applyBlindEffect, + checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect, customAttributes, generateImage, isRemoveSpeedEnabled, isMySQLWebsite; public static String getNickRegex, getUnloggedinGroup, getMySQLHost, @@ -273,7 +273,7 @@ public final class Settings extends YamlConfiguration { getMaxLoginPerIp = configFile.getInt("settings.restrictions.maxLoginPerIp", 0); getMaxJoinPerIp = configFile.getInt("settings.restrictions.maxJoinPerIp", 0); checkVeryGames = configFile.getBoolean("VeryGames.enableIpCheck", false); - delayJoinMessage = configFile.getBoolean("settings.delayJoinMessage", false); + delayJoinLeaveMessages = configFile.getBoolean("settings.delayJoinLeaveMessage", false); noTeleport = configFile.getBoolean("settings.restrictions.noTeleport", false); crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db"); getPassRegex = configFile.getString("settings.restrictions.allowedPasswordCharacters", "[\\x21-\\x7E]*"); @@ -402,8 +402,12 @@ public final class Settings extends YamlConfiguration { set("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_]*"); changes = true; } - if (!contains("settings.delayJoinMessage")) { - set("settings.delayJoinMessage", false); + if (contains("settings.delayJoinMessage")) { + set("settings.delayJoinMessage", null); + changes = true; + } + if (!contains("settings.delayJoinLeaveMessages")) { + set("settings.delayJoinLeaveMessages", true); changes = true; } if (!contains("settings.restrictions.noTeleport")) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6e3ad561..e991efc0 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -253,8 +253,8 @@ settings: useWelcomeMessage: true # Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player broadcastWelcomeMessage: false - # Do we need to delay the X has joined the game after /login ? - delayJoinMessage: false + # Do we need to delay the join/leave message to be displayed only when the player is authenticated ? + delayJoinLeaveMessages: true # Do we need to add potion effect Blinding before login/register ? applyBlindEffect: false ExternalBoardOptions: From 7824131cec0ae59b8f661f2f3a7a0cb5bae83134 Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Sun, 1 Nov 2015 13:34:21 +0100 Subject: [PATCH 293/427] Remove old loading chunk system --- .../process/register/ProcessSyncronousPasswordRegister.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index bd299191..02ffe2a1 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -85,10 +85,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { Location loca = plugin.getSpawnLocation(player); RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca); plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } + if (!tpEvent.isCancelled() && tpEvent.getTo() != null) { player.teleport(tpEvent.getTo()); } } From 49a9d3f51b04c1b33b60e27101e5dbcedd80e71c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 14:42:39 +0100 Subject: [PATCH 294/427] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 056700d3..220a2ced 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@

    The most used authentication plugin for CraftBukkit/Spigot!


    + +####Development history: +[![Guava AuthMe History Video](http://img.youtube.com/vi/hJRzNfYyd9k/hqdefault.jpg)](https://www.youtube.com/watch?v=hJRzNfYyd9k) + #####Development tools: - DEVELOPMENT TEAM REPO (please send PRs here!): Github Development Page From 7cea79eefc2f136ece27a1a6525a26e8c57c0c0e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 13:34:24 +0100 Subject: [PATCH 295/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../java/fr/xephi/authme/process/join/AsyncronousJoin.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index aae74c27..8371bbb4 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -109,7 +109,7 @@ public class AuthMe extends JavaPlugin { // In case we need to cache PlayerAuths, prevent connection before it's done private boolean canConnect = true; - public boolean isCanConnect() { + public boolean canConnect() { return canConnect; } diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index b52833e4..a35708ba 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -58,8 +58,7 @@ public class AsyncronousJoin { plugin.ess.getUser(player).setSocialSpyEnabled(false); } - if (!plugin.isCanConnect()) - { + if (!plugin.canConnect()) { final GameMode gM = AuthMePlayerListener.gameMode.get(name); sched.scheduleSyncDelayedTask(plugin, new Runnable() { From 1897b1f5e6569b73217ed238b3dd433cdc387636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 15:31:15 +0100 Subject: [PATCH 296/427] Added dynamic command handler from Dungeon Maze --- .../dynamic/CommandArgumentDescription.java | 91 ++ .../commands/dynamic/CommandDescription.java | 912 ++++++++++++++++++ .../commands/dynamic/CommandHandler.java | 205 ++++ .../dynamic/CommandHandlerService.java | 90 ++ .../commands/dynamic/CommandManager.java | 288 ++++++ .../authme/commands/dynamic/CommandParts.java | 204 ++++ .../commands/dynamic/CommandPermissions.java | 182 ++++ .../commands/dynamic/ExecutableCommand.java | 17 + .../commands/dynamic/FoundCommandResult.java | 151 +++ .../executable/CheckUpdatesCommand.java | 78 ++ .../executable/CreateWorldCommand.java | 140 +++ .../executable/DungeonMazeCommand.java | 28 + .../dynamic/executable/HelpCommand.java | 37 + .../executable/InstallUpdateCommand.java | 75 ++ .../dynamic/executable/ListWorldCommand.java | 67 ++ .../dynamic/executable/LoadWorldCommand.java | 75 ++ .../dynamic/executable/ReloadCommand.java | 75 ++ .../executable/ReloadPermissionsCommand.java | 56 ++ .../dynamic/executable/RestartCommand.java | 105 ++ .../dynamic/executable/ServiceCommand.java | 73 ++ .../dynamic/executable/StatusCommand.java | 180 ++++ .../dynamic/executable/TeleportCommand.java | 80 ++ .../executable/UnloadWorldCommand.java | 107 ++ .../dynamic/executable/VersionCommand.java | 80 ++ .../commands/dynamic/help/HelpPrinter.java | 189 ++++ .../commands/dynamic/help/HelpProvider.java | 114 +++ .../dynamic/help/HelpSyntaxHelper.java | 60 ++ 27 files changed, 3759 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/CommandArgumentDescription.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/CommandDescription.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/CommandHandler.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/CommandHandlerService.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/CommandManager.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/CommandParts.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/CommandPermissions.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/ExecutableCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/FoundCommandResult.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/CheckUpdatesCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/CreateWorldCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/DungeonMazeCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/HelpCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/InstallUpdateCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/ListWorldCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/LoadWorldCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/ReloadCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/ReloadPermissionsCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/RestartCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/ServiceCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/StatusCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/TeleportCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/UnloadWorldCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/executable/VersionCommand.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/help/HelpPrinter.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/help/HelpProvider.java create mode 100644 src/main/java/fr/xephi/authme/commands/dynamic/help/HelpSyntaxHelper.java diff --git a/src/main/java/fr/xephi/authme/commands/dynamic/CommandArgumentDescription.java b/src/main/java/fr/xephi/authme/commands/dynamic/CommandArgumentDescription.java new file mode 100644 index 00000000..5d021b65 --- /dev/null +++ b/src/main/java/fr/xephi/authme/commands/dynamic/CommandArgumentDescription.java @@ -0,0 +1,91 @@ +package fr.xephi.authme.commands.dynamic; + +public class CommandArgumentDescription { + + // TODO: Allow argument to consist of infinite parts.
    + + + net.ricecode + string-similarity + 1.0.0 + +
    From 96d220881793c3436f94cefe589c5ee19f5d2a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:01:44 +0100 Subject: [PATCH 302/427] Fixed HelpPrinter class --- .../fr/xephi/authme/command/help/HelpPrinter.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java b/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java index d3d8f78d..18ec476e 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java @@ -1,17 +1,18 @@ package fr.xephi.authme.command.help; -import com.timvisee.dungeonmaze.Core; +import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandArgumentDescription; import fr.xephi.authme.command.CommandDescription; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.CommandPermissions; -import com.timvisee.dungeonmaze.util.StringUtils; +import fr.xephi.authme.util.StringUtils; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.List; public class HelpPrinter { @@ -103,7 +104,7 @@ public class HelpPrinter { for(String node : permissions.getPermissionNodes()) { boolean nodePermission = true; if(sender instanceof Player) - nodePermission = Core.getPermissionsManager().hasPermission((Player) sender, node, false); + nodePermission = AuthMe.getInstance().authmePermissible((Player) sender, node); final String nodePermsString = ChatColor.GRAY + (nodePermission ? ChatColor.ITALIC + " (Permission!)" : ChatColor.ITALIC + " (No Permission!)"); sender.sendMessage(" " + ChatColor.YELLOW + ChatColor.ITALIC + node + nodePermsString); } @@ -160,7 +161,12 @@ public class HelpPrinter { } // Sort the alternatives - Collections.sort(alternatives, (o1, o2) -> Double.compare(StringUtils.getDifference(usedLabel, o1), StringUtils.getDifference(usedLabel, o2))); + Collections.sort(alternatives, new Comparator() { + @Override + public int compare(String o1, String o2) { + return Double.compare(StringUtils.getDifference(usedLabel, o1), StringUtils.getDifference(usedLabel, o2)); + } + }); // Print each alternative with proper syntax for(String alternative : alternatives) From 59d8ced86d8fd5128dd0eeaae095a5d4ca10ea88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:01:59 +0100 Subject: [PATCH 303/427] Fixed imports of HelpSyntaxHelper class --- .../fr/xephi/authme/command/help/HelpSyntaxHelper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java b/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java index ef1f8d39..492a4f14 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java @@ -1,9 +1,9 @@ package fr.xephi.authme.command.help; -import com.timvisee.dungeonmaze.command.CommandArgumentDescription; -import com.timvisee.dungeonmaze.command.CommandDescription; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.util.ListUtils; +import fr.xephi.authme.command.CommandArgumentDescription; +import fr.xephi.authme.command.CommandDescription; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.util.ListUtils; import org.bukkit.ChatColor; public class HelpSyntaxHelper { From 690c7d95327e75997eace615dac1061cff5bcb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:13:34 +0100 Subject: [PATCH 304/427] Added CommandHandler instance --- src/main/java/fr/xephi/authme/AuthMe.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index aae74c27..8bfe1169 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; +import fr.xephi.authme.command.CommandHandler; import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -77,6 +78,9 @@ public class AuthMe extends JavaPlugin { private static Server server; private Logger authmeLogger; + // TODO: Move this to a better place! -- timvisee + private CommandHandler commandHandler = null; + public Management management; public NewAPI api; public SendMailSSL mail; @@ -140,6 +144,10 @@ public class AuthMe extends JavaPlugin { authmeLogger = Logger.getLogger("AuthMe"); authme = this; + // Set up and initialize the command handler + this.commandHandler = new CommandHandler(false); + this.commandHandler.init(); + // TODO: split the plugin in more modules moduleManager = new ModuleManager(this); @SuppressWarnings("unused") @@ -808,4 +816,13 @@ public class AuthMe extends JavaPlugin { public String getCountryName(String ip) { return Utils.getCountryName(ip); } + + /** + * Get the command handler instance. + * + * @return Command handler. + */ + public CommandHandler getCommandHandler() { + return this.commandHandler; + } } From aff503c11cad3881a5f0584ae9542c1e07ee3d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:13:49 +0100 Subject: [PATCH 305/427] Fixed HelpProvider class --- .../java/fr/xephi/authme/command/help/HelpProvider.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java index a887ead9..42696493 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java @@ -1,7 +1,7 @@ package fr.xephi.authme.command.help; -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.*; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.*; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -33,9 +33,9 @@ public class HelpProvider { */ public static void showHelp(CommandSender sender, CommandParts reference, CommandParts helpQuery, boolean showCommand, boolean showDescription, boolean showArguments, boolean showPermissions, boolean showAlternatives, boolean showCommands) { // Find the command for this help query, one with and one without a prefixed base command - FoundCommandResult result = Core.getCommandHandler().getCommandManager().findCommand(new CommandParts(helpQuery.getList())); + FoundCommandResult result = AuthMe.getInstance().getCommandHandler().getCommandManager().findCommand(new CommandParts(helpQuery.getList())); CommandParts commandReferenceOther = new CommandParts(reference.get(0), helpQuery.getList()); - FoundCommandResult resultOther = Core.getCommandHandler().getCommandManager().findCommand(commandReferenceOther); + FoundCommandResult resultOther = AuthMe.getInstance().getCommandHandler().getCommandManager().findCommand(commandReferenceOther); if(resultOther != null) { if(result == null) result = resultOther; From 8b4d8a489c767c18bb8b67acdd729cd82a8858a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:16:48 +0100 Subject: [PATCH 306/427] Fixed and improved CommandDescriptor class --- .../authme/command/CommandDescription.java | 52 +++++++++++-------- .../authme/command/help/HelpPrinter.java | 4 +- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandDescription.java b/src/main/java/fr/xephi/authme/command/CommandDescription.java index 01034a2d..018ac79b 100644 --- a/src/main/java/fr/xephi/authme/command/CommandDescription.java +++ b/src/main/java/fr/xephi/authme/command/CommandDescription.java @@ -1,10 +1,11 @@ package fr.xephi.authme.command; -import com.timvisee.dungeonmaze.util.StringUtils; +import fr.xephi.authme.util.StringUtils; import org.bukkit.command.CommandSender; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.List; @SuppressWarnings("UnusedDeclaration") @@ -21,7 +22,7 @@ public class CommandDescription { /** The parent command. */ private CommandDescription parent = null; /** The child labels. */ - private List childs = new ArrayList<>(); + private List children = new ArrayList<>(); /** The command arguments. */ private List arguments = new ArrayList<>(); /** Defines whether there is an argument maximum or not. */ @@ -487,12 +488,12 @@ public class CommandDescription { } /** - * Get all command childs. + * Get all command children. * - * @return Command childs. + * @return Command children. */ - public List getChilds() { - return this.childs; + public List getChildren() { + return this.children; } /** @@ -514,7 +515,7 @@ public class CommandDescription { return true; // The command description to add as a child - if(!this.childs.add(commandDescription)) + if(!this.children.add(commandDescription)) return false; // Set this description as parent on the child @@ -522,17 +523,17 @@ public class CommandDescription { } /** - * Set the childs of this command. + * Set the children of this command. * - * @param childs New command childs. Null to remove all childs. + * @param children New command children. Null to remove all children. */ - public void setChilds(List childs) { - // Check whether the childs list should be cleared - if(childs == null) - this.childs.clear(); + public void setChildren(List children) { + // Check whether the children list should be cleared + if(children == null) + this.children.clear(); else - this.childs = childs; + this.children = children; } /** @@ -541,7 +542,7 @@ public class CommandDescription { * @return True if this command has any child labels. */ public boolean hasChilds() { - return (this.childs.size() != 0); + return (this.children.size() != 0); } /** @@ -559,7 +560,7 @@ public class CommandDescription { return false; // Check whether this child exists, return the result - return this.childs.contains(commandDescription); + return this.children.contains(commandDescription); } /** @@ -765,15 +766,20 @@ public class CommandDescription { CommandParts newArguments = new CommandParts(queryReference.getRange(getParentCount() + 1)); // Handle the child's, if this command has any - if(getChilds().size() > 0) { + if(getChildren().size() > 0) { // Get a new instance of the child's list, and sort them by their difference in comparison to the query reference - List commandChilds = new ArrayList<>(getChilds()); - Collections.sort(commandChilds, (o1, o2) -> Double.compare( - o1.getCommandDifference(queryReference), - o2.getCommandDifference(queryReference))); + List commandChildren = new ArrayList<>(getChildren()); + Collections.sort(commandChildren, new Comparator() { + @Override + public int compare(CommandDescription o1, CommandDescription o2) { + return Double.compare( + o1.getCommandDifference(queryReference), + o2.getCommandDifference(queryReference)); + } + }); // Get the difference of the first child in the list - double firstChildDifference = commandChilds.get(0).getCommandDifference(queryReference, true); + double firstChildDifference = commandChildren.get(0).getCommandDifference(queryReference, true); // Check if the reference perfectly suits the arguments of the current command if it doesn't perfectly suits a child command if(firstChildDifference > 0.0) @@ -781,7 +787,7 @@ public class CommandDescription { return new FoundCommandResult(this, newReference, newArguments, queryReference); // Loop through each child - for(CommandDescription child : commandChilds) { + for(CommandDescription child : commandChildren) { // Get the best suitable command FoundCommandResult result = child.findCommand(queryReference); if(result != null) diff --git a/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java b/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java index 18ec476e..17aeb163 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java @@ -182,14 +182,14 @@ public class HelpPrinter { */ public static void printChildren(CommandSender sender, CommandDescription command, CommandParts commandReference) { // Make sure there are child's - if(command.getChilds().size() <= 0) + if(command.getChildren().size() <= 0) return; // Print the header sender.sendMessage(ChatColor.GOLD + "Commands:"); // Loop through each child - for(CommandDescription child : command.getChilds()) + for(CommandDescription child : command.getChildren()) sender.sendMessage(" " + HelpSyntaxHelper.getCommandSyntax(child, commandReference, null, false) + ChatColor.GRAY + ChatColor.ITALIC + " : " + child.getDescription()); } } From 5a0ffab6c22881a28db80d711ee28f5e2a415a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:17:16 +0100 Subject: [PATCH 307/427] Fixed import in CommandHandler class --- src/main/java/fr/xephi/authme/command/CommandHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandHandler.java b/src/main/java/fr/xephi/authme/command/CommandHandler.java index 0302255b..d9638314 100644 --- a/src/main/java/fr/xephi/authme/command/CommandHandler.java +++ b/src/main/java/fr/xephi/authme/command/CommandHandler.java @@ -1,6 +1,6 @@ package fr.xephi.authme.command; -import com.timvisee.dungeonmaze.command.help.HelpProvider; +import fr.xephi.authme.command.help.HelpProvider; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; From a4461dd564899061b69966846c7527ffc63bbc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:17:57 +0100 Subject: [PATCH 308/427] Ignore unused method --- src/main/java/fr/xephi/authme/command/CommandHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/command/CommandHandler.java b/src/main/java/fr/xephi/authme/command/CommandHandler.java index d9638314..7dfa0ab0 100644 --- a/src/main/java/fr/xephi/authme/command/CommandHandler.java +++ b/src/main/java/fr/xephi/authme/command/CommandHandler.java @@ -87,6 +87,7 @@ public class CommandHandler { * * @return True if the command was executed, false otherwise. */ + @SuppressWarnings("unused") public boolean onCommand(CommandSender sender, @SuppressWarnings("UnusedParameters") org.bukkit.command.Command bukkitCommand, String bukkitCommandLabel, String[] bukkitArgs) { // Process the arguments List args = processArguments(bukkitArgs); From c1931209585a65dae0ed211137c4e9e3b55dad32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:18:29 +0100 Subject: [PATCH 309/427] Fixed imports for CommandParts class --- src/main/java/fr/xephi/authme/command/CommandParts.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandParts.java b/src/main/java/fr/xephi/authme/command/CommandParts.java index fd2ef6b8..6f9f8559 100644 --- a/src/main/java/fr/xephi/authme/command/CommandParts.java +++ b/src/main/java/fr/xephi/authme/command/CommandParts.java @@ -1,7 +1,7 @@ package fr.xephi.authme.command; -import com.timvisee.dungeonmaze.util.ListUtils; -import com.timvisee.dungeonmaze.util.StringUtils; +import fr.xephi.authme.util.ListUtils; +import fr.xephi.authme.util.StringUtils; import java.util.ArrayList; import java.util.List; From 7962d6b9feb10949c48fc8a58e24d66ed33fcbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:19:56 +0100 Subject: [PATCH 310/427] Fixed CommandPermissions class --- .../xephi/authme/command/CommandPermissions.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandPermissions.java b/src/main/java/fr/xephi/authme/command/CommandPermissions.java index 0955e48f..3ebe5baa 100644 --- a/src/main/java/fr/xephi/authme/command/CommandPermissions.java +++ b/src/main/java/fr/xephi/authme/command/CommandPermissions.java @@ -1,7 +1,8 @@ package fr.xephi.authme.command; -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.permission.PermissionsManager; +//import com.timvisee.dungeonmaze.Core; +//import com.timvisee.dungeonmaze.permission.PermissionsManager; +import fr.xephi.authme.AuthMe; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -123,14 +124,14 @@ public class CommandPermissions { // Get the player instance Player player = (Player) sender; - // Get the permissions manager, and make sure it's instance is valid - PermissionsManager permissionsManager = Core.getPermissionsManager(); - if(permissionsManager == null) - return false; +// // Get the permissions manager, and make sure it's instance is valid +// PermissionsManager permissionsManager = Core.getPermissionsManager(); +// if(permissionsManager == null) +// return false; // Check whether the player has permission, return the result for(String node : this.permissionNodes) - if(!permissionsManager.hasPermission(player, node, defaultPermission)) + if(!AuthMe.getInstance().authmePermissible(player, node)) return false; return true; } From 802053f0456a9c00be17f030257ba5fb86f2f84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:21:24 +0100 Subject: [PATCH 311/427] Removed unused service class --- .../authme/command/CommandHandlerService.java | 90 ------------------- 1 file changed, 90 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/command/CommandHandlerService.java diff --git a/src/main/java/fr/xephi/authme/command/CommandHandlerService.java b/src/main/java/fr/xephi/authme/command/CommandHandlerService.java deleted file mode 100644 index f3fc2de5..00000000 --- a/src/main/java/fr/xephi/authme/command/CommandHandlerService.java +++ /dev/null @@ -1,90 +0,0 @@ -package fr.xephi.authme.command; - -import com.timvisee.dungeonmaze.service.Service; - -public class CommandHandlerService extends Service { - - /** Service name. */ - private static final String SERVICE_NAME = "Command Handler"; - - /** Command handler instance. */ - private CommandHandler commandHandler; - - /** - * Initialize the service. - * - * @return True on success, false on failure. True will also be returned if the service was initialized already. - */ - @Override - public boolean init() { - // Initialize the command handler - this.commandHandler = new CommandHandler(false); - - // Initialize the command handler, return the result - return this.commandHandler.init(); - } - - /** - * Check whether the service is initialized. - * - * @return True if the service is initialized, false otherwise. - */ - @Override - public boolean isInit() { - // Make sure the command handler is set - if(this.commandHandler == null) - return false; - - // Check whether the command handler is initialized - return this.commandHandler.isInit(); - } - - /** - * Destroy the service. The destruction won't be forced. - * - * @param force True to force the destruction. This wil re-destroy the service even if it isn't initialized. - * This will also force the initialization state to be set to false even if an error occurred while - * destroying. - * - * @return True on success, false on failure. True will also be returned if the service wasn't initialized. False - * might be returned if force is set to true, even though the initialization state is set to false. - */ - @Override - public boolean destroy(boolean force) { - // Make sure the command handler is initialized - if(!this.isInit() && !force) - return true; - - // Destroy the command handler - if(this.commandHandler != null) { - if(!this.commandHandler.destroy()) { - if(force) - this.commandHandler = null; - return false; - } - } - - // Return the result - this.commandHandler = null; - return true; - } - - /** - * Get the name of the service. - * - * @return Service name. - */ - @Override - public String getName() { - return SERVICE_NAME; - } - - /** - * Get the command handler. - * - * @return Command handler instance. - */ - public CommandHandler getCommandHandler() { - return this.commandHandler; - } -} From 2e5e3f25e3a50a571a605def85b7755e1d0efe83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:34:13 +0100 Subject: [PATCH 312/427] Fixed imports of HelpCommand class --- .../fr/xephi/authme/command/executable/HelpCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java b/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java index fb4b299c..3ddcb5a5 100644 --- a/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java @@ -1,8 +1,8 @@ package fr.xephi.authme.command.executable; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.command.help.HelpProvider; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.command.help.HelpProvider; import org.bukkit.command.CommandSender; public class HelpCommand extends ExecutableCommand { From 59d02e1497dd28011d9a0bc86ec9658da6a79028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:34:36 +0100 Subject: [PATCH 313/427] Created base command for /authme --- .../{DungeonMazeCommand.java => AuthMeCommand.java} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/main/java/fr/xephi/authme/command/executable/{DungeonMazeCommand.java => AuthMeCommand.java} (75%) diff --git a/src/main/java/fr/xephi/authme/command/executable/DungeonMazeCommand.java b/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java similarity index 75% rename from src/main/java/fr/xephi/authme/command/executable/DungeonMazeCommand.java rename to src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java index 569a6286..a2b159e4 100644 --- a/src/main/java/fr/xephi/authme/command/executable/DungeonMazeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java @@ -1,12 +1,11 @@ package fr.xephi.authme.command.executable; -import com.timvisee.dungeonmaze.DungeonMaze; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -public class DungeonMazeCommand extends ExecutableCommand { +public class AuthMeCommand extends ExecutableCommand { /** * Execute the command. @@ -20,7 +19,8 @@ public class DungeonMazeCommand extends ExecutableCommand { @Override public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { // Show some version info - sender.sendMessage(ChatColor.GREEN + "This server is running " + DungeonMaze.PLUGIN_NAME + " v" + DungeonMaze.getVersionName() + "! " + ChatColor.RED + "<3"); + // TODO: Use plugin name and version constants here! + sender.sendMessage(ChatColor.GREEN + "This server is running AuthMeReloaded v1.0! " + ChatColor.RED + "<3"); sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " help" + ChatColor.YELLOW + " to view help."); sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " about" + ChatColor.YELLOW + " to view about."); return true; From 756469449e0f70f885638ddfe2701e97394f72a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:36:05 +0100 Subject: [PATCH 314/427] Updated command manager --- .../xephi/authme/command/CommandManager.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 912e7661..624b07e7 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -1,6 +1,6 @@ package fr.xephi.authme.command; -import com.timvisee.dungeonmaze.command.executable.*; +import fr.xephi.authme.command.executable.*; import java.util.ArrayList; import java.util.List; @@ -28,14 +28,13 @@ public class CommandManager { @SuppressWarnings("SpellCheckingInspection") public void registerCommands() { // Register the base Dungeon Maze command - CommandDescription dungeonMazeCommand = new CommandDescription( - new DungeonMazeCommand(), + CommandDescription authMeCommand = new CommandDescription( + new AuthMeCommand(), new ArrayList() {{ - add("dungeonmaze"); - add("dm"); + add("authme"); }}, "Main command", - "The main Dungeon Maze command. The root for all the other commands.", null); + "The main AuthMeReloaded command. The root for all the other commands.", null); // Register the help command CommandDescription helpCommand = new CommandDescription( @@ -48,12 +47,12 @@ public class CommandManager { add("?"); }}, "View help", - "View detailed help pages about Dungeon Maze commands.", - dungeonMazeCommand); + "View detailed help pages about AuthMeReloaded commands.", + authMeCommand); helpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); helpCommand.setMaximumArguments(false); - // Register the create command + /*// Register the create command CommandDescription createWorldCommand = new CommandDescription( new CreateWorldCommand(), new ArrayList() {{ @@ -236,10 +235,10 @@ public class CommandManager { "Version info", "Show detailed information about the installed Dungeon Maze version, and shows the developers, contributors, license and other information.", dungeonMazeCommand); - versionCommand.setMaximumArguments(false); + versionCommand.setMaximumArguments(false);*/ - // Add the base command to the commands array - this.commandDescriptions.add(dungeonMazeCommand); + // Add the base commands to the commands array + this.commandDescriptions.add(authMeCommand); } /** From 2b8fdc65f0357f24a53ce7ab5ae41554514cde93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:54:23 +0100 Subject: [PATCH 315/427] Removed unused commands --- .../executable/CheckUpdatesCommand.java | 78 -------- .../executable/CreateWorldCommand.java | 140 -------------- .../executable/InstallUpdateCommand.java | 75 -------- .../command/executable/ListWorldCommand.java | 67 ------- .../command/executable/LoadWorldCommand.java | 75 -------- .../command/executable/ReloadCommand.java | 75 -------- .../executable/ReloadPermissionsCommand.java | 56 ------ .../command/executable/RestartCommand.java | 105 ---------- .../command/executable/ServiceCommand.java | 73 ------- .../command/executable/StatusCommand.java | 180 ------------------ .../command/executable/TeleportCommand.java | 80 -------- .../executable/UnloadWorldCommand.java | 107 ----------- .../command/executable/VersionCommand.java | 80 -------- 13 files changed, 1191 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/command/executable/CheckUpdatesCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/CreateWorldCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/InstallUpdateCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/ListWorldCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/LoadWorldCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/ReloadPermissionsCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/RestartCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/ServiceCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/StatusCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/TeleportCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/UnloadWorldCommand.java delete mode 100644 src/main/java/fr/xephi/authme/command/executable/VersionCommand.java diff --git a/src/main/java/fr/xephi/authme/command/executable/CheckUpdatesCommand.java b/src/main/java/fr/xephi/authme/command/executable/CheckUpdatesCommand.java deleted file mode 100644 index 65f92ad4..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/CheckUpdatesCommand.java +++ /dev/null @@ -1,78 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.update.UpdateCheckerService; -import com.timvisee.dungeonmaze.update.bukkit.Updater; -import com.timvisee.dungeonmaze.util.Profiler; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -public class CheckUpdatesCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Profile the process - Profiler p = new Profiler(true); - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Checking for Dungeon Maze updates..."); - - // Get the update checker service, shut it down and start it again to force an update check - UpdateCheckerService service = Core.getUpdateCheckerService(); - service.shutdownUpdateChecker(); - service.setupUpdateChecker(); - - // Get the update checker instance - Updater uc = service.getUpdateChecker(); - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Update checking succeed, took " + p.getTimeFormatted() + "!"); - - // Get the version number of the new update - String newVer = uc.getLatestName(); - - // Make sure any update is available - if(uc.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE) { - sender.sendMessage(ChatColor.GREEN + "New Dungeon Maze version available: " + String.valueOf(newVer)); - return true; - - } else if(uc.getResult() == Updater.UpdateResult.NO_UPDATE) { - sender.sendMessage(ChatColor.GREEN + "You are running the latest Dungeon Maze version!"); - return true; - } - - // Make sure the new version is compatible with the current bukkit version - if(uc.getResult() == Updater.UpdateResult.FAIL_NOVERSION) { - // Show a message - sender.sendMessage(ChatColor.GREEN + "New Dungeon Maze version available: " + String.valueOf(newVer)); - sender.sendMessage(ChatColor.DARK_RED + "The new version is not compatible with your Bukkit version!"); - sender.sendMessage(ChatColor.DARK_RED + "Please update your Bukkit to " + uc.getLatestGameVersion() + " or higher!"); - return true; - } - - // Check whether the update was installed or not - if(uc.getResult() == Updater.UpdateResult.SUCCESS) - sender.sendMessage(ChatColor.GREEN + "New version installed (" + String.valueOf(newVer) + "). Server reboot required!"); - - else { - sender.sendMessage(ChatColor.GREEN + "New version found: " + String.valueOf(newVer)); - //noinspection SpellCheckingInspection - sender.sendMessage(ChatColor.GREEN + "Use " + ChatColor.GOLD + "/dm installupdate" + - ChatColor.GREEN + " to automatically install the new version!"); - } - - // Return the result - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/CreateWorldCommand.java b/src/main/java/fr/xephi/authme/command/executable/CreateWorldCommand.java deleted file mode 100644 index 60d99787..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/CreateWorldCommand.java +++ /dev/null @@ -1,140 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.DungeonMaze; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.util.Profiler; -import com.timvisee.dungeonmaze.world.WorldManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.World; -import org.bukkit.WorldCreator; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class CreateWorldCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Get and trim the preferred world name - String worldName = commandArguments.get(0).trim(); - - // Validate the world name - if(!WorldManager.isValidWorldName(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + worldName); - sender.sendMessage(ChatColor.DARK_RED + "The world name contains invalid characters!"); - return true; - } - - // Set whether the world should be preloaded - boolean preloadWorld = true; - - // Get whether the world should be preloaded based on the arguments - if(commandArguments.getCount() >= 2) { - String arg = commandArguments.get(1); - - // Check whether the argument equals 'force' - if(arg.equalsIgnoreCase("preload")) - preloadWorld = true; - - else if(arg.equalsIgnoreCase("true") || arg.equalsIgnoreCase("t") || arg.equalsIgnoreCase("yes") || arg.equalsIgnoreCase("y")) - preloadWorld = true; - - else if(arg.equalsIgnoreCase("false") || arg.equalsIgnoreCase("f") || arg.equalsIgnoreCase("no") || arg.equalsIgnoreCase("n")) - preloadWorld = false; - - else { - sender.sendMessage(ChatColor.DARK_RED + arg); - sender.sendMessage(ChatColor.DARK_RED + "Invalid argument!"); - return true; - } - } - - // Get the world manager, and make sure it's valid - WorldManager worldManager = Core.getWorldManager(); - boolean showWorldManagerError = false; - if(worldManager == null) - showWorldManagerError = true; - else if(!worldManager.isInit()) - showWorldManagerError = true; - if(showWorldManagerError) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to create the world, world manager not available!"); - return true; - } - - // Make sure the world doesn't exist - if(worldManager.isWorld(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + "The world " + ChatColor.GOLD + worldName + ChatColor.DARK_RED + " already exists!"); - sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " listworlds" + ChatColor.YELLOW + " to list all worlds."); - sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " loadworld " + worldName + ChatColor.YELLOW + " to load the world."); - return true; - } - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Preparing the server..."); - - // Prepare the server for the new world - if(!worldManager.prepareDungeonMazeWorld(worldName, preloadWorld)) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to prepare the server!"); - return true; - } - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Generating the " + DungeonMaze.PLUGIN_NAME + " " + ChatColor.GOLD + worldName + ChatColor.YELLOW + "..."); - Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE + "Generating a new world, expecting lag for a while..."); - - // Profile the world generation - Profiler p = new Profiler(true); - - // Create the world - // TODO: Put this in a separate function! - WorldCreator newWorld = new WorldCreator(worldName); - newWorld.generator(DungeonMaze.instance.getDungeonMazeGenerator()); - World world = newWorld.createWorld(); - - // Force-save the level.dat file for the world, profile the process - Profiler pWorldSave = new Profiler(true); - try { - // Force-save the world, and show some status messages - Core.getLogger().info("Force saving the level.dat file for '" + world.getName() + "'..."); - world.save(); - Core.getLogger().info("World saved successfully, took " + pWorldSave.getTimeFormatted() + "!"); - - } catch(Exception ex) { - Core.getLogger().error("Failed to save the world after " + pWorldSave.getTimeFormatted() + "!"); - } - - // Make sure the world instance is valid - if(world == null) { - Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE + "World generation failed after " + p.getTimeFormatted() + "!"); - sender.sendMessage(ChatColor.DARK_RED + "The " + DungeonMaze.PLUGIN_NAME + " " + ChatColor.GOLD + worldName + ChatColor.GREEN + - " failed to generate after " + p.getTimeFormatted() + "!"); - return true; - } - - // Show a status message - Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE + "World generation finished, took " + p.getTimeFormatted() + "!"); - sender.sendMessage(ChatColor.GREEN + "The " + DungeonMaze.PLUGIN_NAME + " " + ChatColor.GOLD + worldName + ChatColor.GREEN + - " has successfully been generated, took " + p.getTimeFormatted() + "!"); - - // If the command was executed by a player, teleport the player - if(sender instanceof Player) { - // Teleport the player - ((Player) sender).teleport(world.getSpawnLocation()); - sender.sendMessage(ChatColor.GREEN + "You have been teleported to " + ChatColor.GOLD + worldName + ChatColor.GREEN + "!"); - } - - // Return the result - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/InstallUpdateCommand.java b/src/main/java/fr/xephi/authme/command/executable/InstallUpdateCommand.java deleted file mode 100644 index e796563d..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/InstallUpdateCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.update.UpdateCheckerService; -import com.timvisee.dungeonmaze.update.bukkit.Updater; -import com.timvisee.dungeonmaze.util.Profiler; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -public class InstallUpdateCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Profile the process - Profiler p = new Profiler(true); - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Checking for Dungeon Maze updates..."); - - // Get the update checker service, shut it down and start it again to force an update check - UpdateCheckerService service = Core.getUpdateCheckerService(); - service.shutdownUpdateChecker(); - service.setupUpdateChecker(); - - // Get the update checker instance - Updater uc = service.getUpdateChecker(); - - // TODO: Automatically install the actual update! - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Update checking succeed, took " + p.getTimeFormatted() + "!"); - - // Get the version number of the new update - String newVer = uc.getLatestName(); - - // Make sure any update is available - if(uc.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE) { - sender.sendMessage(ChatColor.GREEN + "New Dungeon Maze version available: " + String.valueOf(newVer)); - return true; - - } else if(uc.getResult() == Updater.UpdateResult.NO_UPDATE) { - sender.sendMessage(ChatColor.GREEN + "You are running the latest Dungeon Maze version!"); - return true; - } - - // Make sure the new version is compatible with the current bukkit version - if(uc.getResult() == Updater.UpdateResult.FAIL_NOVERSION) { - // Show a message - sender.sendMessage(ChatColor.GREEN + "New Dungeon Maze version available: " + String.valueOf(newVer)); - sender.sendMessage(ChatColor.DARK_RED + "The new version is not compatible with your Bukkit version!"); - sender.sendMessage(ChatColor.DARK_RED + "Please update your Bukkit to " + uc.getLatestGameVersion() + " or higher!"); - return true; - } - - // Check whether the update was installed or not - if(uc.getResult() == Updater.UpdateResult.SUCCESS) - sender.sendMessage(ChatColor.GREEN + "New version installed (" + String.valueOf(newVer) + "). Server reboot required!"); - else - sender.sendMessage(ChatColor.DARK_RED + "Automatic installation failed, please update manually!"); - - // Return the result - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/ListWorldCommand.java b/src/main/java/fr/xephi/authme/command/executable/ListWorldCommand.java deleted file mode 100644 index ff0b2976..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/ListWorldCommand.java +++ /dev/null @@ -1,67 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.DungeonMaze; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.world.WorldManager; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -import java.util.List; - -public class ListWorldCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Get the world manager and make sure it's valid - WorldManager worldManager = Core.getWorldManager(); - if(worldManager == null) { - sender.sendMessage(ChatColor.DARK_RED + "Error, failed to list the worlds!"); - return true; - } - - // Get the list of Dungeon Maze worlds and other worlds - List dungeonMazeWorlds = worldManager.getDungeonMazeWorlds(); - List otherWorlds = worldManager.getWorlds(true); - - // Show the list of Dungeon Maze worlds - sender.sendMessage(ChatColor.GOLD + "==========[ \" + DungeonMaze.PLUGIN_NAME.toUpperCase() + \" WORLDS ]=========="); - sender.sendMessage(ChatColor.GOLD + DungeonMaze.PLUGIN_NAME + " worlds:"); - if(dungeonMazeWorlds.size() > 0) { - for(String worldName : dungeonMazeWorlds) { - if(worldManager.isDungeonMazeWorldLoaded(worldName)) - sender.sendMessage(ChatColor.WHITE + " " + worldName + ChatColor.GREEN + ChatColor.ITALIC + " (Loaded)"); - else - sender.sendMessage(ChatColor.WHITE + " " + worldName + ChatColor.GRAY + ChatColor.ITALIC + " (Not Loaded)"); - } - } else - // No Dungeon Maze world available, show a message - sender.sendMessage(ChatColor.GRAY + "" + ChatColor.ITALIC + " No Dungeon Maze worlds available!"); - - // Show the list of other worlds - sender.sendMessage(ChatColor.GOLD + "Other worlds:"); - if(otherWorlds.size() > 0) { - for(String worldName : otherWorlds) { - if(worldManager.isWorldLoaded(worldName)) - sender.sendMessage(ChatColor.WHITE + " " + worldName + ChatColor.GREEN + ChatColor.ITALIC + " (Loaded)"); - else - sender.sendMessage(ChatColor.WHITE + " " + worldName + ChatColor.GRAY + ChatColor.ITALIC + " (Not Loaded)"); - } - } else - // No other world available, show a message - sender.sendMessage(ChatColor.GRAY + "" + ChatColor.ITALIC + " No other worlds available!"); - - // Return the result - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/LoadWorldCommand.java b/src/main/java/fr/xephi/authme/command/executable/LoadWorldCommand.java deleted file mode 100644 index 29174ecd..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/LoadWorldCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.util.Profiler; -import com.timvisee.dungeonmaze.world.WorldManager; -import org.bukkit.ChatColor; -import org.bukkit.World; -import org.bukkit.command.CommandSender; - -public class LoadWorldCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Get and trim the preferred world name - String worldName = commandArguments.get(0).trim(); - - // Profile the world loading - Profiler p = new Profiler(true); - - // Validate the world name - if(!WorldManager.isValidWorldName(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + worldName); - sender.sendMessage(ChatColor.DARK_RED + "The world name contains invalid characters!"); - return true; - } - - // Get the world manager, and make sure it's valid - WorldManager worldManager = Core.getWorldManager(); - boolean showWorldManagerError = false; - if(worldManager == null) - showWorldManagerError = true; - else if(!worldManager.isInit()) - showWorldManagerError = true; - if(showWorldManagerError) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to load the world, world manager not available!"); - return true; - } - - // Make sure the world exists - if(!worldManager.isWorld(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + "The world " + ChatColor.GOLD + worldName + ChatColor.DARK_RED + " doesn't exist!"); - return true; - } - - // Make sure the world isn't loaded already - if(worldManager.isWorldLoaded(worldName)) { - sender.sendMessage(ChatColor.GREEN + "The world " + ChatColor.GOLD + worldName + ChatColor.GREEN + " is already loaded!"); - return true; - } - - // Load the world, store the instance - World world = worldManager.loadWorld(worldName); - - // Make sure the world was loaded - if(world == null) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to load the world!"); - return true; - } - - // Show a status message, return the result - sender.sendMessage(ChatColor.GREEN + "The world " + ChatColor.GOLD + worldName + ChatColor.GREEN + " has been loaded, took " + p.getTimeFormatted() + "!"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java deleted file mode 100644 index 2335e7e7..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.config.ConfigHandler; -import com.timvisee.dungeonmaze.util.Profiler; -import com.timvisee.dungeonmaze.world.WorldManager; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -public class ReloadCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Profile the reload process - Profiler p = new Profiler(true); - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Reloading Dungeon Maze..."); - - /* // Set whether the reload is forced - boolean force = false; - - // Get whether the reload should be forced from the command arguments - if(commandArguments.getCount() >= 1) { - String arg = commandArguments.get(0); - - // Check whether the argument equals 'force' - if(arg.equalsIgnoreCase("force") || arg.equalsIgnoreCase("forced")) - force = true; - - else if(arg.equalsIgnoreCase("true") || arg.equalsIgnoreCase("t") || arg.equalsIgnoreCase("yes") || arg.equalsIgnoreCase("y")) - force = true; - - else if(arg.equalsIgnoreCase("false") || arg.equalsIgnoreCase("f") || arg.equalsIgnoreCase("no") || arg.equalsIgnoreCase("n")) - force = false; - - else { - sender.sendMessage(ChatColor.DARK_RED + arg); - sender.sendMessage(ChatColor.DARK_RED + "Invalid argument!"); - return true; - } - }*/ - - // Reload the configuration - ConfigHandler configHandler = Core.getConfigHandler(); - if(configHandler != null) { - configHandler.load(); - sender.sendMessage(ChatColor.YELLOW + "Reloaded the configuration!"); - } else - sender.sendMessage(ChatColor.DARK_RED + "Failed to reload the configuration!"); - - // Get the world manager to reload the world list, and make sure it's valid - WorldManager worldManager = Core.getWorldManager(); - if(worldManager != null) { - worldManager.refresh(); - sender.sendMessage(ChatColor.YELLOW + "Reloaded the worlds!"); - } else - sender.sendMessage(ChatColor.DARK_RED + "Failed to reload the worlds!"); - - // Dungeon Maze reloaded, show a status message - sender.sendMessage(ChatColor.GREEN + "Dungeon Maze has been reloaded successfully, took " + p.getTimeFormatted() + "!"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/ReloadPermissionsCommand.java b/src/main/java/fr/xephi/authme/command/executable/ReloadPermissionsCommand.java deleted file mode 100644 index b9f9088c..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/ReloadPermissionsCommand.java +++ /dev/null @@ -1,56 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.permission.PermissionsManager; -import com.timvisee.dungeonmaze.util.Profiler; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -public class ReloadPermissionsCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Profile the permissions reload process - Profiler p = new Profiler(true); - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Reloading permissions..."); - Core.getLogger().info("Reloading permissions..."); - - // Get the permissions manager and make sure it's valid - PermissionsManager permissionsManager = Core.getPermissionsManager(); - if(permissionsManager == null) { - Core.getLogger().info("Failed to access the permissions manager after " + p.getTimeFormatted() + "!"); - sender.sendMessage(ChatColor.DARK_RED + "Failed to access the permissions manager after " + p.getTimeFormatted() + "!"); - return true; - } - - // Reload the permissions service, show an error on failure - if(!permissionsManager.reload()) { - Core.getLogger().info("Failed to reload permissions after " + p.getTimeFormatted() + "!"); - sender.sendMessage(ChatColor.DARK_RED + "Failed to reload permissions after " + p.getTimeFormatted() + "!"); - return true; - } - - // Show a success message - Core.getLogger().info("Permissions reloaded successfully, took " + p.getTimeFormatted() + "!"); - sender.sendMessage(ChatColor.GREEN + "Permissions reloaded successfully, took " + p.getTimeFormatted() + "!"); - - // Get and show the permissions system being used - String permissionsSystem = ChatColor.GOLD + permissionsManager.getUsedPermissionsSystemType().getName(); - Core.getLogger().info("Used permissions system: " + permissionsSystem); - sender.sendMessage(ChatColor.GREEN + "Used permissions system: " + permissionsSystem); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/RestartCommand.java b/src/main/java/fr/xephi/authme/command/executable/RestartCommand.java deleted file mode 100644 index dbc9d298..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/RestartCommand.java +++ /dev/null @@ -1,105 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.DungeonMaze; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.util.Profiler; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -public class RestartCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Profile the restart process - Profiler p = new Profiler(true); - - // Set whether the restart is forced - boolean force = false; - - // Get whether the restart should be forced from the command arguments - if(commandArguments.getCount() >= 1) { - String arg = commandArguments.get(0); - - // Check whether the argument equals 'force' - if(arg.equalsIgnoreCase("force") || arg.equalsIgnoreCase("forced")) - force = true; - - else if(arg.equalsIgnoreCase("true") || arg.equalsIgnoreCase("t") || arg.equalsIgnoreCase("yes") || arg.equalsIgnoreCase("y")) - force = true; - - else if(arg.equalsIgnoreCase("false") || arg.equalsIgnoreCase("f") || arg.equalsIgnoreCase("no") || arg.equalsIgnoreCase("n")) - force = false; - - else { - sender.sendMessage(ChatColor.DARK_RED + arg); - sender.sendMessage(ChatColor.DARK_RED + "Invalid argument!"); - return true; - } - } - - // Show a restart warning - if(force) { - sender.sendMessage(ChatColor.YELLOW + "Force restarting Dungeon Maze..."); - Core.getLogger().info("Force restarting Dungeon Maze..."); - } else { - sender.sendMessage(ChatColor.YELLOW + "Restarting Dungeon Maze..."); - Core.getLogger().info("Restarting Dungeon Maze..."); - } - - // Profile the Dungeon Maze Core destruction - Profiler stopCoreProfiler = new Profiler(true); - - // Destroy the Dungeon Maze core - if(!DungeonMaze.instance.destroyCore(force)) { - // Failed to destroy the core, show a status message - sender.sendMessage(ChatColor.DARK_RED + "Failed to stop the Dungeon Maze Core after " + stopCoreProfiler.getTimeFormatted() + "!"); - sender.sendMessage(ChatColor.DARK_RED + "Please use " + ChatColor.GOLD + "/reload" + ChatColor.DARK_RED + " for plugin instability reasons!"); - Core.getLogger().error("Failed to stop the core, after " + stopCoreProfiler.getTimeFormatted() + "!"); - - // Return if the restart isn't force - if(!force) - return true; - } - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Dungeon Maze Core stopped, took " + stopCoreProfiler.getTimeFormatted() + "!"); - - // Profile the core starting - Profiler startCoreProfiler = new Profiler(true); - - // Initialize the core, show the result status - if(!DungeonMaze.instance.initCore()) { - // Core failed to initialize, show a status message - sender.sendMessage(ChatColor.DARK_RED + "Failed to start the Dungeon Maze Core after " + startCoreProfiler.getTimeFormatted() + "!"); - sender.sendMessage(ChatColor.DARK_RED + "Please use " + ChatColor.GOLD + "/reload" + ChatColor.DARK_RED + " for plugin instability reasons!"); - Core.getLogger().error("Failed to start the core, after " + startCoreProfiler.getTimeFormatted() + "!"); - - // Return if the restart isn't forced - if(!force) - return true; - } - - // Core initialized, show a status message - sender.sendMessage(ChatColor.YELLOW + "Dungeon Maze Core started, took " + startCoreProfiler.getTimeFormatted() + "!"); - - // Show a status message of the running services - final int runningServices = Core.instance.getServiceManager().getServiceCount(true); - final int totalServices = Core.instance.getServiceManager().getServiceCount(); - sender.sendMessage(ChatColor.YELLOW + "Started " + ChatColor.GOLD + runningServices + ChatColor.YELLOW + " out of " + ChatColor.GOLD + totalServices + ChatColor.YELLOW + " Dungeon Maze services!"); - - // Dungeon Maze restarted, show a status message - sender.sendMessage(ChatColor.GREEN + "Dungeon Maze has been restarted successfully, took " + p.getTimeFormatted() + "!"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/ServiceCommand.java b/src/main/java/fr/xephi/authme/command/executable/ServiceCommand.java deleted file mode 100644 index da89506b..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/ServiceCommand.java +++ /dev/null @@ -1,73 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.DungeonMaze; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.service.Service; -import com.timvisee.dungeonmaze.service.ServiceManager; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -import java.util.List; - -public class ServiceCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Print the status info header - sender.sendMessage(ChatColor.GOLD + "==========[ " + DungeonMaze.PLUGIN_NAME.toUpperCase() + " SERVICES ]=========="); - - // Get the service manager and make sure it's valid - ServiceManager serviceManager = Core.instance.getServiceManager(); - if(serviceManager == null) { - sender.sendMessage(ChatColor.DARK_RED + "Error, failed to retrieve the services information!"); - return true; - } - - // Print the service count and the list of services - sender.sendMessage(ChatColor.GOLD + "Running Services: " + ChatColor.WHITE + serviceManager.getServiceCount(true) + ChatColor.GRAY + " / " + Core.instance.getServiceManager().getServiceCount()); - printServices(sender); - - // Return the result - return true; - } - - /** - * Print all services. - * - * @param sender The command sender to print the services to. - */ - public void printServices(CommandSender sender) { - // Get the service manager and make sure it's valid - ServiceManager serviceManager = Core.instance.getServiceManager(); - if(serviceManager == null) { - sender.sendMessage(ChatColor.DARK_RED + "Error, failed to retrieve the services information!"); - return; - } - - // Get all the services - List services = serviceManager.getServices(); - - // Print the header - sender.sendMessage(ChatColor.GOLD + "Services:"); - - // Print all the services - for(Service service : services) { - // Check whether the service is initialized - if(service.isInit()) - sender.sendMessage(ChatColor.WHITE + " " + service.getName() + " service " + ChatColor.GREEN + ChatColor.ITALIC + "(Loaded)"); - else - sender.sendMessage(ChatColor.WHITE + " " + service.getName() + " service " + ChatColor.DARK_RED + ChatColor.ITALIC + "(Not loaded)"); - } - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/StatusCommand.java b/src/main/java/fr/xephi/authme/command/executable/StatusCommand.java deleted file mode 100644 index d0bfc583..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/StatusCommand.java +++ /dev/null @@ -1,180 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.DungeonMaze; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.permission.PermissionsManager; -import com.timvisee.dungeonmaze.util.MinecraftUtils; -import com.timvisee.dungeonmaze.util.SystemUtils; -import com.timvisee.dungeonmaze.world.WorldManager; -import com.timvisee.dungeonmaze.world.dungeon.chunk.grid.DungeonChunkGridManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -public class StatusCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Print the status info header - sender.sendMessage(ChatColor.GOLD + "==========[ " + DungeonMaze.PLUGIN_NAME.toUpperCase() + " STATUS ]=========="); - - // Get the world manager - WorldManager worldManager = Core.getWorldManager(); - - // Print the number of Dungeon Maze worlds - if(worldManager != null) - sender.sendMessage(ChatColor.GOLD + DungeonMaze.PLUGIN_NAME + " worlds: " + ChatColor.WHITE + worldManager.getDungeonMazeWorlds().size()); - else - sender.sendMessage(ChatColor.GOLD + DungeonMaze.PLUGIN_NAME + " worlds: " + ChatColor.DARK_RED + ChatColor.ITALIC + "Unknown!"); - - // Print the Dungeon Maze player count - int playerCount = Bukkit.getOnlinePlayers().size(); - int dungeonMazePlayerCount = 0; - if(worldManager != null) { - for(Player player : Bukkit.getOnlinePlayers()) - if(worldManager.isDungeonMazeWorld(player.getWorld().getName())) - dungeonMazePlayerCount++; - - sender.sendMessage(ChatColor.GOLD + DungeonMaze.PLUGIN_NAME + " players: " + ChatColor.WHITE + dungeonMazePlayerCount + ChatColor.GRAY + " / " + playerCount); - - } else - sender.sendMessage(ChatColor.GOLD + DungeonMaze.PLUGIN_NAME + " players: " + ChatColor.DARK_RED + ChatColor.ITALIC + "Unknown!"); - - // Get the permissions manager - PermissionsManager permissionsManager = Core.getPermissionsManager(); - - // Print the permissions manager status - if(permissionsManager != null) { - // Get the used permissions system - PermissionsManager.PermissionsSystemType type = permissionsManager.getUsedPermissionsSystemType(); - - if(!type.equals(PermissionsManager.PermissionsSystemType.NONE)) - sender.sendMessage(ChatColor.GOLD + "Permissions System: " + ChatColor.GREEN + permissionsManager.getUsedPermissionsSystemType().getName()); - else - sender.sendMessage(ChatColor.GOLD + "Permissions System: " + ChatColor.GRAY + ChatColor.ITALIC + permissionsManager.getUsedPermissionsSystemType().getName()); - } else - sender.sendMessage(ChatColor.GOLD + "Permissions System: " + ChatColor.DARK_RED + ChatColor.ITALIC + "Unknown!"); - - // Get the dungeon chunk grid manager - DungeonChunkGridManager dungeonChunkGridManager = Core.getDungeonChunkGridManager(); - if(dungeonChunkGridManager != null) { - int loadedChunks = dungeonChunkGridManager.getLoadedChunksCount(); - int loadedGrids = dungeonChunkGridManager.getLoadedGridsCount(); - sender.sendMessage(ChatColor.GOLD + "Loaded Dungeon Chunks: " + ChatColor.WHITE + loadedChunks + ChatColor.GRAY + " in " + ChatColor.WHITE + loadedGrids + ChatColor.GRAY + " grid" + (loadedGrids != 1 ? "s" : "")); - } else - sender.sendMessage(ChatColor.GOLD + "Loaded Dungeon Chunks: " + ChatColor.DARK_RED + ChatColor.ITALIC + "Unknown!"); - - // Print the service count - sender.sendMessage(ChatColor.GOLD + "Running Services: " + ChatColor.WHITE + Core.instance.getServiceManager().getServiceCount(true) + ChatColor.GRAY + " / " + Core.instance.getServiceManager().getServiceCount()); - - // Print the plugin runtime - printPluginRuntime(sender); - - // Show the version status - sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + "Dungeon Maze v" + DungeonMaze.getVersionName() + ChatColor.GRAY + " (code: " + DungeonMaze.getVersionCode() + ")"); - - // Print the server status - printServerStatus(sender); - - // Print the machine status - printMachineStatus(sender); - return true; - } - - /** - * Print the plugin runtime. - * - * @param sender Command sender to print the runtime to. - */ - public void printPluginRuntime(CommandSender sender) { - // Get the runtime - long runtime = new Date().getTime() - Core.getInitializationTime().getTime(); - - // Calculate the timings - int millis = (int) (runtime % 1000); - runtime/=1000; - int seconds = (int) (runtime % 60); - runtime/=60; - int minutes = (int) (runtime % 60); - runtime/=60; - int hours = (int) runtime; - - // Create a double and triple digit formatter - DecimalFormat doubleDigit = new DecimalFormat("######00"); - DecimalFormat tripleDigit = new DecimalFormat("000"); - - // Generate the timing string - StringBuilder runtimeStr = new StringBuilder(ChatColor.WHITE + doubleDigit.format(seconds) + ChatColor.GRAY + "." + ChatColor.WHITE + tripleDigit.format(millis)); - String measurement = "Seconds"; - if(minutes > 0 || hours > 0) { - runtimeStr.insert(0, ChatColor.WHITE + doubleDigit.format(minutes) + ChatColor.GRAY + ":"); - measurement = "Minutes"; - if(hours > 0) { - runtimeStr.insert(0, ChatColor.WHITE + doubleDigit.format(hours) + ChatColor.GRAY + ":"); - measurement = "Hours"; - } - } - - // Print the runtime - sender.sendMessage(ChatColor.GOLD + "Runtime: " + ChatColor.WHITE + runtimeStr + " " + ChatColor.GRAY + measurement); - } - - /** - * Print the server status. - * - * @param sender The command sender to print the status to. - */ - public void printServerStatus(CommandSender sender) { - // Print the header - sender.sendMessage(ChatColor.GRAY + "" + ChatColor.ITALIC + "Server Status:"); - - // Print the server status - sender.sendMessage(ChatColor.GOLD + "Detected Minecraft Version: " + ChatColor.WHITE + MinecraftUtils.getMinecraftVersion()); - sender.sendMessage(ChatColor.GOLD + "Detected Minecraft Server: " + ChatColor.WHITE + MinecraftUtils.getServerType().getName()); - sender.sendMessage(ChatColor.GOLD + "Server Version: " + ChatColor.WHITE + Bukkit.getVersion()); - sender.sendMessage(ChatColor.GOLD + "Bukkit Version: " + ChatColor.WHITE + Bukkit.getBukkitVersion()); - sender.sendMessage(ChatColor.GOLD + "Running Plugins: " + ChatColor.WHITE + Bukkit.getPluginManager().getPlugins().length); - - // Get the world manager - WorldManager worldManager = Core.getWorldManager(); - if(worldManager != null) - sender.sendMessage(ChatColor.GOLD + "Loaded Worlds: " + ChatColor.WHITE + Bukkit.getWorlds().size() + ChatColor.GRAY + " / " + worldManager.getWorlds().size()); - - // Print the server time - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - sender.sendMessage(ChatColor.GOLD + "Server Time: " + ChatColor.WHITE + dateFormat.format(new Date())); - } - - /** - * Print the machine status. - * - * @param sender The command sender to print the status to. - */ - public void printMachineStatus(CommandSender sender) { - // Print the header - sender.sendMessage(ChatColor.GRAY + "" + ChatColor.ITALIC + "Machine Status:"); - - // Return the machine status - sender.sendMessage(ChatColor.GOLD + "OS Name: " + ChatColor.WHITE + System.getProperty("os.name")); - sender.sendMessage(ChatColor.GOLD + "OS Architecture: " + ChatColor.WHITE + SystemUtils.getSystemArchNumber() + "-bit" + ChatColor.GRAY + " (" + SystemUtils.getSystemArchFull() + ")"); - sender.sendMessage(ChatColor.GOLD + "OS Version: " + ChatColor.WHITE + System.getProperty("os.version")); - sender.sendMessage(ChatColor.GOLD + "Java Version: " + ChatColor.WHITE + System.getProperty("java.version") + ChatColor.GRAY + " (" + System.getProperty("sun.arch.data.model") + "-bit)"); - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/TeleportCommand.java b/src/main/java/fr/xephi/authme/command/executable/TeleportCommand.java deleted file mode 100644 index b1821cf5..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/TeleportCommand.java +++ /dev/null @@ -1,80 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.world.WorldManager; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class TeleportCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Make sure the command is executed by an in-game player - if(!(sender instanceof Player)) { - sender.sendMessage(ChatColor.DARK_RED + "You need to be in-game to use this command!"); - return true; - } - - // Get the player and the world name to teleport to - Player player = (Player) sender; - String worldName = commandArguments.get(0); - - // Get the world manager, and make sure it's valid - WorldManager worldManager = Core.getWorldManager(); - boolean showWorldManagerError = false; - if(worldManager == null) - showWorldManagerError = true; - else if(!worldManager.isInit()) - showWorldManagerError = true; - if(showWorldManagerError) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to teleport, world manager not available!"); - return true; - } - - // Make sure the world exists - if(!worldManager.isWorld(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + worldName); - sender.sendMessage(ChatColor.DARK_RED + "This world doesn't exists!"); - return true; - } - - // Try to load the world - World world = worldManager.loadWorld(worldName); - - // Make sure the world was loaded successfully - if(world == null) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to teleport, unable to load the world!"); - return true; - } - - // Get the spawn location to teleport the player to - Location spawn = world.getSpawnLocation(); - - // Force-set the location on Dungeon Maze worlds - // TODO: Fix this! - if(worldManager.isDungeonMazeWorld(worldName)) { - spawn.setX(4); - spawn.setY(68); - spawn.setZ(4); - } - - // Teleport the player, show a status message and return true - player.teleport(spawn); - player.sendMessage(ChatColor.GREEN + "You have been teleported to " + ChatColor.GOLD + worldName + ChatColor.GREEN + "!"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/UnloadWorldCommand.java b/src/main/java/fr/xephi/authme/command/executable/UnloadWorldCommand.java deleted file mode 100644 index 815737b8..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/UnloadWorldCommand.java +++ /dev/null @@ -1,107 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.Core; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import com.timvisee.dungeonmaze.util.Profiler; -import com.timvisee.dungeonmaze.world.WorldManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.stream.Collectors; - -public class UnloadWorldCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Get and trim the preferred world name - String worldName = commandArguments.get(0).trim(); - - // Profile the world unloading - Profiler p = new Profiler(true); - - // Validate the world name - if(!WorldManager.isValidWorldName(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + worldName); - sender.sendMessage(ChatColor.DARK_RED + "The world name contains invalid characters!"); - return true; - } - - // Get the world manager, and make sure it's valid - WorldManager worldManager = Core.getWorldManager(); - boolean showWorldManagerError = false; - if(worldManager == null) - showWorldManagerError = true; - else if(!worldManager.isInit()) - showWorldManagerError = true; - if(showWorldManagerError) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to unload the world, world manager not available!"); - return true; - } - - // Make sure the world exists - if(!worldManager.isWorld(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + "The world " + ChatColor.GOLD + worldName + ChatColor.DARK_RED + " doesn't exist!"); - return true; - } - - // Make sure the world is loaded - if(!worldManager.isWorldLoaded(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + "The world " + ChatColor.GOLD + worldName + ChatColor.DARK_RED + " isn't loaded!"); - return true; - } - - // Make sure the main world isn't unloaded - if(worldManager.isMainWorld(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + "The main world can't be unloaded!"); - return true; - } - - // Get all players in the world - List players = Bukkit.getOnlinePlayers().stream().filter(player -> player.getWorld().getName().equals(worldName)).collect(Collectors.toList()); - int playerCount = players.size(); - - // Teleport all players away - if(playerCount > 0) { - // Get the main world - World mainWorld = worldManager.getMainWorld(); - Location mainWorldSpawn = mainWorld.getSpawnLocation(); - - // Teleport all players - for(Player player : players) { - // Teleport the player to the spawn of the main world - player.teleport(mainWorldSpawn); - - // Show a message to the player - player.sendMessage(ChatColor.YELLOW + "The current world is being unloaded, you've been teleported!"); - } - - // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Teleported " + ChatColor.GOLD + playerCount + ChatColor.YELLOW + " player" + (playerCount != 1 ? "s" : "") + " away!"); - } - - // Force the world to be loaded if it isn't already loaded - if(!worldManager.unloadWorld(worldName)) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to unload the world!"); - return true; - } - - // Show a status message, return the result - sender.sendMessage(ChatColor.GREEN + "The world " + ChatColor.GOLD + worldName + ChatColor.GREEN + " has been unloaded, took " + p.getTimeFormatted() + "!"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java b/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java deleted file mode 100644 index 7adc9229..00000000 --- a/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java +++ /dev/null @@ -1,80 +0,0 @@ -package fr.xephi.authme.command.executable; - -import com.timvisee.dungeonmaze.DungeonMaze; -import com.timvisee.dungeonmaze.command.CommandParts; -import com.timvisee.dungeonmaze.command.ExecutableCommand; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class VersionCommand extends ExecutableCommand { - - /** - * Execute the command. - * - * @param sender The command sender. - * @param commandReference The command reference. - * @param commandArguments The command arguments. - * - * @return True if the command was executed successfully, false otherwise. - */ - @Override - public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Show some version info - sender.sendMessage(ChatColor.GOLD + "==========[ " + DungeonMaze.PLUGIN_NAME.toUpperCase() + " ABOUT ]=========="); - sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + DungeonMaze.PLUGIN_NAME + " v" + DungeonMaze.getVersionName() + ChatColor.GRAY + " (code: " + DungeonMaze.getVersionCode() + ")"); - sender.sendMessage(ChatColor.GOLD + "Developers:"); - printDeveloper(sender, "Tim Visee", "timvisee", "Lead Developer"); - printDeveloper(sender, "Xephi", "xephi", "Code Contributor"); - printDeveloper(sender, "sgdc3", "sgdc3", "Code Contributor"); - printDeveloper(sender, "Metonymia", "Metonymia", "Design Contributor"); - sender.sendMessage(ChatColor.GOLD + "Website: " + ChatColor.WHITE + "http://timvisee.com/projects/bukkit/dungeon-maze/"); - sender.sendMessage(ChatColor.GOLD + "License: " + ChatColor.WHITE + "GNU GPL v3.0" + ChatColor.GRAY + ChatColor.ITALIC + " (See LICENSE file)"); - sender.sendMessage(ChatColor.GOLD + "Copyright: " + ChatColor.WHITE + "Copyright (c) Tim Visee 2015. All rights reserved."); - return true; - } - - /** - * Print a developer with proper styling. - * - * @param sender The command sender. - * @param name The display name of the developer. - * @param minecraftName The Minecraft username of the developer, if available. - * @param function The function of the developer. - */ - @SuppressWarnings("StringConcatenationInsideStringBufferAppend") - private void printDeveloper(CommandSender sender, String name, String minecraftName, String function) { - // Print the name - StringBuilder msg = new StringBuilder(); - msg.append(" " + ChatColor.WHITE); - msg.append(name); - - // Append the Minecraft name, if available - if(minecraftName.length() != 0) - msg.append(ChatColor.GRAY + " // " + ChatColor.WHITE + minecraftName); - msg.append(ChatColor.GRAY + "" + ChatColor.ITALIC + " (" + function + ")"); - - // Show the online status - if(minecraftName.length() != 0) - if(isPlayerOnline(minecraftName)) - msg.append(ChatColor.GREEN + "" + ChatColor.ITALIC + " (In-Game)"); - - // Print the message - sender.sendMessage(msg.toString()); - } - - /** - * Check whether a player is online. - * - * @param minecraftName The Minecraft player name. - * - * @return True if the player is online, false otherwise. - */ - private boolean isPlayerOnline(String minecraftName) { - for(Player player : Bukkit.getOnlinePlayers()) - if(player.getName().equalsIgnoreCase(minecraftName)) - return true; - return false; - } -} From 7463d123e9c2a4e96e6e461676f530f928b6f184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:54:42 +0100 Subject: [PATCH 316/427] Disabled legacy /authme command --- src/main/java/fr/xephi/authme/AuthMe.java | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 8bfe1169..4ce12c4c 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -17,6 +17,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.PluginManager; @@ -335,8 +336,9 @@ public class AuthMe extends JavaPlugin { pm.registerEvents(new AuthMeEntityListener(this), this); pm.registerEvents(new AuthMeServerListener(this), this); + // TODO: This is moving to AuthMe.onCommand(); // Register commands - getCommand("authme").setExecutor(new AdminCommand(this)); + //getCommand("authme").setExecutor(new AdminCommand(this)); getCommand("register").setExecutor(new RegisterCommand(this)); getCommand("login").setExecutor(new LoginCommand(this)); getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); @@ -825,4 +827,25 @@ public class AuthMe extends JavaPlugin { public CommandHandler getCommandHandler() { return this.commandHandler; } + + /** + * Handle Bukkit commands. + * + * @param sender The command sender (Bukkit). + * @param cmd The command (Bukkit). + * @param commandLabel The command label (Bukkit). + * @param args The command arguments (Bukkit). + * + * @return True if the command was executed, false otherwise. + */ + @Override + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + // Get the command handler, and make sure it's valid + CommandHandler commandHandler = this.getCommandHandler(); + if(commandHandler == null) + return false; + + // Handle the command, return the result + return commandHandler.onCommand(sender, cmd, commandLabel, args); + } } From 2fcb5f11837a3abd80b6ba6095d6f63b4b81f972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:58:13 +0100 Subject: [PATCH 317/427] Added plugin name and version constants, implemented these --- src/main/java/fr/xephi/authme/AuthMe.java | 26 +++++++++++++++++++ .../command/executable/AuthMeCommand.java | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 4ce12c4c..f3ff8778 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -75,6 +75,14 @@ import net.minelink.ctplus.CombatTagPlus; public class AuthMe extends JavaPlugin { + /** Defines the name of the plugin. */ + // TODO: Create a getter method for this constant, and make it private + public static final String PLUGIN_NAME = "AuthMeReloaded"; + /** Defines the current AuthMeReloaded version name. */ + private static final String PLUGIN_VERSION_NAME = "5.1-SNAPSHOT"; + /** Defines the current AuthMeReloaded version code. */ + private static final int PLUGIN_VERSION_CODE = 100; // Increase this number by one when an update is released + private static AuthMe authme; private static Server server; private Logger authmeLogger; @@ -848,4 +856,22 @@ public class AuthMe extends JavaPlugin { // Handle the command, return the result return commandHandler.onCommand(sender, cmd, commandLabel, args); } + + /** + * Get the current installed AuthMeReloaded version name. + * + * @return The version name of the currently installed AuthMeReloaded instance. + */ + public static String getVersionName() { + return PLUGIN_VERSION_NAME; + } + + /** + * Get the current installed AuthMeReloaded version code. + * + * @return The version code of the currently installed AuthMeReloaded instance. + */ + public static int getVersionCode() { + return PLUGIN_VERSION_CODE; + } } diff --git a/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java b/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java index a2b159e4..8f1edd84 100644 --- a/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java @@ -1,5 +1,6 @@ package fr.xephi.authme.command.executable; +import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import org.bukkit.ChatColor; @@ -20,7 +21,7 @@ public class AuthMeCommand extends ExecutableCommand { public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { // Show some version info // TODO: Use plugin name and version constants here! - sender.sendMessage(ChatColor.GREEN + "This server is running AuthMeReloaded v1.0! " + ChatColor.RED + "<3"); + sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.PLUGIN_NAME + " v" + AuthMe.getVersionName() + "! " + ChatColor.RED + "<3"); sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " help" + ChatColor.YELLOW + " to view help."); sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " about" + ChatColor.YELLOW + " to view about."); return true; From 53a2e8f9f0915eaf2b39d81eeea9237001b48649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:59:07 +0100 Subject: [PATCH 318/427] Implemented plugin name in help page header --- src/main/java/fr/xephi/authme/command/help/HelpProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java index 42696493..000f721e 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java @@ -95,7 +95,7 @@ public class HelpProvider { } // Print the help header - sender.sendMessage(ChatColor.GOLD + "==========[ DUNGEON MAZE HELP ]=========="); + sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.PLUGIN_NAME.toUpperCase() + " HELP ]=========="); // Print the command help information if(showCommand) From c30792f2782c24edcfce6cf51ef5b91ef9d43c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:06:36 +0100 Subject: [PATCH 319/427] Implemented version command --- .../xephi/authme/command/CommandManager.java | 8 +- .../command/executable/VersionCommand.java | 79 +++++++++++++++++++ 2 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/VersionCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 624b07e7..c735f400 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -220,7 +220,7 @@ public class CommandManager { "Show detailed information about all the Dungeon Maze serivces.", dungeonMazeCommand); serviceCommand.setMaximumArguments(false); - serviceCommand.setCommandPermissions("dungeonmaze.command.services", CommandPermissions.DefaultPermission.OP_ONLY); + serviceCommand.setCommandPermissions("dungeonmaze.command.services", CommandPermissions.DefaultPermission.OP_ONLY);*/ // Register the version command CommandDescription versionCommand = new CommandDescription( @@ -233,9 +233,9 @@ public class CommandManager { add("info"); }}, "Version info", - "Show detailed information about the installed Dungeon Maze version, and shows the developers, contributors, license and other information.", - dungeonMazeCommand); - versionCommand.setMaximumArguments(false);*/ + "Show detailed information about the installed AuthMeReloaded version, and shows the developers, contributors, license and other information.", + authMeCommand); + versionCommand.setMaximumArguments(false); // Add the base commands to the commands array this.commandDescriptions.add(authMeCommand); diff --git a/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java b/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java new file mode 100644 index 00000000..fc243c7d --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java @@ -0,0 +1,79 @@ +package fr.xephi.authme.command.executable; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class VersionCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // Show some version info + sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.PLUGIN_NAME.toUpperCase() + " ABOUT ]=========="); + sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.PLUGIN_NAME + " v" + AuthMe.getVersionName() + ChatColor.GRAY + " (code: " + AuthMe.getVersionCode() + ")"); + sender.sendMessage(ChatColor.GOLD + "Developers:"); + printDeveloper(sender, "Xephi", "xephi", "Lead Developer"); + printDeveloper(sender, "Sgdc3", "sgdc3", "Code Contributor"); + printDeveloper(sender, "Tim Visee", "timvisee", "Code Contributor"); + sender.sendMessage(ChatColor.GOLD + "Website: " + ChatColor.WHITE + "http://dev.bukkit.org/bukkit-plugins/authme-reloaded/"); + sender.sendMessage(ChatColor.GOLD + "License: " + ChatColor.WHITE + "GNU GPL v3.0" + ChatColor.GRAY + ChatColor.ITALIC + " (See LICENSE file)"); + sender.sendMessage(ChatColor.GOLD + "Copyright: " + ChatColor.WHITE + "Copyright (c) Xephi 2015. All rights reserved."); + return true; + } + + /** + * Print a developer with proper styling. + * + * @param sender The command sender. + * @param name The display name of the developer. + * @param minecraftName The Minecraft username of the developer, if available. + * @param function The function of the developer. + */ + @SuppressWarnings("StringConcatenationInsideStringBufferAppend") + private void printDeveloper(CommandSender sender, String name, String minecraftName, String function) { + // Print the name + StringBuilder msg = new StringBuilder(); + msg.append(" " + ChatColor.WHITE); + msg.append(name); + + // Append the Minecraft name, if available + if(minecraftName.length() != 0) + msg.append(ChatColor.GRAY + " // " + ChatColor.WHITE + minecraftName); + msg.append(ChatColor.GRAY + "" + ChatColor.ITALIC + " (" + function + ")"); + + // Show the online status + if(minecraftName.length() != 0) + if(isPlayerOnline(minecraftName)) + msg.append(ChatColor.GREEN + "" + ChatColor.ITALIC + " (In-Game)"); + + // Print the message + sender.sendMessage(msg.toString()); + } + + /** + * Check whether a player is online. + * + * @param minecraftName The Minecraft player name. + * + * @return True if the player is online, false otherwise. + */ + private boolean isPlayerOnline(String minecraftName) { + for(Player player : Bukkit.getOnlinePlayers()) + if(player.getName().equalsIgnoreCase(minecraftName)) + return true; + return false; + } +} From 40c7ef95e5a75d382a35098c9d7e6f2375001684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:08:23 +0100 Subject: [PATCH 320/427] Added Profiler class --- .../java/fr/xephi/authme/util/Profiler.java | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/util/Profiler.java diff --git a/src/main/java/fr/xephi/authme/util/Profiler.java b/src/main/java/fr/xephi/authme/util/Profiler.java new file mode 100644 index 00000000..04255f4a --- /dev/null +++ b/src/main/java/fr/xephi/authme/util/Profiler.java @@ -0,0 +1,132 @@ +package fr.xephi.authme.util; + +import java.text.DecimalFormat; + +@SuppressWarnings("UnusedDeclaration") +public class Profiler { + + /** Defines the past time in milliseconds. */ + private long time = 0; + /** Defines the time in milliseconds the profiler last started at. */ + private long start = -1; + + /** + * Constructor. This won't start the profiler immediately. + */ + public Profiler() { + this(false); + } + + /** + * Constructor. + * + * @param start True to immediately start the profiler. + */ + public Profiler(boolean start) { + // Should the timer be started + if(start) + start(); + } + + /** + * Start the profiler. + * + * @return True if the profiler was started, false otherwise possibly due to an error. + * True will also be returned if the profiler was started already. + */ + public boolean start() { + // Make sure the timer isn't started already + if(isActive()) + return true; + + // Set the start time + this.start = System.currentTimeMillis(); + return true; + } + + /** + * This will start the profiler if it's not active, or will stop the profiler if it's currently active. + * + * @return True if the profiler has been started, false if the profiler has been stopped. + */ + public boolean pause() { + // Toggle the profiler state + if(isStarted()) + stop(); + else + start(); + + // Return the result + return isStarted(); + } + + /** + * Stop the profiler if it's active. + * + * @return True will be returned if the profiler was stopped while it was active. False will be returned if the + * profiler was stopped already. + */ + public boolean stop() { + // Make sure the profiler is active + if(!isActive()) + return false; + + // Stop the profiler, calculate the passed time + this.time += System.currentTimeMillis() - this.start; + this.start = -1; + return true; + } + + /** + * Check whether the profiler has been started. The profiler doesn't need to be active right now. + * + * @return True if the profiler was started, false otherwise. + */ + public boolean isStarted() { + return isActive() || this.time > 0; + } + + /** + * Check whether the profiler is currently active. + * + * @return True if the profiler is active, false otherwise. + */ + public boolean isActive() { + return this.start >= 0; + } + + /** + * Get the passed time in milliseconds. + * + * @return The passed time in milliseconds. + */ + public long getTime() { + // Check whether the profiler is currently active + if(isActive()) + return this.time + (System.currentTimeMillis() - this.start); + return this.time; + } + + /** + * Get the passed time in a formatted string. + * + * @return The passed time in a formatted string. + */ + public String getTimeFormatted() { + // Get the passed time + long time = getTime(); + + // Return the time if it's less than one millisecond + if(time <= 0) + return "<1 ms"; + + // Return the time in milliseconds + if(time < 1000) + return time + " ms"; + + // Convert the time into seconds with a single decimal + double timeSeconds = ((double) time) / 1000; + DecimalFormat df = new DecimalFormat("#0.0"); + return df.format(timeSeconds) + " s"; + } +} From 0781bc16d12a4628b8429dc517f27dd3a0ceab17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:12:50 +0100 Subject: [PATCH 321/427] Implemented reload command --- .../xephi/authme/command/CommandManager.java | 13 ++--- .../command/executable/ReloadCommand.java | 55 +++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index c735f400..12bb42d2 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -121,7 +121,7 @@ public class CommandManager { "List Dungeon Mazes", "Lists the available Dungeon Maze worlds and shows some additional information.", dungeonMazeCommand); - listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY); + listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY);*/ // Register the reload command CommandDescription reloadCommand = new CommandDescription( @@ -131,13 +131,12 @@ public class CommandManager { add("rld"); add("r"); }}, - "Reload Dungeon Maze", - "Reload the Dungeon Maze plugin.", - dungeonMazeCommand); - reloadCommand.setCommandPermissions("dungeonmaze.command.reload", CommandPermissions.DefaultPermission.OP_ONLY); - reloadCommand.addArgument(new CommandArgumentDescription("force", "True or False to force reload.", true)); + "Reload AuthMeReloaded", + "Reload the AuthMeReloaded plugin.", + authMeCommand); + reloadCommand.setCommandPermissions("authme.admin.reload", CommandPermissions.DefaultPermission.OP_ONLY); - // Register the reload permissions command + /* // Register the reload permissions command CommandDescription reloadPermissionsCommand = new CommandDescription( new ReloadPermissionsCommand(), new ArrayList() {{ diff --git a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java new file mode 100644 index 00000000..da0e6dfa --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java @@ -0,0 +1,55 @@ +package fr.xephi.authme.command.executable; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; + +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Profiler; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + +public class ReloadCommand extends ExecutableCommand { + + /** AuthMe plugin instance. */ + private AuthMe plugin = AuthMe.getInstance(); + /** Messages instance. */ + private Messages m = Messages.getInstance(); + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // Profile the reload process + Profiler p = new Profiler(true); + + // Show a status message + sender.sendMessage(ChatColor.YELLOW + "Reloading Dungeon Maze..."); + + try { + Settings.reload(); + plugin.getModuleManager().reloadModules(); + m.reloadMessages(); + plugin.setupDatabase(); + } catch (Exception e) { + ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); + ConsoleLogger.writeStackTrace(e); + plugin.stopOrUnload(); + return false; + } + m.send(sender, "reload"); + + // Dungeon Maze reloaded, show a status message + sender.sendMessage(ChatColor.GREEN + "Dungeon Maze has been reloaded successfully, took " + p.getTimeFormatted() + "!"); + return true; + } +} From d583a3f339aaa6666ab9baa2483a28350d2130f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:19:50 +0100 Subject: [PATCH 322/427] Improved reload command --- .../command/executable/ReloadCommand.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java index da0e6dfa..427998b4 100644 --- a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java @@ -8,16 +8,11 @@ import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.Profiler; -import org.bukkit.ChatColor; +//import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; public class ReloadCommand extends ExecutableCommand { - /** AuthMe plugin instance. */ - private AuthMe plugin = AuthMe.getInstance(); - /** Messages instance. */ - private Messages m = Messages.getInstance(); - /** * Execute the command. * @@ -32,13 +27,18 @@ public class ReloadCommand extends ExecutableCommand { // Profile the reload process Profiler p = new Profiler(true); + // AuthMe plugin instance + AuthMe plugin = AuthMe.getInstance(); + // Messages instance + Messages m = Messages.getInstance(); + // Show a status message - sender.sendMessage(ChatColor.YELLOW + "Reloading Dungeon Maze..."); + //sender.sendMessage(ChatColor.YELLOW + "Reloading AuthMeReloaded..."); try { Settings.reload(); plugin.getModuleManager().reloadModules(); - m.reloadMessages(); + Messages.getInstance().reloadMessages(); plugin.setupDatabase(); } catch (Exception e) { ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); @@ -46,10 +46,12 @@ public class ReloadCommand extends ExecutableCommand { plugin.stopOrUnload(); return false; } + + // Show a status message m.send(sender, "reload"); - // Dungeon Maze reloaded, show a status message - sender.sendMessage(ChatColor.GREEN + "Dungeon Maze has been reloaded successfully, took " + p.getTimeFormatted() + "!"); + // AuthMeReloaded reloaded, show a status message + //sender.sendMessage(ChatColor.GREEN + "AuthMeReloaded has been reloaded successfully, took " + p.getTimeFormatted() + "!"); return true; } } From 085f19355d2169b0c1eca393f4c65896389c6a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:31:22 +0100 Subject: [PATCH 323/427] Improved grammar in reload command --- .../java/fr/xephi/authme/command/executable/ReloadCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java index 427998b4..e646ccf7 100644 --- a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java @@ -41,7 +41,7 @@ public class ReloadCommand extends ExecutableCommand { Messages.getInstance().reloadMessages(); plugin.setupDatabase(); } catch (Exception e) { - ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); + ConsoleLogger.showError("Fatal error occurred! AuthMe instance ABORTED!"); ConsoleLogger.writeStackTrace(e); plugin.stopOrUnload(); return false; From 1a62cecd58d72476212ca2ac7fc0676903134b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:34:35 +0100 Subject: [PATCH 324/427] Implemented the purge command --- .../xephi/authme/command/CommandManager.java | 13 ++++ .../command/executable/PurgeCommand.java | 72 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/PurgeCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 12bb42d2..93bd6606 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -123,6 +123,19 @@ public class CommandManager { dungeonMazeCommand); listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY);*/ + // Register the purge command + CommandDescription purgeCommand = new CommandDescription( + new ReloadCommand(), + new ArrayList() {{ + add("purge"); + add("delete"); + }}, + "Purge AuthMeReloaded data", + "Purge old AuthMeReloaded data longer than the specified amount of days ago.", + authMeCommand); + purgeCommand.setCommandPermissions("authme.admin.purge", CommandPermissions.DefaultPermission.OP_ONLY); + purgeCommand.addArgument(new CommandArgumentDescription("days", "Number of days", false)); + // Register the reload command CommandDescription reloadCommand = new CommandDescription( new ReloadCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/PurgeCommand.java b/src/main/java/fr/xephi/authme/command/executable/PurgeCommand.java new file mode 100644 index 00000000..3dbca4eb --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/PurgeCommand.java @@ -0,0 +1,72 @@ +package fr.xephi.authme.command.executable; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Settings; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + +import java.util.Calendar; +import java.util.List; + +public class PurgeCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + AuthMe plugin = AuthMe.getInstance(); + + // Get the days parameter + String daysStr = commandArguments.get(0); + + // Convert the days string to an integer value, and make sure it's valid + int days; + try { + days = Integer.valueOf(daysStr); + } catch(Exception ex) { + sender.sendMessage(ChatColor.RED + "The value you've entered is invalid!"); + return true; + } + + // Validate the value + if(days < 30) { + sender.sendMessage(ChatColor.RED + "You can only purge data older than 30 days"); + return true; + } + + // Create a calender instance to determine the date + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -days); + long until = calendar.getTimeInMillis(); + + // Purge the data, get the purged values + List purged = plugin.database.autoPurgeDatabase(until); + + // Show a status message + sender.sendMessage(ChatColor.GOLD + "Deleted " + purged.size() + " user accounts"); + + // Purge other data + if(Settings.purgeEssentialsFile && plugin.ess != null) + plugin.dataManager.purgeEssentials(purged); + if(Settings.purgePlayerDat) + plugin.dataManager.purgeDat(purged); + if(Settings.purgeLimitedCreative) + plugin.dataManager.purgeLimitedCreative(purged); + if(Settings.purgeAntiXray) + plugin.dataManager.purgeAntiXray(purged); + + // Show a status message + sender.sendMessage(ChatColor.GREEN + "[AuthMe] Database has been purged correctly"); + return true; + } +} From a2e33402f9ff45c0c258f1596cc385add27fb205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:37:40 +0100 Subject: [PATCH 325/427] Fixed invalid command reference --- src/main/java/fr/xephi/authme/command/CommandManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 93bd6606..715c3637 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -125,7 +125,7 @@ public class CommandManager { // Register the purge command CommandDescription purgeCommand = new CommandDescription( - new ReloadCommand(), + new PurgeCommand(), new ArrayList() {{ add("purge"); add("delete"); From 39d6fdd05d058bfcde182b5929d80566ba4c38cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:42:46 +0100 Subject: [PATCH 326/427] Implemented lastlogin command --- .../xephi/authme/command/CommandManager.java | 13 ++++ .../command/executable/LastLoginCommand.java | 74 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 715c3637..1a62a036 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -123,6 +123,19 @@ public class CommandManager { dungeonMazeCommand); listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY);*/ + // Register the purge command + CommandDescription lastLoginCommand = new CommandDescription( + new LastLoginCommand(), + new ArrayList() {{ + add("lastlogin"); + add("ll"); + }}, + "Player's last login", + "View the date of the specified players last login", + authMeCommand); + lastLoginCommand.setCommandPermissions("authme.admin.lastlogin", CommandPermissions.DefaultPermission.OP_ONLY); + lastLoginCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); + // Register the purge command CommandDescription purgeCommand = new CommandDescription( new PurgeCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java new file mode 100644 index 00000000..cc184cbb --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java @@ -0,0 +1,74 @@ +package fr.xephi.authme.command.executable; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Profiler; +import org.bukkit.command.CommandSender; + +//import org.bukkit.ChatColor; +import java.util.Date; + +public class LastLoginCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // Profile the reload process + Profiler p = new Profiler(true); + + // AuthMe plugin instance + AuthMe plugin = AuthMe.getInstance(); + // Messages instance + Messages m = Messages.getInstance(); + + // Get the player + String playerName = sender.getName(); + if(commandArguments.getCount() >= 1) + playerName = commandArguments.get(0); + + // Validate the player + PlayerAuth auth; + try { + auth = plugin.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; + } + + // Get the last login date + long lastLogin = auth.getLastLogin(); + Date date = new Date(lastLogin); + + // Get the difference + final long diff = System.currentTimeMillis() - lastLogin; + + // Build the message + final String msg = (int) (diff / 86400000) + " days " + (int) (diff / 3600000 % 24) + " hours " + (int) (diff / 60000 % 60) + " mins " + (int) (diff / 1000 % 60) + " secs."; + + // Get the player's last IP + String lastIP = auth.getIp(); + + // Show the player status + sender.sendMessage("[AuthMe] " + args[1] + " last login : " + date.toString()); + sender.sendMessage("[AuthMe] The player " + auth.getNickname() + " is unlogged since " + msg); + sender.sendMessage("[AuthMe] Last Player's IP: " + lastIP); + return true; + } +} From 1fd64bc0659dc92a26709a17bf102d7234a96edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:43:10 +0100 Subject: [PATCH 327/427] Fixed issue, removed unused imports --- .../xephi/authme/command/executable/LastLoginCommand.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java index cc184cbb..def95148 100644 --- a/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java @@ -1,16 +1,13 @@ package fr.xephi.authme.command.executable; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.Profiler; import org.bukkit.command.CommandSender; -//import org.bukkit.ChatColor; import java.util.Date; public class LastLoginCommand extends ExecutableCommand { @@ -42,7 +39,7 @@ public class LastLoginCommand extends ExecutableCommand { // Validate the player PlayerAuth auth; try { - auth = plugin.database.getAuth(args[1].toLowerCase()); + auth = plugin.database.getAuth(playerName.toLowerCase()); } catch (NullPointerException e) { m.send(sender, "unknown_user"); return true; @@ -66,7 +63,7 @@ public class LastLoginCommand extends ExecutableCommand { String lastIP = auth.getIp(); // Show the player status - sender.sendMessage("[AuthMe] " + args[1] + " last login : " + date.toString()); + sender.sendMessage("[AuthMe] " + playerName + " last login : " + date.toString()); sender.sendMessage("[AuthMe] The player " + auth.getNickname() + " is unlogged since " + msg); sender.sendMessage("[AuthMe] Last Player's IP: " + lastIP); return true; From 4ae5b0be1e86fadcdeba8493f6e3cf16accc9775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:44:34 +0100 Subject: [PATCH 328/427] Removed unused code --- .../fr/xephi/authme/command/executable/LastLoginCommand.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java index def95148..749ec34c 100644 --- a/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java @@ -5,7 +5,6 @@ import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.util.Profiler; import org.bukkit.command.CommandSender; import java.util.Date; @@ -23,9 +22,6 @@ public class LastLoginCommand extends ExecutableCommand { */ @Override public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { - // Profile the reload process - Profiler p = new Profiler(true); - // AuthMe plugin instance AuthMe plugin = AuthMe.getInstance(); // Messages instance From 9e65eaa0485c5c09418fcf60310844f56e4c077a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:50:06 +0100 Subject: [PATCH 329/427] Implemented accounts command --- .../xephi/authme/command/CommandManager.java | 13 +++ .../command/executable/AccountsCommand.java | 110 ++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/AccountsCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 1a62a036..2b6740a5 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -136,6 +136,19 @@ public class CommandManager { lastLoginCommand.setCommandPermissions("authme.admin.lastlogin", CommandPermissions.DefaultPermission.OP_ONLY); lastLoginCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); + // Register the accounts command + CommandDescription accountsCommand = new CommandDescription( + new AccountsCommand(), + new ArrayList() {{ + add("accounts"); + add("account"); + }}, + "Display player accounts", + "Display all accounts of a player by it's player name or IP.", + authMeCommand); + accountsCommand.setCommandPermissions("authme.admin.accounts", CommandPermissions.DefaultPermission.OP_ONLY); + accountsCommand.addArgument(new CommandArgumentDescription("player", "Player name or IP", true)); + // Register the purge command CommandDescription purgeCommand = new CommandDescription( new PurgeCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/AccountsCommand.java b/src/main/java/fr/xephi/authme/command/executable/AccountsCommand.java new file mode 100644 index 00000000..9bace568 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/AccountsCommand.java @@ -0,0 +1,110 @@ +package fr.xephi.authme.command.executable; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + +import java.util.List; + +public class AccountsCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the player query + String playerQuery = sender.getName(); + if(commandArguments.getCount() >= 1) + playerQuery = commandArguments.get(0); + final String playerQueryFinal = playerQuery; + + // Command logic + if (!playerQuery.contains(".")) { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + + @Override + public void run() { + PlayerAuth auth; + StringBuilder message = new StringBuilder("[AuthMe] "); + try { + auth = plugin.database.getAuth(playerQueryFinal.toLowerCase()); + } catch (NullPointerException npe) { + m.send(sender, "unknown_user"); + return; + } + if (auth == null) { + m.send(sender, "unknown_user"); + return; + } + List accountList = plugin.database.getAllAuthsByName(auth); + if (accountList == null || accountList.isEmpty()) { + m.send(sender, "user_unknown"); + return; + } + if (accountList.size() == 1) { + sender.sendMessage("[AuthMe] " + playerQueryFinal + " is a single account player"); + return; + } + int i = 0; + for (String account : accountList) { + i++; + message.append(account); + if (i != accountList.size()) { + message.append(", "); + } else { + message.append("."); + } + } + sender.sendMessage("[AuthMe] " + playerQueryFinal + " has " + String.valueOf(accountList.size()) + " accounts"); + sender.sendMessage(message.toString()); + } + }); + return true; + } else { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override + public void run() { + StringBuilder message = new StringBuilder("[AuthMe] "); + List accountList = plugin.database.getAllAuthsByIp(playerQueryFinal); + if (accountList == null || accountList.isEmpty()) { + sender.sendMessage("[AuthMe] This IP does not exist in the database"); + return; + } + if (accountList.size() == 1) { + sender.sendMessage("[AuthMe] " + playerQueryFinal + " is a single account player"); + return; + } + int i = 0; + for (String account : accountList) { + i++; + message.append(account); + if (i != accountList.size()) { + message.append(", "); + } else { + message.append("."); + } + } + sender.sendMessage("[AuthMe] " + playerQueryFinal + " has " + String.valueOf(accountList.size()) + " accounts"); + sender.sendMessage(message.toString()); + } + }); + return true; + } + } +} From 93e9ef18d260eb5175aacbf51d37c0ad8e592af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:51:29 +0100 Subject: [PATCH 330/427] Organized executable commands package --- src/main/java/fr/xephi/authme/command/CommandManager.java | 1 + .../authme/command/executable/{ => authme}/AccountsCommand.java | 2 +- .../authme/command/executable/{ => authme}/HelpCommand.java | 2 +- .../command/executable/{ => authme}/LastLoginCommand.java | 2 +- .../authme/command/executable/{ => authme}/PurgeCommand.java | 2 +- .../authme/command/executable/{ => authme}/ReloadCommand.java | 2 +- .../authme/command/executable/{ => authme}/VersionCommand.java | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) rename src/main/java/fr/xephi/authme/command/executable/{ => authme}/AccountsCommand.java (98%) rename src/main/java/fr/xephi/authme/command/executable/{ => authme}/HelpCommand.java (96%) rename src/main/java/fr/xephi/authme/command/executable/{ => authme}/LastLoginCommand.java (97%) rename src/main/java/fr/xephi/authme/command/executable/{ => authme}/PurgeCommand.java (97%) rename src/main/java/fr/xephi/authme/command/executable/{ => authme}/ReloadCommand.java (97%) rename src/main/java/fr/xephi/authme/command/executable/{ => authme}/VersionCommand.java (98%) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 2b6740a5..20086600 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -1,6 +1,7 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.*; +import fr.xephi.authme.command.executable.authme.*; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/fr/xephi/authme/command/executable/AccountsCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java similarity index 98% rename from src/main/java/fr/xephi/authme/command/executable/AccountsCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java index 9bace568..3634d3f7 100644 --- a/src/main/java/fr/xephi/authme/command/executable/AccountsCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; diff --git a/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/HelpCommand.java similarity index 96% rename from src/main/java/fr/xephi/authme/command/executable/HelpCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/HelpCommand.java index 3ddcb5a5..b892b7fe 100644 --- a/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/HelpCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; diff --git a/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java similarity index 97% rename from src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java index 749ec34c..6218ad0d 100644 --- a/src/main/java/fr/xephi/authme/command/executable/LastLoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; diff --git a/src/main/java/fr/xephi/authme/command/executable/PurgeCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeCommand.java similarity index 97% rename from src/main/java/fr/xephi/authme/command/executable/PurgeCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/PurgeCommand.java index 3dbca4eb..d207d34e 100644 --- a/src/main/java/fr/xephi/authme/command/executable/PurgeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; diff --git a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java similarity index 97% rename from src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java index e646ccf7..4364e928 100644 --- a/src/main/java/fr/xephi/authme/command/executable/ReloadCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; diff --git a/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java similarity index 98% rename from src/main/java/fr/xephi/authme/command/executable/VersionCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java index fc243c7d..aaa823f4 100644 --- a/src/main/java/fr/xephi/authme/command/executable/VersionCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; From 89c3c6ed5bd9d1ba326e717b6140c07b984b3178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 17:56:10 +0100 Subject: [PATCH 331/427] Implemented register command --- .../xephi/authme/command/CommandManager.java | 14 +++ .../executable/authme/RegisterCommand.java | 91 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 20086600..878ed7e0 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -124,6 +124,20 @@ public class CommandManager { dungeonMazeCommand); listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY);*/ + // Register the register command + CommandDescription registerCommand = new CommandDescription( + new RegisterCommand(), + new ArrayList() {{ + add("register"); + add("reg"); + }}, + "Register a player", + "Register the specified player with the specified password.", + authMeCommand); + registerCommand.setCommandPermissions("authme.admin.register", CommandPermissions.DefaultPermission.OP_ONLY); + registerCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); + registerCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); + // Register the purge command CommandDescription lastLoginCommand = new CommandDescription( new LastLoginCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java new file mode 100644 index 00000000..ee4d8494 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java @@ -0,0 +1,91 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.security.PasswordSecurity; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + +import java.security.NoSuchAlgorithmException; + +public class RegisterCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the player name and password + final String playerName = commandArguments.get(0); + final String playerPass = commandArguments.get(1); + final String playerNameLowerCase = playerName.toLowerCase(); + final String playerPassLowerCase = playerPass.toLowerCase(); + + // Command logic + if (playerPassLowerCase.contains("delete") || playerPassLowerCase.contains("where") || playerPassLowerCase.contains("insert") || playerPassLowerCase.contains("modify") || playerPassLowerCase.contains("from") || playerPassLowerCase.contains("select") || playerPassLowerCase.contains(";") || playerPassLowerCase.contains("null") || !playerPassLowerCase.matches(Settings.getPassRegex)) { + m.send(sender, "password_error"); + return true; + } + if (playerPassLowerCase.equalsIgnoreCase(playerName)) { + m.send(sender, "password_error_nick"); + return true; + } + if (playerPassLowerCase.length() < Settings.getPasswordMinLen || playerPassLowerCase.length() > Settings.passwordMaxLength) { + m.send(sender, "pass_len"); + return true; + } + if (!Settings.unsafePasswords.isEmpty()) { + if (Settings.unsafePasswords.contains(playerPassLowerCase)) { + m.send(sender, "password_error_unsafe"); + return true; + } + } + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @SuppressWarnings("deprecation") + @Override + public void run() { + try { + if (plugin.database.isAuthAvailable(playerNameLowerCase)) { + m.send(sender, "user_regged"); + return; + } + String hash = PasswordSecurity.getHash(Settings.getPasswordHash, playerPassLowerCase, playerNameLowerCase); + PlayerAuth auth = new PlayerAuth(playerNameLowerCase, hash, "192.168.0.1", 0L, "your@email.com", playerName); + if (PasswordSecurity.userSalt.containsKey(playerNameLowerCase) && PasswordSecurity.userSalt.get(playerNameLowerCase) != null) + auth.setSalt(PasswordSecurity.userSalt.get(playerNameLowerCase)); + else auth.setSalt(""); + if (!plugin.database.saveAuth(auth)) { + m.send(sender, "error"); + return; + } + plugin.database.setUnlogged(playerNameLowerCase); + if (Bukkit.getPlayerExact(playerName) != null) + Bukkit.getPlayerExact(playerName).kickPlayer("An admin just registered you, please log again"); + m.send(sender, "registered"); + ConsoleLogger.info(playerNameLowerCase + " registered"); + } catch (NoSuchAlgorithmException ex) { + ConsoleLogger.showError(ex.getMessage()); + m.send(sender, "error"); + } + + } + }); + return true; + } +} From 19f4af3e8554f975392e7e78d1d3a62da5b3cce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:02:26 +0100 Subject: [PATCH 332/427] Implemented getemail command Various other improvements. --- .../xephi/authme/command/CommandManager.java | 15 +++++++ .../executable/authme/AccountsCommand.java | 1 + .../executable/authme/GetEmailCommand.java | 45 +++++++++++++++++++ .../executable/authme/LastLoginCommand.java | 1 + .../executable/authme/RegisterCommand.java | 1 + .../executable/authme/ReloadCommand.java | 1 + 6 files changed, 64 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 878ed7e0..bba25bcd 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -164,6 +164,21 @@ public class CommandManager { accountsCommand.setCommandPermissions("authme.admin.accounts", CommandPermissions.DefaultPermission.OP_ONLY); accountsCommand.addArgument(new CommandArgumentDescription("player", "Player name or IP", true)); + // Register the getemail command + CommandDescription getEmailCommand = new CommandDescription( + new RegisterCommand(), + new ArrayList() {{ + add("getemail"); + add("getmail"); + add("email"); + add("mail"); + }}, + "Display player's email", + "Display the email address of the specified player if set.", + authMeCommand); + getEmailCommand.setCommandPermissions("authme.admin.getemail", CommandPermissions.DefaultPermission.OP_ONLY); + getEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); + // Register the purge command CommandDescription purgeCommand = new CommandDescription( new PurgeCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java index 3634d3f7..fddf078a 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java @@ -25,6 +25,7 @@ public class AccountsCommand extends ExecutableCommand { public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { // AuthMe plugin instance final AuthMe plugin = AuthMe.getInstance(); + // Messages instance final Messages m = Messages.getInstance(); diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java new file mode 100644 index 00000000..76d5423c --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java @@ -0,0 +1,45 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import org.bukkit.command.CommandSender; + +public class GetEmailCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + Messages m = Messages.getInstance(); + + // Get the player name + String playerName = sender.getName(); + if(commandArguments.getCount() >= 1) + playerName = commandArguments.get(0); + + // Get the authenticated user + PlayerAuth auth = plugin.database.getAuth(playerName.toLowerCase()); + if (auth == null) { + m.send(sender, "unknown_user"); + return true; + } + + // Show the email address + sender.sendMessage("[AuthMe] " + playerName + "'s email: " + auth.getEmail()); + return true; + } +} diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java index 6218ad0d..121a4c15 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java @@ -24,6 +24,7 @@ public class LastLoginCommand extends ExecutableCommand { public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { // AuthMe plugin instance AuthMe plugin = AuthMe.getInstance(); + // Messages instance Messages m = Messages.getInstance(); diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java index ee4d8494..782cc787 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java @@ -28,6 +28,7 @@ public class RegisterCommand extends ExecutableCommand { public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { // AuthMe plugin instance final AuthMe plugin = AuthMe.getInstance(); + // Messages instance final Messages m = Messages.getInstance(); diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java index 4364e928..1d1dea02 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java @@ -29,6 +29,7 @@ public class ReloadCommand extends ExecutableCommand { // AuthMe plugin instance AuthMe plugin = AuthMe.getInstance(); + // Messages instance Messages m = Messages.getInstance(); From bc0f1b4bb980140205fa77020775df1980c35a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:06:09 +0100 Subject: [PATCH 333/427] Implemented the setmail command --- .../xephi/authme/command/CommandManager.java | 18 +++++- .../executable/authme/SetEmailCommand.java | 63 +++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index bba25bcd..404810c8 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -166,7 +166,7 @@ public class CommandManager { // Register the getemail command CommandDescription getEmailCommand = new CommandDescription( - new RegisterCommand(), + new GetEmailCommand(), new ArrayList() {{ add("getemail"); add("getmail"); @@ -179,6 +179,22 @@ public class CommandManager { getEmailCommand.setCommandPermissions("authme.admin.getemail", CommandPermissions.DefaultPermission.OP_ONLY); getEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); + // Register the setemail command + CommandDescription setEmailCommand = new CommandDescription( + new SetEmailCommand(), + new ArrayList() {{ + add("chgemail"); + add("chgmail"); + add("setemail"); + add("setmail"); + }}, + "Change player's email", + "Change the email address of the specified player.", + authMeCommand); + setEmailCommand.setCommandPermissions("authme.admin.chgemail", CommandPermissions.DefaultPermission.OP_ONLY); + setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); + setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false)); + // Register the purge command CommandDescription purgeCommand = new CommandDescription( new PurgeCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java new file mode 100644 index 00000000..ffe8d950 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java @@ -0,0 +1,63 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; + +public class SetEmailCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + Messages m = Messages.getInstance(); + + // Get the player name and email address + String playerName = commandArguments.get(0); + String playerEmail = commandArguments.get(1); + + // Validate the email address + if (!Settings.isEmailCorrect(playerEmail)) { + m.send(sender, "email_invalid"); + return true; + } + + // Validate the user + PlayerAuth auth = plugin.database.getAuth(playerName.toLowerCase()); + if (auth == null) { + m.send(sender, "unknown_user"); + return true; + } + + // Set the email address + auth.setEmail(playerEmail); + if (!plugin.database.updateEmail(auth)) { + m.send(sender, "error"); + return true; + } + + // Update the player cache + if (PlayerCache.getInstance().getAuth(playerName.toLowerCase()) != null) + PlayerCache.getInstance().updatePlayer(auth); + + // Show a status message + m.send(sender, "email_changed"); + return true; + } +} From 79dd26da0f55d9af05c0d9f021d48e09944e199a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:10:24 +0100 Subject: [PATCH 334/427] Implemented the setspawn command --- .../xephi/authme/command/CommandManager.java | 12 ++++++ .../executable/authme/SetSpawnCommand.java | 39 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 404810c8..39776fe8 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -195,6 +195,18 @@ public class CommandManager { setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false)); + // Register the setspawn command + CommandDescription setSpawnCommand = new CommandDescription( + new SetSpawnCommand(), + new ArrayList() {{ + add("setspawn"); + add("chgspawn"); + }}, + "Change the spawn", + "Change the player's spawn to your current position.", + authMeCommand); + setSpawnCommand.setCommandPermissions("authme.admin.setspawn", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the purge command CommandDescription purgeCommand = new CommandDescription( new PurgeCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java new file mode 100644 index 00000000..ada37f41 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java @@ -0,0 +1,39 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Spawn; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class SetSpawnCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // Make sure the command executor is a player + try { + if (sender instanceof Player) { + 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"); + } + } catch (NullPointerException ex) { + ConsoleLogger.showError(ex.getMessage()); + } + return true; + } +} From ff909d0c3117369e86b9c7c5c493d0daff1125c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:12:15 +0100 Subject: [PATCH 335/427] Implemented the setfirstspawn command --- .../xephi/authme/command/CommandManager.java | 12 +++++++ .../authme/SetFirstSpawnCommand.java | 36 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 39776fe8..19545c34 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -207,6 +207,18 @@ public class CommandManager { authMeCommand); setSpawnCommand.setCommandPermissions("authme.admin.setspawn", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the setfirstspawn command + CommandDescription setFirstSpawnCommand = new CommandDescription( + new SetFirstSpawnCommand(), + new ArrayList() {{ + add("setfirstspawn"); + add("chgfirstspawn"); + }}, + "Change the first spawn", + "Change the first player's spawn to your current position.", + authMeCommand); + setFirstSpawnCommand.setCommandPermissions("authme.admin.setfirstspawn", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the purge command CommandDescription purgeCommand = new CommandDescription( new PurgeCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java new file mode 100644 index 00000000..c51aa6f7 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java @@ -0,0 +1,36 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Spawn; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class SetFirstSpawnCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + try { + if (sender instanceof Player) { + if (Spawn.getInstance().setFirstSpawn(((Player) sender).getLocation())) + 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"); + } + } catch (NullPointerException ex) { + ConsoleLogger.showError(ex.getMessage()); + } + return true; + } +} From 17c103a7b2054b1d4ea8160084423f5d493517c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:13:36 +0100 Subject: [PATCH 336/427] Changed some command descriptions --- src/main/java/fr/xephi/authme/command/CommandManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 19545c34..d08fe26b 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -226,7 +226,7 @@ public class CommandManager { add("purge"); add("delete"); }}, - "Purge AuthMeReloaded data", + "Purge old data", "Purge old AuthMeReloaded data longer than the specified amount of days ago.", authMeCommand); purgeCommand.setCommandPermissions("authme.admin.purge", CommandPermissions.DefaultPermission.OP_ONLY); @@ -240,7 +240,7 @@ public class CommandManager { add("rld"); add("r"); }}, - "Reload AuthMeReloaded", + "Reload plugin", "Reload the AuthMeReloaded plugin.", authMeCommand); reloadCommand.setCommandPermissions("authme.admin.reload", CommandPermissions.DefaultPermission.OP_ONLY); From 4ff8cb8c5999de179a24c785887c6ff25df13803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:17:13 +0100 Subject: [PATCH 337/427] Implemented the purgebannedplayers command --- .../xephi/authme/command/CommandManager.java | 14 ++++++ .../authme/PurgeBannedPlayersCommand.java | 50 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index d08fe26b..bf1d10b6 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -232,6 +232,20 @@ public class CommandManager { purgeCommand.setCommandPermissions("authme.admin.purge", CommandPermissions.DefaultPermission.OP_ONLY); purgeCommand.addArgument(new CommandArgumentDescription("days", "Number of days", false)); + // Register the purgebannedplayers command + CommandDescription purgeBannedPlayersCommand = new CommandDescription( + new PurgeBannedPlayersCommand(), + new ArrayList() {{ + add("purgebannedplayers"); + add("purgebannedplayer"); + add("deletebannedplayers"); + add("deletebannedplayer"); + }}, + "Purge banned palyers data", + "Purge all AuthMeReloaded data for banned players.", + authMeCommand); + purgeBannedPlayersCommand.setCommandPermissions("authme.admin.purgebannedplayers", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the reload command CommandDescription reloadCommand = new CommandDescription( new ReloadCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java new file mode 100644 index 00000000..32c2937c --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java @@ -0,0 +1,50 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Settings; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import java.util.ArrayList; +import java.util.List; + +public class PurgeBannedPlayersCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Get the list of banned players + List bannedPlayers = new ArrayList<>(); + for (OfflinePlayer offlinePlayer : plugin.getServer().getBannedPlayers()) { + bannedPlayers.add(offlinePlayer.getName().toLowerCase()); + } + + // Purge the banned players + plugin.database.purgeBanned(bannedPlayers); + if (Settings.purgeEssentialsFile && plugin.ess != null) + plugin.dataManager.purgeEssentials(bannedPlayers); + if (Settings.purgePlayerDat) + plugin.dataManager.purgeDat(bannedPlayers); + if (Settings.purgeLimitedCreative) + plugin.dataManager.purgeLimitedCreative(bannedPlayers); + if (Settings.purgeAntiXray) + plugin.dataManager.purgeAntiXray(bannedPlayers); + + // Show a status message + sender.sendMessage("[AuthMe] Database has been purged correctly"); + return true; + } +} From c9eef4f1745f6f4e4570491b59e3f16910617336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:19:36 +0100 Subject: [PATCH 338/427] Implemented the spawn command --- .../xephi/authme/command/CommandManager.java | 12 ++++++ .../executable/authme/SpawnCommand.java | 37 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index bf1d10b6..5d48133d 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -195,6 +195,18 @@ public class CommandManager { setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false)); + // Register the spawn command + CommandDescription spawnCommand = new CommandDescription( + new SpawnCommand(), + new ArrayList() {{ + add("spawn"); + add("home"); + }}, + "Teleport to spawn", + "Teleport to the spawn.", + authMeCommand); + spawnCommand.setCommandPermissions("authme.admin.spawn", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the setspawn command CommandDescription setSpawnCommand = new CommandDescription( new SetSpawnCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java new file mode 100644 index 00000000..4e68fb9f --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java @@ -0,0 +1,37 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Spawn; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class SpawnCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // Make sure the command executor is a player + try { + if (sender instanceof Player) { + if (Spawn.getInstance().getSpawn() != null) + ((Player) sender).teleport(Spawn.getInstance().getSpawn()); + else sender.sendMessage("[AuthMe] Spawn has failed, please try to define the spawn"); + } else { + sender.sendMessage("[AuthMe] Please use that command in game"); + } + } catch (NullPointerException ex) { + ConsoleLogger.showError(ex.getMessage()); + } + return true; + } +} From 8ead129423add129a39aac5fabc37aadb3655475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:23:03 +0100 Subject: [PATCH 339/427] Implemented the firstspawn command --- .../xephi/authme/command/CommandManager.java | 12 ++++++ .../executable/authme/FirstSpawnCommand.java | 37 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 5d48133d..02e77267 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -219,6 +219,18 @@ public class CommandManager { authMeCommand); setSpawnCommand.setCommandPermissions("authme.admin.setspawn", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the firstspawn command + CommandDescription firstSpawnCommand = new CommandDescription( + new FirstSpawnCommand(), + new ArrayList() {{ + add("firstspawn"); + add("firsthome"); + }}, + "Teleport to first spawn", + "Teleport to the first spawn.", + authMeCommand); + firstSpawnCommand.setCommandPermissions("authme.admin.firstspawn", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the setfirstspawn command CommandDescription setFirstSpawnCommand = new CommandDescription( new SetFirstSpawnCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java new file mode 100644 index 00000000..4cf5789d --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java @@ -0,0 +1,37 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Spawn; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FirstSpawnCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // Make sure the command executor is a player + try { + if (sender instanceof Player) { + if (Spawn.getInstance().getFirstSpawn() != null) + ((Player) sender).teleport(Spawn.getInstance().getFirstSpawn()); + 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"); + } + } catch (NullPointerException ex) { + ConsoleLogger.showError(ex.getMessage()); + } + return true; + } +} From 2d935d5fefed342ff586b241a9c677b7b8616848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:27:25 +0100 Subject: [PATCH 340/427] Implemented the changepassword command --- .../xephi/authme/command/CommandManager.java | 15 +++ .../authme/ChangePasswordCommand.java | 100 ++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 02e77267..aaae7e6a 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -138,6 +138,21 @@ public class CommandManager { registerCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); registerCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); + // Register the changepassword command + CommandDescription changePasswordCommand = new CommandDescription( + new RegisterCommand(), + new ArrayList() {{ + add("changepassword"); + add("changepass"); + add("cp"); + }}, + "Change player's password", + "Change the password of a player.", + authMeCommand); + changePasswordCommand.setCommandPermissions("authme.admin.changepassword", CommandPermissions.DefaultPermission.OP_ONLY); + changePasswordCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); + changePasswordCommand.addArgument(new CommandArgumentDescription("password", "New password", false)); + // Register the purge command CommandDescription lastLoginCommand = new CommandDescription( new LastLoginCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java new file mode 100644 index 00000000..4e2a0c2a --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java @@ -0,0 +1,100 @@ +package fr.xephi.authme.command.executable.authme; + +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.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.security.PasswordSecurity; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + +import java.security.NoSuchAlgorithmException; + +public class ChangePasswordCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the player and password + String playerName = commandArguments.get(0); + final String playerPass = commandArguments.get(1); + + // Validate the password + String playerPassLowerCase = playerPass.toLowerCase(); + if (playerPassLowerCase.contains("delete") || playerPassLowerCase.contains("where") || playerPassLowerCase.contains("insert") || playerPassLowerCase.contains("modify") || playerPassLowerCase.contains("from") || playerPassLowerCase.contains("select") || playerPassLowerCase.contains(";") || playerPassLowerCase.contains("null") || !playerPassLowerCase.matches(Settings.getPassRegex)) { + m.send(sender, "password_error"); + return true; + } + if (playerPassLowerCase.equalsIgnoreCase(playerName)) { + m.send(sender, "password_error_nick"); + return true; + } + if (playerPassLowerCase.length() < Settings.getPasswordMinLen || playerPassLowerCase.length() > Settings.passwordMaxLength) { + m.send(sender, "pass_len"); + return true; + } + if (!Settings.unsafePasswords.isEmpty()) { + if (Settings.unsafePasswords.contains(playerPassLowerCase)) { + m.send(sender, "password_error_unsafe"); + return true; + } + } + + // Set the password + final String playerNameLowerCase = playerName.toLowerCase(); + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + String hash; + try { + hash = PasswordSecurity.getHash(Settings.getPasswordHash, playerPass, playerNameLowerCase); + } catch (NoSuchAlgorithmException e) { + m.send(sender, "error"); + return; + } + PlayerAuth auth = null; + if (PlayerCache.getInstance().isAuthenticated(playerNameLowerCase)) { + auth = PlayerCache.getInstance().getAuth(playerNameLowerCase); + } else if (plugin.database.isAuthAvailable(playerNameLowerCase)) { + auth = plugin.database.getAuth(playerNameLowerCase); + } + if (auth == null) { + m.send(sender, "unknown_user"); + return; + } + auth.setHash(hash); + if (PasswordSecurity.userSalt.containsKey(playerNameLowerCase)) { + auth.setSalt(PasswordSecurity.userSalt.get(playerNameLowerCase)); + plugin.database.updateSalt(auth); + } + if (!plugin.database.updatePassword(auth)) { + m.send(sender, "error"); + return; + } + sender.sendMessage("pwd_changed"); + ConsoleLogger.info(playerNameLowerCase + "'s password changed"); + } + + }); + return true; + } +} From e4d46ae9b9a5359e1c53ead08d05c331308b9b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:30:29 +0100 Subject: [PATCH 341/427] Implemented the unregister command --- .../xephi/authme/command/CommandManager.java | 15 +++ .../executable/authme/UnregisterCommand.java | 98 +++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index aaae7e6a..b03e9e5f 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -138,6 +138,21 @@ public class CommandManager { registerCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); registerCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); + // Register the unregister command + CommandDescription unregisterCommand = new CommandDescription( + new UnregisterCommand(), + new ArrayList() {{ + add("unregister"); + add("unreg"); + add("delete"); + add("del"); + }}, + "Unregister a player", + "Unregister the specified player.", + authMeCommand); + unregisterCommand.setCommandPermissions("authme.admin.unregister", CommandPermissions.DefaultPermission.OP_ONLY); + unregisterCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); + // Register the changepassword command CommandDescription changePasswordCommand = new CommandDescription( new RegisterCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java new file mode 100644 index 00000000..e04b8889 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java @@ -0,0 +1,98 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.Utils; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.events.SpawnTeleportEvent; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.task.MessageTask; +import fr.xephi.authme.task.TimeoutTask; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + +public class UnregisterCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the player name + String playerName = commandArguments.get(0); + String playerNameLowerCase = playerName.toLowerCase(); + + // Make sure the user is valid + if (!plugin.database.isAuthAvailable(playerNameLowerCase)) { + m.send(sender, "user_unknown"); + return true; + } + + // Remove the player + if (!plugin.database.removeAuth(playerNameLowerCase)) { + m.send(sender, "error"); + return true; + } + + // Unregister the player + @SuppressWarnings("deprecation") + Player target = Bukkit.getPlayer(playerNameLowerCase); + PlayerCache.getInstance().removePlayer(playerNameLowerCase); + Utils.setGroup(target, Utils.GroupType.UNREGISTERED); + if (target != null) { + if (target.isOnline()) { + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawn = plugin.getSpawnLocation(target); + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + target.teleport(tpEvent.getTo()); + } + } + LimboCache.getInstance().addLimboPlayer(target); + int delay = Settings.getRegistrationTimeout * 20; + int interval = Settings.getWarnMessageInterval; + BukkitScheduler scheduler = sender.getServer().getScheduler(); + if (delay != 0) { + BukkitTask id = scheduler.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, playerNameLowerCase, target), delay); + LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setTimeoutTaskId(id); + } + LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTaskId(scheduler.runTaskAsynchronously(plugin, new MessageTask(plugin, playerNameLowerCase, m.send("reg_msg"), interval))); + if (Settings.applyBlindEffect) + target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { + target.setWalkSpeed(0.0f); + target.setFlySpeed(0.0f); + } + m.send(target, "unregistered"); + } + } + + // Show a status message + m.send(sender, "unregistered"); + ConsoleLogger.info(playerName + " unregistered"); + return true; + } +} From 559072b3c642f4b60c6ca48a87a948d9a2d0ce23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:35:40 +0100 Subject: [PATCH 342/427] Implemented the purgelastposition command --- .../xephi/authme/command/CommandManager.java | 17 +++++ .../authme/PurgeLastPositionCommand.java | 64 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/PurgeLastPositionCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index b03e9e5f..0b600944 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -286,6 +286,23 @@ public class CommandManager { purgeCommand.setCommandPermissions("authme.admin.purge", CommandPermissions.DefaultPermission.OP_ONLY); purgeCommand.addArgument(new CommandArgumentDescription("days", "Number of days", false)); + // Register the purgelastposition command + CommandDescription purgeLastPositionCommand = new CommandDescription( + new PurgeLastPositionCommand(), + new ArrayList() {{ + add("purgelastposition"); + add("purgelastpos"); + add("resetposition"); + add("resetpos"); + add("resetlastposition"); + add("resetlastpos"); + }}, + "Purge player's last position", + "Purge the last know position of the specified player.", + authMeCommand); + purgeLastPositionCommand.setCommandPermissions("authme.admin.purgelastpos", CommandPermissions.DefaultPermission.OP_ONLY); + purgeLastPositionCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); + // Register the purgebannedplayers command CommandDescription purgeBannedPlayersCommand = new CommandDescription( new PurgeBannedPlayersCommand(), 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 new file mode 100644 index 00000000..e74e6651 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeLastPositionCommand.java @@ -0,0 +1,64 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class PurgeLastPositionCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the player + String playerName = sender.getName(); + if(commandArguments.getCount() >= 1) + playerName = commandArguments.get(0); + String playerNameLowerCase = playerName.toLowerCase(); + + // Purge the last position of the player + try { + // Get the user auth and make sure the user exists + PlayerAuth auth = plugin.database.getAuth(playerNameLowerCase); + if (auth == null) { + m.send(sender, "unknown_user"); + return true; + } + + // Set the last position + auth.setQuitLocX(0D); + auth.setQuitLocY(0D); + auth.setQuitLocZ(0D); + auth.setWorld("world"); + plugin.database.updateQuitLoc(auth); + + // Show a status message + sender.sendMessage(playerNameLowerCase + "'s last position location is now reset"); + + } catch (Exception e) { + ConsoleLogger.showError("An error occurred while trying to reset location or player do not exist, please see below: "); + ConsoleLogger.showError(e.getMessage()); + if (sender instanceof Player) + sender.sendMessage("An error occurred while trying to reset location or player do not exist, please see logs"); + } + return true; + } +} From e3a6c73b587c5273cf48e1bc858acc50ab2a0143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:41:03 +0100 Subject: [PATCH 343/427] Implemented the switchantibot command --- src/main/java/fr/xephi/authme/AuthMe.java | 4 ++ .../xephi/authme/command/CommandManager.java | 14 ++++++ .../authme/SwitchAntiBotCommand.java | 46 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index f3ff8778..ec141717 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -721,6 +721,10 @@ public class AuthMe extends JavaPlugin { Settings.switchAntiBotMod(mode); } + public boolean getAntiBotModMode() { + return this.antibotMod; + } + private void recallEmail() { if (!Settings.recallEmail) return; diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 0b600944..61cf6fec 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -317,6 +317,20 @@ public class CommandManager { authMeCommand); purgeBannedPlayersCommand.setCommandPermissions("authme.admin.purgebannedplayers", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the switchantibot command + CommandDescription switchAntiBotCommand = new CommandDescription( + new PurgeLastPositionCommand(), + new ArrayList() {{ + add("switchantibot"); + add("toggleantibot"); + add("antibot"); + }}, + "Switch AntiBot mode", + "Switch or toggle the AntiBot mode to the specified state.", + authMeCommand); + switchAntiBotCommand.setCommandPermissions("authme.admin.switchantibot", CommandPermissions.DefaultPermission.OP_ONLY); + switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true)); + // Register the reload command CommandDescription reloadCommand = new CommandDescription( new ReloadCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java new file mode 100644 index 00000000..2b888e7e --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java @@ -0,0 +1,46 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import org.bukkit.command.CommandSender; + +public class SwitchAntiBotCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Get the new state + String newState = plugin.getAntiBotModMode() ? "OFF" : "ON"; + if(commandArguments.getCount() >= 1) + newState = commandArguments.get(0); + + // Enable the mod + if(newState.equalsIgnoreCase("ON")) { + plugin.switchAntiBotMod(true); + sender.sendMessage("[AuthMe] AntiBotMod enabled"); + return true; + } + + // Disable the mod + if(newState.equalsIgnoreCase("OFF")) { + plugin.switchAntiBotMod(false); + sender.sendMessage("[AuthMe] AntiBotMod disabled"); + return true; + } + + // Invalid command arguments, return false + return false; + } +} From c4c54cd13403bede070b1c95515c36aa3886c26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:43:09 +0100 Subject: [PATCH 344/427] Fixed invalid command reference --- src/main/java/fr/xephi/authme/command/CommandManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 61cf6fec..6a061b93 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -319,7 +319,7 @@ public class CommandManager { // Register the switchantibot command CommandDescription switchAntiBotCommand = new CommandDescription( - new PurgeLastPositionCommand(), + new SwitchAntiBotCommand(), new ArrayList() {{ add("switchantibot"); add("toggleantibot"); From c11ca35774c3130293eb89527f46131ee91674df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:46:57 +0100 Subject: [PATCH 345/427] Improved the switchantibot command --- .../executable/authme/SwitchAntiBotCommand.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java index 2b888e7e..b3adf430 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java @@ -3,6 +3,8 @@ package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.command.help.HelpProvider; +import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; public class SwitchAntiBotCommand extends ExecutableCommand { @@ -40,7 +42,15 @@ public class SwitchAntiBotCommand extends ExecutableCommand { return true; } - // Invalid command arguments, return false - return false; + // Show the invalid arguments warning + sender.sendMessage(ChatColor.DARK_RED + "Invalid AntiBot mode!"); + + // Show the command argument help + HelpProvider.showHelp(sender, commandReference, commandReference, true, false, true, false, false, false); + + // Show the command to use for detailed help + CommandParts helpCommandReference = new CommandParts(commandReference.getRange(1)); + sender.sendMessage(ChatColor.GOLD + "Detailed help: " + ChatColor.WHITE + "/" + commandReference.get(0) + " help " + helpCommandReference); + return true; } } From 14eb8e28cf928d18b85340f8be84f2c49ae874be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:54:03 +0100 Subject: [PATCH 346/427] Implemented getip command --- .../xephi/authme/command/CommandManager.java | 13 ++++++ .../executable/authme/GetIpCommand.java | 41 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 6a061b93..0040b677 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -225,6 +225,19 @@ public class CommandManager { setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false)); + // Register the getip command + CommandDescription getIpCommand = new CommandDescription( + new GetIpCommand(), + new ArrayList() {{ + add("getip"); + add("ip"); + }}, + "Get player's IP", + "Get the IP address of the specified online player.", + authMeCommand); + getIpCommand.setCommandPermissions("authme.admin.getip", CommandPermissions.DefaultPermission.OP_ONLY); + getIpCommand.addArgument(new CommandArgumentDescription("player", "Online player name", false)); + // Register the spawn command CommandDescription spawnCommand = new CommandDescription( new SpawnCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java new file mode 100644 index 00000000..d67b7d63 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java @@ -0,0 +1,41 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class GetIpCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Get the player query + String playerName = sender.getName(); + if(commandArguments.getCount() >= 1) + playerName = commandArguments.get(0); + + @SuppressWarnings("deprecation") + Player player = Bukkit.getPlayer(playerName); + if (player == null) { + sender.sendMessage("This player is not actually online"); + return true; + } + 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; + } +} From afd46edb393c6d98efc0b014ae423ffb00e64135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:57:28 +0100 Subject: [PATCH 347/427] Implemented the forcelogin command --- .../xephi/authme/command/CommandManager.java | 15 +++++- .../executable/authme/ForceLoginCommand.java | 51 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 0040b677..70b147d4 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -236,7 +236,20 @@ public class CommandManager { "Get the IP address of the specified online player.", authMeCommand); getIpCommand.setCommandPermissions("authme.admin.getip", CommandPermissions.DefaultPermission.OP_ONLY); - getIpCommand.addArgument(new CommandArgumentDescription("player", "Online player name", false)); + getIpCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); + + // Register the forcelogin command + CommandDescription forceLoginCommand = new CommandDescription( + new ForceLoginCommand(), + new ArrayList() {{ + add("forcelogin"); + add("login"); + }}, + "Force login player", + "Force the specified player to login.", + authMeCommand); + forceLoginCommand.setCommandPermissions("authme.admin.forcelogin", CommandPermissions.DefaultPermission.OP_ONLY); + forceLoginCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); // Register the spawn command CommandDescription spawnCommand = new CommandDescription( diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java new file mode 100644 index 00000000..e4f285be --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java @@ -0,0 +1,51 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ForceLoginCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Get the player query + String playerName = sender.getName(); + if(commandArguments.getCount() >= 1) + playerName = commandArguments.get(0); + + // Command logic + try { + @SuppressWarnings("deprecation") + Player player = Bukkit.getPlayer(playerName); + if (player == null || !player.isOnline()) { + sender.sendMessage("Player needs to be online!"); + return true; + } + if (!plugin.authmePermissible(player, "authme.canbeforced")) { + sender.sendMessage("You cannot force login for the player " + playerName + "!"); + return true; + } + plugin.management.performLogin(player, "dontneed", true); + sender.sendMessage("Force Login for " + playerName + " performed!"); + } catch (Exception e) { + sender.sendMessage("An error occurred while trying to get that player!"); + } + + return true; + } +} From 443e9954af360fa7edc8449fea496a6ca47d19d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:58:22 +0100 Subject: [PATCH 348/427] Moved some code around --- .../xephi/authme/command/CommandManager.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 70b147d4..8d952fd5 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -153,6 +153,19 @@ public class CommandManager { unregisterCommand.setCommandPermissions("authme.admin.unregister", CommandPermissions.DefaultPermission.OP_ONLY); unregisterCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); + // Register the forcelogin command + CommandDescription forceLoginCommand = new CommandDescription( + new ForceLoginCommand(), + new ArrayList() {{ + add("forcelogin"); + add("login"); + }}, + "Force login player", + "Force the specified player to login.", + authMeCommand); + forceLoginCommand.setCommandPermissions("authme.admin.forcelogin", CommandPermissions.DefaultPermission.OP_ONLY); + forceLoginCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); + // Register the changepassword command CommandDescription changePasswordCommand = new CommandDescription( new RegisterCommand(), @@ -238,19 +251,6 @@ public class CommandManager { getIpCommand.setCommandPermissions("authme.admin.getip", CommandPermissions.DefaultPermission.OP_ONLY); getIpCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); - // Register the forcelogin command - CommandDescription forceLoginCommand = new CommandDescription( - new ForceLoginCommand(), - new ArrayList() {{ - add("forcelogin"); - add("login"); - }}, - "Force login player", - "Force the specified player to login.", - authMeCommand); - forceLoginCommand.setCommandPermissions("authme.admin.forcelogin", CommandPermissions.DefaultPermission.OP_ONLY); - forceLoginCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); - // Register the spawn command CommandDescription spawnCommand = new CommandDescription( new SpawnCommand(), From b4d710840de576a96e75968f943f104eb7ae10b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 18:58:41 +0100 Subject: [PATCH 349/427] Removed some unused code --- .../xephi/authme/command/CommandManager.java | 156 ------------------ 1 file changed, 156 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 8d952fd5..996ff901 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -53,77 +53,6 @@ public class CommandManager { helpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); helpCommand.setMaximumArguments(false); - /*// Register the create command - CommandDescription createWorldCommand = new CommandDescription( - new CreateWorldCommand(), - new ArrayList() {{ - add("createworld"); - add("cw"); - }}, - "Create world", - "Create a new Dungeon Maze world, the name of the world must be unique.", - dungeonMazeCommand); - createWorldCommand.addArgument(new CommandArgumentDescription("world", "The name of the world to create.", false)); - createWorldCommand.addArgument(new CommandArgumentDescription("preload", "True or False to preload the world on startup.", true)); - createWorldCommand.setCommandPermissions("dungeonmaze.command.createworld", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the teleport command - CommandDescription teleportCommand = new CommandDescription( - new TeleportCommand(), - new ArrayList() {{ - add("teleport"); - add("tp"); - add("warp"); - add("goto"); - add("move"); - }}, - "Teleport to world", - "Teleports to any another world, such as a Dungeon Maze world." , - dungeonMazeCommand); - teleportCommand.addArgument(new CommandArgumentDescription("world", "The name of the world to teleport to.", false)); - teleportCommand.setCommandPermissions("dungeonmaze.command.teleport", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the load world command - CommandDescription loadWorldCommand = new CommandDescription( - new LoadWorldCommand(), - new ArrayList() {{ - add("loadworld"); - add("load"); - }}, - "Load a world", - "Load a world if it isn't loaded." , - dungeonMazeCommand); - loadWorldCommand.addArgument(new CommandArgumentDescription("world", "The name of the world to load.", false)); - loadWorldCommand.setCommandPermissions("dungeonmaze.command.loadworld", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the unload world command - CommandDescription unloadWorldCommand = new CommandDescription( - new UnloadWorldCommand(), - new ArrayList() {{ - add("unloadworld"); - add("unload"); - }}, - "Unload a world", - "Unload a loaded world." , - dungeonMazeCommand); - unloadWorldCommand.addArgument(new CommandArgumentDescription("world", "The name of the world to unload.", false)); - unloadWorldCommand.setCommandPermissions("dungeonmaze.command.unloadworld", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the list world command - CommandDescription listWorldCommand = new CommandDescription( - new ListWorldCommand(), - new ArrayList() {{ - add("listworlds"); - add("listworld"); - add("list"); - add("worlds"); - add("lw"); - }}, - "List Dungeon Mazes", - "Lists the available Dungeon Maze worlds and shows some additional information.", - dungeonMazeCommand); - listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY);*/ - // Register the register command CommandDescription registerCommand = new CommandDescription( new RegisterCommand(), @@ -370,91 +299,6 @@ public class CommandManager { authMeCommand); reloadCommand.setCommandPermissions("authme.admin.reload", CommandPermissions.DefaultPermission.OP_ONLY); - /* // Register the reload permissions command - CommandDescription reloadPermissionsCommand = new CommandDescription( - new ReloadPermissionsCommand(), - new ArrayList() {{ - add("reloadpermissions"); - add("reloadpermission"); - add("reloadperms"); - add("rp"); - }}, - "Reload permissions", - "Reload the permissions system and rehook the installed permissions system.", - dungeonMazeCommand); - reloadPermissionsCommand.setCommandPermissions("dungeonmaze.command.reloadpermissions", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the restart command - CommandDescription restartCommand = new CommandDescription( - new RestartCommand(), - new ArrayList() {{ - add("restart"); - add("rstrt"); - }}, - "Restart Dungeon Maze", - "Restart the Dungeon Maze plugin.", - dungeonMazeCommand); - restartCommand.setCommandPermissions("dungeonmaze.command.restart", CommandPermissions.DefaultPermission.OP_ONLY); - restartCommand.addArgument(new CommandArgumentDescription("force", "True or False to force restart.", true)); - - // Register the check updates command - CommandDescription checkUpdatesCommand = new CommandDescription( - new CheckUpdatesCommand(), - new ArrayList() {{ - add("checkupdates"); - add("checkupdate"); - add("check"); - add("updates"); - add("update"); - add("cu"); - }}, - "Check updates", - "Check for available updates to install.", - dungeonMazeCommand); - checkUpdatesCommand.setCommandPermissions("dungeonmaze.command.checkupdates", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the install update command - CommandDescription installUpdateCommand = new CommandDescription( - new InstallUpdateCommand(), - new ArrayList() {{ - add("installupdates"); - add("installupdate"); - add("install"); - add("iu"); - }}, - "Install update", - "Try to install any availble update.", - dungeonMazeCommand); - installUpdateCommand.setCommandPermissions("dungeonmaze.command.installupdate", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the status command - CommandDescription statusCommand = new CommandDescription( - new StatusCommand(), - new ArrayList() {{ - add("status"); - add("stats"); - add("s"); - }}, - "Status info", - "Show detailed plugin status.", - dungeonMazeCommand); - statusCommand.setMaximumArguments(false); - statusCommand.setCommandPermissions("dungeonmaze.command.status", CommandPermissions.DefaultPermission.OP_ONLY); - - // Register the status command - CommandDescription serviceCommand = new CommandDescription( - new ServiceCommand(), - new ArrayList() {{ - add("services"); - add("service"); - add("serv"); - }}, - "Services command", - "Show detailed information about all the Dungeon Maze serivces.", - dungeonMazeCommand); - serviceCommand.setMaximumArguments(false); - serviceCommand.setCommandPermissions("dungeonmaze.command.services", CommandPermissions.DefaultPermission.OP_ONLY);*/ - // Register the version command CommandDescription versionCommand = new CommandDescription( new VersionCommand(), From 913ba56343d5595a830cecb632ad8b343e0d2aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 19:03:23 +0100 Subject: [PATCH 350/427] Implemented the base of the resetname command --- .../xephi/authme/command/CommandManager.java | 12 ++++++ .../executable/authme/ResetNameCommand.java | 42 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 996ff901..e9668c7a 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -286,6 +286,18 @@ public class CommandManager { switchAntiBotCommand.setCommandPermissions("authme.admin.switchantibot", CommandPermissions.DefaultPermission.OP_ONLY); switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true)); +// // Register the resetname command +// CommandDescription resetNameCommand = new CommandDescription( +// new SwitchAntiBotCommand(), +// new ArrayList() {{ +// add("resetname"); +// add("resetnames"); +// }}, +// "Reset name", +// "Reset name", +// authMeCommand); +// resetNameCommand.setCommandPermissions("authme.admin.resetname", CommandPermissions.DefaultPermission.OP_ONLY); + // Register the reload command CommandDescription reloadCommand = new CommandDescription( new ReloadCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java new file mode 100644 index 00000000..900cd0b9 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java @@ -0,0 +1,42 @@ +package fr.xephi.authme.command.executable.authme; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + +import java.util.List; + +public class ResetNameCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Command logic + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + List authentications = plugin.database.getAllAuths(); + for(PlayerAuth auth : authentications) { + auth.setRealName("Player"); + plugin.database.updateSession(auth); + } + } + }); + + return true; + } +} From 0ca60299adaf2473e1ee9cf41273d5c653b1913e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 19:06:43 +0100 Subject: [PATCH 351/427] Some minor command description changes --- .../fr/xephi/authme/command/CommandManager.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index e9668c7a..ae9a74bb 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -35,7 +35,7 @@ public class CommandManager { add("authme"); }}, "Main command", - "The main AuthMeReloaded command. The root for all the other commands.", null); + "The main AuthMeReloaded command. The root for all admin commands.", null); // Register the help command CommandDescription helpCommand = new CommandDescription( @@ -89,8 +89,8 @@ public class CommandManager { add("forcelogin"); add("login"); }}, - "Force login player", - "Force the specified player to login.", + "Enforce login player", + "Enforce the specified player to login.", authMeCommand); forceLoginCommand.setCommandPermissions("authme.admin.forcelogin", CommandPermissions.DefaultPermission.OP_ONLY); forceLoginCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); @@ -99,6 +99,7 @@ public class CommandManager { CommandDescription changePasswordCommand = new CommandDescription( new RegisterCommand(), new ArrayList() {{ + add("password"); add("changepassword"); add("changepass"); add("cp"); @@ -108,7 +109,7 @@ public class CommandManager { authMeCommand); changePasswordCommand.setCommandPermissions("authme.admin.changepassword", CommandPermissions.DefaultPermission.OP_ONLY); changePasswordCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); - changePasswordCommand.addArgument(new CommandArgumentDescription("password", "New password", false)); + changePasswordCommand.addArgument(new CommandArgumentDescription("pwd", "New password", false)); // Register the purge command CommandDescription lastLoginCommand = new CommandDescription( @@ -245,10 +246,10 @@ public class CommandManager { CommandDescription purgeLastPositionCommand = new CommandDescription( new PurgeLastPositionCommand(), new ArrayList() {{ + add("resetpos"); add("purgelastposition"); add("purgelastpos"); add("resetposition"); - add("resetpos"); add("resetlastposition"); add("resetlastpos"); }}, @@ -288,7 +289,7 @@ public class CommandManager { // // Register the resetname command // CommandDescription resetNameCommand = new CommandDescription( -// new SwitchAntiBotCommand(), +// new ResetNameCommand(), // new ArrayList() {{ // add("resetname"); // add("resetnames"); From 6e222c1bc9a806958adb51df7cd0b16afccce881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 19:13:55 +0100 Subject: [PATCH 352/427] Implemented the login command --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../xephi/authme/command/CommandManager.java | 56 +++++++++++-------- .../executable/login/LoginCommand.java | 50 +++++++++++++++++ 3 files changed, 85 insertions(+), 23 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index ec141717..aa3f6137 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -348,7 +348,7 @@ public class AuthMe extends JavaPlugin { // Register commands //getCommand("authme").setExecutor(new AdminCommand(this)); getCommand("register").setExecutor(new RegisterCommand(this)); - getCommand("login").setExecutor(new LoginCommand(this)); + //getCommand("login").setExecutor(new LoginCommand(this)); getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); getCommand("logout").setExecutor(new LogoutCommand(this)); getCommand("unregister").setExecutor(new UnregisterCommand(this)); diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index ae9a74bb..c3309cea 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -2,6 +2,7 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; +import fr.xephi.authme.command.executable.login.LoginCommand; import java.util.ArrayList; import java.util.List; @@ -29,7 +30,7 @@ public class CommandManager { @SuppressWarnings("SpellCheckingInspection") public void registerCommands() { // Register the base Dungeon Maze command - CommandDescription authMeCommand = new CommandDescription( + CommandDescription authMeBaseCommand = new CommandDescription( new AuthMeCommand(), new ArrayList() {{ add("authme"); @@ -49,7 +50,7 @@ public class CommandManager { }}, "View help", "View detailed help pages about AuthMeReloaded commands.", - authMeCommand); + authMeBaseCommand); helpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); helpCommand.setMaximumArguments(false); @@ -62,7 +63,7 @@ public class CommandManager { }}, "Register a player", "Register the specified player with the specified password.", - authMeCommand); + authMeBaseCommand); registerCommand.setCommandPermissions("authme.admin.register", CommandPermissions.DefaultPermission.OP_ONLY); registerCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); registerCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); @@ -78,7 +79,7 @@ public class CommandManager { }}, "Unregister a player", "Unregister the specified player.", - authMeCommand); + authMeBaseCommand); unregisterCommand.setCommandPermissions("authme.admin.unregister", CommandPermissions.DefaultPermission.OP_ONLY); unregisterCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); @@ -91,7 +92,7 @@ public class CommandManager { }}, "Enforce login player", "Enforce the specified player to login.", - authMeCommand); + authMeBaseCommand); forceLoginCommand.setCommandPermissions("authme.admin.forcelogin", CommandPermissions.DefaultPermission.OP_ONLY); forceLoginCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); @@ -106,7 +107,7 @@ public class CommandManager { }}, "Change player's password", "Change the password of a player.", - authMeCommand); + authMeBaseCommand); changePasswordCommand.setCommandPermissions("authme.admin.changepassword", CommandPermissions.DefaultPermission.OP_ONLY); changePasswordCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); changePasswordCommand.addArgument(new CommandArgumentDescription("pwd", "New password", false)); @@ -120,7 +121,7 @@ public class CommandManager { }}, "Player's last login", "View the date of the specified players last login", - authMeCommand); + authMeBaseCommand); lastLoginCommand.setCommandPermissions("authme.admin.lastlogin", CommandPermissions.DefaultPermission.OP_ONLY); lastLoginCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); @@ -133,7 +134,7 @@ public class CommandManager { }}, "Display player accounts", "Display all accounts of a player by it's player name or IP.", - authMeCommand); + authMeBaseCommand); accountsCommand.setCommandPermissions("authme.admin.accounts", CommandPermissions.DefaultPermission.OP_ONLY); accountsCommand.addArgument(new CommandArgumentDescription("player", "Player name or IP", true)); @@ -148,7 +149,7 @@ public class CommandManager { }}, "Display player's email", "Display the email address of the specified player if set.", - authMeCommand); + authMeBaseCommand); getEmailCommand.setCommandPermissions("authme.admin.getemail", CommandPermissions.DefaultPermission.OP_ONLY); getEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); @@ -163,7 +164,7 @@ public class CommandManager { }}, "Change player's email", "Change the email address of the specified player.", - authMeCommand); + authMeBaseCommand); setEmailCommand.setCommandPermissions("authme.admin.chgemail", CommandPermissions.DefaultPermission.OP_ONLY); setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false)); @@ -177,7 +178,7 @@ public class CommandManager { }}, "Get player's IP", "Get the IP address of the specified online player.", - authMeCommand); + authMeBaseCommand); getIpCommand.setCommandPermissions("authme.admin.getip", CommandPermissions.DefaultPermission.OP_ONLY); getIpCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); @@ -190,7 +191,7 @@ public class CommandManager { }}, "Teleport to spawn", "Teleport to the spawn.", - authMeCommand); + authMeBaseCommand); spawnCommand.setCommandPermissions("authme.admin.spawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the setspawn command @@ -202,7 +203,7 @@ public class CommandManager { }}, "Change the spawn", "Change the player's spawn to your current position.", - authMeCommand); + authMeBaseCommand); setSpawnCommand.setCommandPermissions("authme.admin.setspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the firstspawn command @@ -214,7 +215,7 @@ public class CommandManager { }}, "Teleport to first spawn", "Teleport to the first spawn.", - authMeCommand); + authMeBaseCommand); firstSpawnCommand.setCommandPermissions("authme.admin.firstspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the setfirstspawn command @@ -226,7 +227,7 @@ public class CommandManager { }}, "Change the first spawn", "Change the first player's spawn to your current position.", - authMeCommand); + authMeBaseCommand); setFirstSpawnCommand.setCommandPermissions("authme.admin.setfirstspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the purge command @@ -238,7 +239,7 @@ public class CommandManager { }}, "Purge old data", "Purge old AuthMeReloaded data longer than the specified amount of days ago.", - authMeCommand); + authMeBaseCommand); purgeCommand.setCommandPermissions("authme.admin.purge", CommandPermissions.DefaultPermission.OP_ONLY); purgeCommand.addArgument(new CommandArgumentDescription("days", "Number of days", false)); @@ -255,7 +256,7 @@ public class CommandManager { }}, "Purge player's last position", "Purge the last know position of the specified player.", - authMeCommand); + authMeBaseCommand); purgeLastPositionCommand.setCommandPermissions("authme.admin.purgelastpos", CommandPermissions.DefaultPermission.OP_ONLY); purgeLastPositionCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); @@ -270,7 +271,7 @@ public class CommandManager { }}, "Purge banned palyers data", "Purge all AuthMeReloaded data for banned players.", - authMeCommand); + authMeBaseCommand); purgeBannedPlayersCommand.setCommandPermissions("authme.admin.purgebannedplayers", CommandPermissions.DefaultPermission.OP_ONLY); // Register the switchantibot command @@ -283,7 +284,7 @@ public class CommandManager { }}, "Switch AntiBot mode", "Switch or toggle the AntiBot mode to the specified state.", - authMeCommand); + authMeBaseCommand); switchAntiBotCommand.setCommandPermissions("authme.admin.switchantibot", CommandPermissions.DefaultPermission.OP_ONLY); switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true)); @@ -309,7 +310,7 @@ public class CommandManager { }}, "Reload plugin", "Reload the AuthMeReloaded plugin.", - authMeCommand); + authMeBaseCommand); reloadCommand.setCommandPermissions("authme.admin.reload", CommandPermissions.DefaultPermission.OP_ONLY); // Register the version command @@ -324,11 +325,22 @@ public class CommandManager { }}, "Version info", "Show detailed information about the installed AuthMeReloaded version, and shows the developers, contributors, license and other information.", - authMeCommand); + authMeBaseCommand); versionCommand.setMaximumArguments(false); + // Register the base Dungeon Maze command + CommandDescription loginBaseCommand = new CommandDescription( + new LoginCommand(), + new ArrayList() {{ + add("authme"); + }}, + "Login command", + "Command to login using AuthMeReloaded.", null); + loginBaseCommand.addArgument(new CommandArgumentDescription("password", "Login password", true)); + // Add the base commands to the commands array - this.commandDescriptions.add(authMeCommand); + this.commandDescriptions.add(authMeBaseCommand); + this.commandDescriptions.add(loginBaseCommand); } /** diff --git a/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java new file mode 100644 index 00000000..4d775ecd --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java @@ -0,0 +1,50 @@ +package fr.xephi.authme.command.executable.login; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class LoginCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the player instance + final Player player = (Player) sender; + + // Make sure the password is set + if(commandArguments.getCount() == 0) { + m.send(player, "usage_log"); + return true; + } + + // Get the password + String playerPass = commandArguments.get(0); + + // Login the player + plugin.management.performLogin(player, playerPass, false); + return true; + } +} From 9d386ed80a3276d65d3a77a6ba69d24fc9b774ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 19:15:56 +0100 Subject: [PATCH 353/427] Fixed invalid login command label --- src/main/java/fr/xephi/authme/command/CommandHandler.java | 3 ++- src/main/java/fr/xephi/authme/command/CommandManager.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandHandler.java b/src/main/java/fr/xephi/authme/command/CommandHandler.java index 7dfa0ab0..1eb46ca0 100644 --- a/src/main/java/fr/xephi/authme/command/CommandHandler.java +++ b/src/main/java/fr/xephi/authme/command/CommandHandler.java @@ -1,5 +1,6 @@ package fr.xephi.authme.command; +import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.help.HelpProvider; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -100,7 +101,7 @@ public class CommandHandler { // Get a suitable command for this reference, and make sure it isn't null FoundCommandResult result = this.commandManager.findCommand(commandReference); if(result == null) { - sender.sendMessage(ChatColor.DARK_RED + "Failed to parse Dungeon Maze command!"); + sender.sendMessage(ChatColor.DARK_RED + "Failed to parse " + AuthMe.PLUGIN_NAME + " command!"); return false; } diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index c3309cea..dd65d5d3 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -332,7 +332,7 @@ public class CommandManager { CommandDescription loginBaseCommand = new CommandDescription( new LoginCommand(), new ArrayList() {{ - add("authme"); + add("login"); }}, "Login command", "Command to login using AuthMeReloaded.", null); From bade9d5d5e6c783b21d92353a5085fba3e82bd51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 19:18:00 +0100 Subject: [PATCH 354/427] Fixed invalid permissions for login command --- src/main/java/fr/xephi/authme/command/CommandManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index dd65d5d3..3f4ba5a1 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -336,6 +336,7 @@ public class CommandManager { }}, "Login command", "Command to login using AuthMeReloaded.", null); + loginBaseCommand.setCommandPermissions("authme.login", CommandPermissions.DefaultPermission.ALLOWED); loginBaseCommand.addArgument(new CommandArgumentDescription("password", "Login password", true)); // Add the base commands to the commands array From 7700799e82e21ae236ec0d70b3f13862fd09991a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 19:19:50 +0100 Subject: [PATCH 355/427] Forced the password parameter for login command --- src/main/java/fr/xephi/authme/command/CommandManager.java | 2 +- .../xephi/authme/command/executable/login/LoginCommand.java | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 3f4ba5a1..95a0a9d4 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -337,7 +337,7 @@ public class CommandManager { "Login command", "Command to login using AuthMeReloaded.", null); loginBaseCommand.setCommandPermissions("authme.login", CommandPermissions.DefaultPermission.ALLOWED); - loginBaseCommand.addArgument(new CommandArgumentDescription("password", "Login password", true)); + loginBaseCommand.addArgument(new CommandArgumentDescription("password", "Login password", false)); // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); diff --git a/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java index 4d775ecd..3d0a86d5 100644 --- a/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java @@ -34,12 +34,6 @@ public class LoginCommand extends ExecutableCommand { // Get the player instance final Player player = (Player) sender; - // Make sure the password is set - if(commandArguments.getCount() == 0) { - m.send(player, "usage_log"); - return true; - } - // Get the password String playerPass = commandArguments.get(0); From 67ad35075466953a9345f6c4102a9e37e7bd67d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 19:26:04 +0100 Subject: [PATCH 356/427] Moved help command --- .../authme/command/executable/{authme => }/HelpCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/main/java/fr/xephi/authme/command/executable/{authme => }/HelpCommand.java (96%) diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/HelpCommand.java b/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java similarity index 96% rename from src/main/java/fr/xephi/authme/command/executable/authme/HelpCommand.java rename to src/main/java/fr/xephi/authme/command/executable/HelpCommand.java index b892b7fe..3ddcb5a5 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/HelpCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable.authme; +package fr.xephi.authme.command.executable; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; From f67cb02d233627fb20b3eb46efc9c15b20899fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 20:16:35 +0100 Subject: [PATCH 357/427] Added help command for login --- .../xephi/authme/command/CommandManager.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 95a0a9d4..696e4658 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -39,7 +39,7 @@ public class CommandManager { "The main AuthMeReloaded command. The root for all admin commands.", null); // Register the help command - CommandDescription helpCommand = new CommandDescription( + CommandDescription authMeHelpCommand = new CommandDescription( new HelpCommand(), new ArrayList() {{ add("help"); @@ -51,8 +51,8 @@ public class CommandManager { "View help", "View detailed help pages about AuthMeReloaded commands.", authMeBaseCommand); - helpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); - helpCommand.setMaximumArguments(false); + authMeHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + authMeHelpCommand.setMaximumArguments(false); // Register the register command CommandDescription registerCommand = new CommandDescription( @@ -339,6 +339,22 @@ public class CommandManager { loginBaseCommand.setCommandPermissions("authme.login", CommandPermissions.DefaultPermission.ALLOWED); loginBaseCommand.addArgument(new CommandArgumentDescription("password", "Login password", false)); + // Register the help command + CommandDescription loginHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded login commands.", + loginBaseCommand); + loginHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + loginHelpCommand.setMaximumArguments(false); + // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); this.commandDescriptions.add(loginBaseCommand); From 1fad2b401c8651355c08196104841ed7a1811a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 20:17:52 +0100 Subject: [PATCH 358/427] Removed unused code --- .../xephi/authme/command/executable/login/LoginCommand.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java index 3d0a86d5..22b57dcd 100644 --- a/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java @@ -3,7 +3,6 @@ package fr.xephi.authme.command.executable.login; import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import fr.xephi.authme.settings.Messages; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -23,9 +22,6 @@ public class LoginCommand extends ExecutableCommand { // AuthMe plugin instance final AuthMe plugin = AuthMe.getInstance(); - // Messages instance - final Messages m = Messages.getInstance(); - // Make sure the current command executor is a player if(!(sender instanceof Player)) { return true; From 45fe939239cdfff9f02ed787d4863187ec5b4bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 20:35:41 +0100 Subject: [PATCH 359/427] Improved Dutch language pack --- src/main/resources/messages/messages_nl.yml | 66 ++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/main/resources/messages/messages_nl.yml b/src/main/resources/messages/messages_nl.yml index acd42a2c..f1c585e2 100644 --- a/src/main/resources/messages/messages_nl.yml +++ b/src/main/resources/messages/messages_nl.yml @@ -1,56 +1,56 @@ -unknown_user: Gebruiker is niet gevonden in database -unsafe_spawn: De locatie waar je de vorige keer het spel verlied was gevaarlijk, je bent geteleporteert naar de Spawn +unknown_user: Gebruiker is niet gevonden in de database +unsafe_spawn: De locatie waar je de vorige keer het spel verliet was gevaarlijk, je bent geteleporteerd naar de spawn not_logged_in: '&cNiet ingelogt!' reg_voluntarily: Je kunt je gebruikersnaam registreren met "/register " usage_log: '&cGebruik: /login ' wrong_pwd: '&cFout wachtwoord' unregistered: '&cRegistratie succesvol ongedaan gemaakt!' reg_disabled: '&cRegistratie is uitgeschakeld' -valid_session: '&cSessie ingelogt' -login: '&cSuccesvol ingelogt!' -password_error_nick: '&fYou can''t use your name as password' -password_error_unsafe: '&fYou can''t use unsafe passwords' +valid_session: '&cSessie ingelogd' +login: '&cSuccesvol ingelogd!' +password_error_nick: '&fJe kunt je gebruikersnaam niet als wachtwoord gebruiken' +password_error_unsafe: '&fJe kunt geen onveilige wachtwoorden gebruiken' vb_nonActiv: Je accound is nog niet geactiveerd, controleer je mailbox! user_regged: '&cGebruikersnaam is al geregistreerd' usage_reg: '&cGebruik: /register ' max_reg: Je hebt de maximale registraties van jouw account overschreden. no_perm: '&cGeen toegang!' -error: Error; neem contact op met een ADMIN! +error: Error: neem contact op met een administrator! login_msg: '&cLog in met "/login "' reg_msg: '&cRegistreer met "/register "' usage_unreg: '&cGebruik: /unregister password' pwd_changed: '&cWachtwoord aangepast!' user_unknown: '&cGebruikersnaam niet geregistreerd' password_error: Wachtwoord incorrect! -invalid_session: Sessie beschadigt, wacht tot de sessie is verlopen en join opnieuw. +invalid_session: Sessie beschadigd, wacht tot de sessie is verlopen en verbindt opnieuw. reg_only: Alleen voor geregistreerde spelers! Bezoek http://example.com om te registreren -logged_in: '&cJe bent al ingelogt!' -logout: '&cJe bent succesvol uitgelogt' +logged_in: '&cJe bent al ingelogd!' +logout: '&cJe bent succesvol uitgelogd' same_nick: Er is al iemand met jou gebruikersnaam online. registered: '&cSuccesvol geregistreerd!' pass_len: Je gekozen wachtwoord voldoet niet aan de minimum of maximum lengte reload: Configuratie en database is opnieuw opgestard -timeout: Login time-out; het duurde telang voor je je inlogde. +timeout: Login time-out: het duurde telang voor je je inlogde. usage_changepassword: 'Gebruik: /changepassword ' -name_len: '&cJouw gebruikersnaam is te kort' -regex: '&cJouw gebruikersnaam bestaat uit illegale tekens. tegestaan chars: REG_EX' -add_email: '&cVoeg uw email toe Alstublieft met: /email add jouw wachtwoord herhaalwachtwoord' -recovery_email: '&cWachtwoord vergeten? gebruik alstublieft /email recovery ' -usage_captcha: '&cGebruik: /captcha ' -wrong_captcha: '&cverkeerde Captcha, Gebruik alstublieft : /captcha THE_CAPTCHA' -valid_captcha: '&cJouw captcha is geldig!' -kick_forvip: '&cA VIP Gebruiker ga naar de volledige server!' -kick_fullserver: '&cDe server is eigenlijk vol, Sorry!' -usage_email_add: '&fGebruik: /email add ' -usage_email_change: '&fGebruik: /email change ' -usage_email_recovery: '&fGebruik: /email recovery ' -new_email_invalid: '[AuthMe] Nieuw email ongeldig!' -old_email_invalid: '[AuthMe] Oud email ongeldig!' -email_invalid: '[AuthMe] ongeldig Email' -email_added: '[AuthMe] Bevestig jouw Email !' -email_confirm: '[AuthMe] Bevestig jouw Email !' -email_changed: '[AuthMe] Email Veranderd !' -email_send: '[AuthMe] Herstel Email Verzonden !' -country_banned: 'Your country is banned from this server' -antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!' -antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped' +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 ' +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!' +kick_fullserver: '&cDe server is vol, sorry!' +usage_email_add: '&fGebruik: /email add ' +usage_email_change: '&fGebruik: /email change ' +usage_email_recovery: '&fGebruik: /email recovery ' +new_email_invalid: '[AuthMe] Nieuwe E-mail ongeldig!' +old_email_invalid: '[AuthMe] Oude E-mail ongeldig!' +email_invalid: '[AuthMe] Ongeldige E-mail' +email_added: '[AuthMe] Bevestig jouw E-mail!' +email_confirm: '[AuthMe] Bevestig jouw E-mail!' +email_changed: '[AuthMe] Email Veranderd!' +email_send: '[AuthMe] Herstel E-mail Verzonden!' +country_banned: 'Jouw land is geband op deze server' +antibot_auto_enabled: '[AuthMe] AntiBotMod automatisch aangezet vanewge veel verbindingen!' +antibot_auto_disabled: '[AuthMe] AntiBotMod automatisch uitgezet na %m minuten, hopelijk is de invasie gestopt' From ae76759dc0e197cb286a6484d1b8c22029cce62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 20:50:25 +0100 Subject: [PATCH 360/427] Implemented the register command --- .../xephi/authme/command/CommandManager.java | 31 +++++++++ .../executable/register/RegisterCommand.java | 69 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 696e4658..82c5d173 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -355,9 +355,40 @@ public class CommandManager { loginHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); loginHelpCommand.setMaximumArguments(false); + // Register the base register command + CommandDescription registerBaseCommand = new CommandDescription( + new RegisterCommand(), + new ArrayList() {{ + add("register"); + add("reg"); + }}, + "Registration command", + "Command to register using AuthMeReloaded.", null); + registerBaseCommand.setCommandPermissions("authme.register", CommandPermissions.DefaultPermission.ALLOWED); + registerBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); + registerBaseCommand.addArgument(new CommandArgumentDescription("verifyPassword", "Verify password", false)); + registerBaseCommand.setMaximumArguments(false); + + // Register the help command + CommandDescription registerHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded register commands.", + registerBaseCommand); + registerHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + registerHelpCommand.setMaximumArguments(false); + // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); this.commandDescriptions.add(loginBaseCommand); + this.commandDescriptions.add(registerBaseCommand); } /** diff --git a/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java new file mode 100644 index 00000000..b08190fc --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java @@ -0,0 +1,69 @@ +package fr.xephi.authme.command.executable.register; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.security.RandomString; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class RegisterCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Make sure the sender is a player + if (!(sender instanceof Player)) { + sender.sendMessage("Player Only! Use 'authme register ' instead"); + return true; + } + + // Make sure the command arguments are valid + final Player player = (Player) sender; + if (commandArguments.getCount() == 0 || (Settings.getEnablePasswordVerifier && commandArguments.getCount() < 2)) { + m.send(player, "usage_reg"); + return true; + } + + if (Settings.emailRegistration && !Settings.getmailAccount.isEmpty()) { + if (Settings.doubleEmailCheck) { + if (commandArguments.getCount() < 2 || !commandArguments.get(0).equals(commandArguments.get(1))) { + m.send(player, "usage_reg"); + return true; + } + } + final String email = commandArguments.get(0); + if (!Settings.isEmailCorrect(email)) { + m.send(player, "email_invalid"); + return true; + } + RandomString rand = new RandomString(Settings.getRecoveryPassLength); + final String thePass = rand.nextString(); + plugin.management.performRegister(player, thePass, email); + return true; + } + if (commandArguments.getCount() > 1 && Settings.getEnablePasswordVerifier) + if (!commandArguments.get(0).equals(commandArguments.get(1))) { + m.send(player, "password_error"); + return true; + } + plugin.management.performRegister(player, commandArguments.get(0), ""); + return true; + } +} From 5093e8ff780330241d6c23a92ec7611f173830c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 20:51:16 +0100 Subject: [PATCH 361/427] Implemented the register command (2) --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index aa3f6137..d0e499e8 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -347,7 +347,7 @@ public class AuthMe extends JavaPlugin { // TODO: This is moving to AuthMe.onCommand(); // Register commands //getCommand("authme").setExecutor(new AdminCommand(this)); - getCommand("register").setExecutor(new RegisterCommand(this)); + //getCommand("register").setExecutor(new RegisterCommand(this)); //getCommand("login").setExecutor(new LoginCommand(this)); getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); getCommand("logout").setExecutor(new LogoutCommand(this)); From a36553f75f17236761ab6509250846713ba5e715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 20:57:13 +0100 Subject: [PATCH 362/427] Implemented the changepassword command --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../xephi/authme/command/CommandManager.java | 33 +++++++++ .../changepassword/ChangePasswordCommand.java | 74 +++++++++++++++++++ 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index d0e499e8..e18baf0d 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -349,7 +349,7 @@ public class AuthMe extends JavaPlugin { //getCommand("authme").setExecutor(new AdminCommand(this)); //getCommand("register").setExecutor(new RegisterCommand(this)); //getCommand("login").setExecutor(new LoginCommand(this)); - getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); + //getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); getCommand("logout").setExecutor(new LogoutCommand(this)); getCommand("unregister").setExecutor(new UnregisterCommand(this)); getCommand("email").setExecutor(new EmailCommand(this)); diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 82c5d173..5510f40e 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -2,6 +2,8 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; +import fr.xephi.authme.command.executable.changepassword.*; +import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; import fr.xephi.authme.command.executable.login.LoginCommand; import java.util.ArrayList; @@ -385,10 +387,41 @@ public class CommandManager { registerHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); registerHelpCommand.setMaximumArguments(false); + // Register the base changepassword command + CommandDescription changePasswordBaseCommand = new CommandDescription( + new ChangePasswordCommand(), + new ArrayList() {{ + add("changepassword"); + add("changepass"); + }}, + "Change password command", + "Command to change your password using AuthMeReloaded.", null); + changePasswordBaseCommand.setCommandPermissions("authme.changepassword", CommandPermissions.DefaultPermission.ALLOWED); + changePasswordBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); + changePasswordBaseCommand.addArgument(new CommandArgumentDescription("verifyPassword", "Verify password", false)); + changePasswordBaseCommand.setMaximumArguments(false); + + // Register the help command + CommandDescription changePasswordHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded register commands.", + changePasswordBaseCommand); + changePasswordHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + changePasswordHelpCommand.setMaximumArguments(false); + // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); this.commandDescriptions.add(loginBaseCommand); this.commandDescriptions.add(registerBaseCommand); + this.commandDescriptions.add(changePasswordBaseCommand); } /** diff --git a/src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java new file mode 100644 index 00000000..bebba5b4 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java @@ -0,0 +1,74 @@ +package fr.xephi.authme.command.executable.changepassword; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.task.ChangePasswordTask; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ChangePasswordCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the passwords + String playerPass = commandArguments.get(0); + String playerPassVerify = commandArguments.get(1); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the player instance and make sure it's authenticated + Player player = (Player) sender; + String name = player.getName().toLowerCase(); + if (!PlayerCache.getInstance().isAuthenticated(name)) { + m.send(player, "not_logged_in"); + return true; + } + + // Make sure the password is allowed + String playerPassLowerCase = playerPass.toLowerCase(); + if (playerPassLowerCase.contains("delete") || playerPassLowerCase.contains("where") || playerPassLowerCase.contains("insert") || playerPassLowerCase.contains("modify") || playerPassLowerCase.contains("from") || playerPassLowerCase.contains("select") || playerPassLowerCase.contains(";") || playerPassLowerCase.contains("null") || !playerPassLowerCase.matches(Settings.getPassRegex)) { + m.send(player, "password_error"); + return true; + } + if (playerPassLowerCase.equalsIgnoreCase(name)) { + m.send(player, "password_error_nick"); + return true; + } + if (playerPassLowerCase.length() < Settings.getPasswordMinLen || playerPassLowerCase.length() > Settings.passwordMaxLength) { + m.send(player, "pass_len"); + return true; + } + if (!Settings.unsafePasswords.isEmpty()) { + if (Settings.unsafePasswords.contains(playerPassLowerCase)) { + m.send(player, "password_error_unsafe"); + return true; + } + } + + // Set the password + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, playerPass, playerPassVerify)); + return true; + } +} From ebd25e16a09b8ed34eb8d6fc1e19b66f06f2fdc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 20:57:33 +0100 Subject: [PATCH 363/427] Moved authme command --- src/main/java/fr/xephi/authme/command/CommandManager.java | 1 - .../authme/command/executable/{ => authme}/AuthMeCommand.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) rename src/main/java/fr/xephi/authme/command/executable/{ => authme}/AuthMeCommand.java (96%) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 5510f40e..a2d548a7 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -2,7 +2,6 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; -import fr.xephi.authme.command.executable.changepassword.*; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; import fr.xephi.authme.command.executable.login.LoginCommand; diff --git a/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java similarity index 96% rename from src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java index 8f1edd84..06f66fae 100644 --- a/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; From ebefca73b744370fbe9a75619e6699f6b4c6d3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:00:41 +0100 Subject: [PATCH 364/427] Implemented the logout command --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../xephi/authme/command/CommandManager.java | 28 ++++++++++++++ .../executable/logout/LogoutCommand.java | 37 +++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index e18baf0d..37b95967 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -350,7 +350,7 @@ public class AuthMe extends JavaPlugin { //getCommand("register").setExecutor(new RegisterCommand(this)); //getCommand("login").setExecutor(new LoginCommand(this)); //getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); - getCommand("logout").setExecutor(new LogoutCommand(this)); + //getCommand("logout").setExecutor(new LogoutCommand(this)); getCommand("unregister").setExecutor(new UnregisterCommand(this)); getCommand("email").setExecutor(new EmailCommand(this)); getCommand("captcha").setExecutor(new CaptchaCommand(this)); diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index a2d548a7..7f06492e 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -4,6 +4,7 @@ import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; import fr.xephi.authme.command.executable.login.LoginCommand; +import fr.xephi.authme.command.executable.logout.LogoutCommand; import java.util.ArrayList; import java.util.List; @@ -356,6 +357,32 @@ public class CommandManager { loginHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); loginHelpCommand.setMaximumArguments(false); + // Register the base logout command + CommandDescription logoutBaseCommand = new CommandDescription( + new LogoutCommand(), + new ArrayList() {{ + add("logout"); + }}, + "Logout command", + "Command to logout using AuthMeReloaded.", null); + logoutBaseCommand.setCommandPermissions("authme.logout", CommandPermissions.DefaultPermission.ALLOWED); + + // Register the help command + CommandDescription logoutHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded register commands.", + logoutBaseCommand); + logoutHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + logoutHelpCommand.setMaximumArguments(false); + // Register the base register command CommandDescription registerBaseCommand = new CommandDescription( new RegisterCommand(), @@ -419,6 +446,7 @@ public class CommandManager { // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); this.commandDescriptions.add(loginBaseCommand); + this.commandDescriptions.add(logoutBaseCommand); this.commandDescriptions.add(registerBaseCommand); this.commandDescriptions.add(changePasswordBaseCommand); } diff --git a/src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java b/src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java new file mode 100644 index 00000000..95b5ab9c --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java @@ -0,0 +1,37 @@ +package fr.xephi.authme.command.executable.logout; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class LogoutCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the player instance + final Player player = (Player) sender; + + // Logout the player + plugin.management.performLogout(player); + return true; + } +} From 7f63056cc955114e1f07f9ca95475674ac2f0b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:06:19 +0100 Subject: [PATCH 365/427] Implemented the unregister command --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../xephi/authme/command/CommandManager.java | 30 +++++++++++ .../unregister/UnregisterCommand.java | 52 +++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 37b95967..50743503 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -351,7 +351,7 @@ public class AuthMe extends JavaPlugin { //getCommand("login").setExecutor(new LoginCommand(this)); //getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); //getCommand("logout").setExecutor(new LogoutCommand(this)); - getCommand("unregister").setExecutor(new UnregisterCommand(this)); + //getCommand("unregister").setExecutor(new UnregisterCommand(this)); getCommand("email").setExecutor(new EmailCommand(this)); getCommand("captcha").setExecutor(new CaptchaCommand(this)); getCommand("converter").setExecutor(new ConverterCommand(this)); diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 7f06492e..864d098b 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -413,6 +413,35 @@ public class CommandManager { registerHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); registerHelpCommand.setMaximumArguments(false); + // Register the base unregister command + CommandDescription unregisterBaseCommand = new CommandDescription( + new RegisterCommand(), + new ArrayList() {{ + add("unregister"); + add("unreg"); + }}, + "Unregistration command", + "Command to unregister using AuthMeReloaded.", null); + unregisterBaseCommand.setCommandPermissions("authme.unregister", CommandPermissions.DefaultPermission.ALLOWED); + unregisterBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); + unregisterBaseCommand.setMaximumArguments(false); + + // Register the help command + CommandDescription unregisterHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded register commands.", + unregisterBaseCommand); + unregisterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + unregisterHelpCommand.setMaximumArguments(false); + // Register the base changepassword command CommandDescription changePasswordBaseCommand = new CommandDescription( new ChangePasswordCommand(), @@ -448,6 +477,7 @@ public class CommandManager { this.commandDescriptions.add(loginBaseCommand); this.commandDescriptions.add(logoutBaseCommand); this.commandDescriptions.add(registerBaseCommand); + this.commandDescriptions.add(unregisterBaseCommand); this.commandDescriptions.add(changePasswordBaseCommand); } diff --git a/src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java new file mode 100644 index 00000000..20055203 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java @@ -0,0 +1,52 @@ +package fr.xephi.authme.command.executable.unregister; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class UnregisterCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the password + String playerPass = commandArguments.get(0); + + // Get the player instance and name + final Player player = (Player) sender; + final String playerNameLowerCase = player.getName().toLowerCase(); + + // Make sure the player is authenticated + if (!PlayerCache.getInstance().isAuthenticated(playerNameLowerCase)) { + m.send(player, "not_logged_in"); + return true; + } + + // Unregister the player + plugin.management.performUnregister(player, playerPass, false); + return true; + } +} From 4c536a52043da84a606f2fc75fe8cd327beb6a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:20:08 +0100 Subject: [PATCH 366/427] Implemented the email add command --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../xephi/authme/command/CommandManager.java | 50 ++++++++++- .../executable/email/AddEmailCommand.java | 90 +++++++++++++++++++ 3 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 50743503..92db8257 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -352,7 +352,7 @@ public class AuthMe extends JavaPlugin { //getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); //getCommand("logout").setExecutor(new LogoutCommand(this)); //getCommand("unregister").setExecutor(new UnregisterCommand(this)); - getCommand("email").setExecutor(new EmailCommand(this)); + //getCommand("email").setExecutor(new EmailCommand(this)); getCommand("captcha").setExecutor(new CaptchaCommand(this)); getCommand("converter").setExecutor(new ConverterCommand(this)); diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 864d098b..28b11b6d 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -3,6 +3,7 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; +import fr.xephi.authme.command.executable.email.AddEmailCommand; import fr.xephi.authme.command.executable.login.LoginCommand; import fr.xephi.authme.command.executable.logout.LogoutCommand; @@ -31,7 +32,7 @@ public class CommandManager { */ @SuppressWarnings("SpellCheckingInspection") public void registerCommands() { - // Register the base Dungeon Maze command + // Register the base AuthMe Reloaded command CommandDescription authMeBaseCommand = new CommandDescription( new AuthMeCommand(), new ArrayList() {{ @@ -378,7 +379,7 @@ public class CommandManager { add("?"); }}, "View help", - "View detailed help pages about AuthMeReloaded register commands.", + "View detailed help pages about AuthMeReloaded logout commands.", logoutBaseCommand); logoutHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); logoutHelpCommand.setMaximumArguments(false); @@ -437,7 +438,7 @@ public class CommandManager { add("?"); }}, "View help", - "View detailed help pages about AuthMeReloaded register commands.", + "View detailed help pages about AuthMeReloaded unregister commands.", unregisterBaseCommand); unregisterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); unregisterHelpCommand.setMaximumArguments(false); @@ -467,11 +468,51 @@ public class CommandManager { add("?"); }}, "View help", - "View detailed help pages about AuthMeReloaded register commands.", + "View detailed help pages about AuthMeReloaded change password commands.", changePasswordBaseCommand); changePasswordHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); changePasswordHelpCommand.setMaximumArguments(false); + // Register the base Dungeon Maze command + CommandDescription emailBaseCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("email"); + add("mail"); + }}, + "E-mail command", + "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null); + + // Register the help command + CommandDescription addEmailCommand = new CommandDescription( + new AddEmailCommand(), + new ArrayList() {{ + add("add"); + add("addemail"); + add("addmail"); + }}, + "Add E-mail", + "Add a new E-Mail address to your account.", + emailBaseCommand); + addEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); + addEmailCommand.addArgument(new CommandArgumentDescription("verifyEmail", "Email address verification", false)); + + // Register the help command + CommandDescription emailHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded help commands.", + emailBaseCommand); + emailHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + emailHelpCommand.setMaximumArguments(false); + // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); this.commandDescriptions.add(loginBaseCommand); @@ -479,6 +520,7 @@ public class CommandManager { this.commandDescriptions.add(registerBaseCommand); this.commandDescriptions.add(unregisterBaseCommand); this.commandDescriptions.add(changePasswordBaseCommand); + this.commandDescriptions.add(emailBaseCommand); } /** diff --git a/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java new file mode 100644 index 00000000..3fa8e0f2 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java @@ -0,0 +1,90 @@ +package fr.xephi.authme.command.executable.email; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class AddEmailCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the parameter values + String playerMail = commandArguments.get(0); + String playerMailVerify = commandArguments.get(1); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the player instance and name + final Player player = (Player) sender; + final String playerName = player.getName(); + + // Command logic + if (Settings.getmaxRegPerEmail > 0) { + if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(playerMail).size() >= Settings.getmaxRegPerEmail) { + m.send(player, "max_reg"); + return true; + } + } + + if (playerMail.equals(playerMailVerify) && PlayerCache.getInstance().isAuthenticated(playerName)) { + PlayerAuth auth = PlayerCache.getInstance().getAuth(playerName); + + if (auth.getEmail() == null || (!auth.getEmail().equals("your@email.com") && !auth.getEmail().isEmpty())) { + m.send(player, "usage_email_change"); + return true; + } + + if (!Settings.isEmailCorrect(playerMail)) { + m.send(player, "email_invalid"); + return true; + } + + auth.setEmail(playerMail); + + if (!plugin.database.updateEmail(auth)) { + m.send(player, "error"); + return true; + } + + PlayerCache.getInstance().updatePlayer(auth); + m.send(player, "email_added"); + player.sendMessage(auth.getEmail()); + + } else if (PlayerCache.getInstance().isAuthenticated(playerName)) { + m.send(player, "email_confirm"); + + } else { + if (!plugin.database.isAuthAvailable(playerName)) { + m.send(player, "login_msg"); + } else { + m.send(player, "reg_email_msg"); + } + } + + return true; + } +} From b10d3d39740e4f07c743c5ee13d49d069405095f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:26:00 +0100 Subject: [PATCH 367/427] Implemented the email change command --- .../xephi/authme/command/CommandManager.java | 19 +++- .../executable/email/ChangeEmailCommand.java | 88 +++++++++++++++++++ 2 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 28b11b6d..413ab767 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -4,6 +4,7 @@ import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; import fr.xephi.authme.command.executable.email.AddEmailCommand; +import fr.xephi.authme.command.executable.email.ChangeEmailCommand; import fr.xephi.authme.command.executable.login.LoginCommand; import fr.xephi.authme.command.executable.logout.LogoutCommand; @@ -483,7 +484,7 @@ public class CommandManager { "E-mail command", "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null); - // Register the help command + // Register the add command CommandDescription addEmailCommand = new CommandDescription( new AddEmailCommand(), new ArrayList() {{ @@ -492,11 +493,25 @@ public class CommandManager { add("addmail"); }}, "Add E-mail", - "Add a new E-Mail address to your account.", + "Add an new E-Mail address to your account.", emailBaseCommand); addEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); addEmailCommand.addArgument(new CommandArgumentDescription("verifyEmail", "Email address verification", false)); + // Register the change command + CommandDescription changeEmailCommand = new CommandDescription( + new ChangeEmailCommand(), + new ArrayList() {{ + add("change"); + add("changeemail"); + add("changemail"); + }}, + "Change E-mail", + "Change an E-Mail address of your account.", + emailBaseCommand); + changeEmailCommand.addArgument(new CommandArgumentDescription("oldEmail", "Old email address", false)); + changeEmailCommand.addArgument(new CommandArgumentDescription("newEmail", "New email address", false)); + // Register the help command CommandDescription emailHelpCommand = new CommandDescription( new HelpCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java new file mode 100644 index 00000000..aad9bc22 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java @@ -0,0 +1,88 @@ +package fr.xephi.authme.command.executable.email; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Arrays; + +public class ChangeEmailCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the parameter values + String playerMailOld = commandArguments.get(0); + String playerMailNew = commandArguments.get(1); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the player instance and name + final Player player = (Player) sender; + final String playerName = player.getName(); + + // Command logic + if (Settings.getmaxRegPerEmail > 0) { + if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(playerMailNew).size() >= Settings.getmaxRegPerEmail) { + m.send(player, "max_reg"); + return true; + } + } + if (PlayerCache.getInstance().isAuthenticated(playerName)) { + PlayerAuth auth = PlayerCache.getInstance().getAuth(playerName); + if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) { + m.send(player, "usage_email_add"); + return true; + } + if (!playerMailOld.equals(auth.getEmail())) { + m.send(player, "old_email_invalid"); + return true; + } + if (!Settings.isEmailCorrect(playerMailNew)) { + m.send(player, "new_email_invalid"); + return true; + } + auth.setEmail(playerMailNew); + if (!plugin.database.updateEmail(auth)) { + m.send(player, "error"); + return true; + } + PlayerCache.getInstance().updatePlayer(auth); + m.send(player, "email_changed"); + player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); + } else if (PlayerCache.getInstance().isAuthenticated(playerName)) { + m.send(player, "email_confirm"); + } else { + if (!plugin.database.isAuthAvailable(playerName)) { + m.send(player, "login_msg"); + } else { + m.send(player, "reg_email_msg"); + } + } + + return true; + } +} From 3e16866b236da5f1e88bd57d2fea68c14a02547e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:28:17 +0100 Subject: [PATCH 368/427] Implemented the email recover command --- .../xephi/authme/command/CommandManager.java | 15 +++ .../executable/email/RecoverEmailCommand.java | 95 +++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 413ab767..bd1868c8 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -5,6 +5,7 @@ import fr.xephi.authme.command.executable.authme.*; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; import fr.xephi.authme.command.executable.email.AddEmailCommand; import fr.xephi.authme.command.executable.email.ChangeEmailCommand; +import fr.xephi.authme.command.executable.email.RecoverEmailCommand; import fr.xephi.authme.command.executable.login.LoginCommand; import fr.xephi.authme.command.executable.logout.LogoutCommand; @@ -512,6 +513,20 @@ public class CommandManager { changeEmailCommand.addArgument(new CommandArgumentDescription("oldEmail", "Old email address", false)); changeEmailCommand.addArgument(new CommandArgumentDescription("newEmail", "New email address", false)); + // Register the recover command + CommandDescription recoverEmailCommand = new CommandDescription( + new RecoverEmailCommand(), + new ArrayList() {{ + add("recover"); + add("recovery"); + add("recoveremail"); + add("recovermail"); + }}, + "Recover using E-mail", + "Recover your account using an E-mail address.", + emailBaseCommand); + recoverEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); + // Register the help command CommandDescription emailHelpCommand = new CommandDescription( new HelpCommand(), diff --git a/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java new file mode 100644 index 00000000..2680613b --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java @@ -0,0 +1,95 @@ +package fr.xephi.authme.command.executable.email; + +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.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.security.PasswordSecurity; +import fr.xephi.authme.security.RandomString; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.security.NoSuchAlgorithmException; + +public class RecoverEmailCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the parameter values + String playerMail = commandArguments.get(0); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the player instance and name + final Player player = (Player) sender; + final String playerName = player.getName(); + + // Command logic + if (plugin.mail == null) { + m.send(player, "error"); + return true; + } + if (plugin.database.isAuthAvailable(playerName)) { + if (PlayerCache.getInstance().isAuthenticated(playerName)) { + m.send(player, "logged_in"); + return true; + } + try { + RandomString rand = new RandomString(Settings.getRecoveryPassLength); + String thePass = rand.nextString(); + String hashNew = PasswordSecurity.getHash(Settings.getPasswordHash, thePass, playerName); + PlayerAuth auth; + if (PlayerCache.getInstance().isAuthenticated(playerName)) { + auth = PlayerCache.getInstance().getAuth(playerName); + } else if (plugin.database.isAuthAvailable(playerName)) { + auth = plugin.database.getAuth(playerName); + } else { + m.send(player, "unknown_user"); + return true; + } + if (Settings.getmailAccount.equals("") || Settings.getmailAccount.isEmpty()) { + m.send(player, "error"); + return true; + } + + if (!playerMail.equalsIgnoreCase(auth.getEmail()) || playerMail.equalsIgnoreCase("your@email.com") || auth.getEmail().equalsIgnoreCase("your@email.com")) { + m.send(player, "email_invalid"); + return true; + } + auth.setHash(hashNew); + plugin.database.updatePassword(auth); + plugin.mail.main(auth, thePass); + m.send(player, "email_send"); + } catch (NoSuchAlgorithmException | NoClassDefFoundError ex) { + ConsoleLogger.showError(ex.getMessage()); + m.send(sender, "error"); + } + } else { + m.send(player, "reg_email_msg"); + } + + return true; + } +} From bd6a95c3a8e040251e9b20fdbf9e5b2eeb13062d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:36:56 +0100 Subject: [PATCH 369/427] Implemented the captcha command, fixed permissions for email commands Implemented the captcha command. Fixed missing permission configurations for all email commands. --- src/main/java/fr/xephi/authme/AuthMe.java | 2 +- .../xephi/authme/command/CommandManager.java | 33 ++++++++ .../executable/captcha/CaptchaCommand.java | 84 +++++++++++++++++++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 92db8257..c8593371 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -353,7 +353,7 @@ public class AuthMe extends JavaPlugin { //getCommand("logout").setExecutor(new LogoutCommand(this)); //getCommand("unregister").setExecutor(new UnregisterCommand(this)); //getCommand("email").setExecutor(new EmailCommand(this)); - getCommand("captcha").setExecutor(new CaptchaCommand(this)); + //getCommand("captcha").setExecutor(new CaptchaCommand(this)); getCommand("converter").setExecutor(new ConverterCommand(this)); // Purge on start if enabled diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index bd1868c8..23d55c52 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -496,6 +496,7 @@ public class CommandManager { "Add E-mail", "Add an new E-Mail address to your account.", emailBaseCommand); + addEmailCommand.setCommandPermissions("authme.email.add", CommandPermissions.DefaultPermission.ALLOWED); addEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); addEmailCommand.addArgument(new CommandArgumentDescription("verifyEmail", "Email address verification", false)); @@ -510,6 +511,7 @@ public class CommandManager { "Change E-mail", "Change an E-Mail address of your account.", emailBaseCommand); + changeEmailCommand.setCommandPermissions("authme.email.change", CommandPermissions.DefaultPermission.ALLOWED); changeEmailCommand.addArgument(new CommandArgumentDescription("oldEmail", "Old email address", false)); changeEmailCommand.addArgument(new CommandArgumentDescription("newEmail", "New email address", false)); @@ -525,6 +527,7 @@ public class CommandManager { "Recover using E-mail", "Recover your account using an E-mail address.", emailBaseCommand); + recoverEmailCommand.setCommandPermissions("authme.email.recover", CommandPermissions.DefaultPermission.ALLOWED); recoverEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); // Register the help command @@ -543,6 +546,35 @@ public class CommandManager { emailHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); emailHelpCommand.setMaximumArguments(false); + // Register the base captcha command + CommandDescription captchaBaseCommand = new CommandDescription( + new ChangePasswordCommand(), + new ArrayList() {{ + add("captcha"); + add("capt"); + }}, + "Captcha command", + "Captcha command for AuthMeReloaded.", null); + captchaBaseCommand.setCommandPermissions("authme.captcha", CommandPermissions.DefaultPermission.ALLOWED); + captchaBaseCommand.addArgument(new CommandArgumentDescription("captcha", "The captcha", false)); + captchaBaseCommand.setMaximumArguments(false); + + // Register the help command + CommandDescription captchaHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded change captcha commands.", + captchaBaseCommand); + captchaHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + captchaHelpCommand.setMaximumArguments(false); + // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); this.commandDescriptions.add(loginBaseCommand); @@ -551,6 +583,7 @@ public class CommandManager { this.commandDescriptions.add(unregisterBaseCommand); this.commandDescriptions.add(changePasswordBaseCommand); this.commandDescriptions.add(emailBaseCommand); + this.commandDescriptions.add(captchaBaseCommand); } /** diff --git a/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java new file mode 100644 index 00000000..0b156287 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java @@ -0,0 +1,84 @@ +package fr.xephi.authme.command.executable.captcha; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.security.RandomString; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class CaptchaCommand extends ExecutableCommand { + + /** + * RandomString instance, for captcha generation. + */ + public static RandomString randStr = new RandomString(Settings.captchaLength); + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the parameter values + String captcha = commandArguments.get(0); + + // Make sure the current command executor is a player + if(!(sender instanceof Player)) { + return true; + } + + // Get the player instance and name + final Player player = (Player) sender; + final String playerNameLowerCase = player.getName().toLowerCase(); + + // Command logic + if (PlayerCache.getInstance().isAuthenticated(playerNameLowerCase)) { + m.send(player, "logged_in"); + return true; + } + + if (!Settings.useCaptcha) { + m.send(player, "usage_log"); + return true; + } + + if (!plugin.cap.containsKey(playerNameLowerCase)) { + m.send(player, "usage_log"); + return true; + } + + if (Settings.useCaptcha && !captcha.equals(plugin.cap.get(playerNameLowerCase))) { + plugin.cap.remove(playerNameLowerCase); + plugin.cap.put(playerNameLowerCase, randStr.nextString()); + for (String s : m.send("wrong_captcha")) { + player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(playerNameLowerCase))); + } + return true; + } + + try { + plugin.captcha.remove(playerNameLowerCase); + plugin.cap.remove(playerNameLowerCase); + } catch (NullPointerException ignored) { } + + // Show a status message + m.send(player, "valid_captcha"); + m.send(player, "login_msg"); + return true; + } +} From dc0129d980e56f41e6b236eec4d6ff93406eaeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:44:13 +0100 Subject: [PATCH 370/427] Implemented convert command --- src/main/java/fr/xephi/authme/AuthMe.java | 4 +- .../xephi/authme/command/CommandManager.java | 31 +++++ .../converter/ConverterCommand.java | 108 ++++++++++++++++++ 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index c8593371..390ce879 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -344,7 +344,7 @@ public class AuthMe extends JavaPlugin { pm.registerEvents(new AuthMeEntityListener(this), this); pm.registerEvents(new AuthMeServerListener(this), this); - // TODO: This is moving to AuthMe.onCommand(); + // TODO: This is moved to CommandManager.registerCommands() handled by AuthMe.onCommand() -- timvisee // Register commands //getCommand("authme").setExecutor(new AdminCommand(this)); //getCommand("register").setExecutor(new RegisterCommand(this)); @@ -354,7 +354,7 @@ public class AuthMe extends JavaPlugin { //getCommand("unregister").setExecutor(new UnregisterCommand(this)); //getCommand("email").setExecutor(new EmailCommand(this)); //getCommand("captcha").setExecutor(new CaptchaCommand(this)); - getCommand("converter").setExecutor(new ConverterCommand(this)); + //getCommand("converter").setExecutor(new ConverterCommand(this)); // Purge on start if enabled autoPurge(); diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 23d55c52..df5fc41e 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -575,6 +575,36 @@ public class CommandManager { captchaHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); captchaHelpCommand.setMaximumArguments(false); + // Register the base converter command + CommandDescription converterBaseCommand = new CommandDescription( + new ChangePasswordCommand(), + new ArrayList() {{ + add("convert"); + add("converter"); + add("conv"); + }}, + "Convert command", + "Convert command for AuthMeReloaded.", null); + converterBaseCommand.setCommandPermissions("authme.converter", CommandPermissions.DefaultPermission.ALLOWED); + converterBaseCommand.addArgument(new CommandArgumentDescription("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / royalauth / vauth / sqltoflat", false)); + converterBaseCommand.setMaximumArguments(false); + + // Register the help command + CommandDescription converterHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded change captcha commands.", + converterBaseCommand); + converterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + converterHelpCommand.setMaximumArguments(false); + // Add the base commands to the commands array this.commandDescriptions.add(authMeBaseCommand); this.commandDescriptions.add(loginBaseCommand); @@ -584,6 +614,7 @@ public class CommandManager { this.commandDescriptions.add(changePasswordBaseCommand); this.commandDescriptions.add(emailBaseCommand); this.commandDescriptions.add(captchaBaseCommand); + this.commandDescriptions.add(converterBaseCommand); } /** diff --git a/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java b/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java new file mode 100644 index 00000000..42e599f8 --- /dev/null +++ b/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java @@ -0,0 +1,108 @@ +package fr.xephi.authme.command.executable.converter; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; +import fr.xephi.authme.converter.*; +import fr.xephi.authme.settings.Messages; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ConverterCommand extends ExecutableCommand { + + /** + * Execute the command. + * + * @param sender The command sender. + * @param commandReference The command reference. + * @param commandArguments The command arguments. + * + * @return True if the command was executed successfully, false otherwise. + */ + @Override + public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { + // AuthMe plugin instance + final AuthMe plugin = AuthMe.getInstance(); + + // Messages instance + final Messages m = Messages.getInstance(); + + // Get the conversion job + String job = commandArguments.get(0); + + // Determine the job type + ConvertType jobType = ConvertType.fromName(job); + if (jobType == null) { + m.send(sender, "error"); + return true; + } + + // Get the proper converter instance + Converter converter = null; + switch (jobType) { + case ftsql: + converter = new FlatToSql(); + break; + case ftsqlite: + converter = new FlatToSqlite(sender); + break; + case xauth: + converter = new xAuthConverter(plugin, sender); + break; + case crazylogin: + converter = new CrazyLoginConverter(plugin, sender); + break; + case rakamak: + converter = new RakamakConverter(plugin, sender); + break; + case royalauth: + converter = new RoyalAuthConverter(plugin); + break; + case vauth: + converter = new vAuthConverter(plugin, sender); + break; + case sqltoflat: + converter = new SqlToFlat(plugin, sender); + break; + default: + break; + } + + // Run the convert job + Bukkit.getScheduler().runTaskAsynchronously(plugin, converter); + + // Show a status message + sender.sendMessage("[AuthMe] Successfully converted from " + jobType.getName()); + return true; + } + + public enum ConvertType { + ftsql("flattosql"), + ftsqlite("flattosqlite"), + xauth("xauth"), + crazylogin("crazylogin"), + rakamak("rakamak"), + royalauth("royalauth"), + vauth("vauth"), + sqltoflat("sqltoflat"); + + String name; + + ConvertType(String name) { + this.name = name; + } + + String getName() { + return this.name; + } + + public static ConvertType fromName(String name) { + for (ConvertType type : ConvertType.values()) { + if (type.getName().equalsIgnoreCase(name)) + return type; + } + return null; + } + } +} From ffd6d8e52509420d93cd6233285e8dbe1ac2b8e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:46:13 +0100 Subject: [PATCH 371/427] Fixed invalid command references --- src/main/java/fr/xephi/authme/command/CommandManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index df5fc41e..ea84e4f0 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -2,7 +2,9 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; +import fr.xephi.authme.command.executable.captcha.CaptchaCommand; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; +import fr.xephi.authme.command.executable.converter.ConverterCommand; import fr.xephi.authme.command.executable.email.AddEmailCommand; import fr.xephi.authme.command.executable.email.ChangeEmailCommand; import fr.xephi.authme.command.executable.email.RecoverEmailCommand; @@ -418,7 +420,7 @@ public class CommandManager { // Register the base unregister command CommandDescription unregisterBaseCommand = new CommandDescription( - new RegisterCommand(), + new UnregisterCommand(), new ArrayList() {{ add("unregister"); add("unreg"); @@ -548,7 +550,7 @@ public class CommandManager { // Register the base captcha command CommandDescription captchaBaseCommand = new CommandDescription( - new ChangePasswordCommand(), + new CaptchaCommand(), new ArrayList() {{ add("captcha"); add("capt"); @@ -577,7 +579,7 @@ public class CommandManager { // Register the base converter command CommandDescription converterBaseCommand = new CommandDescription( - new ChangePasswordCommand(), + new ConverterCommand(), new ArrayList() {{ add("convert"); add("converter"); From 40fc2c893d55265822281ccb88255114738465c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 21:49:47 +0100 Subject: [PATCH 372/427] Fixed captcha command dependency initializing too early --- .../authme/command/executable/captcha/CaptchaCommand.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java index 0b156287..0b2d6371 100644 --- a/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java @@ -12,11 +12,6 @@ import org.bukkit.entity.Player; public class CaptchaCommand extends ExecutableCommand { - /** - * RandomString instance, for captcha generation. - */ - public static RandomString randStr = new RandomString(Settings.captchaLength); - /** * Execute the command. * @@ -34,6 +29,9 @@ public class CaptchaCommand extends ExecutableCommand { // Messages instance final Messages m = Messages.getInstance(); + // Random string instance, for captcha generation (I think) -- timvisee + RandomString randStr = new RandomString(Settings.captchaLength); + // Get the parameter values String captcha = commandArguments.get(0); From 39c35fd342c799325e39529c54a044fc21fecfa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:06:50 +0100 Subject: [PATCH 373/427] Fixed invalid command references --- .../fr/xephi/authme/command/CommandManager.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index ea84e4f0..3ce26e96 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -2,8 +2,11 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.*; import fr.xephi.authme.command.executable.authme.*; +import fr.xephi.authme.command.executable.authme.ChangePasswordCommand; +import fr.xephi.authme.command.executable.authme.RegisterCommand; +import fr.xephi.authme.command.executable.authme.UnregisterCommand; import fr.xephi.authme.command.executable.captcha.CaptchaCommand; -import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; +import fr.xephi.authme.command.executable.changepassword.*; import fr.xephi.authme.command.executable.converter.ConverterCommand; import fr.xephi.authme.command.executable.email.AddEmailCommand; import fr.xephi.authme.command.executable.email.ChangeEmailCommand; @@ -105,7 +108,7 @@ public class CommandManager { // Register the changepassword command CommandDescription changePasswordCommand = new CommandDescription( - new RegisterCommand(), + new ChangePasswordCommand(), new ArrayList() {{ add("password"); add("changepassword"); @@ -390,7 +393,7 @@ public class CommandManager { // Register the base register command CommandDescription registerBaseCommand = new CommandDescription( - new RegisterCommand(), + new fr.xephi.authme.command.executable.register.RegisterCommand(), new ArrayList() {{ add("register"); add("reg"); @@ -420,7 +423,7 @@ public class CommandManager { // Register the base unregister command CommandDescription unregisterBaseCommand = new CommandDescription( - new UnregisterCommand(), + new fr.xephi.authme.command.executable.unregister.UnregisterCommand(), new ArrayList() {{ add("unregister"); add("unreg"); @@ -429,7 +432,6 @@ public class CommandManager { "Command to unregister using AuthMeReloaded.", null); unregisterBaseCommand.setCommandPermissions("authme.unregister", CommandPermissions.DefaultPermission.ALLOWED); unregisterBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); - unregisterBaseCommand.setMaximumArguments(false); // Register the help command CommandDescription unregisterHelpCommand = new CommandDescription( @@ -449,7 +451,7 @@ public class CommandManager { // Register the base changepassword command CommandDescription changePasswordBaseCommand = new CommandDescription( - new ChangePasswordCommand(), + new fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand(), new ArrayList() {{ add("changepassword"); add("changepass"); @@ -581,8 +583,8 @@ public class CommandManager { CommandDescription converterBaseCommand = new CommandDescription( new ConverterCommand(), new ArrayList() {{ - add("convert"); add("converter"); + add("convert"); add("conv"); }}, "Convert command", From a187bd61caa2ef7ab3bca18b94ea2e34aec9e02b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:06:59 +0100 Subject: [PATCH 374/427] Removed unused import --- src/main/java/fr/xephi/authme/command/CommandManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 3ce26e96..4ce4a02e 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -6,7 +6,6 @@ import fr.xephi.authme.command.executable.authme.ChangePasswordCommand; import fr.xephi.authme.command.executable.authme.RegisterCommand; import fr.xephi.authme.command.executable.authme.UnregisterCommand; import fr.xephi.authme.command.executable.captcha.CaptchaCommand; -import fr.xephi.authme.command.executable.changepassword.*; import fr.xephi.authme.command.executable.converter.ConverterCommand; import fr.xephi.authme.command.executable.email.AddEmailCommand; import fr.xephi.authme.command.executable.email.ChangeEmailCommand; From efeef0e1e9dbece1c21f0546f20370d1678923e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:12:09 +0100 Subject: [PATCH 375/427] Fixed default permissions --- src/main/java/fr/xephi/authme/command/CommandManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 4ce4a02e..a7426f4c 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -588,7 +588,7 @@ public class CommandManager { }}, "Convert command", "Convert command for AuthMeReloaded.", null); - converterBaseCommand.setCommandPermissions("authme.converter", CommandPermissions.DefaultPermission.ALLOWED); + converterBaseCommand.setCommandPermissions("authme.converter", CommandPermissions.DefaultPermission.OP_ONLY); converterBaseCommand.addArgument(new CommandArgumentDescription("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / royalauth / vauth / sqltoflat", false)); converterBaseCommand.setMaximumArguments(false); From 386b80babc76361f40ea5ae5210f2efbae4ecd8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:14:10 +0100 Subject: [PATCH 376/427] Moved a command configuration --- .../xephi/authme/command/CommandManager.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index a7426f4c..8f60a4c0 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -488,6 +488,22 @@ public class CommandManager { "E-mail command", "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null); + // Register the help command + CommandDescription emailHelpCommand = new CommandDescription( + new HelpCommand(), + new ArrayList() {{ + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + }}, + "View help", + "View detailed help pages about AuthMeReloaded help commands.", + emailBaseCommand); + emailHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); + emailHelpCommand.setMaximumArguments(false); + // Register the add command CommandDescription addEmailCommand = new CommandDescription( new AddEmailCommand(), @@ -533,22 +549,6 @@ public class CommandManager { recoverEmailCommand.setCommandPermissions("authme.email.recover", CommandPermissions.DefaultPermission.ALLOWED); recoverEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); - // Register the help command - CommandDescription emailHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded help commands.", - emailBaseCommand); - emailHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); - emailHelpCommand.setMaximumArguments(false); - // Register the base captcha command CommandDescription captchaBaseCommand = new CommandDescription( new CaptchaCommand(), From 5a6f6751a7e97f6521979b8fa7b1f2069a35bf9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:27:31 +0100 Subject: [PATCH 377/427] Changed r command to register --- src/main/java/fr/xephi/authme/command/CommandManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 8f60a4c0..ed139ed5 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -69,6 +69,7 @@ public class CommandManager { new ArrayList() {{ add("register"); add("reg"); + add("r"); }}, "Register a player", "Register the specified player with the specified password.", @@ -83,6 +84,7 @@ public class CommandManager { new ArrayList() {{ add("unregister"); add("unreg"); + add("unr"); add("delete"); add("del"); }}, @@ -315,7 +317,6 @@ public class CommandManager { new ArrayList() {{ add("reload"); add("rld"); - add("r"); }}, "Reload plugin", "Reload the AuthMeReloaded plugin.", From aae78fe9ef008c294e6093c4a71f2684eb89603e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:37:48 +0100 Subject: [PATCH 378/427] Fixed grammar --- src/main/java/fr/xephi/authme/SendMailSSL.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index baac1955..5bf44b52 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -113,9 +113,9 @@ public class SendMailSSL { file.delete(); } catch (RuntimeException e) { - ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); + ConsoleLogger.showError("Some error occurred while trying to send a email to " + mail); } catch (Exception e) { - ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); + ConsoleLogger.showError("Some error occurred while trying to send a email to " + mail); } } From 6089d481a99929c6298964ae942aee482f028e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:38:07 +0100 Subject: [PATCH 379/427] Collapsed catch block --- src/main/java/fr/xephi/authme/SendMailSSL.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 5bf44b52..6c1eb23a 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -112,9 +112,7 @@ public class SendMailSSL { if (file != null) file.delete(); - } catch (RuntimeException e) { - ConsoleLogger.showError("Some error occurred while trying to send a email to " + mail); - } catch (Exception e) { + } catch(Exception e) { ConsoleLogger.showError("Some error occurred while trying to send a email to " + mail); } } From 67a40a6fd0c5858498b1fa26fde0d84c8d7b0833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:38:27 +0100 Subject: [PATCH 380/427] Print a stack trace on STMP error --- src/main/java/fr/xephi/authme/SendMailSSL.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 6c1eb23a..2239f0db 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -113,6 +113,8 @@ public class SendMailSSL { file.delete(); } catch(Exception e) { + // Print the stack trace + e.printStackTrace(); ConsoleLogger.showError("Some error occurred while trying to send a email to " + mail); } } From d69651026d388b61513bd794761eece2b41fad7b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 22:41:26 +0100 Subject: [PATCH 381/427] Fix head rotation --- .../xephi/authme/listener/AuthMePlayerListener.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 4504a11d..70ee50b0 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -139,12 +139,14 @@ public class AuthMePlayerListener implements Listener { return; if (!Settings.isMovementAllowed) { - if (Settings.isRemoveSpeedEnabled) { - player.setWalkSpeed(0.0f); - player.setFlySpeed(0.0f); + if (event.getFrom().distance(event.getTo()) > 0) { + if (Settings.isRemoveSpeedEnabled) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } + event.setTo(event.getFrom()); + return; } - event.setTo(event.getFrom()); - return; } if (Settings.getMovementRadius <= 0) { From d401ad1dabe80344c140806b29ead42d5f1bd51b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 22:43:48 +0100 Subject: [PATCH 382/427] I'm so stupid --- src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 70ee50b0..1ef4c3d6 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -77,6 +77,7 @@ public class AuthMePlayerListener implements Listener { return; } } + event.setCancelled(true); if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) { m.send(player, "login_msg"); From 1f888abc12dd79309551ad09ff13a588f10fc129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 22:54:37 +0100 Subject: [PATCH 383/427] Updated javax mail implementation --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 47b6bb2a..16fda3ff 100644 --- a/pom.xml +++ b/pom.xml @@ -206,9 +206,9 @@ - com.sun.mail - javax.mail - 1.5.4 + javax.mail + javax.mail-api + 1.5.1 compile From 0fbeefc4888fd09a81eeaca2299f14e764c241b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 23:16:09 +0100 Subject: [PATCH 384/427] Reverted javax mail implementation --- pom.xml | 6 +++--- .../command/executable/email/RecoverEmailCommand.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 16fda3ff..47b6bb2a 100644 --- a/pom.xml +++ b/pom.xml @@ -206,9 +206,9 @@ - javax.mail - javax.mail-api - 1.5.1 + com.sun.mail + javax.mail + 1.5.4 compile diff --git a/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java index 2680613b..13628f90 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java @@ -83,6 +83,7 @@ public class RecoverEmailCommand extends ExecutableCommand { plugin.mail.main(auth, thePass); m.send(player, "email_send"); } catch (NoSuchAlgorithmException | NoClassDefFoundError ex) { + ex.printStackTrace(); ConsoleLogger.showError(ex.getMessage()); m.send(sender, "error"); } From 3643afdea3ded4b1809406e3903f4456e86dabf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 23:29:47 +0100 Subject: [PATCH 385/427] Moved Utils class to util package --- src/main/java/fr/xephi/authme/AuthMe.java | 10 +--------- src/main/java/fr/xephi/authme/DataManager.java | 1 + src/main/java/fr/xephi/authme/api/API.java | 2 +- src/main/java/fr/xephi/authme/api/NewAPI.java | 2 +- .../java/fr/xephi/authme/cache/backup/JsonCache.java | 2 +- .../command/executable/authme/UnregisterCommand.java | 2 +- .../java/fr/xephi/authme/commands/AdminCommand.java | 4 ++-- .../fr/xephi/authme/datasource/CacheDataSource.java | 2 +- .../fr/xephi/authme/listener/AuthMeBlockListener.java | 2 +- .../fr/xephi/authme/listener/AuthMeEntityListener.java | 2 +- .../fr/xephi/authme/listener/AuthMePlayerListener.java | 2 +- .../xephi/authme/listener/AuthMePlayerListener16.java | 2 +- .../xephi/authme/listener/AuthMePlayerListener18.java | 2 +- .../fr/xephi/authme/listener/AuthMeServerListener.java | 2 +- .../fr/xephi/authme/process/join/AsyncronousJoin.java | 4 ++-- .../xephi/authme/process/login/AsyncronousLogin.java | 2 +- .../process/login/ProcessSyncronousPlayerLogin.java | 4 ++-- .../xephi/authme/process/logout/AsyncronousLogout.java | 4 ++-- .../fr/xephi/authme/process/quit/AsyncronousQuit.java | 2 +- .../register/ProcessSyncronousEmailRegister.java | 2 +- .../register/ProcessSyncronousPasswordRegister.java | 2 +- .../process/unregister/AsyncronousUnregister.java | 4 ++-- src/main/java/fr/xephi/authme/task/MessageTask.java | 2 +- src/main/java/fr/xephi/authme/{ => util}/Utils.java | 4 +++- 24 files changed, 31 insertions(+), 36 deletions(-) rename src/main/java/fr/xephi/authme/{ => util}/Utils.java (99%) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 390ce879..ce737377 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -12,6 +12,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; import fr.xephi.authme.command.CommandHandler; +import fr.xephi.authme.util.Utils; import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -37,15 +38,6 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.commands.AdminCommand; -import fr.xephi.authme.commands.CaptchaCommand; -import fr.xephi.authme.commands.ChangePasswordCommand; -import fr.xephi.authme.commands.ConverterCommand; -import fr.xephi.authme.commands.EmailCommand; -import fr.xephi.authme.commands.LoginCommand; -import fr.xephi.authme.commands.LogoutCommand; -import fr.xephi.authme.commands.RegisterCommand; -import fr.xephi.authme.commands.UnregisterCommand; import fr.xephi.authme.converter.Converter; import fr.xephi.authme.converter.ForceFlatToSqlite; import fr.xephi.authme.datasource.CacheDataSource; diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 2d08489d..2f1459cc 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -7,6 +7,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import fr.xephi.authme.util.Utils; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index 79eaeaff..eeb6a9cf 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -9,7 +9,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.security.PasswordSecurity; diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index e1426f6f..b965abaf 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -9,7 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.security.PasswordSecurity; diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index 837bf45a..d2b3ae24 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -19,7 +19,7 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.settings.Settings; public class JsonCache { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java index e04b8889..c2893eba 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java @@ -2,7 +2,7 @@ package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.command.CommandParts; diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index a5c77430..c868ea98 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -20,8 +20,8 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.GroupType; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 12d52c2e..e9f0638d 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -10,7 +10,7 @@ import java.util.concurrent.Executors; import org.bukkit.entity.Player; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index 3708b702..c8bb7b0b 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -7,7 +7,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; public class AuthMeBlockListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index 51b953fc..1a26a084 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -20,7 +20,7 @@ import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.projectiles.ProjectileSource; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; public class AuthMeEntityListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 4504a11d..9d12310f 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -42,7 +42,7 @@ import com.google.common.io.ByteStreams; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java index d535e351..86560a3b 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java @@ -7,7 +7,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerEditBookEvent; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; public class AuthMePlayerListener16 implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java index 0ca2fb78..27a00e71 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java @@ -7,7 +7,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; public class AuthMePlayerListener18 implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index bde28732..92d67ab2 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -9,7 +9,7 @@ import org.bukkit.event.server.ServerListPingEvent; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index b52833e4..0feb468a 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -13,8 +13,8 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.GroupType; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java index a3b43791..e35b1708 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java @@ -9,7 +9,7 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 00322f68..daeb6112 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -8,8 +8,8 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.potion.PotionEffectType; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.GroupType; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index 0d4e4002..dca7d2ca 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -5,8 +5,8 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.GroupType; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 26917e63..0591666f 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index 280daa29..652038c8 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -6,7 +6,7 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.settings.Messages; diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 02ffe2a1..25ebcdc2 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -10,7 +10,7 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.events.AuthMeTeleportEvent; diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java index 1822eac8..31547939 100644 --- a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java +++ b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java @@ -11,8 +11,8 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.Utils; -import fr.xephi.authme.Utils.GroupType; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/task/MessageTask.java b/src/main/java/fr/xephi/authme/task/MessageTask.java index bbef229f..53c1510a 100644 --- a/src/main/java/fr/xephi/authme/task/MessageTask.java +++ b/src/main/java/fr/xephi/authme/task/MessageTask.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; +import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java similarity index 99% rename from src/main/java/fr/xephi/authme/Utils.java rename to src/main/java/fr/xephi/authme/util/Utils.java index 75d8ca61..a833d907 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -1,4 +1,4 @@ -package fr.xephi.authme; +package fr.xephi.authme.util; import java.io.File; import java.io.FileOutputStream; @@ -12,6 +12,8 @@ import java.util.Collection; import java.util.Collections; import java.util.zip.GZIPInputStream; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; From 175da3f6fcc4ef10be196882bb0337190304ee0d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 1 Nov 2015 23:35:10 +0100 Subject: [PATCH 386/427] Cleanup! --- pom.xml | 13 +++++----- src/main/java/fr/xephi/authme/AuthMe.java | 11 +------- .../authme/command/CommandDescription.java | 7 ++--- .../xephi/authme/command/CommandHandler.java | 11 ++++---- .../xephi/authme/command/CommandManager.java | 26 +++++++++++++++---- .../fr/xephi/authme/command/CommandParts.java | 6 ++--- .../authme/command/CommandPermissions.java | 11 ++++---- .../command/executable/HelpCommand.java | 3 ++- .../executable/authme/AccountsCommand.java | 9 ++++--- .../executable/authme/AuthMeCommand.java | 5 ++-- .../authme/ChangePasswordCommand.java | 9 ++++--- .../executable/authme/FirstSpawnCommand.java | 5 ++-- .../executable/authme/ForceLoginCommand.java | 7 ++--- .../executable/authme/GetEmailCommand.java | 3 ++- .../executable/authme/GetIpCommand.java | 7 ++--- .../executable/authme/LastLoginCommand.java | 7 ++--- .../authme/PurgeBannedPlayersCommand.java | 11 ++++---- .../executable/authme/PurgeCommand.java | 11 ++++---- .../authme/PurgeLastPositionCommand.java | 5 ++-- .../executable/authme/RegisterCommand.java | 9 ++++--- .../executable/authme/ReloadCommand.java | 6 ++--- .../executable/authme/ResetNameCommand.java | 9 ++++--- .../executable/authme/SetEmailCommand.java | 3 ++- .../authme/SetFirstSpawnCommand.java | 5 ++-- .../executable/authme/SetSpawnCommand.java | 5 ++-- .../executable/authme/SpawnCommand.java | 5 ++-- .../authme/SwitchAntiBotCommand.java | 5 ++-- .../executable/authme/UnregisterCommand.java | 17 ++++++------ .../executable/authme/VersionCommand.java | 7 ++--- .../executable/captcha/CaptchaCommand.java | 5 ++-- .../changepassword/ChangePasswordCommand.java | 5 ++-- .../converter/ConverterCommand.java | 16 +++++++++--- .../executable/email/AddEmailCommand.java | 5 ++-- .../executable/email/ChangeEmailCommand.java | 9 ++++--- .../executable/email/RecoverEmailCommand.java | 9 ++++--- .../executable/login/LoginCommand.java | 5 ++-- .../executable/logout/LogoutCommand.java | 5 ++-- .../executable/register/RegisterCommand.java | 5 ++-- .../unregister/UnregisterCommand.java | 5 ++-- .../authme/command/help/HelpPrinter.java | 17 ++++++------ .../authme/command/help/HelpProvider.java | 7 +++-- .../authme/command/help/HelpSyntaxHelper.java | 3 ++- 42 files changed, 194 insertions(+), 140 deletions(-) diff --git a/pom.xml b/pom.xml index 47b6bb2a..ecb05302 100644 --- a/pom.xml +++ b/pom.xml @@ -210,12 +210,13 @@ javax.mail 1.5.4 compile - - - activation - javax.activation - - + true + + + javax.mail + javax.mail-api + 1.5.4 + compile true diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 1bceb5a5..5bdf0f4e 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; -import fr.xephi.authme.command.CommandHandler; import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -37,15 +36,7 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.commands.AdminCommand; -import fr.xephi.authme.commands.CaptchaCommand; -import fr.xephi.authme.commands.ChangePasswordCommand; -import fr.xephi.authme.commands.ConverterCommand; -import fr.xephi.authme.commands.EmailCommand; -import fr.xephi.authme.commands.LoginCommand; -import fr.xephi.authme.commands.LogoutCommand; -import fr.xephi.authme.commands.RegisterCommand; -import fr.xephi.authme.commands.UnregisterCommand; +import fr.xephi.authme.command.CommandHandler; import fr.xephi.authme.converter.Converter; import fr.xephi.authme.converter.ForceFlatToSqlite; import fr.xephi.authme.datasource.CacheDataSource; diff --git a/src/main/java/fr/xephi/authme/command/CommandDescription.java b/src/main/java/fr/xephi/authme/command/CommandDescription.java index 018ac79b..be635d42 100644 --- a/src/main/java/fr/xephi/authme/command/CommandDescription.java +++ b/src/main/java/fr/xephi/authme/command/CommandDescription.java @@ -1,13 +1,14 @@ package fr.xephi.authme.command; -import fr.xephi.authme.util.StringUtils; -import org.bukkit.command.CommandSender; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; +import org.bukkit.command.CommandSender; + +import fr.xephi.authme.util.StringUtils; + @SuppressWarnings("UnusedDeclaration") public class CommandDescription { diff --git a/src/main/java/fr/xephi/authme/command/CommandHandler.java b/src/main/java/fr/xephi/authme/command/CommandHandler.java index 1eb46ca0..f11ced44 100644 --- a/src/main/java/fr/xephi/authme/command/CommandHandler.java +++ b/src/main/java/fr/xephi/authme/command/CommandHandler.java @@ -1,14 +1,15 @@ package fr.xephi.authme.command; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.command.help.HelpProvider; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.help.HelpProvider; + public class CommandHandler { /** The command manager instance. */ diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index ed139ed5..09aa84cf 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -1,10 +1,29 @@ package fr.xephi.authme.command; -import fr.xephi.authme.command.executable.*; -import fr.xephi.authme.command.executable.authme.*; +import java.util.ArrayList; +import java.util.List; + +import fr.xephi.authme.command.executable.HelpCommand; +import fr.xephi.authme.command.executable.authme.AccountsCommand; +import fr.xephi.authme.command.executable.authme.AuthMeCommand; import fr.xephi.authme.command.executable.authme.ChangePasswordCommand; +import fr.xephi.authme.command.executable.authme.FirstSpawnCommand; +import fr.xephi.authme.command.executable.authme.ForceLoginCommand; +import fr.xephi.authme.command.executable.authme.GetEmailCommand; +import fr.xephi.authme.command.executable.authme.GetIpCommand; +import fr.xephi.authme.command.executable.authme.LastLoginCommand; +import fr.xephi.authme.command.executable.authme.PurgeBannedPlayersCommand; +import fr.xephi.authme.command.executable.authme.PurgeCommand; +import fr.xephi.authme.command.executable.authme.PurgeLastPositionCommand; import fr.xephi.authme.command.executable.authme.RegisterCommand; +import fr.xephi.authme.command.executable.authme.ReloadCommand; +import fr.xephi.authme.command.executable.authme.SetEmailCommand; +import fr.xephi.authme.command.executable.authme.SetFirstSpawnCommand; +import fr.xephi.authme.command.executable.authme.SetSpawnCommand; +import fr.xephi.authme.command.executable.authme.SpawnCommand; +import fr.xephi.authme.command.executable.authme.SwitchAntiBotCommand; import fr.xephi.authme.command.executable.authme.UnregisterCommand; +import fr.xephi.authme.command.executable.authme.VersionCommand; import fr.xephi.authme.command.executable.captcha.CaptchaCommand; import fr.xephi.authme.command.executable.converter.ConverterCommand; import fr.xephi.authme.command.executable.email.AddEmailCommand; @@ -13,9 +32,6 @@ import fr.xephi.authme.command.executable.email.RecoverEmailCommand; import fr.xephi.authme.command.executable.login.LoginCommand; import fr.xephi.authme.command.executable.logout.LogoutCommand; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings("UnusedDeclaration") public class CommandManager { diff --git a/src/main/java/fr/xephi/authme/command/CommandParts.java b/src/main/java/fr/xephi/authme/command/CommandParts.java index 6f9f8559..732e9199 100644 --- a/src/main/java/fr/xephi/authme/command/CommandParts.java +++ b/src/main/java/fr/xephi/authme/command/CommandParts.java @@ -1,11 +1,11 @@ package fr.xephi.authme.command; -import fr.xephi.authme.util.ListUtils; -import fr.xephi.authme.util.StringUtils; - import java.util.ArrayList; import java.util.List; +import fr.xephi.authme.util.ListUtils; +import fr.xephi.authme.util.StringUtils; + public class CommandParts { /** The list of parts for this command. */ diff --git a/src/main/java/fr/xephi/authme/command/CommandPermissions.java b/src/main/java/fr/xephi/authme/command/CommandPermissions.java index 3ebe5baa..7628ea44 100644 --- a/src/main/java/fr/xephi/authme/command/CommandPermissions.java +++ b/src/main/java/fr/xephi/authme/command/CommandPermissions.java @@ -1,13 +1,14 @@ package fr.xephi.authme.command; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + //import com.timvisee.dungeonmaze.Core; //import com.timvisee.dungeonmaze.permission.PermissionsManager; import fr.xephi.authme.AuthMe; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.List; @SuppressWarnings("UnusedDeclaration") public class CommandPermissions { diff --git a/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java b/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java index 3ddcb5a5..831db024 100644 --- a/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/HelpCommand.java @@ -1,9 +1,10 @@ package fr.xephi.authme.command.executable; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.command.help.HelpProvider; -import org.bukkit.command.CommandSender; public class HelpCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java index fddf078a..aa8753c4 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java @@ -1,14 +1,15 @@ package fr.xephi.authme.command.executable.authme; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; - -import java.util.List; public class AccountsCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java index 06f66fae..72ff623f 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java @@ -1,10 +1,11 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; public class AuthMeCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java index 4e2a0c2a..d226a436 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ChangePasswordCommand.java @@ -1,5 +1,10 @@ package fr.xephi.authme.command.executable.authme; +import java.security.NoSuchAlgorithmException; + +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -9,10 +14,6 @@ import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; - -import java.security.NoSuchAlgorithmException; public class ChangePasswordCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java index 4cf5789d..99907080 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/FirstSpawnCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Spawn; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class FirstSpawnCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java index e4f285be..17c5d8a4 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ForceLoginCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class ForceLoginCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java index 76d5423c..1ed99ff9 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/GetEmailCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import org.bukkit.command.CommandSender; public class GetEmailCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java index d67b7d63..61a4c2b6 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/GetIpCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class GetIpCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java index 121a4c15..1cef6e56 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/LastLoginCommand.java @@ -1,13 +1,14 @@ package fr.xephi.authme.command.executable.authme; +import java.util.Date; + +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import org.bukkit.command.CommandSender; - -import java.util.Date; public class LastLoginCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java index 32c2937c..ad966b44 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeBannedPlayersCommand.java @@ -1,14 +1,15 @@ package fr.xephi.authme.command.executable.authme; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Settings; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.CommandSender; - -import java.util.ArrayList; -import java.util.List; public class PurgeBannedPlayersCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/PurgeCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeCommand.java index d207d34e..e2f855e6 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/PurgeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/PurgeCommand.java @@ -1,14 +1,15 @@ package fr.xephi.authme.command.executable.authme; +import java.util.Calendar; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Settings; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -import java.util.Calendar; -import java.util.List; public class PurgeCommand extends ExecutableCommand { 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 e74e6651..c7ea009b 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 @@ -1,13 +1,14 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class PurgeLastPositionCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java index 782cc787..7a51fd3c 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterCommand.java @@ -1,5 +1,10 @@ package fr.xephi.authme.command.executable.authme; +import java.security.NoSuchAlgorithmException; + +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -8,10 +13,6 @@ import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; - -import java.security.NoSuchAlgorithmException; public class RegisterCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java index 1d1dea02..cfc7b113 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java @@ -1,15 +1,15 @@ package fr.xephi.authme.command.executable.authme; +//import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; - import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.Profiler; -//import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; public class ReloadCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java index 900cd0b9..4715c00d 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ResetNameCommand.java @@ -1,13 +1,14 @@ package fr.xephi.authme.command.executable.authme; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; - -import java.util.List; public class ResetNameCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java index ffe8d950..8011de24 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SetEmailCommand.java @@ -1,5 +1,7 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; @@ -7,7 +9,6 @@ import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; public class SetEmailCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java index c51aa6f7..f8c469d7 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SetFirstSpawnCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Spawn; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class SetFirstSpawnCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java index ada37f41..7d65d666 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SetSpawnCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Spawn; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class SetSpawnCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java index 4e68fb9f..250e9d2f 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SpawnCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Spawn; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class SpawnCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java index b3adf430..a9e34662 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/SwitchAntiBotCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.command.help.HelpProvider; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; public class SwitchAntiBotCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java index e04b8889..176fda08 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java @@ -1,5 +1,14 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; @@ -12,14 +21,6 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; public class UnregisterCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java index aaa823f4..e49b6115 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java @@ -1,13 +1,14 @@ package fr.xephi.authme.command.executable.authme; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.command.CommandParts; -import fr.xephi.authme.command.ExecutableCommand; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.ExecutableCommand; + public class VersionCommand extends ExecutableCommand { /** diff --git a/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java index 0b2d6371..81f4c50f 100644 --- a/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java @@ -1,5 +1,8 @@ package fr.xephi.authme.command.executable.captcha; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.command.CommandParts; @@ -7,8 +10,6 @@ import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class CaptchaCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java index bebba5b4..20649792 100644 --- a/src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/changepassword/ChangePasswordCommand.java @@ -1,5 +1,8 @@ package fr.xephi.authme.command.executable.changepassword; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.command.CommandParts; @@ -7,8 +10,6 @@ import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.ChangePasswordTask; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class ChangePasswordCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java b/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java index 42e599f8..a593dc3a 100644 --- a/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java @@ -1,13 +1,21 @@ package fr.xephi.authme.command.executable.converter; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import fr.xephi.authme.converter.*; +import fr.xephi.authme.converter.Converter; +import fr.xephi.authme.converter.CrazyLoginConverter; +import fr.xephi.authme.converter.FlatToSql; +import fr.xephi.authme.converter.FlatToSqlite; +import fr.xephi.authme.converter.RakamakConverter; +import fr.xephi.authme.converter.RoyalAuthConverter; +import fr.xephi.authme.converter.SqlToFlat; +import fr.xephi.authme.converter.vAuthConverter; +import fr.xephi.authme.converter.xAuthConverter; import fr.xephi.authme.settings.Messages; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class ConverterCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java index 3fa8e0f2..f91e6a24 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java @@ -1,5 +1,8 @@ package fr.xephi.authme.command.executable.email; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; @@ -7,8 +10,6 @@ import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class AddEmailCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java index aad9bc22..b7f71736 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java @@ -1,5 +1,10 @@ package fr.xephi.authme.command.executable.email; +import java.util.Arrays; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; @@ -7,10 +12,6 @@ import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.Arrays; public class ChangeEmailCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java index 13628f90..26e74165 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java @@ -1,5 +1,10 @@ package fr.xephi.authme.command.executable.email; +import java.security.NoSuchAlgorithmException; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -10,10 +15,6 @@ import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.security.NoSuchAlgorithmException; public class RecoverEmailCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java index 22b57dcd..edb34910 100644 --- a/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/login/LoginCommand.java @@ -1,10 +1,11 @@ package fr.xephi.authme.command.executable.login; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class LoginCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java b/src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java index 95b5ab9c..0dfcbaf4 100644 --- a/src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/logout/LogoutCommand.java @@ -1,10 +1,11 @@ package fr.xephi.authme.command.executable.logout; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class LogoutCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java index b08190fc..45e3c470 100644 --- a/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java @@ -1,13 +1,14 @@ package fr.xephi.authme.command.executable.register; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class RegisterCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java index 20055203..66af5abc 100644 --- a/src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/unregister/UnregisterCommand.java @@ -1,12 +1,13 @@ package fr.xephi.authme.command.executable.unregister; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class UnregisterCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java b/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java index 17aeb163..4f28eb29 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpPrinter.java @@ -1,19 +1,20 @@ package fr.xephi.authme.command.help; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandArgumentDescription; import fr.xephi.authme.command.CommandDescription; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.CommandPermissions; import fr.xephi.authme.util.StringUtils; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; public class HelpPrinter { diff --git a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java index 000f721e..4cf27c6d 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java @@ -1,10 +1,13 @@ package fr.xephi.authme.command.help; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.command.*; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.command.CommandDescription; +import fr.xephi.authme.command.CommandParts; +import fr.xephi.authme.command.FoundCommandResult; + public class HelpProvider { /** diff --git a/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java b/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java index 492a4f14..b2c40875 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpSyntaxHelper.java @@ -1,10 +1,11 @@ package fr.xephi.authme.command.help; +import org.bukkit.ChatColor; + import fr.xephi.authme.command.CommandArgumentDescription; import fr.xephi.authme.command.CommandDescription; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.util.ListUtils; -import org.bukkit.ChatColor; public class HelpSyntaxHelper { From da9cfc93d34d694cc5ac6b66d588b89f147e7130 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Mon, 2 Nov 2015 05:51:07 +0700 Subject: [PATCH 387/427] cleanup command pre process --- .../authme/listener/AuthMePlayerListener.java | 37 ++++++-------- .../fr/xephi/authme/settings/Settings.java | 51 +++++++++---------- 2 files changed, 39 insertions(+), 49 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 3f087319..6cbfb2da 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -66,35 +66,30 @@ public class AuthMePlayerListener implements Listener { private void handleChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); - if (!Utils.checkAuth(player)) { - String cmd = event.getMessage().split(" ")[0]; - if (cmd.startsWith("/")) { - if (Settings.allowCommands.contains(cmd)) { - return; - } - } else { - if (Settings.isChatAllowed) { - return; - } - } - event.setCancelled(true); + if (Utils.checkAuth(player)) + return; - if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) { - m.send(player, "login_msg"); + if (Settings.isChatAllowed) { + return; + } + event.setCancelled(true); + + if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) { + m.send(player, "login_msg"); + } else { + if (Settings.emailRegistration) { + m.send(player, "reg_email_msg"); } else { - if (Settings.emailRegistration) { - m.send(player, "reg_email_msg"); - } else { - m.send(player, "reg_msg"); - } + m.send(player, "reg_msg"); } } + } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - String cmd = event.getMessage().split(" ")[0]; - if (Settings.useEssentialsMotd && cmd.equalsIgnoreCase("/motd")) + String cmd = event.getMessage().split(" ")[0].toLowerCase(); + if (Settings.useEssentialsMotd && cmd.equals("/motd")) return; if (Settings.allowCommands.contains(cmd)) return; diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 84672b38..a2886ccf 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -1,22 +1,16 @@ package fr.xephi.authme.settings; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.bukkit.configuration.file.YamlConfiguration; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource.DataSourceType; import fr.xephi.authme.security.HashAlgorithm; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; public final class Settings extends YamlConfiguration { @@ -193,21 +187,22 @@ public final class Settings extends YamlConfiguration { backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); - allowCommands = configFile.getStringList("settings.restrictions.allowCommands"); - if (configFile.contains("allowCommands")) { - if (!allowCommands.contains("/login")) - allowCommands.add("/login"); - if (!allowCommands.contains("/register")) - allowCommands.add("/register"); - if (!allowCommands.contains("/l")) - allowCommands.add("/l"); - if (!allowCommands.contains("/reg")) - allowCommands.add("/reg"); - if (!allowCommands.contains("/email")) - allowCommands.add("/email"); - if (!allowCommands.contains("/captcha")) - allowCommands.add("/captcha"); + allowCommands = new ArrayList<>(); + for (String cmd : configFile.getStringList("settings.restrictions.allowCommands")) { + allowCommands.add(cmd.toLowerCase()); } + if (!allowCommands.contains("/login")) + allowCommands.add("/login"); + if (!allowCommands.contains("/register")) + allowCommands.add("/register"); + if (!allowCommands.contains("/l")) + allowCommands.add("/l"); + if (!allowCommands.contains("/reg")) + allowCommands.add("/reg"); + if (!allowCommands.contains("/email")) + allowCommands.add("/email"); + if (!allowCommands.contains("/captcha")) + allowCommands.add("/captcha"); rakamakUsers = configFile.getString("Converter.Rakamak.fileName", "users.rak"); rakamakUsersIp = configFile.getString("Converter.Rakamak.ipFileName", "UsersIp.rak"); rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false); @@ -491,8 +486,8 @@ public final class Settings extends YamlConfiguration { changes = true; } if (!contains("DataSource.mySQLQueryCache")) { - set("DataSource.mySQLWebsite", false); - changes = true; + set("DataSource.mySQLWebsite", false); + changes = true; } if (changes) { From 5e7c5560cf2713d26fb01a57193c8a51406b3b4e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 2 Nov 2015 00:09:34 +0100 Subject: [PATCH 388/427] Cleanup2: The Revenge --- src/main/java/fr/xephi/authme/AuthMe.java | 3 +-- src/main/java/fr/xephi/authme/DataManager.java | 2 +- src/main/java/fr/xephi/authme/api/API.java | 2 +- src/main/java/fr/xephi/authme/api/NewAPI.java | 2 +- src/main/java/fr/xephi/authme/cache/backup/JsonCache.java | 2 +- src/main/java/fr/xephi/authme/command/CommandManager.java | 2 +- .../authme/command/executable/authme/ReloadCommand.java | 5 +++-- .../authme/command/executable/authme/UnregisterCommand.java | 2 +- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 4 ++-- .../java/fr/xephi/authme/datasource/CacheDataSource.java | 2 +- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 2 +- .../java/fr/xephi/authme/listener/AuthMeServerListener.java | 2 +- .../java/fr/xephi/authme/process/join/AsyncronousJoin.java | 4 ++-- .../java/fr/xephi/authme/process/login/AsyncronousLogin.java | 2 +- .../authme/process/login/ProcessSyncronousPlayerLogin.java | 4 ++-- .../fr/xephi/authme/process/logout/AsyncronousLogout.java | 4 ++-- .../java/fr/xephi/authme/process/quit/AsyncronousQuit.java | 2 +- .../process/register/ProcessSyncronousEmailRegister.java | 2 +- .../process/register/ProcessSyncronousPasswordRegister.java | 2 +- .../authme/process/unregister/AsyncronousUnregister.java | 4 ++-- src/main/java/fr/xephi/authme/task/MessageTask.java | 2 +- src/main/java/fr/xephi/authme/util/Utils.java | 4 ++-- 22 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 981b4eaa..dbf99b6c 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -11,8 +11,6 @@ import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; -import fr.xephi.authme.command.CommandHandler; -import fr.xephi.authme.util.Utils; import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -63,6 +61,7 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.OtherAccounts; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; +import fr.xephi.authme.util.Utils; import net.milkbowl.vault.permission.Permission; import net.minelink.ctplus.CombatTagPlus; diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 2f1459cc..95a9ab53 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -7,12 +7,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import fr.xephi.authme.util.Utils; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; import net.milkbowl.vault.permission.Permission; public class DataManager { diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java index eeb6a9cf..96dcc2a6 100644 --- a/src/main/java/fr/xephi/authme/api/API.java +++ b/src/main/java/fr/xephi/authme/api/API.java @@ -9,11 +9,11 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; public class API { diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index b965abaf..6c48286a 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -9,11 +9,11 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; public class NewAPI { diff --git a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java index d2b3ae24..31c647cb 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/JsonCache.java @@ -19,8 +19,8 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; public class JsonCache { diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 09aa84cf..694fd780 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -52,7 +52,7 @@ public class CommandManager { /** * Register all commands. */ - @SuppressWarnings("SpellCheckingInspection") + @SuppressWarnings({ "SpellCheckingInspection", "serial" }) public void registerCommands() { // Register the base AuthMe Reloaded command CommandDescription authMeBaseCommand = new CommandDescription( diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java index cfc7b113..4cb450d0 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java @@ -34,7 +34,7 @@ public class ReloadCommand extends ExecutableCommand { Messages m = Messages.getInstance(); // Show a status message - //sender.sendMessage(ChatColor.YELLOW + "Reloading AuthMeReloaded..."); + // sender.sendMessage(ChatColor.YELLOW + "Reloading AuthMeReloaded..."); try { Settings.reload(); @@ -49,10 +49,11 @@ public class ReloadCommand extends ExecutableCommand { } // Show a status message + // TODO: add the profiler result m.send(sender, "reload"); // AuthMeReloaded reloaded, show a status message - //sender.sendMessage(ChatColor.GREEN + "AuthMeReloaded has been reloaded successfully, took " + p.getTimeFormatted() + "!"); + // sender.sendMessage(ChatColor.GREEN + "AuthMeReloaded has been reloaded successfully, took " + p.getTimeFormatted() + "!"); return true; } } diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java index a0c99942..4bb057e5 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java @@ -11,7 +11,6 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.command.CommandParts; @@ -21,6 +20,7 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import fr.xephi.authme.util.Utils; public class UnregisterCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index c868ea98..f482f19b 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -20,8 +20,6 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; -import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -32,6 +30,8 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; public class AdminCommand implements CommandExecutor { diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index e9f0638d..0032b9a0 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -10,9 +10,9 @@ import java.util.concurrent.Executors; import org.bukkit.entity.Player; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; +import fr.xephi.authme.util.Utils; public class CacheDataSource implements DataSource { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 6cbfb2da..479b8692 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -42,13 +42,13 @@ import com.google.common.io.ByteStreams; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; 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.cache.limbo.LimboPlayer; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; public class AuthMePlayerListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 92d67ab2..a493080a 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -9,9 +9,9 @@ import org.bukkit.event.server.ServerListPingEvent; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; public class AuthMeServerListener implements Listener { diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 8aaf53ed..04317f77 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -13,8 +13,6 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; -import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -28,6 +26,8 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; public class AsyncronousJoin { diff --git a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java index e35b1708..4879ea8b 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java @@ -9,7 +9,6 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -21,6 +20,7 @@ import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; +import fr.xephi.authme.util.Utils; public class AsyncronousLogin { diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index daeb6112..ec35d128 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -8,8 +8,6 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.potion.PotionEffectType; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.util.Utils; -import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -21,6 +19,8 @@ import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; public class ProcessSyncronousPlayerLogin implements Runnable { diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index dca7d2ca..e8bfd6ab 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -5,8 +5,6 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.util.Utils; -import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -14,6 +12,8 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.events.AuthMeTeleportEvent; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; public class AsyncronousLogout { diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 0591666f..3085fb4e 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -6,7 +6,6 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -14,6 +13,7 @@ import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.Utils; public class AsyncronousQuit { diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index 652038c8..0b1a723d 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -6,13 +6,13 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import fr.xephi.authme.util.Utils; public class ProcessSyncronousEmailRegister implements Runnable { diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 25ebcdc2..56b7158b 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -10,7 +10,6 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.events.AuthMeTeleportEvent; @@ -21,6 +20,7 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import fr.xephi.authme.util.Utils; public class ProcessSyncronousPasswordRegister implements Runnable { diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java index 31547939..71a79688 100644 --- a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java +++ b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java @@ -11,8 +11,6 @@ import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.util.Utils; -import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; @@ -22,6 +20,8 @@ import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; +import fr.xephi.authme.util.Utils; +import fr.xephi.authme.util.Utils.GroupType; public class AsyncronousUnregister { diff --git a/src/main/java/fr/xephi/authme/task/MessageTask.java b/src/main/java/fr/xephi/authme/task/MessageTask.java index 53c1510a..7c92b1c9 100644 --- a/src/main/java/fr/xephi/authme/task/MessageTask.java +++ b/src/main/java/fr/xephi/authme/task/MessageTask.java @@ -4,9 +4,9 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.util.Utils; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.util.Utils; public class MessageTask implements Runnable { diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index a833d907..76915420 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -12,8 +12,6 @@ import java.util.Collection; import java.util.Collections; import java.util.zip.GZIPInputStream; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -23,6 +21,8 @@ import org.bukkit.entity.Player; import com.maxmind.geoip.LookupService; +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; From 7b4ea381ef50c33d902e83d55568afcd2e5b0a2c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 2 Nov 2015 01:47:32 +0100 Subject: [PATCH 389/427] Update team --- team.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/team.txt b/team.txt index 427516ce..e1c7e860 100644 --- a/team.txt +++ b/team.txt @@ -1,13 +1,14 @@ AuthMe-Team: Active staff: -Xephi (Xephi59) - Leader, Main developer (temporary inactive) +Xephi (Xephi59) - Leader, Main developer DNx5 - Developer games647 - Developer +TimVisee - Developer Gabriele C. (sgdc3) - Project Manager, Contributor Staff to contact: -CryLegend - Contributor, AuthMeBridge Developer (Need activation) +CryLegend - Contributor, AuthMeBridge Developer (Needs activation) External Contributors: Gnat008 - Contributor From 2cd7bc8512c6f9420418c778a1cc44e617bffadc Mon Sep 17 00:00:00 2001 From: vanhec_a Date: Mon, 2 Nov 2015 10:16:01 +0100 Subject: [PATCH 390/427] Check a boolean is a quickest way than check database :) --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 479b8692..cf0eefc0 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -66,12 +66,12 @@ public class AuthMePlayerListener implements Listener { private void handleChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); + + if (Settings.isChatAllowed) + return; if (Utils.checkAuth(player)) return; - if (Settings.isChatAllowed) { - return; - } event.setCancelled(true); if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) { From 4fd8d6e0cda78681456fecc77fbc1d2bbfe9ba24 Mon Sep 17 00:00:00 2001 From: Xephi Date: Mon, 2 Nov 2015 10:25:53 +0100 Subject: [PATCH 391/427] Don't use SuppressWarnings please :3 --- .../fr/xephi/authme/command/CommandArgumentDescription.java | 1 - src/main/java/fr/xephi/authme/command/CommandDescription.java | 1 - src/main/java/fr/xephi/authme/command/CommandHandler.java | 3 +-- src/main/java/fr/xephi/authme/command/CommandManager.java | 3 +-- src/main/java/fr/xephi/authme/command/CommandParts.java | 1 - src/main/java/fr/xephi/authme/command/CommandPermissions.java | 1 - src/main/java/fr/xephi/authme/command/FoundCommandResult.java | 1 - 7 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandArgumentDescription.java b/src/main/java/fr/xephi/authme/command/CommandArgumentDescription.java index 7efede29..a5ea63d0 100644 --- a/src/main/java/fr/xephi/authme/command/CommandArgumentDescription.java +++ b/src/main/java/fr/xephi/authme/command/CommandArgumentDescription.java @@ -17,7 +17,6 @@ public class CommandArgumentDescription { * @param label The argument label. * @param description The argument description. */ - @SuppressWarnings("UnusedDeclaration") public CommandArgumentDescription(String label, String description) { this(label, description, false); } diff --git a/src/main/java/fr/xephi/authme/command/CommandDescription.java b/src/main/java/fr/xephi/authme/command/CommandDescription.java index be635d42..302a6e6c 100644 --- a/src/main/java/fr/xephi/authme/command/CommandDescription.java +++ b/src/main/java/fr/xephi/authme/command/CommandDescription.java @@ -9,7 +9,6 @@ import org.bukkit.command.CommandSender; import fr.xephi.authme.util.StringUtils; -@SuppressWarnings("UnusedDeclaration") public class CommandDescription { /** Defines the acceptable labels. */ diff --git a/src/main/java/fr/xephi/authme/command/CommandHandler.java b/src/main/java/fr/xephi/authme/command/CommandHandler.java index f11ced44..063f8935 100644 --- a/src/main/java/fr/xephi/authme/command/CommandHandler.java +++ b/src/main/java/fr/xephi/authme/command/CommandHandler.java @@ -89,8 +89,7 @@ public class CommandHandler { * * @return True if the command was executed, false otherwise. */ - @SuppressWarnings("unused") - public boolean onCommand(CommandSender sender, @SuppressWarnings("UnusedParameters") org.bukkit.command.Command bukkitCommand, String bukkitCommandLabel, String[] bukkitArgs) { + public boolean onCommand(CommandSender sender, org.bukkit.command.Command bukkitCommand, String bukkitCommandLabel, String[] bukkitArgs) { // Process the arguments List args = processArguments(bukkitArgs); diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 694fd780..83aa4c43 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -32,7 +32,6 @@ import fr.xephi.authme.command.executable.email.RecoverEmailCommand; import fr.xephi.authme.command.executable.login.LoginCommand; import fr.xephi.authme.command.executable.logout.LogoutCommand; -@SuppressWarnings("UnusedDeclaration") public class CommandManager { /** The list of commandDescriptions. */ @@ -52,7 +51,7 @@ public class CommandManager { /** * Register all commands. */ - @SuppressWarnings({ "SpellCheckingInspection", "serial" }) + @SuppressWarnings({ "serial" }) public void registerCommands() { // Register the base AuthMe Reloaded command CommandDescription authMeBaseCommand = new CommandDescription( diff --git a/src/main/java/fr/xephi/authme/command/CommandParts.java b/src/main/java/fr/xephi/authme/command/CommandParts.java index 732e9199..6e833482 100644 --- a/src/main/java/fr/xephi/authme/command/CommandParts.java +++ b/src/main/java/fr/xephi/authme/command/CommandParts.java @@ -165,7 +165,6 @@ public class CommandParts { * * @return The result from zero to above. A negative number will be returned on error. */ - @SuppressWarnings("UnusedDeclaration") public double getDifference(CommandParts other) { return getDifference(other, false); } diff --git a/src/main/java/fr/xephi/authme/command/CommandPermissions.java b/src/main/java/fr/xephi/authme/command/CommandPermissions.java index 7628ea44..89007835 100644 --- a/src/main/java/fr/xephi/authme/command/CommandPermissions.java +++ b/src/main/java/fr/xephi/authme/command/CommandPermissions.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Player; //import com.timvisee.dungeonmaze.permission.PermissionsManager; import fr.xephi.authme.AuthMe; -@SuppressWarnings("UnusedDeclaration") public class CommandPermissions { /** Defines the permission nodes required to have permission to execute this command. */ diff --git a/src/main/java/fr/xephi/authme/command/FoundCommandResult.java b/src/main/java/fr/xephi/authme/command/FoundCommandResult.java index e959325a..207cf8dc 100644 --- a/src/main/java/fr/xephi/authme/command/FoundCommandResult.java +++ b/src/main/java/fr/xephi/authme/command/FoundCommandResult.java @@ -57,7 +57,6 @@ public class FoundCommandResult { * @param commandDescription The command description. * */ - @SuppressWarnings("UnusedDeclaration") public void setCommandDescription(CommandDescription commandDescription) { this.commandDescription = commandDescription; } From 9bcc210428f1b53106b20dfcd9f547b5d1024941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Mon, 2 Nov 2015 13:22:43 +0100 Subject: [PATCH 392/427] Updated developer in version command according to team.txt --- .../authme/command/executable/authme/VersionCommand.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java index e49b6115..45e1e3df 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java @@ -26,9 +26,11 @@ public class VersionCommand extends ExecutableCommand { sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.PLUGIN_NAME.toUpperCase() + " ABOUT ]=========="); sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.PLUGIN_NAME + " v" + AuthMe.getVersionName() + ChatColor.GRAY + " (code: " + AuthMe.getVersionCode() + ")"); sender.sendMessage(ChatColor.GOLD + "Developers:"); - printDeveloper(sender, "Xephi", "xephi", "Lead Developer"); - printDeveloper(sender, "Sgdc3", "sgdc3", "Code Contributor"); - printDeveloper(sender, "Tim Visee", "timvisee", "Code Contributor"); + printDeveloper(sender, "Xephi", "xephi59", "Lead Developer"); + printDeveloper(sender, "DNx5", "DNx5", "Developer"); + printDeveloper(sender, "games647", "games647", "Developer"); + printDeveloper(sender, "Tim Visee", "timvisee", "Developer"); + printDeveloper(sender, "Sgdc3", "sgdc3", "Project manager, Contributor"); sender.sendMessage(ChatColor.GOLD + "Website: " + ChatColor.WHITE + "http://dev.bukkit.org/bukkit-plugins/authme-reloaded/"); sender.sendMessage(ChatColor.GOLD + "License: " + ChatColor.WHITE + "GNU GPL v3.0" + ChatColor.GRAY + ChatColor.ITALIC + " (See LICENSE file)"); sender.sendMessage(ChatColor.GOLD + "Copyright: " + ChatColor.WHITE + "Copyright (c) Xephi 2015. All rights reserved."); From f90104ca2de4bbdb3e9665802041c4f391d91a6e Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 01:53:01 +0700 Subject: [PATCH 393/427] update player move event listener. --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index cf0eefc0..1a7c4add 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -130,6 +130,9 @@ public class AuthMePlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onPlayerMove(PlayerMoveEvent event) { + if (Settings.isMovementAllowed && Settings.getMovementRadius <= 0) + return; + Player player = event.getPlayer(); if (Utils.checkAuth(player)) return; From 6cc0cd62f586bcc08a4280e2addf6113e2827fbc Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 02:01:24 +0700 Subject: [PATCH 394/427] move set join message outside task. --- .../authme/listener/AuthMePlayerListener.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 1a7c4add..10b2b388 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -201,8 +201,16 @@ public class AuthMePlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJoin(final PlayerJoinEvent event) { - if (event.getPlayer() == null) { + if (event.getPlayer() == null) return; + + final Player player = event.getPlayer(); + String name = player.getName().toLowerCase(); + + // Remove the join message while the player isn't logging in + if (Settings.delayJoinLeaveMessages && event.getJoinMessage() != null) { + joinMessage.put(name, event.getJoinMessage()); + event.setJoinMessage(null); } // Shedule login task so works after the prelogin @@ -211,16 +219,7 @@ public class AuthMePlayerListener implements Listener { @Override public void run() { - Player player = event.getPlayer(); - String name = player.getName().toLowerCase(); - plugin.management.performJoin(player); - - // Remove the join message while the player isn't logging in - if (Settings.delayJoinLeaveMessages && event.getJoinMessage() != null) { - joinMessage.put(name, event.getJoinMessage()); - event.setJoinMessage(null); - } } }); } From 6d4682793620eab0e8d744305e743c79ab18b075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Mon, 2 Nov 2015 20:20:59 +0100 Subject: [PATCH 395/427] Removed unused TODO --- .../fr/xephi/authme/command/executable/authme/AuthMeCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java index 72ff623f..8edb818e 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java @@ -21,7 +21,6 @@ public class AuthMeCommand extends ExecutableCommand { @Override public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { // Show some version info - // TODO: Use plugin name and version constants here! sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.PLUGIN_NAME + " v" + AuthMe.getVersionName() + "! " + ChatColor.RED + "<3"); sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " help" + ChatColor.YELLOW + " to view help."); sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " about" + ChatColor.YELLOW + " to view about."); From 872856e7291393458094cd4fa0464dc58da0a995 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 03:42:02 +0700 Subject: [PATCH 396/427] create teleportTospawn method in Utils class --- .../executable/authme/UnregisterCommand.java | 62 ++++++------- .../xephi/authme/commands/AdminCommand.java | 86 +++++++++---------- .../process/logout/AsyncronousLogout.java | 22 ++--- .../ProcessSyncronousPasswordRegister.java | 21 +---- .../unregister/AsyncronousUnregister.java | 25 +----- src/main/java/fr/xephi/authme/util/Utils.java | 13 +++ 6 files changed, 92 insertions(+), 137 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java index 4bb057e5..e7ea7216 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java @@ -1,14 +1,5 @@ package fr.xephi.authme.command.executable.authme; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerCache; @@ -21,6 +12,14 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.util.Utils; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; public class UnregisterCommand extends ExecutableCommand { @@ -30,7 +29,6 @@ public class UnregisterCommand extends ExecutableCommand { * @param sender The command sender. * @param commandReference The command reference. * @param commandArguments The command arguments. - * * @return True if the command was executed successfully, false otherwise. */ @Override @@ -62,33 +60,25 @@ public class UnregisterCommand extends ExecutableCommand { Player target = Bukkit.getPlayer(playerNameLowerCase); PlayerCache.getInstance().removePlayer(playerNameLowerCase); Utils.setGroup(target, Utils.GroupType.UNREGISTERED); - if (target != null) { - if (target.isOnline()) { - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(target); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - target.teleport(tpEvent.getTo()); - } - } - LimboCache.getInstance().addLimboPlayer(target); - int delay = Settings.getRegistrationTimeout * 20; - int interval = Settings.getWarnMessageInterval; - BukkitScheduler scheduler = sender.getServer().getScheduler(); - if (delay != 0) { - BukkitTask id = scheduler.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, playerNameLowerCase, target), delay); - LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setTimeoutTaskId(id); - } - LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTaskId(scheduler.runTaskAsynchronously(plugin, new MessageTask(plugin, playerNameLowerCase, m.send("reg_msg"), interval))); - if (Settings.applyBlindEffect) - target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - target.setWalkSpeed(0.0f); - target.setFlySpeed(0.0f); - } - m.send(target, "unregistered"); + if (target != null && target.isOnline()) { + Utils.teleportToSpawn(target); + LimboCache.getInstance().addLimboPlayer(target); + int delay = Settings.getRegistrationTimeout * 20; + int interval = Settings.getWarnMessageInterval; + BukkitScheduler scheduler = sender.getServer().getScheduler(); + if (delay != 0) { + BukkitTask id = scheduler.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, playerNameLowerCase, target), delay); + LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setTimeoutTaskId(id); } + LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTaskId(scheduler.runTaskAsynchronously(plugin, new MessageTask(plugin, playerNameLowerCase, m.send("reg_msg"), interval))); + if (Settings.applyBlindEffect) + target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { + target.setWalkSpeed(0.0f); + target.setFlySpeed(0.0f); + } + m.send(target, "unregistered"); + } // Show a status message diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index f482f19b..5b0345cc 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -1,23 +1,5 @@ package fr.xephi.authme.commands; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -32,6 +14,23 @@ import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.util.Utils; import fr.xephi.authme.util.Utils.GroupType; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; public class AdminCommand implements CommandExecutor { @@ -274,7 +273,7 @@ public class AdminCommand implements CommandExecutor { } plugin.database.setUnlogged(name); if (Bukkit.getPlayerExact(realName) != null) - Bukkit.getPlayerExact(realName).kickPlayer("An admin just registered you, please log again"); + Bukkit.getPlayerExact(realName).kickPlayer("An admin just registered you, please log again"); m.send(sender, "registered"); ConsoleLogger.info(name + " registered"); } catch (NoSuchAlgorithmException ex) { @@ -472,33 +471,32 @@ public class AdminCommand implements CommandExecutor { Player target = Bukkit.getPlayer(name); PlayerCache.getInstance().removePlayer(name); Utils.setGroup(target, GroupType.UNREGISTERED); - if (target != null) { - if (target.isOnline()) { - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(target); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - target.teleport(tpEvent.getTo()); - } + if (target != null && target.isOnline()) { + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawn = plugin.getSpawnLocation(target); + SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + target.teleport(tpEvent.getTo()); } - LimboCache.getInstance().addLimboPlayer(target); - int delay = Settings.getRegistrationTimeout * 20; - int interval = Settings.getWarnMessageInterval; - BukkitScheduler sched = sender.getServer().getScheduler(); - if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, target), delay); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); - } - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); - if (Settings.applyBlindEffect) - target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - target.setWalkSpeed(0.0f); - target.setFlySpeed(0.0f); - } - m.send(target, "unregistered"); } + LimboCache.getInstance().addLimboPlayer(target); + int delay = Settings.getRegistrationTimeout * 20; + int interval = Settings.getWarnMessageInterval; + BukkitScheduler sched = sender.getServer().getScheduler(); + if (delay != 0) { + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, target), delay); + LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + } + LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); + if (Settings.applyBlindEffect) + target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { + target.setWalkSpeed(0.0f); + target.setFlySpeed(0.0f); + } + m.send(target, "unregistered"); + } m.send(sender, "unregistered"); ConsoleLogger.info(args[1] + " unregistered"); diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index e8bfd6ab..b0b4670e 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -55,22 +55,12 @@ public class AsyncronousLogout { PlayerCache.getInstance().removePlayer(name); database.setUnlogged(name); - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawnLoc = plugin.getSpawnLocation(p); - final AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(p, spawnLoc); - sched.scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (tpEvent.getTo() != null) - p.teleport(tpEvent.getTo()); - } - } - }); - } - + sched.scheduleSyncDelayedTask(plugin, new Runnable() { + @Override + public void run() { + Utils.teleportToSpawn(p); + } + }); if (LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().addLimboPlayer(player); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 56b7158b..8bdb946f 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -48,17 +48,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } protected void forceLogin(Player player) { - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawnLoc = plugin.getSpawnLocation(player); - AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, spawnLoc); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } - player.teleport(tpEvent.getTo()); - } - } + Utils.teleportToSpawn(player); if (LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().addLimboPlayer(player); @@ -81,14 +71,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); if (limbo != null) { player.setGameMode(limbo.getGameMode()); - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location loca = plugin.getSpawnLocation(player); - RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled() && tpEvent.getTo() != null) { - player.teleport(tpEvent.getTo()); - } - } + Utils.teleportToSpawn(player); if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) { RestoreInventoryEvent event = new RestoreInventoryEvent(player); diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java index 71a79688..e635b755 100644 --- a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java +++ b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java @@ -55,15 +55,7 @@ public class AsyncronousUnregister { return; } if (Settings.isForcedRegistrationEnabled) { - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(player); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - player.teleport(tpEvent.getTo()); - } - } - + Utils.teleportToSpawn(player); player.saveData(); PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); if (!Settings.getRegisteredGroup.isEmpty()) @@ -98,22 +90,11 @@ public class AsyncronousUnregister { } m.send(player, "unregistered"); ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(player); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } - player.teleport(tpEvent.getTo()); - } - } - return; + Utils.teleportToSpawn(player); } else { m.send(player, "wrong_pwd"); } - } catch (NoSuchAlgorithmException ex) { + } catch (NoSuchAlgorithmException ignored) { } } } diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index 76915420..f417824e 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -12,6 +12,8 @@ import java.util.Collection; import java.util.Collections; import java.util.zip.GZIPInputStream; +import fr.xephi.authme.events.SpawnTeleportEvent; +import fr.xephi.authme.settings.Spawn; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -297,4 +299,15 @@ public class Utils { return false; } } + + public static void teleportToSpawn(Player player) { + if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { + Location spawn = plugin.getSpawnLocation(player); + AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, spawn); + plugin.getServer().getPluginManager().callEvent(tpEvent); + if (!tpEvent.isCancelled()) { + player.teleport(tpEvent.getTo()); + } + } + } } From 3ede8f0daeeacd35225e4a5f09d8559eacb96345 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 03:56:20 +0700 Subject: [PATCH 397/427] let bukkit load the chunk --- src/main/java/fr/xephi/authme/util/Utils.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index f417824e..7d26c949 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -216,17 +216,15 @@ public class Utils { if (theWorld == null) theWorld = pl.getWorld(); final World world = theWorld; - final Location locat = new Location(world, x, y, z); + final Location loc = new Location(world, x, y, z); Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { - AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, locat); + AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, loc); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getChunk().isLoaded()) - tpEvent.getTo().getChunk().load(); pl.teleport(tpEvent.getTo()); } } From 56aca7f473beb6bc8e146a86e74cc0e66f5a7d55 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 07:37:00 +0700 Subject: [PATCH 398/427] this is enough. --- .../fr/xephi/authme/datasource/MySQL.java | 98 +++++++------------ src/main/resources/config.yml | 2 +- 2 files changed, 37 insertions(+), 63 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 45c0f036..8fdc2371 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -1,26 +1,18 @@ package fr.xephi.authme.datasource; -import java.sql.Blob; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; - import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.pool.PoolInitializationException; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.Settings; - + +import java.sql.*; +import java.util.ArrayList; +import java.util.List; + public class MySQL implements DataSource { private String host; @@ -108,19 +100,18 @@ public class MySQL implements DataSource { config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); - if (Settings.isMySQLWebsite) - { + if (Settings.isMySQLWebsite) { config.addDataSourceProperty("cachePrepStmts", "false"); - } - else { + } else { config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); } config.addDataSourceProperty("autoReconnect", false); - config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable + config.setInitializationFailFast(true); // Don't start the plugin if the database is unavailable config.setMaxLifetime(180000); // 3 Min config.setIdleTimeout(60000); // 1 Min + config.setMinimumIdle(2); config.setMaximumPoolSize(maxConnections); ds = new HikariDataSource(config); ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); @@ -136,24 +127,7 @@ public class MySQL implements DataSource { } private synchronized Connection getConnection() throws SQLException { - if (!ds.isClosed()) - { - Connection con; - con = ds.getConnection(); - return con; - } - ConsoleLogger.showError("Can't open a database connection!"); - if (Settings.isStopEnabled) - { - ConsoleLogger.showError("Server will ShuttingDown for Security reason"); - Bukkit.getScheduler().scheduleSyncDelayedTask(AuthMe.getInstance(), new Runnable(){ - @Override - public void run() { - AuthMe.getInstance().getServer().shutdown(); - } - }); - } - return null; + return ds.getConnection(); } private synchronized void setupConnection() throws SQLException { @@ -162,7 +136,7 @@ public class MySQL implements DataSource { ResultSet rs = null; try { if ((con = getConnection()) == null) - return; + return; st = con.createStatement(); st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" + columnID + " INTEGER AUTO_INCREMENT," + columnName + " VARCHAR(255) NOT NULL UNIQUE," + columnPassword + " VARCHAR(255) NOT NULL," + columnIp + " VARCHAR(40) NOT NULL DEFAULT '127.0.0.1'," + columnLastLogin + " BIGINT NOT NULL DEFAULT '" + System.currentTimeMillis() + "'," + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT '" + Settings.defaultWorld + "'," + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com'," + columnLogged + " SMALLINT NOT NULL DEFAULT '0'," + "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));"); rs = con.getMetaData().getColumns(null, null, tableName, columnPassword); @@ -210,7 +184,7 @@ public class MySQL implements DataSource { st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) NOT NULL DEFAULT 'Player' AFTER " + columnLogged + ";"); } if (Settings.isMySQLWebsite) - st.execute("SET GLOBAL query_cache_size = 0; SET GLOBAL query_cache_type = 0;"); + st.execute("SET GLOBAL query_cache_size = 0; SET GLOBAL query_cache_type = 0;"); } finally { close(rs); close(st); @@ -226,7 +200,7 @@ public class MySQL implements DataSource { ResultSet rs = null; try { if ((con = getConnection()) == null) - return true; + return true; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); pst.setString(1, user); rs = pst.executeQuery(); @@ -250,7 +224,7 @@ public class MySQL implements DataSource { int id; try { if ((con = getConnection()) == null) - return null; + return null; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); pst.setString(1, user); rs = pst.executeQuery(); @@ -301,7 +275,7 @@ public class MySQL implements DataSource { ResultSet rs = null; try { if ((con = getConnection()) == null) - return false; + return false; if ((columnSalt == null || columnSalt.isEmpty()) || (auth.getSalt() == null || auth.getSalt().isEmpty())) { pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnRealName + ") VALUES (?,?,?,?,?);"); pst.setString(1, auth.getNickname()); @@ -508,7 +482,7 @@ public class MySQL implements DataSource { ResultSet rs = null; try { if ((con = getConnection()) == null) - return false; + return false; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnPassword + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getHash()); pst.setString(2, auth.getNickname()); @@ -552,7 +526,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { if ((con = getConnection()) == null) - return false; + return false; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=?, " + columnRealName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getIp()); pst.setLong(2, auth.getLastLogin()); @@ -575,7 +549,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { if ((con = getConnection()) == null) - return 0; + return 0; pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + " list = new ArrayList<>(); try { if ((con = getConnection()) == null) - return list; + return list; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + " countIp = new ArrayList<>(); try { if ((con = getConnection()) == null) - return countIp; + return countIp; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, auth.getIp()); rs = pst.executeQuery(); @@ -815,7 +789,7 @@ public class MySQL implements DataSource { List countIp = new ArrayList<>(); try { if ((con = getConnection()) == null) - return countIp; + return countIp; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, ip); rs = pst.executeQuery(); @@ -841,7 +815,7 @@ public class MySQL implements DataSource { List countEmail = new ArrayList<>(); try { if ((con = getConnection()) == null) - return countEmail; + return countEmail; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); pst.setString(1, email); rs = pst.executeQuery(); @@ -865,7 +839,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { if ((con = getConnection()) == null) - return; + return; for (String name : banned) { pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, name); @@ -891,7 +865,7 @@ public class MySQL implements DataSource { ResultSet rs = null; try { if ((con = getConnection()) == null) - return false; + return false; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, user); rs = pst.executeQuery(); @@ -914,7 +888,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { if ((con = getConnection()) == null) - return; + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setInt(1, 1); pst.setString(2, user); @@ -934,7 +908,7 @@ public class MySQL implements DataSource { if (user != null) try { if ((con = getConnection()) == null) - return; + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setInt(1, 0); pst.setString(2, user); @@ -953,7 +927,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { if ((con = getConnection()) == null) - return; + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnLogged + "=?;"); pst.setInt(1, 0); pst.setInt(2, 1); @@ -974,7 +948,7 @@ public class MySQL implements DataSource { ResultSet rs; try { if ((con = getConnection()) == null) - return result; + return result; pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";"); rs = pst.executeQuery(); if (rs != null && rs.next()) { @@ -996,7 +970,7 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { if ((con = getConnection()) == null) - return; + return; pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, newone); pst.setString(2, oldone); @@ -1017,7 +991,7 @@ public class MySQL implements DataSource { ResultSet rs = null; try { if ((con = getConnection()) == null) - return auths; + return auths; pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); rs = pst.executeQuery(); while (rs.next()) { @@ -1068,7 +1042,7 @@ public class MySQL implements DataSource { ResultSet rs = null; try { if ((con = getConnection()) == null) - return auths; + return auths; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); rs = pst.executeQuery(); while (rs.next()) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e991efc0..671abc50 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -10,7 +10,7 @@ DataSource: # Database Port mySQLPort: '3306' # MySql Max Connections - mySQLMaxConections: 25 + mySQLMaxConections: 8 # Username about Database Connection Infos mySQLUsername: authme # Password about Database Connection Infos From d73ac92ba3f024b8eea4c57bfddbf650213a93be Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 07:59:42 +0700 Subject: [PATCH 399/427] sqlite max connection update. --- src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 4caecf26..5e531f3c 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -83,10 +83,10 @@ public class SQLite_HIKARI implements DataSource { config.setPoolName("AuthMeSQLitePool"); config.setDriverClassName("org.sqlite.JDBC"); // RuntimeException config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); - config.setConnectionTestQuery("SELECT 1"); config.setMaxLifetime(180000); // 3 Min config.setIdleTimeout(60000); // 1 Min - config.setMaximumPoolSize(50); // 50 (including idle connections) + config.setMinimumIdle(2); + config.setMaximumPoolSize(8); // don't set too much ds = new HikariDataSource(config); ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); } From 1562cb76156c3b778f535f70a45466c132be6ea7 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 10:54:26 +0700 Subject: [PATCH 400/427] missed return statement. --- src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 04317f77..f4831e96 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -70,6 +70,7 @@ public class AsyncronousJoin { } }); + return; } final String ip = plugin.getIP(player); From ce432aa25aa1678eb95f9c9d032b1da17a8a106d Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 12:38:24 +0700 Subject: [PATCH 401/427] add exception to datasource method signature. --- .../executable/authme/AccountsCommand.java | 14 ++- .../executable/email/ChangeEmailCommand.java | 98 +++++++++-------- .../xephi/authme/commands/AdminCommand.java | 12 +- .../authme/datasource/CacheDataSource.java | 46 ++++---- .../xephi/authme/datasource/DataSource.java | 5 +- .../fr/xephi/authme/datasource/MySQL.java | 11 +- .../authme/datasource/SQLite_HIKARI.java | 20 +--- .../fr/xephi/authme/process/Management.java | 4 +- ...ronousRegister.java => AsyncRegister.java} | 103 ++++++++---------- ...ter.java => ProcessSyncEmailRegister.java} | 4 +- 10 files changed, 154 insertions(+), 163 deletions(-) rename src/main/java/fr/xephi/authme/process/register/{AsyncronousRegister.java => AsyncRegister.java} (62%) rename src/main/java/fr/xephi/authme/process/register/{ProcessSyncronousEmailRegister.java => ProcessSyncEmailRegister.java} (93%) diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java index aa8753c4..abe06661 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java @@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.authme; import java.util.List; +import fr.xephi.authme.ConsoleLogger; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -79,11 +80,20 @@ public class AccountsCommand extends ExecutableCommand { }); return true; } else { - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { + List accountList; + try { + accountList = plugin.database.getAllAuthsByIp(playerQueryFinal); + } catch (Exception e) { + ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.writeStackTrace(e); + m.send(sender, "error"); + return; + } + StringBuilder message = new StringBuilder("[AuthMe] "); - List accountList = plugin.database.getAllAuthsByIp(playerQueryFinal); if (accountList == null || accountList.isEmpty()) { sender.sendMessage("[AuthMe] This IP does not exist in the database"); return; diff --git a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java index b7f71736..0b5d7e3c 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java @@ -1,27 +1,26 @@ package fr.xephi.authme.command.executable.email; -import java.util.Arrays; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - 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.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Arrays; public class ChangeEmailCommand extends ExecutableCommand { /** * Execute the command. * - * @param sender The command sender. + * @param sender The command sender. * @param commandReference The command reference. * @param commandArguments The command arguments. - * * @return True if the command was executed successfully, false otherwise. */ @Override @@ -37,7 +36,7 @@ public class ChangeEmailCommand extends ExecutableCommand { String playerMailNew = commandArguments.get(1); // Make sure the current command executor is a player - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { return true; } @@ -46,44 +45,51 @@ public class ChangeEmailCommand extends ExecutableCommand { final String playerName = player.getName(); // Command logic - if (Settings.getmaxRegPerEmail > 0) { - if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(playerMailNew).size() >= Settings.getmaxRegPerEmail) { - m.send(player, "max_reg"); - return true; - } - } - if (PlayerCache.getInstance().isAuthenticated(playerName)) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(playerName); - if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) { - m.send(player, "usage_email_add"); - return true; - } - if (!playerMailOld.equals(auth.getEmail())) { - m.send(player, "old_email_invalid"); - return true; - } - if (!Settings.isEmailCorrect(playerMailNew)) { - m.send(player, "new_email_invalid"); - return true; - } - auth.setEmail(playerMailNew); - if (!plugin.database.updateEmail(auth)) { - m.send(player, "error"); - return true; - } - PlayerCache.getInstance().updatePlayer(auth); - m.send(player, "email_changed"); - player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); - } else if (PlayerCache.getInstance().isAuthenticated(playerName)) { - m.send(player, "email_confirm"); - } else { - if (!plugin.database.isAuthAvailable(playerName)) { - m.send(player, "login_msg"); - } else { - m.send(player, "reg_email_msg"); - } - } - return true; + try { + if (Settings.getmaxRegPerEmail > 0) { + if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(playerMailNew).size() >= Settings.getmaxRegPerEmail) { + m.send(player, "max_reg"); + return true; + } + } + if (PlayerCache.getInstance().isAuthenticated(playerName)) { + PlayerAuth auth = PlayerCache.getInstance().getAuth(playerName); + if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) { + m.send(player, "usage_email_add"); + return true; + } + if (!playerMailOld.equals(auth.getEmail())) { + m.send(player, "old_email_invalid"); + return true; + } + if (!Settings.isEmailCorrect(playerMailNew)) { + m.send(player, "new_email_invalid"); + return true; + } + auth.setEmail(playerMailNew); + if (!plugin.database.updateEmail(auth)) { + m.send(player, "error"); + return true; + } + PlayerCache.getInstance().updatePlayer(auth); + m.send(player, "email_changed"); + player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); + } else if (PlayerCache.getInstance().isAuthenticated(playerName)) { + m.send(player, "email_confirm"); + } else { + if (!plugin.database.isAuthAvailable(playerName)) { + m.send(player, "login_msg"); + } else { + m.send(player, "reg_email_msg"); + } + } + return true; + } catch (Exception e) { + ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.writeStackTrace(e); + m.send(sender, "error"); + return false; + } } } diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 5b0345cc..fa27ee31 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -194,7 +194,7 @@ public class AdminCommand implements CommandExecutor { return true; } else { final String[] arguments = args; - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { StringBuilder message = new StringBuilder("[AuthMe] "); @@ -202,7 +202,15 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("[AuthMe] Please put a valid IP"); return; } - List accountList = plugin.database.getAllAuthsByIp(arguments[1]); + List accountList = null; + try { + accountList = plugin.database.getAllAuthsByIp(arguments[1]); + } catch (Exception e) { + ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.writeStackTrace(e); + m.send(sender, "error"); + return; + } if (accountList == null || accountList.isEmpty()) { sender.sendMessage("[AuthMe] This IP does not exist in the database"); return; diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 0032b9a0..40ed684c 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -1,18 +1,18 @@ package fr.xephi.authme.datasource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import org.bukkit.entity.Player; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.util.Utils; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class CacheDataSource implements DataSource { @@ -281,25 +281,21 @@ public class CacheDataSource implements DataSource { } @Override - public synchronized List getAllAuthsByIp(String ip) { - List result = new ArrayList<>(); - for (Map.Entry stringPlayerAuthEntry : cache.entrySet()) { - PlayerAuth p = stringPlayerAuthEntry.getValue(); - if (p.getIp().equals(ip)) - result.add(p.getNickname()); - } - return result; + public synchronized List getAllAuthsByIp(final String ip) throws Exception { + return exec.submit(new Callable>() { + public List call() throws Exception { + return source.getAllAuthsByIp(ip); + } + }).get(); } @Override - public synchronized List getAllAuthsByEmail(String email) { - List result = new ArrayList<>(); - for (Map.Entry stringPlayerAuthEntry : cache.entrySet()) { - PlayerAuth p = stringPlayerAuthEntry.getValue(); - if (p.getEmail().equals(email)) - result.add(p.getNickname()); - } - return result; + public synchronized List getAllAuthsByEmail(final String email) throws Exception { + return exec.submit(new Callable>() { + public List call() throws Exception { + return source.getAllAuthsByEmail(email); + } + }).get(); } @Override diff --git a/src/main/java/fr/xephi/authme/datasource/DataSource.java b/src/main/java/fr/xephi/authme/datasource/DataSource.java index 184a4fe9..40c3c883 100644 --- a/src/main/java/fr/xephi/authme/datasource/DataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/DataSource.java @@ -1,5 +1,6 @@ package fr.xephi.authme.datasource; +import java.sql.SQLException; import java.util.List; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -35,9 +36,9 @@ public interface DataSource { List getAllAuthsByName(PlayerAuth auth); - List getAllAuthsByIp(String ip); + List getAllAuthsByIp(String ip) throws Exception; - List getAllAuthsByEmail(String email); + List getAllAuthsByEmail(String email) throws Exception; boolean updateEmail(PlayerAuth auth); diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 8fdc2371..e0479468 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -751,6 +751,7 @@ public class MySQL implements DataSource { o.close(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.writeStackTrace(ex); } } } @@ -808,14 +809,13 @@ public class MySQL implements DataSource { } @Override - public synchronized List getAllAuthsByEmail(String email) { - Connection con = null; + public synchronized List getAllAuthsByEmail(String email) throws SQLException { + final Connection con = getConnection(); PreparedStatement pst = null; ResultSet rs = null; List countEmail = new ArrayList<>(); + try { - if ((con = getConnection()) == null) - return countEmail; pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); pst.setString(1, email); rs = pst.executeQuery(); @@ -823,9 +823,6 @@ public class MySQL implements DataSource { countEmail.add(rs.getString(columnName)); } return countEmail; - } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList<>(); } finally { close(rs); close(pst); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java index 5e531f3c..87af9fe9 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java @@ -472,13 +472,12 @@ public class SQLite_HIKARI implements DataSource { } @Override - public List getAllAuthsByIp(String ip) { - Connection con = null; + public List getAllAuthsByIp(String ip) throws SQLException { + final Connection con = getConnection(); PreparedStatement pst = null; ResultSet rs = null; List countIp = new ArrayList<>(); try { - con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); pst.setString(1, ip); rs = pst.executeQuery(); @@ -486,11 +485,6 @@ public class SQLite_HIKARI implements DataSource { countIp.add(rs.getString(columnName)); } return countIp; - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList<>(); - } catch (NullPointerException npe) { - return new ArrayList<>(); } finally { close(rs); close(pst); @@ -499,13 +493,12 @@ public class SQLite_HIKARI implements DataSource { } @Override - public List getAllAuthsByEmail(String email) { - Connection con = null; + public List getAllAuthsByEmail(String email) throws SQLException { + final Connection con = getConnection(); PreparedStatement pst = null; ResultSet rs = null; List countEmail = new ArrayList<>(); try { - con = getConnection(); pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); pst.setString(1, email); rs = pst.executeQuery(); @@ -513,11 +506,6 @@ public class SQLite_HIKARI implements DataSource { countEmail.add(rs.getString(columnName)); } return countEmail; - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList<>(); - } catch (NullPointerException npe) { - return new ArrayList<>(); } finally { close(rs); close(pst); diff --git a/src/main/java/fr/xephi/authme/process/Management.java b/src/main/java/fr/xephi/authme/process/Management.java index 1276012a..f32ae857 100644 --- a/src/main/java/fr/xephi/authme/process/Management.java +++ b/src/main/java/fr/xephi/authme/process/Management.java @@ -9,7 +9,7 @@ import fr.xephi.authme.process.join.AsyncronousJoin; import fr.xephi.authme.process.login.AsyncronousLogin; import fr.xephi.authme.process.logout.AsyncronousLogout; import fr.xephi.authme.process.quit.AsyncronousQuit; -import fr.xephi.authme.process.register.AsyncronousRegister; +import fr.xephi.authme.process.register.AsyncRegister; import fr.xephi.authme.process.unregister.AsyncronousUnregister; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Settings; @@ -46,7 +46,7 @@ public class Management { @Override public void run() { - new AsyncronousRegister(player, password, email, plugin, plugin.database).process(); + new AsyncRegister(player, password, email, plugin, plugin.database).process(); } }); } diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java similarity index 62% rename from src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java rename to src/main/java/fr/xephi/authme/process/register/AsyncRegister.java index cc516697..9f5bdf77 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java @@ -1,10 +1,5 @@ package fr.xephi.authme.process.register; -import java.security.NoSuchAlgorithmException; -import java.util.Date; - -import org.bukkit.entity.Player; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -13,95 +8,90 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; +import org.bukkit.entity.Player; -public class AsyncronousRegister { +import java.security.NoSuchAlgorithmException; +import java.util.Date; + +public class AsyncRegister { protected Player player; protected String name; protected String password; protected String email = ""; - protected boolean allowRegister; private AuthMe plugin; private DataSource database; private Messages m = Messages.getInstance(); - public AsyncronousRegister(Player player, String password, String email, - AuthMe plugin, DataSource data) { + public AsyncRegister(Player player, String password, String email, + AuthMe plugin, DataSource data) { this.player = player; this.password = password; name = player.getName().toLowerCase(); this.email = email; this.plugin = plugin; this.database = data; - this.allowRegister = true; } protected String getIp() { return plugin.getIP(player); } - protected void preRegister() { + protected boolean preRegisterCheck() throws Exception { String lowpass = password.toLowerCase(); if (PlayerCache.getInstance().isAuthenticated(name)) { m.send(player, "logged_in"); - allowRegister = false; - } - - else if (!Settings.isRegistrationEnabled) { + return false; + } else if (!Settings.isRegistrationEnabled) { m.send(player, "reg_disabled"); - 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)) { + return 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)) { m.send(player, "password_error"); - allowRegister = false; - } - - else if (lowpass.equalsIgnoreCase(player.getName())) { + return false; + } else if (lowpass.equalsIgnoreCase(player.getName())) { m.send(player, "password_error_nick"); - allowRegister = false; - } - - else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) { + return false; + } else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) { m.send(player, "pass_len"); - allowRegister = false; - } - - else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) { + return false; + } else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) { m.send(player, "password_error_unsafe"); - allowRegister = false; + return false; } else if (database.isAuthAvailable(name)) { m.send(player, "user_regged"); - allowRegister = false; - } - - else if (Settings.getmaxRegPerIp > 0) { + return false; + } else if (Settings.getmaxRegPerIp > 0) { if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1") && !getIp().equalsIgnoreCase("localhost")) { m.send(player, "max_reg"); - allowRegister = false; + return false; } } - + return true; } public void process() { - preRegister(); - if (!allowRegister) - return; - if (!email.isEmpty() && !email.equals("")) { - if (Settings.getmaxRegPerEmail > 0) { - if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) { - m.send(player, "max_reg"); - return; + try { + if (!preRegisterCheck()) + return; + if (!email.isEmpty() && !email.equals("")) { + if (Settings.getmaxRegPerEmail > 0) { + if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) { + m.send(player, "max_reg"); + return; + } } + emailRegister(); + return; } - emailRegister(); - return; + passwordRegister(); + } catch (Exception e) { + ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.writeStackTrace(e); + m.send(player, "error"); } - passwordRegister(); } - protected void emailRegister() { + protected void emailRegister() throws Exception { if (Settings.getmaxRegPerEmail > 0) { if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) { m.send(player, "max_reg"); @@ -109,14 +99,8 @@ public class AsyncronousRegister { } } PlayerAuth auth; - try { - final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); - auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, player.getName()); - } catch (NoSuchAlgorithmException e) { - ConsoleLogger.showError(e.getMessage()); - m.send(player, "error"); - return; - } + final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); + auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, player.getName()); if (PasswordSecurity.userSalt.containsKey(name)) { auth.setSalt(PasswordSecurity.userSalt.get(name)); } @@ -124,8 +108,9 @@ public class AsyncronousRegister { database.updateEmail(auth); database.updateSession(auth); plugin.mail.main(auth, password); - ProcessSyncronousEmailRegister syncronous = new ProcessSyncronousEmailRegister(player, plugin); + ProcessSyncEmailRegister syncronous = new ProcessSyncEmailRegister(player, plugin); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous); + } protected void passwordRegister() { diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncEmailRegister.java similarity index 93% rename from src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java rename to src/main/java/fr/xephi/authme/process/register/ProcessSyncEmailRegister.java index 0b1a723d..683320a1 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncEmailRegister.java @@ -14,14 +14,14 @@ import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.util.Utils; -public class ProcessSyncronousEmailRegister implements Runnable { +public class ProcessSyncEmailRegister implements Runnable { protected Player player; protected String name; private AuthMe plugin; private Messages m = Messages.getInstance(); - public ProcessSyncronousEmailRegister(Player player, AuthMe plugin) { + public ProcessSyncEmailRegister(Player player, AuthMe plugin) { this.player = player; this.name = player.getName().toLowerCase(); this.plugin = plugin; From e3166c68076637325f109164e114409a516a99aa Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 12:52:07 +0700 Subject: [PATCH 402/427] update management class --- .../fr/xephi/authme/process/Management.java | 66 +++++++++---------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/Management.java b/src/main/java/fr/xephi/authme/process/Management.java index f32ae857..350d9bfe 100644 --- a/src/main/java/fr/xephi/authme/process/Management.java +++ b/src/main/java/fr/xephi/authme/process/Management.java @@ -1,10 +1,7 @@ package fr.xephi.authme.process; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; - import fr.xephi.authme.AuthMe; +import fr.xephi.authme.process.email.AsyncChangeEmail; import fr.xephi.authme.process.join.AsyncronousJoin; import fr.xephi.authme.process.login.AsyncronousLogin; import fr.xephi.authme.process.logout.AsyncronousLogout; @@ -13,83 +10,84 @@ import fr.xephi.authme.process.register.AsyncRegister; import fr.xephi.authme.process.unregister.AsyncronousUnregister; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Settings; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; /** - * * @authors Xephi59, - * Possible - * + * Possible */ public class Management { - public AuthMe plugin; + private final AuthMe pl; + private final BukkitScheduler sched; public static RandomString rdm = new RandomString(Settings.captchaLength); - public PluginManager pm; public Management(AuthMe plugin) { - this.plugin = plugin; - this.pm = plugin.getServer().getPluginManager(); + this.pl = plugin; + this.sched = pl.getServer().getScheduler(); } public void performLogin(final Player player, final String password, final boolean forceLogin) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + sched.runTaskAsynchronously(pl, new Runnable() { @Override public void run() { - new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process(); - } - }); - } - - public void performRegister(final Player player, final String password, final String email) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - new AsyncRegister(player, password, email, plugin, plugin.database).process(); + new AsyncronousLogin(player, password, forceLogin, pl, pl.database).process(); } }); } public void performLogout(final Player player) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + sched.runTaskAsynchronously(pl, new Runnable() { @Override public void run() { - new AsyncronousLogout(player, plugin, plugin.database).process(); + new AsyncronousLogout(player, pl, pl.database).process(); } }); } - public void performQuit(final Player player, final boolean isKick) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + public void performRegister(final Player player, final String password, final String email) { + sched.runTaskAsynchronously(pl, new Runnable() { @Override public void run() { - new AsyncronousQuit(player, plugin, plugin.database, isKick).process(); + new AsyncRegister(player, password, email, pl, pl.database).process(); } + }); + } + public void performUnregister(final Player player, final String password, final boolean force) { + sched.runTaskAsynchronously(pl, new Runnable() { + + @Override + public void run() { + new AsyncronousUnregister(player, password, force, pl).process(); + } }); } public void performJoin(final Player player) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + sched.runTaskAsynchronously(pl, new Runnable() { @Override public void run() { - new AsyncronousJoin(player, plugin, plugin.database).process(); + new AsyncronousJoin(player, pl, pl.database).process(); } }); } - public void performUnregister(final Player player, final String password, final boolean force) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + public void performQuit(final Player player, final boolean isKick) { + sched.runTaskAsynchronously(pl, new Runnable() { @Override public void run() { - new AsyncronousUnregister(player, password, force, plugin).process(); + new AsyncronousQuit(player, pl, pl.database, isKick).process(); } + }); - } + } + } From 4cbd8aad31648c519308a1cea6a424edbb8cbc06 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 14:08:51 +0700 Subject: [PATCH 403/427] update ConsoleLogger --- .../java/fr/xephi/authme/ConsoleLogger.java | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index b7e75790..e791e352 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -1,5 +1,9 @@ package fr.xephi.authme; +import com.google.common.base.Throwables; +import fr.xephi.authme.api.NewAPI; +import fr.xephi.authme.settings.Settings; + import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardOpenOption; @@ -8,39 +12,30 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Logger; -import com.google.common.base.Throwables; - -import fr.xephi.authme.api.NewAPI; -import fr.xephi.authme.settings.Settings; - public class ConsoleLogger { private static final Logger log = AuthMe.getInstance().getLogger(); private static final DateFormat df = new SimpleDateFormat("[MM-dd HH:mm:ss]"); public static void info(String message) { - if (AuthMe.getInstance().isEnabled()) { - log.info("[AuthMe] " + message); - if (Settings.useLogging) { - String dateTime; - synchronized (df) { - dateTime = df.format(new Date()); - } - writeLog(dateTime + " " + message); + log.info("[AuthMe] " + message); + if (Settings.useLogging) { + String dateTime; + synchronized (df) { + dateTime = df.format(new Date()); } + writeLog(dateTime + " " + message); } } public static void showError(String message) { - if (AuthMe.getInstance().isEnabled()) { - log.warning("[AuthMe] " + message); - if (Settings.useLogging) { - String dateTime; - synchronized (df) { - dateTime = df.format(new Date()); - } - writeLog(dateTime + " ERROR: " + message); + log.warning("[AuthMe] " + message); + if (Settings.useLogging) { + String dateTime; + synchronized (df) { + dateTime = df.format(new Date()); } + writeLog(dateTime + " ERROR: " + message); } } @@ -54,10 +49,12 @@ public class ConsoleLogger { } public static void writeStackTrace(Exception ex) { - String dateTime; - synchronized (df) { - dateTime = df.format(new Date()); + if (Settings.useLogging) { + String dateTime; + synchronized (df) { + dateTime = df.format(new Date()); + } + writeLog(dateTime + " " + Throwables.getStackTraceAsString(ex)); } - writeLog(dateTime + " " + Throwables.getStackTraceAsString(ex)); } } From f6a91085bddd42f0d55ac22b1a917094aa2b33e5 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 14:16:57 +0700 Subject: [PATCH 404/427] added async change email process --- .../process/email/AsyncChangeEmail.java | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java diff --git a/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java b/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java new file mode 100644 index 00000000..fcdd01ea --- /dev/null +++ b/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java @@ -0,0 +1,83 @@ +package fr.xephi.authme.process.email; + +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.Messages; +import fr.xephi.authme.settings.Settings; +import org.bukkit.entity.Player; + +import java.util.Arrays; + +public class AsyncChangeEmail { + + private final Player player; + private final AuthMe plugin; + private final String oldEmail; + private final String newEmail; + private final String newEmailVerify; + private final Messages m; + + public AsyncChangeEmail(Player player, AuthMe plugin, String oldEmail, String newEmail, String newEmailVerify) { + this.player = player; + this.plugin = plugin; + this.oldEmail = oldEmail; + this.newEmail = newEmail; + this.newEmailVerify = newEmailVerify; + this.m = Messages.getInstance(); + } + + public AsyncChangeEmail(Player player, AuthMe plugin, String oldEmail, String newEmail) { + this(player, plugin, oldEmail, newEmail, newEmail); + } + + public void process() { + try { + String playerName = player.getName().toLowerCase(); + + if (Settings.getmaxRegPerEmail > 0) { + if (!plugin.authmePermissible(player, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(newEmail).size() >= Settings.getmaxRegPerEmail) { + m.send(player, "max_reg"); + return; + } + } + + if (PlayerCache.getInstance().isAuthenticated(playerName)) { + if (!newEmail.equals(newEmailVerify)) { + m.send(player, "email_confirm"); + return; + } + PlayerAuth auth = PlayerCache.getInstance().getAuth(playerName); + if (oldEmail != null) { + if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) { + m.send(player, "usage_email_add"); + return; + } + if (!oldEmail.equals(auth.getEmail())) { + m.send(player, "old_email_invalid"); + return; + } + } + if (!Settings.isEmailCorrect(newEmail)) { + m.send(player, "new_email_invalid"); + return; + } + String old = auth.getEmail(); + auth.setEmail(newEmail); + if (!plugin.database.updateEmail(auth)) { + m.send(player, "error"); + auth.setEmail(old); + return; + } + PlayerCache.getInstance().updatePlayer(auth); + m.send(player, "email_changed"); + player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); + } + } catch (Exception e) { + ConsoleLogger.showError(e.getMessage()); + ConsoleLogger.writeStackTrace(e); + m.send(player, "error"); + } + } +} From 4eb94787ac70757ffdc2f2277b5bec6b39f5d048 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 14:22:32 +0700 Subject: [PATCH 405/427] implement async change email into management class. --- .../fr/xephi/authme/process/Management.java | 47 +++++++++++++------ .../process/email/AsyncChangeEmail.java | 6 +++ 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/Management.java b/src/main/java/fr/xephi/authme/process/Management.java index 350d9bfe..ccd88b21 100644 --- a/src/main/java/fr/xephi/authme/process/Management.java +++ b/src/main/java/fr/xephi/authme/process/Management.java @@ -19,75 +19,92 @@ import org.bukkit.scheduler.BukkitScheduler; */ public class Management { - private final AuthMe pl; + private final AuthMe plugin; private final BukkitScheduler sched; public static RandomString rdm = new RandomString(Settings.captchaLength); public Management(AuthMe plugin) { - this.pl = plugin; - this.sched = pl.getServer().getScheduler(); + this.plugin = plugin; + this.sched = this.plugin.getServer().getScheduler(); } public void performLogin(final Player player, final String password, final boolean forceLogin) { - sched.runTaskAsynchronously(pl, new Runnable() { + sched.runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { - new AsyncronousLogin(player, password, forceLogin, pl, pl.database).process(); + new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process(); } }); } public void performLogout(final Player player) { - sched.runTaskAsynchronously(pl, new Runnable() { + sched.runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { - new AsyncronousLogout(player, pl, pl.database).process(); + new AsyncronousLogout(player, plugin, plugin.database).process(); } }); } public void performRegister(final Player player, final String password, final String email) { - sched.runTaskAsynchronously(pl, new Runnable() { + sched.runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { - new AsyncRegister(player, password, email, pl, pl.database).process(); + new AsyncRegister(player, password, email, plugin, plugin.database).process(); } }); } public void performUnregister(final Player player, final String password, final boolean force) { - sched.runTaskAsynchronously(pl, new Runnable() { + sched.runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { - new AsyncronousUnregister(player, password, force, pl).process(); + new AsyncronousUnregister(player, password, force, plugin).process(); } }); } public void performJoin(final Player player) { - sched.runTaskAsynchronously(pl, new Runnable() { + sched.runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { - new AsyncronousJoin(player, pl, pl.database).process(); + new AsyncronousJoin(player, plugin, plugin.database).process(); } }); } public void performQuit(final Player player, final boolean isKick) { - sched.runTaskAsynchronously(pl, new Runnable() { + sched.runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { - new AsyncronousQuit(player, pl, pl.database, isKick).process(); + new AsyncronousQuit(player, plugin, plugin.database, isKick).process(); } }); } + public void performAddEmail(final Player player, final String newEmail, final String newEmailVerify) { + sched.runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + new AsyncChangeEmail(player, plugin, null, newEmail, newEmailVerify).process(); + } + }); + } + + public void performChangeEmail(final Player player, final String oldEmail, final String newEmail) { + sched.runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + new AsyncChangeEmail(player, plugin, oldEmail, newEmail).process(); + } + }); + } } 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 fcdd01ea..8735aedf 100644 --- a/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java +++ b/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java @@ -73,6 +73,12 @@ public class AsyncChangeEmail { PlayerCache.getInstance().updatePlayer(auth); m.send(player, "email_changed"); player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); + } else { + if (!plugin.database.isAuthAvailable(playerName)) { + m.send(player, "login_msg"); + } else { + m.send(player, "reg_email_msg"); + } } } catch (Exception e) { ConsoleLogger.showError(e.getMessage()); From 375162ab67cdcb1d20a363759afce180ad909885 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Tue, 3 Nov 2015 14:41:05 +0700 Subject: [PATCH 406/427] update email commands to use new async process --- .../executable/email/AddEmailCommand.java | 58 ++---------- .../executable/email/ChangeEmailCommand.java | 54 +---------- .../xephi/authme/commands/EmailCommand.java | 91 ++----------------- .../authme/datasource/CacheDataSource.java | 27 ++---- .../fr/xephi/authme/datasource/MySQL.java | 1 + .../process/email/AsyncChangeEmail.java | 12 ++- 6 files changed, 37 insertions(+), 206 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java index f91e6a24..d73e4397 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java @@ -1,25 +1,20 @@ package fr.xephi.authme.command.executable.email; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; public class AddEmailCommand extends ExecutableCommand { /** * Execute the command. * - * @param sender The command sender. + * @param sender The command sender. * @param commandReference The command reference. * @param commandArguments The command arguments. - * * @return True if the command was executed successfully, false otherwise. */ @Override @@ -35,57 +30,16 @@ public class AddEmailCommand extends ExecutableCommand { String playerMailVerify = commandArguments.get(1); // Make sure the current command executor is a player - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { return true; } // Get the player instance and name final Player player = (Player) sender; - final String playerName = player.getName(); + final String playerName = player.getName().toLowerCase(); // Command logic - if (Settings.getmaxRegPerEmail > 0) { - if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(playerMail).size() >= Settings.getmaxRegPerEmail) { - m.send(player, "max_reg"); - return true; - } - } - - if (playerMail.equals(playerMailVerify) && PlayerCache.getInstance().isAuthenticated(playerName)) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(playerName); - - if (auth.getEmail() == null || (!auth.getEmail().equals("your@email.com") && !auth.getEmail().isEmpty())) { - m.send(player, "usage_email_change"); - return true; - } - - if (!Settings.isEmailCorrect(playerMail)) { - m.send(player, "email_invalid"); - return true; - } - - auth.setEmail(playerMail); - - if (!plugin.database.updateEmail(auth)) { - m.send(player, "error"); - return true; - } - - PlayerCache.getInstance().updatePlayer(auth); - m.send(player, "email_added"); - player.sendMessage(auth.getEmail()); - - } else if (PlayerCache.getInstance().isAuthenticated(playerName)) { - m.send(player, "email_confirm"); - - } else { - if (!plugin.database.isAuthAvailable(playerName)) { - m.send(player, "login_msg"); - } else { - m.send(player, "reg_email_msg"); - } - } - + plugin.management.performAddEmail(player, playerMail, playerMailVerify); return true; } } diff --git a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java index 0b5d7e3c..fe6a4be2 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java @@ -1,18 +1,12 @@ package fr.xephi.authme.command.executable.email; 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.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.util.Arrays; - public class ChangeEmailCommand extends ExecutableCommand { /** @@ -45,51 +39,7 @@ public class ChangeEmailCommand extends ExecutableCommand { final String playerName = player.getName(); // Command logic - - try { - if (Settings.getmaxRegPerEmail > 0) { - if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(playerMailNew).size() >= Settings.getmaxRegPerEmail) { - m.send(player, "max_reg"); - return true; - } - } - if (PlayerCache.getInstance().isAuthenticated(playerName)) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(playerName); - if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) { - m.send(player, "usage_email_add"); - return true; - } - if (!playerMailOld.equals(auth.getEmail())) { - m.send(player, "old_email_invalid"); - return true; - } - if (!Settings.isEmailCorrect(playerMailNew)) { - m.send(player, "new_email_invalid"); - return true; - } - auth.setEmail(playerMailNew); - if (!plugin.database.updateEmail(auth)) { - m.send(player, "error"); - return true; - } - PlayerCache.getInstance().updatePlayer(auth); - m.send(player, "email_changed"); - player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); - } else if (PlayerCache.getInstance().isAuthenticated(playerName)) { - m.send(player, "email_confirm"); - } else { - if (!plugin.database.isAuthAvailable(playerName)) { - m.send(player, "login_msg"); - } else { - m.send(player, "reg_email_msg"); - } - } - return true; - } catch (Exception e) { - ConsoleLogger.showError(e.getMessage()); - ConsoleLogger.writeStackTrace(e); - m.send(sender, "error"); - return false; - } + plugin.management.performChangeEmail(player, playerMailOld, playerMailNew); + return true; } } diff --git a/src/main/java/fr/xephi/authme/commands/EmailCommand.java b/src/main/java/fr/xephi/authme/commands/EmailCommand.java index 241d543d..c59bcbc3 100644 --- a/src/main/java/fr/xephi/authme/commands/EmailCommand.java +++ b/src/main/java/fr/xephi/authme/commands/EmailCommand.java @@ -1,13 +1,5 @@ package fr.xephi.authme.commands; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -16,9 +8,14 @@ import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.security.NoSuchAlgorithmException; /** - * * @author Xephi59 */ public class EmailCommand implements CommandExecutor { @@ -32,7 +29,7 @@ public class EmailCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { + String[] args) { if (!(sender instanceof Player)) { return true; } @@ -57,81 +54,13 @@ public class EmailCommand implements CommandExecutor { m.send(player, "usage_email_add"); return true; } - if (Settings.getmaxRegPerEmail > 0) { - if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(args[1]).size() >= Settings.getmaxRegPerEmail) { - m.send(player, "max_reg"); - return true; - } - } - if (args[1].equals(args[2]) && PlayerCache.getInstance().isAuthenticated(name)) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(name); - if (auth.getEmail() == null || (!auth.getEmail().equals("your@email.com") && !auth.getEmail().isEmpty())) { - m.send(player, "usage_email_change"); - return true; - } - if (!Settings.isEmailCorrect(args[1])) { - m.send(player, "email_invalid"); - return true; - } - auth.setEmail(args[1]); - if (!plugin.database.updateEmail(auth)) { - m.send(player, "error"); - return true; - } - PlayerCache.getInstance().updatePlayer(auth); - m.send(player, "email_added"); - player.sendMessage(auth.getEmail()); - } else if (PlayerCache.getInstance().isAuthenticated(name)) { - m.send(player, "email_confirm"); - } else { - if (!plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - m.send(player, "reg_email_msg"); - } - } + plugin.management.performAddEmail(player, args[1], args[2]); } else if (args[0].equalsIgnoreCase("change")) { if (args.length != 3) { m.send(player, "usage_email_change"); return true; } - if (Settings.getmaxRegPerEmail > 0) { - if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) { - m.send(player, "max_reg"); - return true; - } - } - if (PlayerCache.getInstance().isAuthenticated(name)) { - PlayerAuth auth = PlayerCache.getInstance().getAuth(name); - if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) { - m.send(player, "usage_email_add"); - return true; - } - if (!args[1].equals(auth.getEmail())) { - m.send(player, "old_email_invalid"); - return true; - } - if (!Settings.isEmailCorrect(args[2])) { - m.send(player, "new_email_invalid"); - return true; - } - auth.setEmail(args[2]); - if (!plugin.database.updateEmail(auth)) { - m.send(player, "error"); - return true; - } - PlayerCache.getInstance().updatePlayer(auth); - m.send(player, "email_changed"); - player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); - } else if (PlayerCache.getInstance().isAuthenticated(name)) { - m.send(player, "email_confirm"); - } else { - if (!plugin.database.isAuthAvailable(name)) { - m.send(player, "login_msg"); - } else { - m.send(player, "reg_email_msg"); - } - } + plugin.management.performChangeEmail(player, args[1], args[2]); } if (args[0].equalsIgnoreCase("recovery")) { if (args.length != 2) { @@ -151,7 +80,7 @@ public class EmailCommand implements CommandExecutor { RandomString rand = new RandomString(Settings.getRecoveryPassLength); String thePass = rand.nextString(); String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, thePass, name); - PlayerAuth auth = null; + PlayerAuth auth; if (PlayerCache.getInstance().isAuthenticated(name)) { auth = PlayerCache.getInstance().getAuth(name); } else if (plugin.database.isAuthAvailable(name)) { diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index 40ed684c..dc2ec02c 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -9,10 +9,7 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.concurrent.*; public class CacheDataSource implements DataSource { @@ -229,23 +226,15 @@ public class CacheDataSource implements DataSource { @Override public synchronized boolean updateEmail(final PlayerAuth auth) { - if (!cache.containsKey(auth.getNickname())) { + try { + return exec.submit(new Callable() { + public Boolean call() { + return source.updateEmail(auth); + } + }).get(); + } catch (Exception e) { return false; } - PlayerAuth cachedAuth = cache.get(auth.getNickname()); - final String oldEmail = cachedAuth.getEmail(); - cachedAuth.setEmail(auth.getEmail()); - exec.execute(new Runnable() { - @Override - public void run() { - if (!source.updateEmail(auth)) { - if (cache.containsKey(auth.getNickname())) { - cache.get(auth.getNickname()).setEmail(oldEmail); - } - } - } - }); - return true; } @Override diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index e0479468..f20d99ef 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -692,6 +692,7 @@ public class MySQL implements DataSource { pst.executeUpdate(); } catch (Exception ex) { ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.writeStackTrace(ex); return false; } finally { close(pst); 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 8735aedf..93f6f22a 100644 --- a/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java +++ b/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java @@ -71,13 +71,21 @@ public class AsyncChangeEmail { return; } PlayerCache.getInstance().updatePlayer(auth); + if (oldEmail == null) { + m.send(player, "email_added"); + player.sendMessage(auth.getEmail()); + return; + } m.send(player, "email_changed"); player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail()); } else { - if (!plugin.database.isAuthAvailable(playerName)) { + if (plugin.database.isAuthAvailable(playerName)) { m.send(player, "login_msg"); } else { - m.send(player, "reg_email_msg"); + if (Settings.emailRegistration) + m.send(player, "reg_email_msg"); + else + m.send(player, "reg_msg"); } } } catch (Exception e) { From 76fa63118415df4b6d60925dec54b07e8cc01297 Mon Sep 17 00:00:00 2001 From: Xephi Date: Tue, 3 Nov 2015 15:23:02 +0100 Subject: [PATCH 407/427] Disable Hikari Cache definitively --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 8fdc2371..940d9263 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -100,13 +100,7 @@ public class MySQL implements DataSource { config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database); config.setUsername(this.username); config.setPassword(this.password); - if (Settings.isMySQLWebsite) { - config.addDataSourceProperty("cachePrepStmts", "false"); - } else { - config.addDataSourceProperty("cachePrepStmts", "true"); - config.addDataSourceProperty("prepStmtCacheSize", "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); - } + config.addDataSourceProperty("cachePrepStmts", "false"); config.addDataSourceProperty("autoReconnect", false); config.setInitializationFailFast(true); // Don't start the plugin if the database is unavailable config.setMaxLifetime(180000); // 3 Min From f4d8e45733b1d241115d9fe3fff485e4153da113 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Tue, 3 Nov 2015 23:40:23 +0100 Subject: [PATCH 408/427] Check for a null destination --- .../xephi/authme/commands/AdminCommand.java | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index fa27ee31..78b05482 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -1,5 +1,23 @@ package fr.xephi.authme.commands; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -14,23 +32,6 @@ import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.util.Utils; import fr.xephi.authme.util.Utils.GroupType; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; public class AdminCommand implements CommandExecutor { @@ -43,7 +44,7 @@ public class AdminCommand implements CommandExecutor { @Override public boolean onCommand(final CommandSender sender, Command cmnd, - String label, String[] args) { + String label, String[] args) { if (args.length == 0) { sender.sendMessage("Usage:"); sender.sendMessage("/authme reload - Reload the config"); @@ -195,6 +196,7 @@ public class AdminCommand implements CommandExecutor { } else { final String[] arguments = args; Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @Override public void run() { StringBuilder message = new StringBuilder("[AuthMe] "); @@ -262,6 +264,7 @@ public class AdminCommand implements CommandExecutor { } } plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @SuppressWarnings("deprecation") @Override public void run() { @@ -484,7 +487,7 @@ public class AdminCommand implements CommandExecutor { Location spawn = plugin.getSpawnLocation(target); SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false); plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled()) { + if (!tpEvent.isCancelled() && tpEvent.getTo() != null) { target.teleport(tpEvent.getTo()); } } From c16b80a2bf55498374d9c451c7bd0629290db914 Mon Sep 17 00:00:00 2001 From: Xephi Date: Wed, 4 Nov 2015 09:02:20 +0100 Subject: [PATCH 409/427] We don't need a final statement --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 10b2b388..64555bcf 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -200,7 +200,7 @@ public class AuthMePlayerListener implements Listener { } @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerJoin(final PlayerJoinEvent event) { + public void onPlayerJoin(PlayerJoinEvent event) { if (event.getPlayer() == null) return; From 6f56e865b76a6640f3d22117a4487dd06d85e999 Mon Sep 17 00:00:00 2001 From: Xephi Date: Wed, 4 Nov 2015 09:09:19 +0100 Subject: [PATCH 410/427] We hope if player is authenticated, he is registered :') --- src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 3085fb4e..73402e4d 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -45,7 +45,7 @@ public class AsyncronousQuit { String ip = plugin.getIP(player); if (PlayerCache.getInstance().isAuthenticated(name)) { - if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) { + if (Settings.isSaveQuitLocationEnabled) { Location loc = player.getLocation(); PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName()); database.updateQuitLoc(auth); From ddda62aa14c5483faea9ae6891dbf64bccf7d9d3 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 7 Nov 2015 00:13:29 +0100 Subject: [PATCH 411/427] cleaup --- .../java/fr/xephi/authme/ConsoleLogger.java | 9 +++++---- .../executable/authme/AccountsCommand.java | 2 +- .../executable/authme/UnregisterCommand.java | 17 ++++++++--------- .../executable/email/AddEmailCommand.java | 5 +++-- .../executable/email/ChangeEmailCommand.java | 5 +++-- .../fr/xephi/authme/commands/EmailCommand.java | 13 +++++++------ .../authme/datasource/CacheDataSource.java | 16 ++++++++++------ .../fr/xephi/authme/datasource/DataSource.java | 1 - .../java/fr/xephi/authme/datasource/MySQL.java | 14 ++++++++++---- .../fr/xephi/authme/process/Management.java | 5 +++-- .../authme/process/email/AsyncChangeEmail.java | 7 ++++--- .../process/logout/AsyncronousLogout.java | 3 --- .../authme/process/register/AsyncRegister.java | 9 +++++---- .../ProcessSyncronousPasswordRegister.java | 3 --- .../unregister/AsyncronousUnregister.java | 2 -- .../fr/xephi/authme/settings/Settings.java | 18 ++++++++++++------ src/main/java/fr/xephi/authme/util/Utils.java | 2 -- 17 files changed, 71 insertions(+), 60 deletions(-) diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index e791e352..e2c4ba5f 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -1,9 +1,5 @@ package fr.xephi.authme; -import com.google.common.base.Throwables; -import fr.xephi.authme.api.NewAPI; -import fr.xephi.authme.settings.Settings; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardOpenOption; @@ -12,6 +8,11 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Logger; +import com.google.common.base.Throwables; + +import fr.xephi.authme.api.NewAPI; +import fr.xephi.authme.settings.Settings; + public class ConsoleLogger { private static final Logger log = AuthMe.getInstance().getLogger(); diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java index abe06661..ad29b365 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/AccountsCommand.java @@ -2,11 +2,11 @@ package fr.xephi.authme.command.executable.authme; import java.util.List; -import fr.xephi.authme.ConsoleLogger; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java index e7ea7216..3ff3ed3f 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterCommand.java @@ -1,25 +1,24 @@ package fr.xephi.authme.command.executable.authme; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; -import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.util.Utils; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; public class UnregisterCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java index d73e4397..c9d38cdc 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/AddEmailCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.email; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class AddEmailCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java index fe6a4be2..d02fdb9a 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/ChangeEmailCommand.java @@ -1,11 +1,12 @@ package fr.xephi.authme.command.executable.email; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.settings.Messages; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class ChangeEmailCommand extends ExecutableCommand { diff --git a/src/main/java/fr/xephi/authme/commands/EmailCommand.java b/src/main/java/fr/xephi/authme/commands/EmailCommand.java index c59bcbc3..5f11ae25 100644 --- a/src/main/java/fr/xephi/authme/commands/EmailCommand.java +++ b/src/main/java/fr/xephi/authme/commands/EmailCommand.java @@ -1,5 +1,12 @@ package fr.xephi.authme.commands; +import java.security.NoSuchAlgorithmException; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -8,12 +15,6 @@ import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.security.NoSuchAlgorithmException; /** * @author Xephi59 diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index dc2ec02c..03d1af22 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -1,15 +1,19 @@ package fr.xephi.authme.datasource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.util.Utils; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.*; public class CacheDataSource implements DataSource { diff --git a/src/main/java/fr/xephi/authme/datasource/DataSource.java b/src/main/java/fr/xephi/authme/datasource/DataSource.java index 40c3c883..3424809e 100644 --- a/src/main/java/fr/xephi/authme/datasource/DataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/DataSource.java @@ -1,6 +1,5 @@ package fr.xephi.authme.datasource; -import java.sql.SQLException; import java.util.List; import fr.xephi.authme.cache.auth.PlayerAuth; diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index cf6ec5af..cfbfd74e 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -1,18 +1,24 @@ package fr.xephi.authme.datasource; +import java.sql.Blob; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.pool.PoolInitializationException; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.Settings; -import java.sql.*; -import java.util.ArrayList; -import java.util.List; - public class MySQL implements DataSource { private String host; diff --git a/src/main/java/fr/xephi/authme/process/Management.java b/src/main/java/fr/xephi/authme/process/Management.java index ccd88b21..b0ba6c04 100644 --- a/src/main/java/fr/xephi/authme/process/Management.java +++ b/src/main/java/fr/xephi/authme/process/Management.java @@ -1,5 +1,8 @@ package fr.xephi.authme.process; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.process.email.AsyncChangeEmail; import fr.xephi.authme.process.join.AsyncronousJoin; @@ -10,8 +13,6 @@ import fr.xephi.authme.process.register.AsyncRegister; import fr.xephi.authme.process.unregister.AsyncronousUnregister; import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Settings; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitScheduler; /** * @authors Xephi59, 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 93f6f22a..6fa9ac7e 100644 --- a/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java +++ b/src/main/java/fr/xephi/authme/process/email/AsyncChangeEmail.java @@ -1,14 +1,15 @@ package fr.xephi.authme.process.email; +import java.util.Arrays; + +import org.bukkit.entity.Player; + 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.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.entity.Player; - -import java.util.Arrays; public class AsyncChangeEmail { diff --git a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java index b0b4670e..e728473f 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsyncronousLogout.java @@ -1,6 +1,5 @@ package fr.xephi.authme.process.logout; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; @@ -9,9 +8,7 @@ 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.AuthMeTeleportEvent; import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.Utils; import fr.xephi.authme.util.Utils.GroupType; diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java index 9f5bdf77..b7abdf5b 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java @@ -1,5 +1,10 @@ package fr.xephi.authme.process.register; +import java.security.NoSuchAlgorithmException; +import java.util.Date; + +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -8,10 +13,6 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; -import org.bukkit.entity.Player; - -import java.security.NoSuchAlgorithmException; -import java.util.Date; public class AsyncRegister { diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 8bdb946f..b747394c 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -2,7 +2,6 @@ package fr.xephi.authme.process.register; import org.bukkit.Bukkit; import org.bukkit.GameMode; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitScheduler; @@ -12,9 +11,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.events.AuthMeTeleportEvent; import fr.xephi.authme.events.LoginEvent; -import fr.xephi.authme.events.RegisterTeleportEvent; import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java index e635b755..e7aafcb0 100644 --- a/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java +++ b/src/main/java/fr/xephi/authme/process/unregister/AsyncronousUnregister.java @@ -2,7 +2,6 @@ package fr.xephi.authme.process.unregister; import java.security.NoSuchAlgorithmException; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -14,7 +13,6 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index a2886ccf..d1c02610 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -1,16 +1,22 @@ package fr.xephi.authme.settings; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.configuration.file.YamlConfiguration; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource.DataSourceType; import fr.xephi.authme.security.HashAlgorithm; -import org.bukkit.configuration.file.YamlConfiguration; - -import java.io.*; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; public final class Settings extends YamlConfiguration { diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index 7d26c949..fd73baf7 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -12,8 +12,6 @@ import java.util.Collection; import java.util.Collections; import java.util.zip.GZIPInputStream; -import fr.xephi.authme.events.SpawnTeleportEvent; -import fr.xephi.authme.settings.Spawn; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; From 89b43158d47e7fd4ee624cac6da86bc2ffeb72d6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 8 Nov 2015 01:18:24 +0100 Subject: [PATCH 412/427] Fix mail library classes conflict --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ecb05302..451aed58 100644 --- a/pom.xml +++ b/pom.xml @@ -216,7 +216,7 @@ javax.mail javax.mail-api 1.5.4 - compile + provided true @@ -508,6 +508,8 @@ net.ricecode string-similarity 1.0.0 + compile + true
    From d4498521c3df7b5761001c883fe2cffa73c46796 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 8 Nov 2015 01:35:13 +0100 Subject: [PATCH 413/427] Remove useless hikari sqlite mode --- src/main/java/fr/xephi/authme/AuthMe.java | 5 - .../java/fr/xephi/authme/PerformBackup.java | 1 - .../xephi/authme/datasource/DataSource.java | 3 +- .../authme/datasource/SQLite_HIKARI.java | 749 ------------------ src/main/resources/config.yml | 6 +- 5 files changed, 4 insertions(+), 760 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index dbf99b6c..43d6a710 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -45,7 +45,6 @@ import fr.xephi.authme.datasource.DatabaseCalls; import fr.xephi.authme.datasource.FlatFile; import fr.xephi.authme.datasource.MySQL; import fr.xephi.authme.datasource.SQLite; -import fr.xephi.authme.datasource.SQLite_HIKARI; import fr.xephi.authme.listener.AuthMeBlockListener; import fr.xephi.authme.listener.AuthMeEntityListener; import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter; @@ -434,10 +433,6 @@ public class AuthMe extends JavaPlugin { database = new SQLite(); isSQLite = true; break; - case SQLITEHIKARI: - database = new SQLite_HIKARI(); - isSQLite = true; - break; } if (isSQLite) { diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index 5550a7c7..0f7e1fcc 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -37,7 +37,6 @@ public class PerformBackup { return FileBackup("auths.db"); case MYSQL: return MySqlBackup(); - case SQLITEHIKARI: case SQLITE: return FileBackup(Settings.getMySQLDatabase + ".db"); } diff --git a/src/main/java/fr/xephi/authme/datasource/DataSource.java b/src/main/java/fr/xephi/authme/datasource/DataSource.java index 3424809e..c4fada07 100644 --- a/src/main/java/fr/xephi/authme/datasource/DataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/DataSource.java @@ -9,8 +9,7 @@ public interface DataSource { enum DataSourceType { MYSQL, FILE, - SQLITE, - SQLITEHIKARI + SQLITE } boolean isAuthAvailable(String user); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java b/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java deleted file mode 100644 index 87af9fe9..00000000 --- a/src/main/java/fr/xephi/authme/datasource/SQLite_HIKARI.java +++ /dev/null @@ -1,749 +0,0 @@ -package fr.xephi.authme.datasource; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.settings.Settings; - -public class SQLite_HIKARI implements DataSource { - - private String database; - private String tableName; - private String columnName; - private String columnPassword; - private String columnIp; - private String columnLastLogin; - private String columnSalt; - private String columnGroup; - private String lastlocX; - private String lastlocY; - private String lastlocZ; - private String lastlocWorld; - private String columnEmail; - private String columnID; - private HikariDataSource ds; - private String columnLogged; - private String columnRealName; - - public SQLite_HIKARI() throws ClassNotFoundException, SQLException { - this.database = Settings.getMySQLDatabase; - this.tableName = Settings.getMySQLTablename; - this.columnName = Settings.getMySQLColumnName; - this.columnPassword = Settings.getMySQLColumnPassword; - this.columnIp = Settings.getMySQLColumnIp; - this.columnLastLogin = Settings.getMySQLColumnLastLogin; - this.columnSalt = Settings.getMySQLColumnSalt; - this.columnGroup = Settings.getMySQLColumnGroup; - this.lastlocX = Settings.getMySQLlastlocX; - this.lastlocY = Settings.getMySQLlastlocY; - this.lastlocZ = Settings.getMySQLlastlocZ; - this.lastlocWorld = Settings.getMySQLlastlocWorld; - this.columnEmail = Settings.getMySQLColumnEmail; - this.columnID = Settings.getMySQLColumnId; - this.columnLogged = Settings.getMySQLColumnLogged; - this.columnRealName = Settings.getMySQLColumnRealName; - - // Set the connection arguments - try { - this.setConnectionArguments(); - } catch (RuntimeException rt) { - ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer!"); - throw rt; - } - - // Initialize the database - try { - this.setupConnection(); - } catch (SQLException e) { - this.close(); - ConsoleLogger.showError("Can't initialize the SQLite database... Please check your database settings in the config.yml file! SHUTDOWN..."); - ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN..."); - throw e; - } - } - - @Override - public DataSourceType getType() { - return DataSourceType.SQLITEHIKARI; - } - - private synchronized void setConnectionArguments() throws RuntimeException { - HikariConfig config = new HikariConfig(); - config.setPoolName("AuthMeSQLitePool"); - config.setDriverClassName("org.sqlite.JDBC"); // RuntimeException - config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); - config.setMaxLifetime(180000); // 3 Min - config.setIdleTimeout(60000); // 1 Min - config.setMinimumIdle(2); - config.setMaximumPoolSize(8); // don't set too much - ds = new HikariDataSource(config); - ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!"); - } - - private synchronized void reloadArguments() - throws ClassNotFoundException, IllegalArgumentException { - if (ds != null) { - ds.close(); - } - setConnectionArguments(); - ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!"); - } - - private synchronized Connection getConnection() throws SQLException { - return ds.getConnection(); - } - - private synchronized void setupConnection() throws SQLException { - Connection con = null; - Statement st = null; - ResultSet rs = null; - try { - con = getConnection(); - st = con.createStatement(); - st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" + columnID + " INTEGER AUTO_INCREMENT," + columnName + " VARCHAR(255) NOT NULL UNIQUE," + columnPassword + " VARCHAR(255) NOT NULL," + columnIp + " VARCHAR(40) NOT NULL," + columnLastLogin + " BIGINT," + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT '" + Settings.defaultWorld + "'," + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com'," + "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));"); - rs = con.getMetaData().getColumns(null, null, tableName, columnPassword); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnPassword + " VARCHAR(255) NOT NULL;"); - } - rs.close(); - rs = con.getMetaData().getColumns(null, null, tableName, columnIp); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnIp + " VARCHAR(40) NOT NULL;"); - } - rs.close(); - rs = con.getMetaData().getColumns(null, null, tableName, columnLastLogin); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnLastLogin + " BIGINT DEFAULT '0';"); - } - rs.close(); - rs = con.getMetaData().getColumns(null, null, tableName, lastlocX); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0';"); - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0';"); - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';"); - } - rs.close(); - rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT 'world';"); - } - rs.close(); - rs = con.getMetaData().getColumns(null, null, tableName, columnEmail); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com';"); - } - rs.close(); - rs = con.getMetaData().getColumns(null, null, tableName, columnLogged); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnLogged + " BIGINT DEFAULT '0';"); - } - rs.close(); - rs = con.getMetaData().getColumns(null, null, tableName, columnRealName); - if (!rs.next()) { - st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) NOT NULL DEFAULT 'Player';"); - } - } finally { - close(rs); - close(st); - close(con); - } - ConsoleLogger.info("SQLite Setup finished"); - } - - @Override - public synchronized boolean isAuthAvailable(String user) { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs = null; - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); - pst.setString(1, user); - rs = pst.executeQuery(); - return rs.next(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(rs); - close(pst); - close(con); - } - } - - @Override - public synchronized PlayerAuth getAuth(String user) { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs = null; - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);"); - pst.setString(1, user); - rs = pst.executeQuery(); - if (rs.next()) { - if (rs.getString(columnIp).isEmpty()) { - 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), rs.getString(columnRealName)); - } 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), rs.getString(columnRealName)); - } else { - return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); - } - } - } else { - return null; - } - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return null; - } finally { - close(rs); - close(pst); - close(con); - } - } - - @Override - public synchronized boolean saveAuth(PlayerAuth auth) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - if (columnSalt.isEmpty() && auth.getSalt().isEmpty()) { - pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnRealName + ") VALUES (?,?,?,?,?);"); - pst.setString(1, auth.getNickname()); - pst.setString(2, auth.getHash()); - pst.setString(3, auth.getIp()); - pst.setLong(4, auth.getLastLogin()); - pst.setString(5, auth.getRealName()); - pst.executeUpdate(); - } else { - pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnSalt + "," + columnRealName + ") VALUES (?,?,?,?,?,?);"); - pst.setString(1, auth.getNickname()); - pst.setString(2, auth.getHash()); - pst.setString(3, auth.getIp()); - pst.setLong(4, auth.getLastLogin()); - pst.setString(5, auth.getSalt()); - pst.setString(6, auth.getRealName()); - pst.executeUpdate(); - } - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(pst); - close(con); - } - return true; - } - - @Override - public synchronized boolean updatePassword(PlayerAuth auth) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnPassword + "=? WHERE " + columnName + "=?;"); - pst.setString(1, auth.getHash()); - pst.setString(2, auth.getNickname()); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(pst); - close(con); - } - return true; - } - - @Override - public boolean updateSession(PlayerAuth auth) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=?, " + columnRealName + "=? WHERE " + columnName + "=?;"); - pst.setString(1, auth.getIp()); - pst.setLong(2, auth.getLastLogin()); - pst.setString(3, auth.getRealName()); - pst.setString(4, auth.getNickname()); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(pst); - close(con); - } - return true; - } - - @Override - public int purgeDatabase(long until) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + " autoPurgeDatabase(long until) { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs = null; - List list = new ArrayList<>(); - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + "(); - } finally { - close(rs); - close(pst); - close(con); - } - } - - @Override - public synchronized boolean removeAuth(String user) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnName + "=?;"); - pst.setString(1, user); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(pst); - close(con); - } - return true; - } - - @Override - public boolean updateQuitLoc(PlayerAuth auth) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + lastlocX + "=?, " + lastlocY + "=?, " + lastlocZ + "=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;"); - pst.setDouble(1, auth.getQuitLocX()); - pst.setDouble(2, auth.getQuitLocY()); - pst.setDouble(3, auth.getQuitLocZ()); - pst.setString(4, auth.getWorld()); - pst.setString(5, auth.getNickname()); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(pst); - close(con); - } - return true; - } - - @Override - public int getIps(String ip) { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs = null; - int countIp = 0; - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); - pst.setString(1, ip); - rs = pst.executeQuery(); - while (rs.next()) { - countIp++; - } - return countIp; - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return 0; - } finally { - close(rs); - close(pst); - close(con); - } - } - - @Override - public boolean updateEmail(PlayerAuth auth) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnEmail + "=? WHERE " + columnName + "=?;"); - pst.setString(1, auth.getEmail()); - pst.setString(2, auth.getNickname()); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(pst); - close(con); - } - return true; - } - - @Override - public boolean updateSalt(PlayerAuth auth) { - if (columnSalt.isEmpty()) { - return false; - } - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnSalt + "=? WHERE " + columnName + "=?;"); - pst.setString(1, auth.getSalt()); - pst.setString(2, auth.getNickname()); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(pst); - close(con); - } - return true; - } - - @Override - public List getAllAuthsByName(PlayerAuth auth) { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs = null; - List countIp = new ArrayList<>(); - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); - pst.setString(1, auth.getIp()); - rs = pst.executeQuery(); - while (rs.next()) { - countIp.add(rs.getString(columnName)); - } - return countIp; - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return new ArrayList<>(); - } catch (NullPointerException npe) { - return new ArrayList<>(); - } finally { - close(rs); - close(pst); - close(con); - } - } - - @Override - public List getAllAuthsByIp(String ip) throws SQLException { - final Connection con = getConnection(); - PreparedStatement pst = null; - ResultSet rs = null; - List countIp = new ArrayList<>(); - try { - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;"); - pst.setString(1, ip); - rs = pst.executeQuery(); - while (rs.next()) { - countIp.add(rs.getString(columnName)); - } - return countIp; - } finally { - close(rs); - close(pst); - close(con); - } - } - - @Override - public List getAllAuthsByEmail(String email) throws SQLException { - final Connection con = getConnection(); - PreparedStatement pst = null; - ResultSet rs = null; - List countEmail = new ArrayList<>(); - try { - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;"); - pst.setString(1, email); - rs = pst.executeQuery(); - while (rs.next()) { - countEmail.add(rs.getString(columnName)); - } - return countEmail; - } finally { - close(rs); - close(pst); - close(con); - } - } - - @Override - public void purgeBanned(List banned) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - for (String name : banned) { - pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnName + "=?;"); - pst.setString(1, name); - pst.executeUpdate(); - } - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } finally { - close(pst); - close(con); - } - } - - @Override - public boolean isLogged(String user) { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs = null; - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;"); - pst.setString(1, user); - rs = pst.executeQuery(); - if (rs.next()) - return (rs.getInt(columnLogged) == 1); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return false; - } finally { - close(rs); - close(pst); - close(con); - } - return false; - } - - @Override - public void setLogged(String user) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); - pst.setInt(1, 1); - pst.setString(2, user); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } finally { - close(pst); - close(con); - } - } - - @Override - public void setUnlogged(String user) { - Connection con = null; - PreparedStatement pst = null; - if (user != null) - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;"); - pst.setInt(1, 0); - pst.setString(2, user); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } finally { - close(pst); - close(con); - } - } - - @Override - public void purgeLogged() { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnLogged + "=?;"); - pst.setInt(1, 0); - pst.setInt(2, 1); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } finally { - close(pst); - close(con); - } - } - - @Override - public int getAccountsRegistered() { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs; - int result = 0; - try { - con = getConnection(); - pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";"); - rs = pst.executeQuery(); - if (rs != null && rs.next()) { - result = rs.getInt(1); - } - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return result; - } finally { - close(pst); - close(con); - } - return result; - } - - @Override - public void updateName(String oldone, String newone) { - Connection con = null; - PreparedStatement pst = null; - try { - con = getConnection(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE " + columnName + "=?;"); - pst.setString(1, newone); - pst.setString(2, oldone); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } finally { - close(pst); - close(con); - } - } - - @Override - public List getAllAuths() { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs; - List auths = new ArrayList<>(); - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + ";"); - rs = pst.executeQuery(); - while (rs.next()) { - PlayerAuth pAuth; - if (rs.getString(columnIp).isEmpty()) { - pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); - } else { - if (!columnSalt.isEmpty()) { - pAuth = 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), rs.getString(columnRealName)); - } else { - pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); - } - } - auths.add(pAuth); - } - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return auths; - } finally { - close(pst); - close(con); - } - return auths; - } - - @Override - public List getLoggedPlayers() { - Connection con = null; - PreparedStatement pst = null; - ResultSet rs; - List auths = new ArrayList<>(); - try { - con = getConnection(); - pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;"); - rs = pst.executeQuery(); - while (rs.next()) { - PlayerAuth pAuth; - if (rs.getString(columnIp).isEmpty()) { - pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); - } else { - if (!columnSalt.isEmpty()) { - pAuth = 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), rs.getString(columnRealName)); - } else { - pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName)); - } - } - auths.add(pAuth); - } - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - } finally { - close(pst); - close(con); - } - return auths; - } - - @Override - public void reload() { - try { - reloadArguments(); - } catch (Exception e) { - ConsoleLogger.showError(e.getMessage()); - ConsoleLogger.showError("Can't reconnect to SQLite database... Please check your SQLite informations ! SHUTDOWN..."); - if (Settings.isStopEnabled) { - AuthMe.getInstance().getServer().shutdown(); - } - if (!Settings.isStopEnabled) - AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance()); - } - } - - @Override - public synchronized void close() { - if (ds != null) - ds.close(); - } - - private void close(AutoCloseable o) { - if (o != null) { - try { - o.close(); - } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); - } - } - } -} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 671abc50..084b9cff 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,9 +1,8 @@ DataSource: # What type of database do you want to use? - # Can be set to: sqlite, sqlitehikari, mysql - # (sqlitehikari should be more fast than normal sqlite but it's an experimental feature!) + # Valid values: sqlite, mysql backend: sqlite - # Enable database caching + # Enable database caching, should improve database performance caching: true # Database location mySQLHost: 127.0.0.1 @@ -136,6 +135,7 @@ settings: # permission: /authme.admin.accounts displayOtherAccounts: true # WorldNames where we need to force the spawn location for ForceSpawnLocOnJoinEnabled + # CASE SENSITIVE ForceSpawnOnTheseWorlds: - world - world_nether From e1d1ebfca55bb4b8c02d86cff07c4cf6f7885dbf Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 8 Nov 2015 14:18:51 +0100 Subject: [PATCH 414/427] Move to old getPlayer method that always work and let us be more compatible --- .../fr/xephi/authme/listener/AuthMePlayerListener.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 64555bcf..fda2caa7 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -227,15 +227,14 @@ public class AuthMePlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPreLogin(AsyncPlayerPreLoginEvent event) { final String name = event.getName().toLowerCase(); - final Player player = plugin.dataManager.getOnlinePlayerLower(name); + final Player player = plugin.getServer().getPlayer(name); if (player == null) return; // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player - if (Settings.isForceSingleSessionEnabled) { - event.setKickMessage(m.getString("same_nick")); - event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); + if (Settings.isForceSingleSessionEnabled && player.isOnline()) { + event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, m.getString("same_nick")); if (LimboCache.getInstance().hasLimboPlayer(name)) Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { From 54c56461f113cfdab127ad1be3b777c357b302f4 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 8 Nov 2015 14:50:04 +0100 Subject: [PATCH 415/427] Add 'l' alias to /login command --- .../xephi/authme/command/CommandManager.java | 770 ++++++++---------- 1 file changed, 352 insertions(+), 418 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 83aa4c43..37efc8e3 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -40,11 +40,12 @@ public class CommandManager { /** * Constructor. * - * @param registerCommands True to register the commands, false otherwise. + * @param registerCommands + * True to register the commands, false otherwise. */ public CommandManager(boolean registerCommands) { // Register the commands - if(registerCommands) + if (registerCommands) registerCommands(); } @@ -54,573 +55,504 @@ public class CommandManager { @SuppressWarnings({ "serial" }) public void registerCommands() { // Register the base AuthMe Reloaded command - CommandDescription authMeBaseCommand = new CommandDescription( - new AuthMeCommand(), - new ArrayList() {{ - add("authme"); - }}, - "Main command", - "The main AuthMeReloaded command. The root for all admin commands.", null); + CommandDescription authMeBaseCommand = new CommandDescription(new AuthMeCommand(), new ArrayList() { + + { + add("authme"); + } + }, "Main command", "The main AuthMeReloaded command. The root for all admin commands.", null); // Register the help command - CommandDescription authMeHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded commands.", - authMeBaseCommand); + CommandDescription authMeHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded commands.", authMeBaseCommand); authMeHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); authMeHelpCommand.setMaximumArguments(false); // Register the register command - CommandDescription registerCommand = new CommandDescription( - new RegisterCommand(), - new ArrayList() {{ - add("register"); - add("reg"); - add("r"); - }}, - "Register a player", - "Register the specified player with the specified password.", - authMeBaseCommand); + CommandDescription registerCommand = new CommandDescription(new RegisterCommand(), new ArrayList() { + + { + add("register"); + add("reg"); + add("r"); + } + }, "Register a player", "Register the specified player with the specified password.", authMeBaseCommand); registerCommand.setCommandPermissions("authme.admin.register", CommandPermissions.DefaultPermission.OP_ONLY); registerCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); registerCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); // Register the unregister command - CommandDescription unregisterCommand = new CommandDescription( - new UnregisterCommand(), - new ArrayList() {{ - add("unregister"); - add("unreg"); - add("unr"); - add("delete"); - add("del"); - }}, - "Unregister a player", - "Unregister the specified player.", - authMeBaseCommand); + CommandDescription unregisterCommand = new CommandDescription(new UnregisterCommand(), new ArrayList() { + + { + add("unregister"); + add("unreg"); + add("unr"); + add("delete"); + add("del"); + } + }, "Unregister a player", "Unregister the specified player.", authMeBaseCommand); unregisterCommand.setCommandPermissions("authme.admin.unregister", CommandPermissions.DefaultPermission.OP_ONLY); unregisterCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); // Register the forcelogin command - CommandDescription forceLoginCommand = new CommandDescription( - new ForceLoginCommand(), - new ArrayList() {{ - add("forcelogin"); - add("login"); - }}, - "Enforce login player", - "Enforce the specified player to login.", - authMeBaseCommand); + CommandDescription forceLoginCommand = new CommandDescription(new ForceLoginCommand(), new ArrayList() { + + { + add("forcelogin"); + add("login"); + } + }, "Enforce login player", "Enforce the specified player to login.", authMeBaseCommand); forceLoginCommand.setCommandPermissions("authme.admin.forcelogin", CommandPermissions.DefaultPermission.OP_ONLY); forceLoginCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); // Register the changepassword command - CommandDescription changePasswordCommand = new CommandDescription( - new ChangePasswordCommand(), - new ArrayList() {{ - add("password"); - add("changepassword"); - add("changepass"); - add("cp"); - }}, - "Change player's password", - "Change the password of a player.", - authMeBaseCommand); + CommandDescription changePasswordCommand = new CommandDescription(new ChangePasswordCommand(), new ArrayList() { + + { + add("password"); + add("changepassword"); + add("changepass"); + add("cp"); + } + }, "Change player's password", "Change the password of a player.", authMeBaseCommand); changePasswordCommand.setCommandPermissions("authme.admin.changepassword", CommandPermissions.DefaultPermission.OP_ONLY); changePasswordCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); changePasswordCommand.addArgument(new CommandArgumentDescription("pwd", "New password", false)); // Register the purge command - CommandDescription lastLoginCommand = new CommandDescription( - new LastLoginCommand(), - new ArrayList() {{ - add("lastlogin"); - add("ll"); - }}, - "Player's last login", - "View the date of the specified players last login", - authMeBaseCommand); + CommandDescription lastLoginCommand = new CommandDescription(new LastLoginCommand(), new ArrayList() { + + { + add("lastlogin"); + add("ll"); + } + }, "Player's last login", "View the date of the specified players last login", authMeBaseCommand); lastLoginCommand.setCommandPermissions("authme.admin.lastlogin", CommandPermissions.DefaultPermission.OP_ONLY); lastLoginCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); // Register the accounts command - CommandDescription accountsCommand = new CommandDescription( - new AccountsCommand(), - new ArrayList() {{ - add("accounts"); - add("account"); - }}, - "Display player accounts", - "Display all accounts of a player by it's player name or IP.", - authMeBaseCommand); + CommandDescription accountsCommand = new CommandDescription(new AccountsCommand(), new ArrayList() { + + { + add("accounts"); + add("account"); + } + }, "Display player accounts", "Display all accounts of a player by it's player name or IP.", authMeBaseCommand); accountsCommand.setCommandPermissions("authme.admin.accounts", CommandPermissions.DefaultPermission.OP_ONLY); accountsCommand.addArgument(new CommandArgumentDescription("player", "Player name or IP", true)); // Register the getemail command - CommandDescription getEmailCommand = new CommandDescription( - new GetEmailCommand(), - new ArrayList() {{ - add("getemail"); - add("getmail"); - add("email"); - add("mail"); - }}, - "Display player's email", - "Display the email address of the specified player if set.", - authMeBaseCommand); + CommandDescription getEmailCommand = new CommandDescription(new GetEmailCommand(), new ArrayList() { + + { + add("getemail"); + add("getmail"); + add("email"); + add("mail"); + } + }, "Display player's email", "Display the email address of the specified player if set.", authMeBaseCommand); getEmailCommand.setCommandPermissions("authme.admin.getemail", CommandPermissions.DefaultPermission.OP_ONLY); getEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); // Register the setemail command - CommandDescription setEmailCommand = new CommandDescription( - new SetEmailCommand(), - new ArrayList() {{ - add("chgemail"); - add("chgmail"); - add("setemail"); - add("setmail"); - }}, - "Change player's email", - "Change the email address of the specified player.", - authMeBaseCommand); + CommandDescription setEmailCommand = new CommandDescription(new SetEmailCommand(), new ArrayList() { + + { + add("chgemail"); + add("chgmail"); + add("setemail"); + add("setmail"); + } + }, "Change player's email", "Change the email address of the specified player.", authMeBaseCommand); setEmailCommand.setCommandPermissions("authme.admin.chgemail", CommandPermissions.DefaultPermission.OP_ONLY); setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false)); // Register the getip command - CommandDescription getIpCommand = new CommandDescription( - new GetIpCommand(), - new ArrayList() {{ - add("getip"); - add("ip"); - }}, - "Get player's IP", - "Get the IP address of the specified online player.", - authMeBaseCommand); + CommandDescription getIpCommand = new CommandDescription(new GetIpCommand(), new ArrayList() { + + { + add("getip"); + add("ip"); + } + }, "Get player's IP", "Get the IP address of the specified online player.", authMeBaseCommand); getIpCommand.setCommandPermissions("authme.admin.getip", CommandPermissions.DefaultPermission.OP_ONLY); getIpCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); // Register the spawn command - CommandDescription spawnCommand = new CommandDescription( - new SpawnCommand(), - new ArrayList() {{ - add("spawn"); - add("home"); - }}, - "Teleport to spawn", - "Teleport to the spawn.", - authMeBaseCommand); + CommandDescription spawnCommand = new CommandDescription(new SpawnCommand(), new ArrayList() { + + { + add("spawn"); + add("home"); + } + }, "Teleport to spawn", "Teleport to the spawn.", authMeBaseCommand); spawnCommand.setCommandPermissions("authme.admin.spawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the setspawn command - CommandDescription setSpawnCommand = new CommandDescription( - new SetSpawnCommand(), - new ArrayList() {{ - add("setspawn"); - add("chgspawn"); - }}, - "Change the spawn", - "Change the player's spawn to your current position.", - authMeBaseCommand); + CommandDescription setSpawnCommand = new CommandDescription(new SetSpawnCommand(), new ArrayList() { + + { + add("setspawn"); + add("chgspawn"); + } + }, "Change the spawn", "Change the player's spawn to your current position.", authMeBaseCommand); setSpawnCommand.setCommandPermissions("authme.admin.setspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the firstspawn command - CommandDescription firstSpawnCommand = new CommandDescription( - new FirstSpawnCommand(), - new ArrayList() {{ - add("firstspawn"); - add("firsthome"); - }}, - "Teleport to first spawn", - "Teleport to the first spawn.", - authMeBaseCommand); + CommandDescription firstSpawnCommand = new CommandDescription(new FirstSpawnCommand(), new ArrayList() { + + { + add("firstspawn"); + add("firsthome"); + } + }, "Teleport to first spawn", "Teleport to the first spawn.", authMeBaseCommand); firstSpawnCommand.setCommandPermissions("authme.admin.firstspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the setfirstspawn command - CommandDescription setFirstSpawnCommand = new CommandDescription( - new SetFirstSpawnCommand(), - new ArrayList() {{ - add("setfirstspawn"); - add("chgfirstspawn"); - }}, - "Change the first spawn", - "Change the first player's spawn to your current position.", - authMeBaseCommand); + CommandDescription setFirstSpawnCommand = new CommandDescription(new SetFirstSpawnCommand(), new ArrayList() { + + { + add("setfirstspawn"); + add("chgfirstspawn"); + } + }, "Change the first spawn", "Change the first player's spawn to your current position.", authMeBaseCommand); setFirstSpawnCommand.setCommandPermissions("authme.admin.setfirstspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the purge command - CommandDescription purgeCommand = new CommandDescription( - new PurgeCommand(), - new ArrayList() {{ - add("purge"); - add("delete"); - }}, - "Purge old data", - "Purge old AuthMeReloaded data longer than the specified amount of days ago.", - authMeBaseCommand); + CommandDescription purgeCommand = new CommandDescription(new PurgeCommand(), new ArrayList() { + + { + add("purge"); + add("delete"); + } + }, "Purge old data", "Purge old AuthMeReloaded data longer than the specified amount of days ago.", authMeBaseCommand); purgeCommand.setCommandPermissions("authme.admin.purge", CommandPermissions.DefaultPermission.OP_ONLY); purgeCommand.addArgument(new CommandArgumentDescription("days", "Number of days", false)); // Register the purgelastposition command - CommandDescription purgeLastPositionCommand = new CommandDescription( - new PurgeLastPositionCommand(), - new ArrayList() {{ - add("resetpos"); - add("purgelastposition"); - add("purgelastpos"); - add("resetposition"); - add("resetlastposition"); - add("resetlastpos"); - }}, - "Purge player's last position", - "Purge the last know position of the specified player.", - authMeBaseCommand); + CommandDescription purgeLastPositionCommand = new CommandDescription(new PurgeLastPositionCommand(), new ArrayList() { + + { + add("resetpos"); + add("purgelastposition"); + add("purgelastpos"); + add("resetposition"); + add("resetlastposition"); + add("resetlastpos"); + } + }, "Purge player's last position", "Purge the last know position of the specified player.", authMeBaseCommand); purgeLastPositionCommand.setCommandPermissions("authme.admin.purgelastpos", CommandPermissions.DefaultPermission.OP_ONLY); purgeLastPositionCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); // Register the purgebannedplayers command - CommandDescription purgeBannedPlayersCommand = new CommandDescription( - new PurgeBannedPlayersCommand(), - new ArrayList() {{ - add("purgebannedplayers"); - add("purgebannedplayer"); - add("deletebannedplayers"); - add("deletebannedplayer"); - }}, - "Purge banned palyers data", - "Purge all AuthMeReloaded data for banned players.", - authMeBaseCommand); + CommandDescription purgeBannedPlayersCommand = new CommandDescription(new PurgeBannedPlayersCommand(), new ArrayList() { + + { + add("purgebannedplayers"); + add("purgebannedplayer"); + add("deletebannedplayers"); + add("deletebannedplayer"); + } + }, "Purge banned palyers data", "Purge all AuthMeReloaded data for banned players.", authMeBaseCommand); purgeBannedPlayersCommand.setCommandPermissions("authme.admin.purgebannedplayers", CommandPermissions.DefaultPermission.OP_ONLY); // Register the switchantibot command - CommandDescription switchAntiBotCommand = new CommandDescription( - new SwitchAntiBotCommand(), - new ArrayList() {{ - add("switchantibot"); - add("toggleantibot"); - add("antibot"); - }}, - "Switch AntiBot mode", - "Switch or toggle the AntiBot mode to the specified state.", - authMeBaseCommand); + CommandDescription switchAntiBotCommand = new CommandDescription(new SwitchAntiBotCommand(), new ArrayList() { + + { + add("switchantibot"); + add("toggleantibot"); + add("antibot"); + } + }, "Switch AntiBot mode", "Switch or toggle the AntiBot mode to the specified state.", authMeBaseCommand); switchAntiBotCommand.setCommandPermissions("authme.admin.switchantibot", CommandPermissions.DefaultPermission.OP_ONLY); switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true)); -// // Register the resetname command -// CommandDescription resetNameCommand = new CommandDescription( -// new ResetNameCommand(), -// new ArrayList() {{ -// add("resetname"); -// add("resetnames"); -// }}, -// "Reset name", -// "Reset name", -// authMeCommand); -// resetNameCommand.setCommandPermissions("authme.admin.resetname", CommandPermissions.DefaultPermission.OP_ONLY); + // // Register the resetname command + // CommandDescription resetNameCommand = new CommandDescription( + // new ResetNameCommand(), + // new ArrayList() {{ + // add("resetname"); + // add("resetnames"); + // }}, + // "Reset name", + // "Reset name", + // authMeCommand); + // resetNameCommand.setCommandPermissions("authme.admin.resetname", + // CommandPermissions.DefaultPermission.OP_ONLY); // Register the reload command - CommandDescription reloadCommand = new CommandDescription( - new ReloadCommand(), - new ArrayList() {{ - add("reload"); - add("rld"); - }}, - "Reload plugin", - "Reload the AuthMeReloaded plugin.", - authMeBaseCommand); + CommandDescription reloadCommand = new CommandDescription(new ReloadCommand(), new ArrayList() { + + { + add("reload"); + add("rld"); + } + }, "Reload plugin", "Reload the AuthMeReloaded plugin.", authMeBaseCommand); reloadCommand.setCommandPermissions("authme.admin.reload", CommandPermissions.DefaultPermission.OP_ONLY); // Register the version command - CommandDescription versionCommand = new CommandDescription( - new VersionCommand(), - new ArrayList() {{ - add("version"); - add("ver"); - add("v"); - add("about"); - add("info"); - }}, - "Version info", - "Show detailed information about the installed AuthMeReloaded version, and shows the developers, contributors, license and other information.", - authMeBaseCommand); + CommandDescription versionCommand = new CommandDescription(new VersionCommand(), new ArrayList() { + + { + add("version"); + add("ver"); + add("v"); + add("about"); + add("info"); + } + }, "Version info", "Show detailed information about the installed AuthMeReloaded version, and shows the developers, contributors, license and other information.", authMeBaseCommand); versionCommand.setMaximumArguments(false); // Register the base Dungeon Maze command - CommandDescription loginBaseCommand = new CommandDescription( - new LoginCommand(), - new ArrayList() {{ - add("login"); - }}, - "Login command", - "Command to login using AuthMeReloaded.", null); + CommandDescription loginBaseCommand = new CommandDescription(new LoginCommand(), new ArrayList() { + + { + add("login"); + add("l"); + } + }, "Login command", "Command to login using AuthMeReloaded.", null); loginBaseCommand.setCommandPermissions("authme.login", CommandPermissions.DefaultPermission.ALLOWED); loginBaseCommand.addArgument(new CommandArgumentDescription("password", "Login password", false)); // Register the help command - CommandDescription loginHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded login commands.", - loginBaseCommand); + CommandDescription loginHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded login commands.", loginBaseCommand); loginHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); loginHelpCommand.setMaximumArguments(false); // Register the base logout command - CommandDescription logoutBaseCommand = new CommandDescription( - new LogoutCommand(), - new ArrayList() {{ - add("logout"); - }}, - "Logout command", - "Command to logout using AuthMeReloaded.", null); + CommandDescription logoutBaseCommand = new CommandDescription(new LogoutCommand(), new ArrayList() { + + { + add("logout"); + } + }, "Logout command", "Command to logout using AuthMeReloaded.", null); logoutBaseCommand.setCommandPermissions("authme.logout", CommandPermissions.DefaultPermission.ALLOWED); // Register the help command - CommandDescription logoutHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded logout commands.", - logoutBaseCommand); + CommandDescription logoutHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded logout commands.", logoutBaseCommand); logoutHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); logoutHelpCommand.setMaximumArguments(false); // Register the base register command - CommandDescription registerBaseCommand = new CommandDescription( - new fr.xephi.authme.command.executable.register.RegisterCommand(), - new ArrayList() {{ - add("register"); - add("reg"); - }}, - "Registration command", - "Command to register using AuthMeReloaded.", null); + CommandDescription registerBaseCommand = new CommandDescription(new fr.xephi.authme.command.executable.register.RegisterCommand(), new ArrayList() { + + { + add("register"); + add("reg"); + } + }, "Registration command", "Command to register using AuthMeReloaded.", null); registerBaseCommand.setCommandPermissions("authme.register", CommandPermissions.DefaultPermission.ALLOWED); registerBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); registerBaseCommand.addArgument(new CommandArgumentDescription("verifyPassword", "Verify password", false)); registerBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription registerHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded register commands.", - registerBaseCommand); + CommandDescription registerHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded register commands.", registerBaseCommand); registerHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); registerHelpCommand.setMaximumArguments(false); // Register the base unregister command - CommandDescription unregisterBaseCommand = new CommandDescription( - new fr.xephi.authme.command.executable.unregister.UnregisterCommand(), - new ArrayList() {{ - add("unregister"); - add("unreg"); - }}, - "Unregistration command", - "Command to unregister using AuthMeReloaded.", null); + CommandDescription unregisterBaseCommand = new CommandDescription(new fr.xephi.authme.command.executable.unregister.UnregisterCommand(), new ArrayList() { + + { + add("unregister"); + add("unreg"); + } + }, "Unregistration command", "Command to unregister using AuthMeReloaded.", null); unregisterBaseCommand.setCommandPermissions("authme.unregister", CommandPermissions.DefaultPermission.ALLOWED); unregisterBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); // Register the help command - CommandDescription unregisterHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded unregister commands.", - unregisterBaseCommand); + CommandDescription unregisterHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded unregister commands.", unregisterBaseCommand); unregisterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); unregisterHelpCommand.setMaximumArguments(false); // Register the base changepassword command - CommandDescription changePasswordBaseCommand = new CommandDescription( - new fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand(), - new ArrayList() {{ - add("changepassword"); - add("changepass"); - }}, - "Change password command", - "Command to change your password using AuthMeReloaded.", null); + CommandDescription changePasswordBaseCommand = new CommandDescription(new fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand(), new ArrayList() { + + { + add("changepassword"); + add("changepass"); + } + }, "Change password command", "Command to change your password using AuthMeReloaded.", null); changePasswordBaseCommand.setCommandPermissions("authme.changepassword", CommandPermissions.DefaultPermission.ALLOWED); changePasswordBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); changePasswordBaseCommand.addArgument(new CommandArgumentDescription("verifyPassword", "Verify password", false)); changePasswordBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription changePasswordHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded change password commands.", - changePasswordBaseCommand); + CommandDescription changePasswordHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded change password commands.", changePasswordBaseCommand); changePasswordHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); changePasswordHelpCommand.setMaximumArguments(false); // Register the base Dungeon Maze command - CommandDescription emailBaseCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("email"); - add("mail"); - }}, - "E-mail command", - "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null); + CommandDescription emailBaseCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("email"); + add("mail"); + } + }, "E-mail command", "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null); // Register the help command - CommandDescription emailHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded help commands.", - emailBaseCommand); + CommandDescription emailHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded help commands.", emailBaseCommand); emailHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); emailHelpCommand.setMaximumArguments(false); // Register the add command - CommandDescription addEmailCommand = new CommandDescription( - new AddEmailCommand(), - new ArrayList() {{ - add("add"); - add("addemail"); - add("addmail"); - }}, - "Add E-mail", - "Add an new E-Mail address to your account.", - emailBaseCommand); + CommandDescription addEmailCommand = new CommandDescription(new AddEmailCommand(), new ArrayList() { + + { + add("add"); + add("addemail"); + add("addmail"); + } + }, "Add E-mail", "Add an new E-Mail address to your account.", emailBaseCommand); addEmailCommand.setCommandPermissions("authme.email.add", CommandPermissions.DefaultPermission.ALLOWED); addEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); addEmailCommand.addArgument(new CommandArgumentDescription("verifyEmail", "Email address verification", false)); // Register the change command - CommandDescription changeEmailCommand = new CommandDescription( - new ChangeEmailCommand(), - new ArrayList() {{ - add("change"); - add("changeemail"); - add("changemail"); - }}, - "Change E-mail", - "Change an E-Mail address of your account.", - emailBaseCommand); + CommandDescription changeEmailCommand = new CommandDescription(new ChangeEmailCommand(), new ArrayList() { + + { + add("change"); + add("changeemail"); + add("changemail"); + } + }, "Change E-mail", "Change an E-Mail address of your account.", emailBaseCommand); changeEmailCommand.setCommandPermissions("authme.email.change", CommandPermissions.DefaultPermission.ALLOWED); changeEmailCommand.addArgument(new CommandArgumentDescription("oldEmail", "Old email address", false)); changeEmailCommand.addArgument(new CommandArgumentDescription("newEmail", "New email address", false)); // Register the recover command - CommandDescription recoverEmailCommand = new CommandDescription( - new RecoverEmailCommand(), - new ArrayList() {{ - add("recover"); - add("recovery"); - add("recoveremail"); - add("recovermail"); - }}, - "Recover using E-mail", - "Recover your account using an E-mail address.", - emailBaseCommand); + CommandDescription recoverEmailCommand = new CommandDescription(new RecoverEmailCommand(), new ArrayList() { + + { + add("recover"); + add("recovery"); + add("recoveremail"); + add("recovermail"); + } + }, "Recover using E-mail", "Recover your account using an E-mail address.", emailBaseCommand); recoverEmailCommand.setCommandPermissions("authme.email.recover", CommandPermissions.DefaultPermission.ALLOWED); recoverEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); // Register the base captcha command - CommandDescription captchaBaseCommand = new CommandDescription( - new CaptchaCommand(), - new ArrayList() {{ - add("captcha"); - add("capt"); - }}, - "Captcha command", - "Captcha command for AuthMeReloaded.", null); + CommandDescription captchaBaseCommand = new CommandDescription(new CaptchaCommand(), new ArrayList() { + + { + add("captcha"); + add("capt"); + } + }, "Captcha command", "Captcha command for AuthMeReloaded.", null); captchaBaseCommand.setCommandPermissions("authme.captcha", CommandPermissions.DefaultPermission.ALLOWED); captchaBaseCommand.addArgument(new CommandArgumentDescription("captcha", "The captcha", false)); captchaBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription captchaHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded change captcha commands.", - captchaBaseCommand); + CommandDescription captchaHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded change captcha commands.", captchaBaseCommand); captchaHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); captchaHelpCommand.setMaximumArguments(false); // Register the base converter command - CommandDescription converterBaseCommand = new CommandDescription( - new ConverterCommand(), - new ArrayList() {{ - add("converter"); - add("convert"); - add("conv"); - }}, - "Convert command", - "Convert command for AuthMeReloaded.", null); + CommandDescription converterBaseCommand = new CommandDescription(new ConverterCommand(), new ArrayList() { + + { + add("converter"); + add("convert"); + add("conv"); + } + }, "Convert command", "Convert command for AuthMeReloaded.", null); converterBaseCommand.setCommandPermissions("authme.converter", CommandPermissions.DefaultPermission.OP_ONLY); converterBaseCommand.addArgument(new CommandArgumentDescription("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / royalauth / vauth / sqltoflat", false)); converterBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription converterHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded change captcha commands.", - converterBaseCommand); + CommandDescription converterHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded change captcha commands.", converterBaseCommand); converterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); converterHelpCommand.setMaximumArguments(false); @@ -657,19 +589,21 @@ public class CommandManager { /** * Find the best suitable command for the specified reference. * - * @param queryReference The query reference to find a command for. + * @param queryReference + * The query reference to find a command for. * * @return The command found, or null. */ public FoundCommandResult findCommand(CommandParts queryReference) { // Make sure the command reference is valid - if(queryReference.getCount() <= 0) + if (queryReference.getCount() <= 0) return null; // Get the base command description - for(CommandDescription commandDescription : this.commandDescriptions) { - // Check whether there's a command description available for the current command - if(!commandDescription.isSuitableLabel(queryReference)) + for (CommandDescription commandDescription : this.commandDescriptions) { + // Check whether there's a command description available for the + // current command + if (!commandDescription.isSuitableLabel(queryReference)) continue; // Find the command reference, return the result From 1c2cc959cc7b20d7ffbe2f38f1a7e371fb5fcf44 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 8 Nov 2015 14:51:46 +0100 Subject: [PATCH 416/427] cleanup --- pom.xml | 39 ++++++++++++++--------------------- src/main/resources/plugin.yml | 12 +++++------ 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index 451aed58..485f9f5c 100644 --- a/pom.xml +++ b/pom.xml @@ -2,57 +2,61 @@ 4.0.0 - + fr.xephi authme 5.1-SNAPSHOT jar - + AuthMeReloaded Authentication plugin for CraftBukkit/Spigot! 2013 http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ - + AuthMe-Team https://github.com/AuthMe-Team - + scm:git:https://github.com/Xephi/AuthMeReloaded.git scm:git:git@github.com:Xephi/AuthMeReloaded.git http://github.com/Xephi/AuthMeReloaded - - + jenkins http://ci.xephi.fr/job/AuthMeReloaded/ - + GitHub https://github.com/Xephi/AuthMeReloaded/issues - + The GNU General Public Licence version 3 (GPLv3) http://www.gnu.org/licenses/gpl-3.0.html - + + UTF-8 + fr.xephi.authme.AuthMe + CustomBuild + [Xephi, sgdc3, DNx5, timvisee, games647] + 1.7 - + 1.8.8-R0.1-SNAPSHOT - AuthMe-${project.version} + ${project.name} . @@ -112,7 +116,6 @@ - spigot-repo @@ -155,23 +158,14 @@ http://repo.luricos.de/content/repositories/releases - + xephi-repo http://ci.xephi.fr/plugin/repository/everything/ - - - - com.zaxxer @@ -511,6 +505,5 @@ compile true - diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 276773ca..65b1321c 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,10 +1,10 @@ -name: AuthMe -author: Xephi59 -website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ -description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the player. -main: fr.xephi.authme.AuthMe +name: ${project.name} +authors: ${pluginAuthors} +website: ${project.url} +description: ${project.description} +main: ${mainClass} version: ${project.version} -softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories, ProtocolLib] +softdepend: [Vault, Multiverse-Core, Essentials, EssentialsSpawn, ProtocolLib] commands: register: description: Register an account From 0828bcc3da2326b8ef58360ac9a041bd20dff734 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 8 Nov 2015 17:53:17 +0100 Subject: [PATCH 417/427] Update circle.yml --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 6da929d4..1b08b3a9 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: version: oraclejdk7 general: artifacts: - - "target/AuthMe-*.jar" + - "target/AuthMeReloaded.jar" test: override: - mvn clean install -B From 6bff45f0ed62f3fa388bc33b1edf1f6a6ecf355c Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 8 Nov 2015 19:31:44 +0100 Subject: [PATCH 418/427] Fix Mail Recovery --- pom.xml | 9 +----- .../java/fr/xephi/authme/SendMailSSL.java | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 451aed58..4953a82d 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ 2.4.2 false - true + false org.mcstats @@ -212,13 +212,6 @@ compile true - - javax.mail - javax.mail-api - 1.5.4 - provided - true - diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 2239f0db..4af471f9 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -12,6 +12,7 @@ import javax.imageio.ImageIO; import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.Multipart; +import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; @@ -62,8 +63,16 @@ public class SendMailSSL { props.put("mail.smtp.host", smtp); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", port); + props.put("mail.smtp.socketFactory.port", port); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.starttls.enable", true); - Session session = Session.getInstance(props, null); + props.put("mail.smtp.socketFactory.fallback", false); + Session session = Session.getInstance(props, new javax.mail.Authenticator() { + + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(acc, password); + } + }); Message message = new MimeMessage(session); try { @@ -71,7 +80,7 @@ public class SendMailSSL { } catch (UnsupportedEncodingException uee) { message.setFrom(new InternetAddress(acc)); } - message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(mail)); + message.addRecipient(Message.RecipientType.TO, new InternetAddress(mail)); message.setSubject(subject); message.setSentDate(new Date()); BodyPart messageBodyPart = new MimeBodyPart(); @@ -96,23 +105,20 @@ public class SendMailSSL { } } - Transport transport = session.getTransport("smtp"); message.setContent(multipart); - try { - transport.connect(smtp, acc, password); + Transport transport = session.getTransport("smtp"); + transport.connect(smtp, Integer.parseInt(port), acc, password); + transport.sendMessage(message, message.getAllRecipients()); + transport.close(); } catch (Exception e) { - ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recovery email to " + mail); - if (file != null) - file.delete(); - return; + e.printStackTrace(); + ConsoleLogger.showError("Cannot send email to " + mail + ", an error occured!"); } - transport.sendMessage(message, message.getAllRecipients()); - if (file != null) file.delete(); - } catch(Exception e) { + } catch (Exception e) { // Print the stack trace e.printStackTrace(); ConsoleLogger.showError("Some error occurred while trying to send a email to " + mail); From 7f4db3a85b24b573c3c6fc80914c6bb7214a5013 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 10 Nov 2015 18:37:53 +0100 Subject: [PATCH 419/427] cleanup --- src/main/java/fr/xephi/authme/AuthMe.java | 6 +++--- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 43d6a710..a9302bb5 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -74,7 +74,7 @@ public class AuthMe extends JavaPlugin { /** Defines the current AuthMeReloaded version code. */ private static final int PLUGIN_VERSION_CODE = 100; // Increase this number by one when an update is released - private static AuthMe authme; + private static AuthMe plugin; private static Server server; private Logger authmeLogger; @@ -122,7 +122,7 @@ public class AuthMe extends JavaPlugin { } public static AuthMe getInstance() { - return authme; + return plugin; } public Settings getSettings() { @@ -142,7 +142,7 @@ public class AuthMe extends JavaPlugin { // Set the Instance server = getServer(); authmeLogger = Logger.getLogger("AuthMe"); - authme = this; + plugin = this; // Set up and initialize the command handler this.commandHandler = new CommandHandler(false); diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index fda2caa7..c393e509 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -227,6 +227,7 @@ public class AuthMePlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPreLogin(AsyncPlayerPreLoginEvent event) { final String name = event.getName().toLowerCase(); + @SuppressWarnings("deprecation") final Player player = plugin.getServer().getPlayer(name); if (player == null) return; From 2c45cece003dbe6450942d0ff4de50e242b9e842 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 10 Nov 2015 18:43:24 +0100 Subject: [PATCH 420/427] fix plugin name (i'm an idiot -_-) --- circle.yml | 2 +- pom.xml | 2 +- src/main/resources/plugin.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index 1b08b3a9..6da929d4 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: version: oraclejdk7 general: artifacts: - - "target/AuthMeReloaded.jar" + - "target/AuthMe-*.jar" test: override: - mvn clean install -B diff --git a/pom.xml b/pom.xml index aaf0da14..a41fa017 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ - ${project.name} + AuthMe-${project.version} . diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 65b1321c..57459638 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,4 +1,4 @@ -name: ${project.name} +name: AuthMe authors: ${pluginAuthors} website: ${project.url} description: ${project.description} From 8a4f2c5ef81926307dc3cec05145dbc4eaa1716e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 10 Nov 2015 19:28:17 +0100 Subject: [PATCH 421/427] I love to clean code and stuff --- pom.xml | 34 + src/main/java/fr/xephi/authme/AuthMe.java | 4 +- .../xephi/authme/commands/AdminCommand.java | 610 ------------------ .../xephi/authme/commands/CaptchaCommand.java | 78 --- .../commands/ChangePasswordCommand.java | 69 -- .../authme/commands/ConverterCommand.java | 114 ---- .../xephi/authme/commands/EmailCommand.java | 116 ---- .../xephi/authme/commands/LoginCommand.java | 41 -- .../xephi/authme/commands/LogoutCommand.java | 37 -- .../authme/commands/RegisterCommand.java | 65 -- .../authme/commands/UnregisterCommand.java | 49 -- .../manager => hooks}/BungeeCordMessage.java | 2 +- .../{plugin/manager => hooks}/EssSpawn.java | 2 +- src/main/java/fr/xephi/authme/util/Utils.java | 11 - 14 files changed, 38 insertions(+), 1194 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/commands/AdminCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/CaptchaCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/ConverterCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/EmailCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/LoginCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/LogoutCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/RegisterCommand.java delete mode 100644 src/main/java/fr/xephi/authme/commands/UnregisterCommand.java rename src/main/java/fr/xephi/authme/{plugin/manager => hooks}/BungeeCordMessage.java (96%) rename src/main/java/fr/xephi/authme/{plugin/manager => hooks}/EssSpawn.java (97%) diff --git a/pom.xml b/pom.xml index a41fa017..62a4d4f8 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,7 @@ 1.7 + 1.8.8-R0.1-SNAPSHOT @@ -92,6 +93,7 @@ false false + org.mcstats @@ -101,6 +103,38 @@ com.google.gson fr.xephi.authme.libs.gson + + com.zaxxer.hikari + fr.xephi.authme.libs.hikari + + + org.slf4j + fr.xephi.authme.libs.slf4j + + + javax.mail + fr.xephi.authme.libs.mail + + + javax.activation + fr.xephi.authme.libs.mail.activation + + + com.sun.activation + fr.xephi.authme.libs.mail.activation + + + com.sun.mail + fr.xephi.authme.libs.mail + + + com.maxmind.geoip + fr.xephi.authme.libs.geoip + + + net.ricecode.similarity + fr.xephi.authme.libs.similarity + diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index a9302bb5..893814ac 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -45,6 +45,8 @@ import fr.xephi.authme.datasource.DatabaseCalls; import fr.xephi.authme.datasource.FlatFile; import fr.xephi.authme.datasource.MySQL; import fr.xephi.authme.datasource.SQLite; +import fr.xephi.authme.hooks.BungeeCordMessage; +import fr.xephi.authme.hooks.EssSpawn; import fr.xephi.authme.listener.AuthMeBlockListener; import fr.xephi.authme.listener.AuthMeEntityListener; import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter; @@ -53,8 +55,6 @@ import fr.xephi.authme.listener.AuthMePlayerListener16; import fr.xephi.authme.listener.AuthMePlayerListener18; import fr.xephi.authme.listener.AuthMeServerListener; import fr.xephi.authme.modules.ModuleManager; -import fr.xephi.authme.plugin.manager.BungeeCordMessage; -import fr.xephi.authme.plugin.manager.EssSpawn; import fr.xephi.authme.process.Management; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.OtherAccounts; diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java deleted file mode 100644 index 78b05482..00000000 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ /dev/null @@ -1,610 +0,0 @@ -package fr.xephi.authme.commands; - -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -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.cache.limbo.LimboCache; -import fr.xephi.authme.events.SpawnTeleportEvent; -import fr.xephi.authme.security.PasswordSecurity; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.settings.Spawn; -import fr.xephi.authme.task.MessageTask; -import fr.xephi.authme.task.TimeoutTask; -import fr.xephi.authme.util.Utils; -import fr.xephi.authme.util.Utils.GroupType; - -public class AdminCommand implements CommandExecutor { - - public AuthMe plugin; - private Messages m = Messages.getInstance(); - - public AdminCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(final CommandSender sender, Command cmnd, - String label, String[] args) { - if (args.length == 0) { - 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 unregister - Unregister a player"); - 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 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"); - return true; - } - - if (!plugin.authmePermissible(sender, "authme.admin." + args[0].toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - if (args[0].equalsIgnoreCase("version")) { - sender.sendMessage("AuthMe Version: " + AuthMe.getInstance().getDescription().getVersion()); - return true; - } - - if (args[0].equalsIgnoreCase("purge")) { - if (args.length != 2) { - 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 { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DATE, -(Integer.parseInt(args[1]))); - long until = calendar.getTimeInMillis(); - List purged = plugin.database.autoPurgeDatabase(until); - sender.sendMessage("Deleted " + purged.size() + " user accounts"); - if (Settings.purgeEssentialsFile && plugin.ess != null) - plugin.dataManager.purgeEssentials(purged); - if (Settings.purgePlayerDat) - plugin.dataManager.purgeDat(purged); - if (Settings.purgeLimitedCreative) - 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 "); - return true; - } - } else if (args[0].equalsIgnoreCase("reload")) { - try { - Settings.reload(); - plugin.getModuleManager().reloadModules(); - m.reloadMessages(); - plugin.setupDatabase(); - } catch (Exception e) { - ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); - ConsoleLogger.writeStackTrace(e); - plugin.stopOrUnload(); - return false; - } - m.send(sender, "reload"); - } else if (args[0].equalsIgnoreCase("lastlogin")) { - if (args.length != 2) { - sender.sendMessage("Usage: /authme lastlogin "); - return true; - } - PlayerAuth auth; - try { - auth = plugin.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 "); - sender.sendMessage("Or: /authme accounts "); - return true; - } - if (!args[1].contains(".")) { - final String[] arguments = args; - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - PlayerAuth auth; - StringBuilder message = new StringBuilder("[AuthMe] "); - try { - auth = plugin.database.getAuth(arguments[1].toLowerCase()); - } catch (NullPointerException npe) { - m.send(sender, "unknown_user"); - return; - } - if (auth == null) { - m.send(sender, "unknown_user"); - return; - } - List accountList = plugin.database.getAllAuthsByName(auth); - if (accountList == null || accountList.isEmpty()) { - m.send(sender, "user_unknown"); - return; - } - if (accountList.size() == 1) { - sender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); - return; - } - int i = 0; - for (String account : accountList) { - i++; - message.append(account); - if (i != accountList.size()) { - message.append(", "); - } else { - message.append("."); - } - } - sender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - sender.sendMessage(message.toString()); - } - }); - return true; - } else { - final String[] arguments = args; - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - StringBuilder message = new StringBuilder("[AuthMe] "); - if (arguments[1] == null) { - sender.sendMessage("[AuthMe] Please put a valid IP"); - return; - } - List accountList = null; - try { - accountList = plugin.database.getAllAuthsByIp(arguments[1]); - } catch (Exception e) { - ConsoleLogger.showError(e.getMessage()); - ConsoleLogger.writeStackTrace(e); - m.send(sender, "error"); - return; - } - if (accountList == null || accountList.isEmpty()) { - sender.sendMessage("[AuthMe] This IP does not exist in the database"); - return; - } - if (accountList.size() == 1) { - sender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player"); - return; - } - int i = 0; - for (String account : accountList) { - i++; - message.append(account); - if (i != accountList.size()) { - message.append(", "); - } else { - message.append("."); - } - } - sender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts"); - sender.sendMessage(message.toString()); - } - }); - return true; - } - } else if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) { - if (args.length != 3) { - sender.sendMessage("Usage: /authme register "); - return true; - } - final String name = args[1].toLowerCase(); - final String realName = args[1]; - final 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(sender, "password_error"); - return true; - } - if (lowpass.equalsIgnoreCase(args[1])) { - m.send(sender, "password_error_nick"); - return true; - } - if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) { - m.send(sender, "pass_len"); - return true; - } - if (!Settings.unsafePasswords.isEmpty()) { - if (Settings.unsafePasswords.contains(lowpass)) { - m.send(sender, "password_error_unsafe"); - return true; - } - } - plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { - - @SuppressWarnings("deprecation") - @Override - public void run() { - try { - if (plugin.database.isAuthAvailable(name)) { - m.send(sender, "user_regged"); - return; - } - String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name); - PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com", realName); - if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) - auth.setSalt(PasswordSecurity.userSalt.get(name)); - else auth.setSalt(""); - if (!plugin.database.saveAuth(auth)) { - m.send(sender, "error"); - return; - } - plugin.database.setUnlogged(name); - if (Bukkit.getPlayerExact(realName) != null) - Bukkit.getPlayerExact(realName).kickPlayer("An admin just registered you, please log again"); - m.send(sender, "registered"); - ConsoleLogger.info(name + " registered"); - } catch (NoSuchAlgorithmException ex) { - ConsoleLogger.showError(ex.getMessage()); - m.send(sender, "error"); - } - - } - }); - return true; - } else if (args[0].equalsIgnoreCase("getemail")) { - if (args.length != 2) { - sender.sendMessage("Usage: /authme getemail "); - return true; - } - String playername = args[1].toLowerCase(); - PlayerAuth auth = plugin.database.getAuth(playername); - if (auth == null) { - m.send(sender, "unknown_user"); - return true; - } - sender.sendMessage("[AuthMe] " + args[1] + "'s email: " + auth.getEmail()); - return true; - } else if (args[0].equalsIgnoreCase("chgemail")) { - if (args.length != 3) { - sender.sendMessage("Usage: /authme chgemail "); - return true; - } - if (!Settings.isEmailCorrect(args[2])) { - m.send(sender, "email_invalid"); - return true; - } - String playername = args[1].toLowerCase(); - PlayerAuth auth = plugin.database.getAuth(playername); - if (auth == null) { - m.send(sender, "unknown_user"); - return true; - } - auth.setEmail(args[2]); - if (!plugin.database.updateEmail(auth)) { - m.send(sender, "error"); - return true; - } - if (PlayerCache.getInstance().getAuth(playername) != null) - 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 defined new spawn point"); - } else { - sender.sendMessage("[AuthMe] SetSpawn has failed, please retry"); - } - } else { - sender.sendMessage("[AuthMe] Please use that command in game"); - } - } catch (NullPointerException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - return true; - } else if (args[0].equalsIgnoreCase("setfirstspawn")) { - try { - if (sender instanceof Player) { - if (Spawn.getInstance().setFirstSpawn(((Player) sender).getLocation())) - 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"); - } - } catch (NullPointerException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - return true; - } else if (args[0].equalsIgnoreCase("purgebannedplayers")) { - List bannedPlayers = new ArrayList<>(); - for (OfflinePlayer off : plugin.getServer().getBannedPlayers()) { - bannedPlayers.add(off.getName().toLowerCase()); - } - plugin.database.purgeBanned(bannedPlayers); - if (Settings.purgeEssentialsFile && plugin.ess != null) - plugin.dataManager.purgeEssentials(bannedPlayers); - if (Settings.purgePlayerDat) - plugin.dataManager.purgeDat(bannedPlayers); - if (Settings.purgeLimitedCreative) - 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 has failed, please try to define the spawn"); - } else { - sender.sendMessage("[AuthMe] Please use that command in game"); - } - } catch (NullPointerException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - return true; - } else if (args[0].equalsIgnoreCase("firstspawn")) { - try { - if (sender instanceof Player) { - if (Spawn.getInstance().getFirstSpawn() != null) - ((Player) sender).teleport(Spawn.getInstance().getFirstSpawn()); - 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"); - } - } catch (NullPointerException ex) { - ConsoleLogger.showError(ex.getMessage()); - } - return true; - } else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) { - if (args.length != 3) { - 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(sender, "password_error"); - return true; - } - if (lowpass.equalsIgnoreCase(args[1])) { - m.send(sender, "password_error_nick"); - return true; - } - if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) { - m.send(sender, "pass_len"); - return true; - } - if (!Settings.unsafePasswords.isEmpty()) { - if (Settings.unsafePasswords.contains(lowpass)) { - m.send(sender, "password_error_unsafe"); - return true; - } - } - final String name = args[1].toLowerCase(); - final String raw = args[2]; - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - String hash; - try { - hash = PasswordSecurity.getHash(Settings.getPasswordHash, raw, name); - } catch (NoSuchAlgorithmException e) { - m.send(sender, "error"); - return; - } - PlayerAuth auth = null; - if (PlayerCache.getInstance().isAuthenticated(name)) { - auth = PlayerCache.getInstance().getAuth(name); - } else if (plugin.database.isAuthAvailable(name)) { - auth = plugin.database.getAuth(name); - } - if (auth == null) { - m.send(sender, "unknown_user"); - return; - } - auth.setHash(hash); - if (PasswordSecurity.userSalt.containsKey(name)) { - auth.setSalt(PasswordSecurity.userSalt.get(name)); - plugin.database.updateSalt(auth); - } - if (!plugin.database.updatePassword(auth)) { - m.send(sender, "error"); - return; - } - sender.sendMessage("pwd_changed"); - ConsoleLogger.info(name + "'s password changed"); - } - - }); - 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 "); - return true; - } - String name = args[1].toLowerCase(); - if (!plugin.database.isAuthAvailable(name)) { - m.send(sender, "user_unknown"); - return true; - } - if (!plugin.database.removeAuth(name)) { - m.send(sender, "error"); - return true; - } - @SuppressWarnings("deprecation") - Player target = Bukkit.getPlayer(name); - PlayerCache.getInstance().removePlayer(name); - Utils.setGroup(target, GroupType.UNREGISTERED); - if (target != null && target.isOnline()) { - if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { - Location spawn = plugin.getSpawnLocation(target); - SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false); - plugin.getServer().getPluginManager().callEvent(tpEvent); - if (!tpEvent.isCancelled() && tpEvent.getTo() != null) { - target.teleport(tpEvent.getTo()); - } - } - LimboCache.getInstance().addLimboPlayer(target); - int delay = Settings.getRegistrationTimeout * 20; - int interval = Settings.getWarnMessageInterval; - BukkitScheduler sched = sender.getServer().getScheduler(); - if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, target), delay); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); - } - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); - if (Settings.applyBlindEffect) - target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - target.setWalkSpeed(0.0f); - target.setFlySpeed(0.0f); - } - m.send(target, "unregistered"); - - } - m.send(sender, "unregistered"); - ConsoleLogger.info(args[1] + " unregistered"); - return true; - } else if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) { - if (args.length != 2) { - sender.sendMessage("Usage: /authme purgelastpos "); - return true; - } - try { - String name = args[1].toLowerCase(); - PlayerAuth auth = plugin.database.getAuth(name); - if (auth == null) { - m.send(sender, "unknown_user"); - return true; - } - auth.setQuitLocX(0D); - auth.setQuitLocY(0D); - auth.setQuitLocZ(0D); - auth.setWorld("world"); - 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: "); - ConsoleLogger.showError(e.getMessage()); - if (sender instanceof Player) - sender.sendMessage("An error occured while trying to reset location or player do not exist, please see logs"); - } - return true; - } else if (args[0].equalsIgnoreCase("switchantibot")) { - if (args.length != 2) { - sender.sendMessage("Usage: /authme switchantibot on/off"); - return true; - } - if (args[1].equalsIgnoreCase("on")) { - plugin.switchAntiBotMod(true); - sender.sendMessage("[AuthMe] AntiBotMod enabled"); - return true; - } - if (args[1].equalsIgnoreCase("off")) { - plugin.switchAntiBotMod(false); - sender.sendMessage("[AuthMe] AntiBotMod disabled"); - return true; - } - sender.sendMessage("Usage: /authme switchantibot on/off"); - return true; - } else if (args[0].equalsIgnoreCase("getip")) { - if (args.length < 2) { - sender.sendMessage("Usage: /authme getip "); - return true; - } - @SuppressWarnings("deprecation") - Player player = Bukkit.getPlayer(args[1]); - if (player == null) { - sender.sendMessage("This player is not actually online"); - sender.sendMessage("Usage: /authme getip "); - return true; - } - 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; - } else if (args[0].equalsIgnoreCase("forcelogin")) { - if (args.length < 2) { - sender.sendMessage("Usage: /authme forcelogin "); - return true; - } - try { - @SuppressWarnings("deprecation") - Player player = Bukkit.getPlayer(args[1]); - if (player == null || !player.isOnline()) { - sender.sendMessage("Player needs to be online!"); - return true; - } - if (!plugin.authmePermissible(player, "authme.canbeforced")) { - sender.sendMessage("You cannot force login for this player!"); - return true; - } - plugin.management.performLogin(player, "dontneed", true); - sender.sendMessage("Force Login performed!"); - } catch (Exception e) { - sender.sendMessage("An error occured while trying to get that player!"); - } - } else if (args[0].equalsIgnoreCase("resetname")) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - List auths = plugin.database.getAllAuths(); - for (PlayerAuth auth : auths) { - auth.setRealName("Player"); - plugin.database.updateSession(auth); - } - } - }); - } else { - sender.sendMessage("Usage: /authme reload|register playername password|changepassword playername password|unregister playername"); - } - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/commands/CaptchaCommand.java b/src/main/java/fr/xephi/authme/commands/CaptchaCommand.java deleted file mode 100644 index 0c0e242a..00000000 --- a/src/main/java/fr/xephi/authme/commands/CaptchaCommand.java +++ /dev/null @@ -1,78 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.security.RandomString; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; - -public class CaptchaCommand implements CommandExecutor { - - public AuthMe plugin; - private Messages m = Messages.getInstance(); - public static RandomString rdm = new RandomString(Settings.captchaLength); - - public CaptchaCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - - if (!(sender instanceof Player)) { - return true; - } - - Player player = (Player) sender; - String name = player.getName().toLowerCase(); - - if (args.length == 0) { - m.send(player, "usage_captcha"); - return true; - } - - if (PlayerCache.getInstance().isAuthenticated(name)) { - m.send(player, "logged_in"); - return true; - } - - if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) { - m.send(player, "no_perm"); - return true; - } - - if (!Settings.useCaptcha) { - m.send(player, "usage_log"); - return true; - } - - if (!plugin.cap.containsKey(name)) { - m.send(player, "usage_log"); - return true; - } - - if (Settings.useCaptcha && !args[0].equals(plugin.cap.get(name))) { - plugin.cap.remove(name); - plugin.cap.put(name, rdm.nextString()); - for (String s : m.send("wrong_captcha")) { - player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(name))); - } - return true; - } - try { - plugin.captcha.remove(name); - plugin.cap.remove(name); - } catch (NullPointerException npe) { - } - m.send(player, "valid_captcha"); - m.send(player, "login_msg"); - return true; - } - -} diff --git a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java b/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java deleted file mode 100644 index 4a668bfe..00000000 --- a/src/main/java/fr/xephi/authme/commands/ChangePasswordCommand.java +++ /dev/null @@ -1,69 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.task.ChangePasswordTask; - -public class ChangePasswordCommand implements CommandExecutor { - - private Messages m = Messages.getInstance(); - public AuthMe plugin; - - public ChangePasswordCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - if (!(sender instanceof Player)) { - return true; - } - - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - Player player = (Player) sender; - String name = player.getName().toLowerCase(); - if (!PlayerCache.getInstance().isAuthenticated(name)) { - m.send(player, "not_logged_in"); - return true; - } - - if (args.length != 2) { - m.send(player, "usage_changepassword"); - return true; - } - - 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)) { - m.send(player, "password_error"); - return true; - } - if (lowpass.equalsIgnoreCase(name)) { - 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; - } - } - plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, args[0], args[1])); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/commands/ConverterCommand.java b/src/main/java/fr/xephi/authme/commands/ConverterCommand.java deleted file mode 100644 index 56deecdf..00000000 --- a/src/main/java/fr/xephi/authme/commands/ConverterCommand.java +++ /dev/null @@ -1,114 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.converter.Converter; -import fr.xephi.authme.converter.CrazyLoginConverter; -import fr.xephi.authme.converter.FlatToSql; -import fr.xephi.authme.converter.FlatToSqlite; -import fr.xephi.authme.converter.RakamakConverter; -import fr.xephi.authme.converter.RoyalAuthConverter; -import fr.xephi.authme.converter.SqlToFlat; -import fr.xephi.authme.converter.vAuthConverter; -import fr.xephi.authme.converter.xAuthConverter; -import fr.xephi.authme.settings.Messages; - -public class ConverterCommand implements CommandExecutor { - - private AuthMe plugin; - private Messages m = Messages.getInstance(); - - public ConverterCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - final String[] args) { - if (!plugin.authmePermissible(sender, "authme.admin.converter")) { - m.send(sender, "no_perm"); - return true; - } - - if (args.length == 0) { - sender.sendMessage("Usage : /converter flattosql | flattosqlite | xauth | crazylogin | rakamak | royalauth | vauth | sqltoflat"); - return true; - } - - ConvertType type = ConvertType.fromName(args[0]); - if (type == null) { - m.send(sender, "error"); - return true; - } - Converter converter = null; - switch (type) { - case ftsql: - converter = new FlatToSql(); - break; - case ftsqlite: - converter = new FlatToSqlite(sender); - break; - case xauth: - converter = new xAuthConverter(plugin, sender); - break; - case crazylogin: - converter = new CrazyLoginConverter(plugin, sender); - break; - case rakamak: - converter = new RakamakConverter(plugin, sender); - break; - case royalauth: - converter = new RoyalAuthConverter(plugin); - break; - case vauth: - converter = new vAuthConverter(plugin, sender); - break; - case sqltoflat: - converter = new SqlToFlat(plugin, sender); - break; - default: - break; - } - if (converter == null) { - m.send(sender, "error"); - return true; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, converter); - sender.sendMessage("[AuthMe] Successfully converted from " + args[0]); - return true; - } - - public enum ConvertType { - - ftsql("flattosql"), - ftsqlite("flattosqlite"), - xauth("xauth"), - crazylogin("crazylogin"), - rakamak("rakamak"), - royalauth("royalauth"), - vauth("vauth"), - sqltoflat("sqltoflat"); - - String name; - - ConvertType(String name) { - this.name = name; - } - - String getName() { - return this.name; - } - - public static ConvertType fromName(String name) { - for (ConvertType type : ConvertType.values()) { - if (type.getName().equalsIgnoreCase(name)) - return type; - } - return null; - } - } -} diff --git a/src/main/java/fr/xephi/authme/commands/EmailCommand.java b/src/main/java/fr/xephi/authme/commands/EmailCommand.java deleted file mode 100644 index 5f11ae25..00000000 --- a/src/main/java/fr/xephi/authme/commands/EmailCommand.java +++ /dev/null @@ -1,116 +0,0 @@ -package fr.xephi.authme.commands; - -import java.security.NoSuchAlgorithmException; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -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.security.PasswordSecurity; -import fr.xephi.authme.security.RandomString; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; - -/** - * @author Xephi59 - */ -public class EmailCommand implements CommandExecutor { - - public AuthMe plugin; - private Messages m = Messages.getInstance(); - - public EmailCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - if (!(sender instanceof Player)) { - return true; - } - - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - Player player = (Player) sender; - String name = player.getName(); - - if (args.length == 0) { - m.send(player, "usage_email_add"); - m.send(player, "usage_email_change"); - m.send(player, "usage_email_recovery"); - return true; - } - - if (args[0].equalsIgnoreCase("add")) { - if (args.length != 3) { - m.send(player, "usage_email_add"); - return true; - } - plugin.management.performAddEmail(player, args[1], args[2]); - } else if (args[0].equalsIgnoreCase("change")) { - if (args.length != 3) { - m.send(player, "usage_email_change"); - return true; - } - plugin.management.performChangeEmail(player, args[1], args[2]); - } - if (args[0].equalsIgnoreCase("recovery")) { - if (args.length != 2) { - m.send(player, "usage_email_recovery"); - return true; - } - if (plugin.mail == null) { - m.send(player, "error"); - return true; - } - if (plugin.database.isAuthAvailable(name)) { - if (PlayerCache.getInstance().isAuthenticated(name)) { - m.send(player, "logged_in"); - return true; - } - try { - RandomString rand = new RandomString(Settings.getRecoveryPassLength); - String thePass = rand.nextString(); - String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, thePass, name); - PlayerAuth auth; - if (PlayerCache.getInstance().isAuthenticated(name)) { - auth = PlayerCache.getInstance().getAuth(name); - } else if (plugin.database.isAuthAvailable(name)) { - auth = plugin.database.getAuth(name); - } else { - m.send(player, "unknown_user"); - return true; - } - if (Settings.getmailAccount.equals("") || Settings.getmailAccount.isEmpty()) { - m.send(player, "error"); - return true; - } - - if (!args[1].equalsIgnoreCase(auth.getEmail()) || args[1].equalsIgnoreCase("your@email.com") || auth.getEmail().equalsIgnoreCase("your@email.com")) { - m.send(player, "email_invalid"); - return true; - } - auth.setHash(hashnew); - plugin.database.updatePassword(auth); - plugin.mail.main(auth, thePass); - m.send(player, "email_send"); - } catch (NoSuchAlgorithmException | NoClassDefFoundError ex) { - ConsoleLogger.showError(ex.getMessage()); - m.send(sender, "error"); - } - } else { - m.send(player, "reg_email_msg"); - } - } - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/commands/LoginCommand.java b/src/main/java/fr/xephi/authme/commands/LoginCommand.java deleted file mode 100644 index b8730929..00000000 --- a/src/main/java/fr/xephi/authme/commands/LoginCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.settings.Messages; - -public class LoginCommand implements CommandExecutor { - - private AuthMe plugin; - private Messages m = Messages.getInstance(); - - public LoginCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - final String[] args) { - if (!(sender instanceof Player)) { - return true; - } - - final Player player = (Player) sender; - - if (args.length == 0) { - m.send(player, "usage_log"); - return true; - } - - if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) { - m.send(player, "no_perm"); - return true; - } - plugin.management.performLogin(player, args[0], false); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/commands/LogoutCommand.java b/src/main/java/fr/xephi/authme/commands/LogoutCommand.java deleted file mode 100644 index 4c21f7f6..00000000 --- a/src/main/java/fr/xephi/authme/commands/LogoutCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.settings.Messages; - -public class LogoutCommand implements CommandExecutor { - - private Messages m = Messages.getInstance(); - private AuthMe plugin; - - public LogoutCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - if (!(sender instanceof Player)) { - return true; - } - - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - final Player player = (Player) sender; - plugin.management.performLogout(player); - return true; - } - -} diff --git a/src/main/java/fr/xephi/authme/commands/RegisterCommand.java b/src/main/java/fr/xephi/authme/commands/RegisterCommand.java deleted file mode 100644 index 0707ee78..00000000 --- a/src/main/java/fr/xephi/authme/commands/RegisterCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.security.RandomString; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; - -public class RegisterCommand implements CommandExecutor { - - private Messages m = Messages.getInstance(); - public PlayerAuth auth; - public AuthMe plugin; - - public RegisterCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - if (!(sender instanceof Player)) { - sender.sendMessage("Player Only! Use 'authme register ' instead"); - return true; - } - final Player player = (Player) sender; - if (args.length == 0 || (Settings.getEnablePasswordVerifier && args.length < 2)) { - m.send(player, "usage_reg"); - return true; - } - if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) { - m.send(player, "no_perm"); - return true; - } - if (Settings.emailRegistration && !Settings.getmailAccount.isEmpty()) { - if (Settings.doubleEmailCheck) { - if (args.length < 2 || !args[0].equals(args[1])) { - m.send(player, "usage_reg"); - return true; - } - } - final String email = args[0]; - if (!Settings.isEmailCorrect(email)) { - m.send(player, "email_invalid"); - return true; - } - RandomString rand = new RandomString(Settings.getRecoveryPassLength); - final String thePass = rand.nextString(); - plugin.management.performRegister(player, thePass, email); - return true; - } - if (args.length > 1 && Settings.getEnablePasswordVerifier) - if (!args[0].equals(args[1])) { - m.send(player, "password_error"); - return true; - } - plugin.management.performRegister(player, args[0], ""); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java deleted file mode 100644 index 4a879f1b..00000000 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ /dev/null @@ -1,49 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Messages; - -public class UnregisterCommand implements CommandExecutor { - - private Messages m = Messages.getInstance(); - public AuthMe plugin; - - public UnregisterCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(final CommandSender sender, Command cmnd, String label, - final String[] args) { - if (!(sender instanceof Player)) { - return true; - } - - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - final Player player = (Player) sender; - final String name = player.getName().toLowerCase(); - - if (!PlayerCache.getInstance().isAuthenticated(name)) { - m.send(player, "not_logged_in"); - return true; - } - - if (args.length != 1) { - m.send(player, "usage_unreg"); - return true; - } - - plugin.management.performUnregister(player, args[0], false); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java similarity index 96% rename from src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java rename to src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java index a81745e7..feff2cca 100644 --- a/src/main/java/fr/xephi/authme/plugin/manager/BungeeCordMessage.java +++ b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.plugin.manager; +package fr.xephi.authme.hooks; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; diff --git a/src/main/java/fr/xephi/authme/plugin/manager/EssSpawn.java b/src/main/java/fr/xephi/authme/hooks/EssSpawn.java similarity index 97% rename from src/main/java/fr/xephi/authme/plugin/manager/EssSpawn.java rename to src/main/java/fr/xephi/authme/hooks/EssSpawn.java index cd422b48..b47b644d 100644 --- a/src/main/java/fr/xephi/authme/plugin/manager/EssSpawn.java +++ b/src/main/java/fr/xephi/authme/hooks/EssSpawn.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.plugin.manager; +package fr.xephi.authme.hooks; import java.io.File; diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index fd73baf7..938a0358 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -163,17 +163,6 @@ public class Utils { return false; } - // TODO: remove if not needed - public static void hasPermOnJoin(Player player) { - if (plugin.permission == null) - return; - for (String permission : Settings.getJoinPermissions) { - if (plugin.permission.playerHas(player, permission)) { - plugin.permission.playerAddTransient(player, permission); - } - } - } - // TODO: Move to a Manager public static boolean checkAuth(Player player) { if (player == null || Utils.isUnrestricted(player)) { From 604f2f3ee918ce0ba2ef04351777c16b45bf098c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 10 Nov 2015 20:20:43 +0100 Subject: [PATCH 422/427] reduce size of the email api --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 62a4d4f8..ef80d41d 100644 --- a/pom.xml +++ b/pom.xml @@ -94,6 +94,11 @@ false false + + + com.sun:* + + org.mcstats @@ -119,14 +124,14 @@ javax.activation fr.xephi.authme.libs.mail.activation - - com.sun.activation - fr.xephi.authme.libs.mail.activation - com.sun.mail fr.xephi.authme.libs.mail + + com.sun.activation + fr.xephi.authme.libs.mail.activation + com.maxmind.geoip fr.xephi.authme.libs.geoip @@ -235,7 +240,14 @@ com.sun.mail - javax.mail + mailapi + 1.5.4 + compile + true + + + com.sun.mail + smtp 1.5.4 compile true From 10606a22e6485253061b5accd85ecb2c69d63008 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 11 Nov 2015 01:28:04 +0100 Subject: [PATCH 423/427] Change default mail api to apache one --- pom.xml | 50 ++----------- src/main/java/fr/xephi/authme/AuthMe.java | 72 +++++++++++-------- .../java/fr/xephi/authme/SendMailSSL.java | 72 +++++-------------- 3 files changed, 65 insertions(+), 129 deletions(-) diff --git a/pom.xml b/pom.xml index ef80d41d..8c8a2148 100644 --- a/pom.xml +++ b/pom.xml @@ -51,13 +51,12 @@ 1.7 - 1.8.8-R0.1-SNAPSHOT - AuthMe-${project.version} + ${project.name} . @@ -93,12 +92,6 @@ false false - - - - com.sun:* - - org.mcstats @@ -108,38 +101,6 @@ com.google.gson fr.xephi.authme.libs.gson - - com.zaxxer.hikari - fr.xephi.authme.libs.hikari - - - org.slf4j - fr.xephi.authme.libs.slf4j - - - javax.mail - fr.xephi.authme.libs.mail - - - javax.activation - fr.xephi.authme.libs.mail.activation - - - com.sun.mail - fr.xephi.authme.libs.mail - - - com.sun.activation - fr.xephi.authme.libs.mail.activation - - - com.maxmind.geoip - fr.xephi.authme.libs.geoip - - - net.ricecode.similarity - fr.xephi.authme.libs.similarity - @@ -240,19 +201,18 @@ com.sun.mail - mailapi + javax.mail 1.5.4 compile true - com.sun.mail - smtp - 1.5.4 + org.apache.commons + commons-email + 1.4 compile true - com.google.code.gson diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 893814ac..d8d80afc 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -72,7 +72,9 @@ public class AuthMe extends JavaPlugin { /** Defines the current AuthMeReloaded version name. */ private static final String PLUGIN_VERSION_NAME = "5.1-SNAPSHOT"; /** Defines the current AuthMeReloaded version code. */ - private static final int PLUGIN_VERSION_CODE = 100; // Increase this number by one when an update is released + private static final int PLUGIN_VERSION_CODE = 100; // Increase this number + // by one when an update + // is released private static AuthMe plugin; private static Server server; @@ -114,14 +116,14 @@ public class AuthMe extends JavaPlugin { private boolean canConnect = true; public boolean canConnect() { - return canConnect; - } + return canConnect; + } - public void setCanConnect(boolean canConnect) { - this.canConnect = canConnect; - } + public void setCanConnect(boolean canConnect) { + this.canConnect = canConnect; + } - public static AuthMe getInstance() { + public static AuthMe getInstance() { return plugin; } @@ -186,18 +188,20 @@ public class AuthMe extends JavaPlugin { Graph databaseBackend = metrics.createGraph("Database backend"); // Custom graphs - if(Settings.messageFile.exists()) { + if (Settings.messageFile.exists()) { messagesLanguage.addPlotter(new Metrics.Plotter(Settings.messagesLanguage) { + @Override public int getValue() { - return 1; + return 1; } }); } databaseBackend.addPlotter(new Metrics.Plotter(Settings.getDataSource.toString()) { + @Override public int getValue() { - return 1; + return 1; } }); @@ -335,17 +339,19 @@ public class AuthMe extends JavaPlugin { pm.registerEvents(new AuthMeEntityListener(this), this); pm.registerEvents(new AuthMeServerListener(this), this); - // TODO: This is moved to CommandManager.registerCommands() handled by AuthMe.onCommand() -- timvisee + // TODO: This is moved to CommandManager.registerCommands() handled by + // AuthMe.onCommand() -- timvisee // Register commands - //getCommand("authme").setExecutor(new AdminCommand(this)); - //getCommand("register").setExecutor(new RegisterCommand(this)); - //getCommand("login").setExecutor(new LoginCommand(this)); - //getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); - //getCommand("logout").setExecutor(new LogoutCommand(this)); - //getCommand("unregister").setExecutor(new UnregisterCommand(this)); - //getCommand("email").setExecutor(new EmailCommand(this)); - //getCommand("captcha").setExecutor(new CaptchaCommand(this)); - //getCommand("converter").setExecutor(new ConverterCommand(this)); + // getCommand("authme").setExecutor(new AdminCommand(this)); + // getCommand("register").setExecutor(new RegisterCommand(this)); + // getCommand("login").setExecutor(new LoginCommand(this)); + // getCommand("changepassword").setExecutor(new + // ChangePasswordCommand(this)); + // getCommand("logout").setExecutor(new LogoutCommand(this)); + // getCommand("unregister").setExecutor(new UnregisterCommand(this)); + // getCommand("email").setExecutor(new EmailCommand(this)); + // getCommand("captcha").setExecutor(new CaptchaCommand(this)); + // getCommand("converter").setExecutor(new ConverterCommand(this)); // Purge on start if enabled autoPurge(); @@ -419,7 +425,8 @@ public class AuthMe extends JavaPlugin { // Initialize and setup the database public void setupDatabase() throws Exception { - if (database != null) database.close(); + if (database != null) + database.close(); // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI boolean isSQLite = false; switch (Settings.getDataSource) { @@ -830,18 +837,23 @@ public class AuthMe extends JavaPlugin { /** * Handle Bukkit commands. * - * @param sender The command sender (Bukkit). - * @param cmd The command (Bukkit). - * @param commandLabel The command label (Bukkit). - * @param args The command arguments (Bukkit). + * @param sender + * The command sender (Bukkit). + * @param cmd + * The command (Bukkit). + * @param commandLabel + * The command label (Bukkit). + * @param args + * The command arguments (Bukkit). * * @return True if the command was executed, false otherwise. */ @Override - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + public boolean onCommand(CommandSender sender, Command cmd, + String commandLabel, String[] args) { // Get the command handler, and make sure it's valid CommandHandler commandHandler = this.getCommandHandler(); - if(commandHandler == null) + if (commandHandler == null) return false; // Handle the command, return the result @@ -851,7 +863,8 @@ public class AuthMe extends JavaPlugin { /** * Get the current installed AuthMeReloaded version name. * - * @return The version name of the currently installed AuthMeReloaded instance. + * @return The version name of the currently installed AuthMeReloaded + * instance. */ public static String getVersionName() { return PLUGIN_VERSION_NAME; @@ -860,7 +873,8 @@ public class AuthMe extends JavaPlugin { /** * Get the current installed AuthMeReloaded version code. * - * @return The version code of the currently installed AuthMeReloaded instance. + * @return The version code of the currently installed AuthMeReloaded + * instance. */ public static int getVersionCode() { return PLUGIN_VERSION_CODE; diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 4af471f9..7fab5078 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -1,25 +1,12 @@ package fr.xephi.authme; import java.io.File; -import java.io.UnsupportedEncodingException; -import java.util.Date; -import java.util.Properties; -import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.imageio.ImageIO; -import javax.mail.BodyPart; -import javax.mail.Message; -import javax.mail.Multipart; -import javax.mail.PasswordAuthentication; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; +import org.apache.commons.mail.HtmlEmail; import org.bukkit.Bukkit; import fr.xephi.authme.cache.auth.PlayerAuth; @@ -47,7 +34,7 @@ public class SendMailSSL { } final String sender = sendername; - final String port = String.valueOf(Settings.getMailPort); + final int port = Settings.getMailPort; final String acc = Settings.getmailAccount; final String subject = Settings.getMailSubject; final String smtp = Settings.getmailSMTP; @@ -59,35 +46,18 @@ public class SendMailSSL { @Override public void run() { try { - Properties props = new Properties(); - props.put("mail.smtp.host", smtp); - props.put("mail.smtp.auth", "true"); - props.put("mail.smtp.port", port); - props.put("mail.smtp.socketFactory.port", port); - props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); - props.put("mail.smtp.starttls.enable", true); - props.put("mail.smtp.socketFactory.fallback", false); - Session session = Session.getInstance(props, new javax.mail.Authenticator() { - - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(acc, password); - } - }); - - Message message = new MimeMessage(session); - try { - message.setFrom(new InternetAddress(acc, sender)); - } catch (UnsupportedEncodingException uee) { - message.setFrom(new InternetAddress(acc)); - } - message.addRecipient(Message.RecipientType.TO, new InternetAddress(mail)); - message.setSubject(subject); - message.setSentDate(new Date()); - BodyPart messageBodyPart = new MimeBodyPart(); - messageBodyPart.setContent(mailText, "text/html"); - Multipart multipart = new MimeMultipart(); - multipart.addBodyPart(messageBodyPart); - + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + HtmlEmail email = new HtmlEmail(); + email.setSmtpPort(port); + email.setHostName(smtp); + email.addTo(mail); + email.setFrom(acc, sender); + email.setSubject(subject); + email.setHtmlMsg(mailText); + email.setAuthentication(acc, password); + email.setStartTLSEnabled(true); + email.setStartTLSRequired(true); + email.setSSLCheckServerIdentity(true); // Generate an image ? File file = null; if (Settings.generateImage) { @@ -95,25 +65,17 @@ public class SendMailSSL { ImageGenerator gen = new ImageGenerator(newPass); file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); ImageIO.write(gen.generateImage(), "jpg", file); - messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(file); - messageBodyPart.setDataHandler(new DataHandler(source)); - messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg"); - multipart.addBodyPart(messageBodyPart); + email.embed(source, auth.getNickname() + "_new_pass.jpg"); } catch (Exception e) { ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); } } - - message.setContent(multipart); try { - Transport transport = session.getTransport("smtp"); - transport.connect(smtp, Integer.parseInt(port), acc, password); - transport.sendMessage(message, message.getAllRecipients()); - transport.close(); + email.send(); } catch (Exception e) { e.printStackTrace(); - ConsoleLogger.showError("Cannot send email to " + mail + ", an error occured!"); + ConsoleLogger.showError("Fail to send a mail to " + mail); } if (file != null) file.delete(); From a9a057c278305e3b6dd9af10d523ff0605d9ad1a Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 11 Nov 2015 01:42:19 +0100 Subject: [PATCH 424/427] Fix Pom --- pom.xml | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8c8a2148..afcb2bfb 100644 --- a/pom.xml +++ b/pom.xml @@ -51,12 +51,13 @@ 1.7 + 1.8.8-R0.1-SNAPSHOT - ${project.name} + AuthMe-${project.version} . @@ -92,6 +93,12 @@ false false + + + + com.sun:* + + org.mcstats @@ -101,6 +108,22 @@ com.google.gson fr.xephi.authme.libs.gson + + com.zaxxer.hikari + fr.xephi.authme.libs.hikari + + + org.slf4j + fr.xephi.authme.libs.slf4j + + + com.maxmind.geoip + fr.xephi.authme.libs.geoip + + + net.ricecode.similarity + fr.xephi.authme.libs.similarity + @@ -201,7 +224,14 @@ com.sun.mail - javax.mail + mailapi + 1.5.4 + compile + true + + + com.sun.mail + smtp 1.5.4 compile true @@ -213,6 +243,7 @@ compile true + com.google.code.gson From 46d39c786458e0cdbef4f6f2d5b4ab26f41ea1b9 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 11 Nov 2015 01:49:15 +0100 Subject: [PATCH 425/427] Fix attachment --- src/main/java/fr/xephi/authme/SendMailSSL.java | 6 ++++-- src/main/resources/config.yml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 7fab5078..2a6083e7 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -53,11 +53,11 @@ public class SendMailSSL { email.addTo(mail); email.setFrom(acc, sender); email.setSubject(subject); - email.setHtmlMsg(mailText); email.setAuthentication(acc, password); email.setStartTLSEnabled(true); email.setStartTLSRequired(true); email.setSSLCheckServerIdentity(true); + String content = mailText; // Generate an image ? File file = null; if (Settings.generateImage) { @@ -66,11 +66,13 @@ public class SendMailSSL { file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); ImageIO.write(gen.generateImage(), "jpg", file); DataSource source = new FileDataSource(file); - email.embed(source, auth.getNickname() + "_new_pass.jpg"); + String tag = email.embed(source, auth.getNickname() + "_new_pass.jpg"); + content = content.replace("", ""); } catch (Exception e) { ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); } } + email.setHtmlMsg(content); try { email.send(); } catch (Exception e) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 084b9cff..cbf62dcb 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -340,7 +340,7 @@ Email: # Email subject of password get mailSubject: 'Your new AuthMe Password' # Email text here - mailText: 'Dear ,

    This is your new AuthMe password for the server

    :



    Do not forget to change password after login!
    /changepassword newPassword' + mailText: 'Dear ,

    This is your new AuthMe password for the server

    :



    Do not forget to change password after login!
    /changepassword newPassword' # Like maxRegPerIp but with email maxRegPerEmail: 1 # Recall players to add an email ? From 3b802d03b1ee021e96968a39d5636ef182ebd4a7 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 11 Nov 2015 01:50:23 +0100 Subject: [PATCH 426/427] Add non html content --- src/main/java/fr/xephi/authme/SendMailSSL.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 2a6083e7..eb4c2b8e 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -73,6 +73,7 @@ public class SendMailSSL { } } email.setHtmlMsg(content); + email.setTextMsg(content); try { email.send(); } catch (Exception e) { From 8dadcbd7dd141024b8ff91a8791e8ba93e2f4899 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 11 Nov 2015 01:52:45 +0100 Subject: [PATCH 427/427] Remove useless Exclusion --- pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pom.xml b/pom.xml index afcb2bfb..7547c90b 100644 --- a/pom.xml +++ b/pom.xml @@ -93,12 +93,6 @@ false false - - - - com.sun:* - - org.mcstats