mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-22 23:51:33 +01:00
- Add usage message on argument mismatch where available - Remove unused message keys - Create tool task to search for a message key's usages and to find unused keys
This commit is contained in:
parent
2f90a45f43
commit
a2d62ea6d9
@ -19,7 +19,7 @@ public interface ExecutableCommand {
|
||||
void executeCommand(CommandSender sender, List<String> arguments);
|
||||
|
||||
/**
|
||||
* Returns the message to show to the user if the command is used with the wrong commands.
|
||||
* Returns the message to show to the user if the command is used with the wrong arguments.
|
||||
* If null is returned, the standard help (/<i>command</i> help) output is shown.
|
||||
*
|
||||
* @return the message explaining the command's usage, or {@code null} for default behavior
|
||||
|
@ -54,4 +54,9 @@ public class ChangePasswordCommand extends PlayerCommand {
|
||||
protected String getAlternativeCommand() {
|
||||
return "/authme password <playername> <password>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_CHANGE_PASSWORD;
|
||||
}
|
||||
}
|
||||
|
@ -32,4 +32,9 @@ public class AddEmailCommand extends PlayerCommand {
|
||||
commonService.send(player, MessageKey.CONFIRM_EMAIL_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_ADD_EMAIL;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package fr.xephi.authme.command.executable.email;
|
||||
|
||||
import fr.xephi.authme.command.PlayerCommand;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -22,4 +23,9 @@ public class ChangeEmailCommand extends PlayerCommand {
|
||||
|
||||
management.performChangeEmail(player, playerMailOld, playerMailNew);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_CHANGE_EMAIL;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class RecoverEmailCommand extends PlayerCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerAuth auth = dataSource.getAuth(playerName); // TODO: Create method to get email only
|
||||
PlayerAuth auth = dataSource.getAuth(playerName); // TODO #1127: Create method to get email only
|
||||
if (auth == null) {
|
||||
commonService.send(player, MessageKey.USAGE_REGISTER);
|
||||
return;
|
||||
@ -73,4 +73,9 @@ public class RecoverEmailCommand extends PlayerCommand {
|
||||
recoveryService.generateAndSendNewPassword(player, email);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_RECOVER_EMAIL;
|
||||
}
|
||||
}
|
||||
|
@ -38,4 +38,14 @@ public class UnregisterCommand extends PlayerCommand {
|
||||
// Unregister the player
|
||||
management.performUnregister(player, playerPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_UNREGISTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAlternativeCommand() {
|
||||
return "/authme unregister <player>";
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,6 @@ public enum MessageKey {
|
||||
/** This user isn't registered! */
|
||||
UNKNOWN_USER("unknown_user"),
|
||||
|
||||
/** Your quit location was unsafe, you have been teleported to the world's spawnpoint. */
|
||||
UNSAFE_QUIT_LOCATION("unsafe_spawn"),
|
||||
|
||||
/** You're not logged in! */
|
||||
NOT_LOGGED_IN("not_logged_in"),
|
||||
|
||||
@ -179,9 +176,6 @@ public enum MessageKey {
|
||||
/** Recovery email sent successfully! Please check your email inbox! */
|
||||
RECOVERY_EMAIL_SENT_MESSAGE("email_send"),
|
||||
|
||||
/** A recovery email was already sent! You can discard it and send a new one using the command below: */
|
||||
RECOVERY_EMAIL_ALREADY_SENT_MESSAGE("email_exists"),
|
||||
|
||||
/** Your country is banned from this server! */
|
||||
COUNTRY_BANNED_ERROR("country_banned"),
|
||||
|
||||
@ -227,7 +221,10 @@ public enum MessageKey {
|
||||
/** The recovery code is not correct! You have %count tries remaining. */
|
||||
INCORRECT_RECOVERY_CODE("recovery_code_incorrect", "%count"),
|
||||
|
||||
/** You have exceeded the maximum number of attempts to enter the recovery code. Use "/email recovery [email]" to generate a new one. */
|
||||
/**
|
||||
* You have exceeded the maximum number of attempts to enter the recovery code.
|
||||
* Use "/email recovery [email]" to generate a new one.
|
||||
*/
|
||||
RECOVERY_TRIES_EXCEEDED("recovery_tries_exceeded"),
|
||||
|
||||
/** Recovery code entered correctly! */
|
||||
|
@ -9,6 +9,7 @@ import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.data.limbo.LimboService;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
||||
import fr.xephi.authme.mail.EmailService;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.permission.AdminPermission;
|
||||
import fr.xephi.authme.permission.PlayerPermission;
|
||||
@ -64,6 +65,9 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
@Inject
|
||||
private LimboService limboService;
|
||||
|
||||
@Inject
|
||||
private EmailService emailService;
|
||||
|
||||
AsynchronousLogin() {
|
||||
}
|
||||
|
||||
@ -189,6 +193,8 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
limboService.muteMessageTask(player);
|
||||
service.send(player, MessageKey.USAGE_CAPTCHA,
|
||||
captchaManager.getCaptchaCodeOrGenerateNew(player.getName()));
|
||||
} else if (emailService.hasAllInformation()) {
|
||||
service.send(player, MessageKey.FORGOT_PASSWORD_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -262,11 +268,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
}
|
||||
|
||||
private void displayOtherAccounts(List<String> auths, Player player) {
|
||||
if (!service.getProperty(RestrictionSettings.DISPLAY_OTHER_ACCOUNTS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auths.size() <= 1) {
|
||||
if (!service.getProperty(RestrictionSettings.DISPLAY_OTHER_ACCOUNTS) || auths.size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cТи беше баннат временно, понеже
|
||||
max_reg: '&cТи си достигнал максималният брой регистрации (%reg_count/%max_acc %reg_names)!'
|
||||
no_perm: '&4Нямаш нужните права за това действие!'
|
||||
error: '&4Получи се неочаквана грешка, моля свържете се с администратора!'
|
||||
unsafe_spawn: '&cКогато излезе твоето местоположение не беше безопастно, телепортиран си на Spawn.'
|
||||
kick_forvip: '&3VIP потребител влезе докато сървъра беше пълен, ти беше изгонен!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2Имейл адреса е добавен!'
|
||||
email_confirm: '&cМоля потвърди своя имейл адрес!'
|
||||
email_changed: '&2Имейл адреса е сменен!'
|
||||
email_send: '&2Възстановяващият имейл е изпратен успешно. Моля провете пощата си!'
|
||||
email_exists: '&cВъзстановяващият имейл е бил изпратен. Може да го откажеш или изпратиш отново с тази команда:'
|
||||
email_show: '&2Твоят имейл адрес е: &f%email'
|
||||
incomplete_email_settings: 'Грешка: Не всички настройки са написани за изпращане на имейл адрес. Моля свържете се с администратора!'
|
||||
email_already_used: '&4Имейл адреса вече се използва, опитайте с друг.'
|
||||
|
@ -34,7 +34,6 @@ tempban_max_logins: '&cVocê foi temporariamente banido por tentar logar muitas
|
||||
max_reg: '&cVocê excedeu o número máximo de inscrições (%reg_count/%max_acc %reg_names) do seu IP!'
|
||||
no_perm: '&4Você não tem permissão para executar esta ação!'
|
||||
error: '&4Ocorreu um erro inesperado, por favor contacte um administrador!'
|
||||
unsafe_spawn: '&cVocê deslogou em um local inseguro e foi teleportado parao Spawn do servidor!'
|
||||
kick_forvip: '&3Um jogador VIP juntou-se ao servidor enquanto ele estava cheio!'
|
||||
|
||||
# AntiBot
|
||||
@ -86,7 +85,6 @@ email_added: '&2Email adicionado com sucesso à sua conta!'
|
||||
email_confirm: '&cPor favor confirme seu endereço de email!'
|
||||
email_changed: '&2Troca de email com sucesso.!'
|
||||
email_send: '&2Recuperação de email enviada com sucesso! Por favor, verifique sua caixa de entrada de e-mail!'
|
||||
email_exists: '&cUm e-mail de recuperação já foi enviado! Você pode descartá-lo e enviar um novo usando o comando abaixo:'
|
||||
email_show: '&2O seu endereço de e-mail atual é: &f%email'
|
||||
incomplete_email_settings: 'Erro: Nem todas as configurações necessárias estão definidas para o envio de e-mails. Entre em contato com um administrador.'
|
||||
email_already_used: '&4O endereço de e-mail já está sendo usado'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cByl jsi dočasně zabanován za příliš mnoho neúspě
|
||||
max_reg: '&cPřekročil(a) jsi limit pro počet účtů (%reg_count/%max_acc %reg_names) z jedné IP adresy.'
|
||||
no_perm: '&cNa tento příkaz nemáš dostatečné pravomoce.'
|
||||
error: '&cVyskytla se chyba - kontaktujte prosím administrátora ...'
|
||||
unsafe_spawn: '&cTvoje pozice při posledním odpojení byla nebezpečná, teleportuji tě proto na spawn!'
|
||||
kick_forvip: '&cOmlouváme se, ale VIP hráč se připojil na plný server!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '[AuthMe] Email přidán!'
|
||||
email_confirm: '[AuthMe] Potvrď prosím svůj email!'
|
||||
email_changed: '[AuthMe] Email změněn!'
|
||||
email_send: '[AuthMe] Email pro obnovení hesla odeslán!'
|
||||
email_exists: '&cNový email byl odeslán! Můžeš ho zahodit a poslat jiný pomocí tohoto příkazu:'
|
||||
email_show: '&2Váš aktuální email je: &f%email'
|
||||
incomplete_email_settings: 'Chyba: chybí některé důležité informace pro odeslání emailu. Kontaktujte prosím admina.'
|
||||
email_already_used: '&4Tato emailová adresa je již používána'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cDu bist wegen zu vielen fehlgeschlagenen Login-Versuchen
|
||||
max_reg: '&cDu hast die maximale Anzahl an Accounts erreicht (%reg_count/%max_acc %reg_names).'
|
||||
no_perm: '&4Du hast keine Rechte, um diese Aktion auszuführen!'
|
||||
error: '&4Ein Fehler ist aufgetreten. Bitte kontaktiere einen Administrator.'
|
||||
unsafe_spawn: '&cDeine Logoutposition war unsicher, du wurdest zum Spawn teleportiert'
|
||||
kick_forvip: '&3Ein VIP-Spieler hat den vollen Server betreten!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2E-Mail hinzugefügt!'
|
||||
email_confirm: '&cBitte bestätige deine E-Mail!'
|
||||
email_changed: '&2E-Mail aktualisiert!'
|
||||
email_send: '&2Wiederherstellungs-E-Mail wurde gesendet!'
|
||||
email_exists: '&cEine Wiederherstellungs-E-Mail wurde bereits versandt! Nutze folgenden Befehl um eine neue E-Mail zu versenden:'
|
||||
email_show: '&2Deine aktuelle E-Mail-Adresse ist: &f%email'
|
||||
incomplete_email_settings: 'Fehler: Es wurden nicht alle notwendigen Einstellungen vorgenommen, um E-Mails zu senden. Bitte kontaktiere einen Administrator.'
|
||||
email_already_used: '&4Diese E-Mail-Adresse wird bereits genutzt.'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cYou have been temporarily banned for failing to log in to
|
||||
max_reg: '&cYou have exceeded the maximum number of registrations (%reg_count/%max_acc %reg_names) for your connection!'
|
||||
no_perm: '&4You don''t have the permission to perform this action!'
|
||||
error: '&4An unexpected error occurred, please contact an administrator!'
|
||||
unsafe_spawn: '&cYour quit location was unsafe, you have been teleported to the world''s spawnpoint.'
|
||||
kick_forvip: '&3A VIP player has joined the server when it was full!'
|
||||
|
||||
# AntiBot
|
||||
@ -81,7 +80,6 @@ email_added: '&2Email address successfully added to your account!'
|
||||
email_confirm: '&cPlease confirm your email address!'
|
||||
email_changed: '&2Email address changed correctly!'
|
||||
email_send: '&2Recovery email sent successfully! Please check your email inbox!'
|
||||
email_exists: '&cA recovery email was already sent! You can discard it and send a new one using the command below:'
|
||||
email_show: '&2Your current email address is: &f%email'
|
||||
incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
email_already_used: '&4The email address is already being used'
|
||||
|
@ -33,7 +33,6 @@ tempban_max_logins: '&cHas sido expulsado temporalmente por intentar iniciar ses
|
||||
max_reg: '&fHas excedido la cantidad máxima de registros para tu cuenta'
|
||||
no_perm: '&cNo tienes permiso'
|
||||
error: '&fHa ocurrido un error. Por favor contacta al administrador.'
|
||||
unsafe_spawn: '&fTu lugar de desconexión es inseguro, teletransportándote al punto inicial del mundo'
|
||||
kick_forvip: '&c¡Un jugador VIP ha ingresado al servidor lleno!'
|
||||
|
||||
# AntiBot
|
||||
@ -85,7 +84,6 @@ email_added: '[AuthMe] Email agregado !'
|
||||
email_confirm: '[AuthMe] Confirma tu Email !'
|
||||
email_changed: '[AuthMe] Email cambiado !'
|
||||
email_send: '[AuthMe] Correo de recuperación enviado !'
|
||||
email_exists: '&c¡El correo de recuperación ya ha sido enviado! Puedes descartarlo y enviar uno nuevo utilizando el siguiente comando:'
|
||||
email_show: '&2Tu dirección de E-Mail actual es: &f%email'
|
||||
incomplete_email_settings: 'Error: no todos los ajustes necesarios se han configurado para enviar correos. Por favor, contacta con un administrador.'
|
||||
email_already_used: '&4La dirección Email ya está siendo usada'
|
||||
|
@ -31,7 +31,6 @@ not_logged_in: '&cSaioa hasi gabe!'
|
||||
max_reg: '&fKontuko 2 erabiltzaile bakarrik izan ditzakezu'
|
||||
no_perm: '&cBaimenik ez'
|
||||
error: '&fErrorea; Mesedez jarri kontaktuan administratzaile batekin'
|
||||
unsafe_spawn: '&fSpawn-era telegarraiatu zara'
|
||||
kick_forvip: '&cVIP erabiltzaile bat sartu da zerbitzaria beteta zegoenean!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '[AuthMe] Emaila gehitu duzu !'
|
||||
email_confirm: '[AuthMe] Konfirmatu zure emaila !'
|
||||
email_changed: '[AuthMe] Emaila aldatua!'
|
||||
email_send: '[AuthMe] Berreskuratze emaila bidalita !'
|
||||
# TODO email_exists: '&cA recovery email was already sent! You can discard it and send a new one using the command below:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
# TODO email_already_used: '&4The email address is already being used'
|
||||
|
@ -31,7 +31,6 @@ not_logged_in: '&cEt ole kirjautunut sisään!'
|
||||
max_reg: '&fSinulla ei ole oikeuksia tehdä enempää pelaajatilejä!'
|
||||
no_perm: '&cEi oikeuksia'
|
||||
error: '&fVirhe: Ota yhteys palveluntarjoojaan!'
|
||||
unsafe_spawn: '&fHengenvaarallinen poistumispaikka! Siirsimme sinut spawnille!'
|
||||
kick_forvip: '&cVIP pelaaja liittyi täyteen palvelimeen!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '[AuthMe] Sähköposti lisätty!'
|
||||
email_confirm: '[AuthMe] Vahvistuta sähköposti!'
|
||||
email_changed: '[AuthMe] Sähköposti vaihdettu!'
|
||||
email_send: '[AuthMe] Palautus sähköposti lähetetty!'
|
||||
# TODO email_exists: '&cA recovery email was already sent! You can discard it and send a new one using the command below:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
# TODO email_already_used: '&4The email address is already being used'
|
||||
|
@ -35,7 +35,6 @@ tempban_max_logins: '&cVous êtes temporairement banni suite à plusieurs échec
|
||||
max_reg: 'Vous avez atteint la limite d''inscription! &o(%reg_count/%max_acc : %reg_names)'
|
||||
no_perm: '&cVous n''êtes pas autorisé à utiliser cette commande.'
|
||||
error: '&cUne erreur est apparue, veuillez contacter un administrateur.'
|
||||
unsafe_spawn: 'Téléportation dans un endroit sûr.'
|
||||
kick_forvip: 'Un joueur VIP a rejoint le serveur à votre place (serveur plein).'
|
||||
|
||||
# AntiBot
|
||||
@ -87,7 +86,6 @@ email_added: '&aEmail enregistré. En cas de perte de MDP, faites "/email recove
|
||||
email_confirm: '&cLa confirmation de l''email est manquante ou éronnée.'
|
||||
email_changed: '&aVotre email a été mis à jour.'
|
||||
email_send: '&aEmail de récupération envoyé !'
|
||||
email_exists: '&cUn email de récupération a déjà été envoyé ! Vous pouvez le jeter et vous en faire envoyez un nouveau en utilisant :'
|
||||
email_show: '&2Votre adresse email actuelle est: &f%email'
|
||||
incomplete_email_settings: '&cErreur : Tous les paramètres requis ne sont pas présent pour l''envoi de mail, veuillez contacter un admin.'
|
||||
email_already_used: '&cCette adresse email est déjà utilisée !'
|
||||
|
@ -31,7 +31,6 @@ not_logged_in: '&cNon te identificaches!'
|
||||
max_reg: '&fExcediches o máximo de rexistros para a túa Conta'
|
||||
no_perm: '&cNon tes o permiso'
|
||||
error: '&fOcurriu un erro; contacta cun administrador'
|
||||
unsafe_spawn: '&fA localización dende a que saíches era insegura, teletransportándote ao spawn do mundo'
|
||||
kick_forvip: '&cUn xogador VIP uniuse ao servidor cheo!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '[AuthMe] Correo engadido!'
|
||||
email_confirm: '[AuthMe] Confirma o teu correo!'
|
||||
email_changed: '[AuthMe] Cambiouse o correo!'
|
||||
email_send: '[AuthMe] Enviouse o correo de confirmación!'
|
||||
# TODO email_exists: '&cA recovery email was already sent! You can discard it and send a new one using the command below:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
# TODO email_already_used: '&4The email address is already being used'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cIdeiglenesen ki lettél tiltva mert túl sok alkalommal r
|
||||
max_reg: '&cElérted a maximálisan beregisztrálható karakterek számát. (%reg_count/%max_acc %reg_names)!'
|
||||
no_perm: '&cNincs jogod ehhez!'
|
||||
error: 'Hiba lépett fel! Lépj kapcsolatba a szerver tulajával sürgősen!'
|
||||
unsafe_spawn: 'A kilépési helyzeted nem biztonságos, ezért elteleportálunk a kezdő pozícióra.'
|
||||
kick_forvip: '&3VIP játékos csatlakozott a szerverhez!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2Az email címed rögzítése sikeresen megtörtént!'
|
||||
email_confirm: '&cKérlek ellenőrízd az email címedet!'
|
||||
email_changed: '&2Az email cím cseréje sikeresen megtörtént!'
|
||||
email_send: '&2A jelszó visszaállításhoz szükséges emailt elküldtük! Ellenőrízd a leveleidet!'
|
||||
email_exists: '&cA visszaállító emailt elküldtük! Hiba esetén újra kérheted az alábbi parancs segítségével:'
|
||||
email_show: '&2A jelenlegi email-ed a következő: &f%email'
|
||||
incomplete_email_settings: 'Hiba: nem lett beállítva az össze szükséges beállítás az email küldéshez. Vedd fel a kapcsolatot egy adminnal.'
|
||||
email_already_used: '&4Ez az email cím már használatban van!'
|
||||
|
@ -31,7 +31,6 @@ not_logged_in: '&cKamu belum login!'
|
||||
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!'
|
||||
unsafe_spawn: '&cLokasi quit kamu tidak aman, kamu telah diteleport ke titik spawn world.'
|
||||
kick_forvip: '&3Player VIP mencoba masuk pada saat server sedang penuh!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ 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:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
# TODO email_already_used: '&4The email address is already being used'
|
||||
|
@ -32,7 +32,6 @@ tempban_max_logins: '&cSei stato temporaneamente bandito per aver fallito l''aut
|
||||
max_reg: '&cHai raggiunto il numero massimo di registrazioni (%reg_count/%max_acc %reg_names) per questo indirizzo IP!'
|
||||
no_perm: '&4Non hai il permesso di eseguire questa operazione.'
|
||||
error: '&4Qualcosa è andato storto, riporta questo errore ad un amministratore!'
|
||||
unsafe_spawn: '&cIl tuo punto di disconnessione risulta ostruito o insicuro, sei stato teletrasportato al punto di rigenerazione!'
|
||||
kick_forvip: '&3Un utente VIP è entrato mentre il server era pieno e ha preso il tuo posto!'
|
||||
|
||||
# AntiBot
|
||||
@ -84,7 +83,6 @@ email_added: '&2Indirizzo email aggiunto correttamente al tuo account!'
|
||||
email_confirm: '&cPer favore, conferma il tuo indirizzo email!'
|
||||
email_changed: '&2Indirizzo email cambiato correttamente!'
|
||||
email_send: '&2Una email di recupero è stata appena inviata al tuo indirizzo email!'
|
||||
email_exists: '&cUna email di recupero ti è già stata inviata! Se vuoi, puoi annullarla e richiederne un''altra con il seguente comando:'
|
||||
email_show: '&2Il tuo indirizzo email al momento è: &f%email'
|
||||
incomplete_email_settings: 'Errore: non tutte le impostazioni richieste per inviare le email sono state impostate. Per favore contatta un amministratore.'
|
||||
email_already_used: '&4L''indirizzo email inserito è già in uso'
|
||||
|
@ -35,7 +35,6 @@ not_logged_in: '&c접속되어있지 않습니다!'
|
||||
max_reg: '&f당신은 가입할 수 있는 계정의 최대 한도를 초과했습니다'
|
||||
no_perm: '&c권한이 없습니다'
|
||||
error: '&f오류가 발생했습니다; 관리자에게 문의해주세요'
|
||||
unsafe_spawn: '&f당신이 종료한 위치는 안전하지 않았습니다, 세계의 소환지점으로 이동합니다'
|
||||
kick_forvip: '&c서버가 만원인 상태일때 VIP 플레이어들만 입장이 가능합니다!'
|
||||
|
||||
# AntiBot
|
||||
@ -86,7 +85,6 @@ email_added: '[AuthMe] 이메일을 추가했습니다!'
|
||||
email_confirm: '[AuthMe] 당신의 이메일을 확인하세요!'
|
||||
email_changed: '[AuthMe] 이메일이 변경되었습니다!'
|
||||
email_send: '[AuthMe] 복구 이메일을 보냈습니다!'
|
||||
email_exists: '[AuthMe] 당신의 계정에 이미 이메일이 존재합니다. 아래의 명령어를 통해 이메일을 변경하실 수 있습니다'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
# TODO email_already_used: '&4The email address is already being used'
|
||||
|
@ -31,7 +31,6 @@ not_logged_in: '&cTu neprisijunges!'
|
||||
max_reg: '&cJus pasiekete maksimalu registraciju skaiciu.'
|
||||
no_perm: '&cNera leidimo'
|
||||
error: '&cAtsirado klaida, praneskite adminstratoriui.'
|
||||
unsafe_spawn: '&6Atsijungimo vieta nesaugi, perkeliame jus i atsiradimo vieta.'
|
||||
kick_forvip: '&cA VIP prisijunge i pilna serveri!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ same_nick: '&cKazkas situo vardu jau zaidzia.'
|
||||
# TODO email_confirm: '&cPlease confirm your email address!'
|
||||
# TODO email_changed: '&2Email address changed correctly!'
|
||||
# TODO email_send: '&2Recovery email sent successfully! Please check your email inbox!'
|
||||
# TODO email_exists: '&cA recovery email was already sent! You can discard it and send a new one using the command below:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
# TODO email_already_used: '&4The email address is already being used'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cJe bent tijdelijk gebanned omdat het inloggen te vaak mis
|
||||
max_reg: 'Je hebt het maximum aantal registraties overschreden (%reg_count/%max_acc: %reg_names).'
|
||||
no_perm: '&cJe hebt geen rechten om deze actie uit te voeren!'
|
||||
error: 'Er is een onverwachte fout opgetreden, neem contact op met een administrator!'
|
||||
unsafe_spawn: '&cDe locatie waar je de vorige keer het spel verliet was gevaarlijk, je bent geteleporteerd naar de spawn.'
|
||||
kick_forvip: '&cEen VIP-gebruiker heeft ingelogd toen de server vol was!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2Het E-mailadres is succesvol toegevoegd aan je account!'
|
||||
email_confirm: '&cVerifiëer je E-mailadres alsjeblieft!'
|
||||
email_changed: '&2Het E-mailadres is succesvol veranderd!'
|
||||
email_send: '&2Een herstel E-mail is verzonden! Check alsjeblieft je mailbox!'
|
||||
email_exists: '&cEen herstel E-mail voor je wachtwoord is al verzonden! Je kunt een nieuwe laten sturen met het volgende commando:'
|
||||
email_show: '&2Jouw huidige E-mailadres is: %email'
|
||||
incomplete_email_settings: 'Fout; er moeten nog enkele opties ingevuld worden om mails te kunnen sturen. Neem contact op met een administrator.'
|
||||
email_already_used: '&4Dit E-mailadres wordt al gebruikt'
|
||||
|
@ -31,7 +31,6 @@ tempban_max_logins: '&cZostales tymczasowo zbanowany za duza liczbe nieudanych l
|
||||
max_reg: '&fPrzekroczyles limit zarejestrowanych kont na serwerze.'
|
||||
no_perm: '&4Nie masz uprawnien'
|
||||
error: '&fBlad prosimy napisac do aministracji'
|
||||
unsafe_spawn: '&fTwoje pozycja jest niebezpieczna. Zostaniesz przeniesiony na bezpieczny spawn.'
|
||||
kick_forvip: '&cA Gracz VIP dolaczyl do gry!'
|
||||
|
||||
# AntiBot
|
||||
@ -83,7 +82,6 @@ email_added: '[AuthMe] Email dodany!'
|
||||
email_confirm: '[AuthMe] Potwierdz swoj email!'
|
||||
email_changed: '[AuthMe] Email zmieniony!'
|
||||
email_send: '[AuthMe] Email z odzyskaniem wyslany!'
|
||||
email_exists: '&cEmail z haslem zostal wyslany, aby wyslac go ponownie uzyj:'
|
||||
email_show: '&2Twoj aktualny adres email to: &f%email'
|
||||
incomplete_email_settings: 'Error: Nie wszystkie opcje odpowiedzialne za wysylanie emaili zostaly ustawione. Skontaktuj sie z administracja.'
|
||||
email_already_used: '&4Ten adres email jest aktualnie uzywany!'
|
||||
|
@ -31,7 +31,6 @@ tempban_max_logins: '&cVocê foi temporariamente banido por falhar muitas vezes
|
||||
max_reg: '&cAtingiu o numero máximo de %reg_count contas registas, maximo de contas %max_acc'
|
||||
no_perm: '&cSem Permissões'
|
||||
error: '&fOcorreu um erro; Por favor contacte um administrador'
|
||||
unsafe_spawn: '&fA sua localização na saída não é segura, será tele-portado para a Spawn'
|
||||
kick_forvip: '&cUm jogador VIP entrou no servidor cheio!'
|
||||
|
||||
# AntiBot
|
||||
@ -83,7 +82,6 @@ email_added: 'Email adicionado com sucesso!'
|
||||
email_confirm: 'Confirme o seu email!'
|
||||
email_changed: 'Email alterado com sucesso!'
|
||||
email_send: 'Nova palavra-passe enviada para o seu email!'
|
||||
email_exists: '&cUm e-mail de recuperação já foi enviado! Pode descartá-lo e enviar um novo usando o comando abaixo:'
|
||||
email_show: '&2O seu endereço de email atual é &f%email'
|
||||
incomplete_email_settings: 'Erro: nem todas as definições necessarias para enviar email foram preenchidas. Por favor contate um administrador.'
|
||||
email_already_used: '&4O endereço de e-mail já está sendo usado'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cAi fost interzis temporar deoarece ai incercat sa te aute
|
||||
max_reg: '&cTe-ai inregistrat cu prea multe counturi (%reg_count/%max_acc %reg_names) pentru conexiunea ta!'
|
||||
no_perm: '&4Nu ai permisiunea!'
|
||||
error: '&4A aparut o eroare, te rugam contacteaza un membru din staff!'
|
||||
unsafe_spawn: '&cLocatia in care esti acum nu este sigura, ai fost teleportat la spawn.'
|
||||
kick_forvip: '&3Un V.I.P a intrat pe server cand era plin!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2Email-ul a fost adaugat cu succes la contul tau!'
|
||||
email_confirm: '&cTe rugam confirma adresa de email!'
|
||||
email_changed: '&2Email-ul a fost schimbat corect!'
|
||||
email_send: ' &2Recuperarea email-ul a fost trimis cu succes! Te rugam sa verificati email-ul in inbox!'
|
||||
email_exists: '&cRecuperarea email-ului a fost deja trimisa! Puteti sa-l anulati si sa trimiteti unul nou folosind comanda de mai jos:'
|
||||
email_show: '&2Adresa ta curenta de email este: &f%email'
|
||||
incomplete_email_settings: 'Eroare: nu toate setarile necesare pentru trimiterea email-ului sunt facute! Te rugam contacteaza un administrator.'
|
||||
email_already_used: '&4Email-ul a fost deja folosit'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cВы были временно забанены, пото
|
||||
max_reg: '&cВы превысили максимальное количество регистраций на сервере! (%reg_count/%max_acc %reg_names)'
|
||||
no_perm: '&cНедостаточно прав'
|
||||
error: '&cПроизошла ошибка. Свяжитесь с администратором'
|
||||
unsafe_spawn: '&eВаше расположение перед выходом было опасным - вы перенесены на спавн'
|
||||
kick_forvip: '&6VIP игрок зашел на переполненный сервер!'
|
||||
|
||||
# АнтиБот (Защита от ботов)
|
||||
@ -82,7 +81,6 @@ email_added: '[AuthMe] Email добавлен!'
|
||||
email_confirm: '[AuthMe] Подтвердите ваш Email!'
|
||||
email_changed: '[AuthMe] Email изменен!'
|
||||
email_send: '[AuthMe] Письмо с инструкциями для восстановления было отправлено на ваш Email!'
|
||||
email_exists: '&cВосстановительное письмо через email отправлено! Вы можете отменить его командой ниже:'
|
||||
email_show: '&2Ваш текущий адрес электронной почты: &f%email'
|
||||
incomplete_email_settings: 'Ошибка: не все необходимые параметры установлены для отправки электронной почты. Пожалуйста, обратитесь к администратору.'
|
||||
email_already_used: '&4Этот email уже используется.'
|
||||
|
@ -35,7 +35,6 @@ not_logged_in: '&cNie si este prihláseny!'
|
||||
max_reg: '&fDosiahol si maximum registrovanych uctov.'
|
||||
no_perm: '&cZiadne'
|
||||
error: '&fNastala chyba; Kontaktujte administrátora'
|
||||
unsafe_spawn: '&fTvoj pozícia bol nebezpecná, teleportujem hraca na spawn'
|
||||
# TODO kick_forvip: '&3A VIP player has joined the server when it was full!'
|
||||
|
||||
# AntiBot
|
||||
@ -86,7 +85,6 @@ same_nick: '&fHrác s tymto nickom uz hrá!'
|
||||
# TODO email_confirm: '&cPlease confirm your email address!'
|
||||
# TODO email_changed: '&2Email address changed correctly!'
|
||||
# TODO email_send: '&2Recovery email sent successfully! Please check your email inbox!'
|
||||
# TODO email_exists: '&cA recovery email was already sent! You can discard it and send a new one using the command below:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
# TODO email_already_used: '&4The email address is already being used'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cBir cok kez yanlis giris yaptiginiz icin gecici olarak ba
|
||||
max_reg: '&cSen maksimum kayit sinirini astin (%reg_count/%max_acc %reg_names)!'
|
||||
no_perm: '&4Bunu yapmak icin iznin yok!'
|
||||
error: '&4Beklenmedik bir hata olustu, yetkili ile iletisime gecin!'
|
||||
unsafe_spawn: '&cOyundan ciktigin yer guvenli degil, baslangic noktasina isinlaniyorsun.'
|
||||
kick_forvip: '&3Bir VIP oyuna giris yaptigi icin atildin!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2Eposta basariyla kullaniciniza eklendi!'
|
||||
email_confirm: '&cLutfen tekrar epostanizi giriniz!'
|
||||
email_changed: '&2Epostaniz basariyla degistirildi!'
|
||||
email_send: '&2Sifreniz epostaniza gonderildi! Lutfen eposta kutunuzu kontrol edin!'
|
||||
email_exists: '&cSifreniz zaten epostanize gonderildi! Bunu iptal etmek veya yeni bir sifre gondermek icin assagidaki komutu kullanabilirsin:'
|
||||
email_show: '&2Suanki eposta adresin: &f%email'
|
||||
incomplete_email_settings: 'Hata: Gonderilen epostada bazi ayarlar tamamlanmis degil. Yetkili ile iletisime gec.'
|
||||
email_already_used: '&4Eposta adresi zaten kullaniliyor.'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cВаш IP тимчасово заблоковано, із
|
||||
max_reg: '&cВичерпано ліміт реєстрацій (%reg_count/%max_acc %reg_names) для вашого підключення!'
|
||||
no_perm: '&4У вас недостатньо прав, щоб застосувати цю команду!'
|
||||
error: '&4[AuthMe] Error. Будь ласка, повідомте адміністратора!'
|
||||
unsafe_spawn: '&cВаше останнє місцезнаходження не є безпечним. Вас було переміщено на точку спавна.'
|
||||
kick_forvip: '&3Вас кікнуто, внаслідок того, що VIP гравець зайшов на сервер коли небуло вільних місць.'
|
||||
|
||||
# AntiBot
|
||||
@ -81,7 +80,6 @@ email_added: '&2Електронну пошту успішно прив’яза
|
||||
email_confirm: '&cАдреси не співпадають.'
|
||||
email_changed: '&2E-mail успішно змінено.'
|
||||
email_send: '&2Лист для відновлення доступу надіслано. Будь ласка, провірте свою пошту!'
|
||||
email_exists: '&cЛист для відновлення доступу вже було надіслано! Ви можете деактуалізувати його, використавши наступну команду:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
incomplete_email_settings: '&4[AuthMe] Error: Не всі необхідні налаштування є встановленими, щоб надсилати електронну пошту. Будь ласка, повідомте адміністратора!'
|
||||
email_already_used: '&4До цієї електронної пошти прив’язано забагато акаунтів!'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&cBạn đã bị tạm thời khóa truy cập do đăng n
|
||||
max_reg: '&cBạn đã vượt quá giới hạn tối đa đăng ký tài khoản (%reg_count/%max_acc %reg_names) cho những lần kết nối tài khoản!'
|
||||
no_perm: '&4Bạn không có quyền truy cập lệnh này!'
|
||||
error: '&4Lỗi! Vui lòng liên hệ quản trị viên hoặc admin'
|
||||
unsafe_spawn: '&cBạn đang ở vị trí không an toàn, bạn đã được dịch chuyển về Spawn.'
|
||||
kick_forvip: '&eChỉ có thành viên VIP mới được tham gia khi máy chủ đầy!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2Địa chỉ email đã thêm vào tài khoản của bạn thà
|
||||
email_confirm: '&cVui lòng xác nhận địa chỉ email của bạn!'
|
||||
email_changed: '&2Địa chỉ email đã thay đổi!'
|
||||
email_send: '&2Email phục hồi đã được gửi thành công! Vui lòng kiểm tra hộp thư đến trong email của bạn.'
|
||||
email_exists: '&cEmail phục hồi đã được gửi, bạn có thể hủy bỏ và gửi thư mới bằng cách sử dụng lệnh sau:'
|
||||
email_show: '&2Địa chỉ email hiện tại của bạn là: &f%email'
|
||||
incomplete_email_settings: 'Lỗi: các thiết lập để gửi thư không được cài đặt đầy đủ. Vui lòng liên hệ với quản trị viên để thông báo lỗi.'
|
||||
email_already_used: '&4Địa chỉ email đã được sử dụng'
|
||||
|
@ -31,7 +31,6 @@ tempban_max_logins: '&c由于您登录失败次数过多,已被暂时禁止登
|
||||
max_reg: '&8[&6玩家系统&8] &f你不允许再为你的IP在服务器注册更多用户了!'
|
||||
no_perm: '&8[&6玩家系统&8] &c没有权限'
|
||||
error: '&8[&6玩家系统&8] &f发现错误,请联系管理员'
|
||||
unsafe_spawn: '&8[&6玩家系统&8] &f你退出服务器时的位置不安全,正在传送你到此世界的出生点'
|
||||
kick_forvip: '&8[&6玩家系统&8] &cA VIP玩家加入了已满的服务器!'
|
||||
|
||||
# AntiBot
|
||||
@ -83,7 +82,6 @@ email_added: '&8[&6玩家系统&8] &f邮箱已添加 !'
|
||||
email_confirm: '&8[&6玩家系统&8] &f确认你的邮箱 !'
|
||||
email_changed: '&8[&6玩家系统&8] &f邮箱已改变 !'
|
||||
email_send: '&8[&6玩家系统&8] &f恢复邮件已发送 !'
|
||||
email_exists: '&8[&6玩家系统&8] &c恢复邮件已发送 ! 你可以丢弃它然後使用以下的指令来发送新的邮件:'
|
||||
email_show: '&2您当前的电子邮件地址为: &f%email'
|
||||
incomplete_email_settings: '错误:并非所有发送邮件需要的设置都已被设置,请联系管理员'
|
||||
email_already_used: '&8[&6玩家系统&8] &4邮箱已被使用'
|
||||
|
@ -35,7 +35,6 @@ not_logged_in: '&8[&6用戶系統&8] &c你還沒有登入 !'
|
||||
max_reg: '&8[&6用戶系統&8] &f你的IP地址已達到註冊數上限。'
|
||||
no_perm: '&8[&6用戶系統&8] &b嗯~你想幹甚麼?'
|
||||
error: '&8[&6用戶系統&8] &f發生錯誤,請與管理員聯絡。'
|
||||
unsafe_spawn: '&8[&6用戶系統&8] &f你的登出位置不安全,現在將傳送你到重生點。'
|
||||
kick_forvip: '&c喔!因為有VIP玩家登入了伺服器。'
|
||||
|
||||
# AntiBot
|
||||
@ -86,7 +85,6 @@ email_added: '&8[&6用戶系統&8] &a已新增你的電郵地址。'
|
||||
email_confirm: '&8[&6用戶系統&8] &5請重覆輸入你的電郵地址。'
|
||||
email_changed: '&8[&6用戶系統&8] &a你的電郵地址已更改。'
|
||||
email_send: '&8[&6用戶系統&8] &a忘記密碼信件已寄出,請查收。'
|
||||
email_exists: '&8[&6用戶系統&8] &c訊息已發送!如果你收不到該封電郵,可以使用以下指令進行重寄:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
email_already_used: '&8[&6用戶系統&8] &4這個電郵地址已被使用。'
|
||||
|
@ -30,7 +30,6 @@ tempban_max_logins: '&c由於登錄失敗次數過多,您已被暫時禁止。
|
||||
max_reg: '&c您已超過註冊的最大數量(%reg_count/%max_acc %reg_names)!'
|
||||
no_perm: '&4您沒有執行此操作的權限!'
|
||||
error: '&4發生錯誤!請聯繫伺服器管理員!'
|
||||
unsafe_spawn: '&c你的登出地點並不安全,你已經被傳送到世界的重生點。'
|
||||
kick_forvip: '&3一名VIP玩家在服務器已滿時已加入伺服器!'
|
||||
|
||||
# AntiBot
|
||||
@ -82,7 +81,6 @@ email_added: '&2電子郵件地址已成功添加到您的帳戶!'
|
||||
email_confirm: '&c請確認你的電郵地址!'
|
||||
email_changed: '&2已正確地更改電子郵件地址!'
|
||||
email_send: '&2帳戶恢復電子郵件已成功發送! 請檢查您的電子郵件收件箱!'
|
||||
email_exists: '&c備援電子郵件已傳送! 您可以使用以下命令丟棄它並發送一個新的備援電子郵件:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
incomplete_email_settings: '缺少必要的配置來為發送電子郵件。請聯繫管理員。'
|
||||
email_already_used: '&4此電子郵件地址已被使用'
|
||||
|
@ -35,7 +35,6 @@ not_logged_in: '&b【AuthMe】&6你還沒有登入!'
|
||||
max_reg: '&b【AuthMe】&6你的 IP 位置所註冊的帳號數量已經達到最大。'
|
||||
no_perm: '&b【AuthMe】&6你沒有使用該指令的權限。'
|
||||
error: '&b【AuthMe】&6發生錯誤,請聯繫管理員'
|
||||
unsafe_spawn: '&b【AuthMe】&6你登出的地點不安全,已傳送你到安全的地點。'
|
||||
kick_forvip: '&b【AuthMe】&6你已經被請出。&c原因 : 有 VIP 玩家登入伺服器'
|
||||
|
||||
# AntiBot
|
||||
@ -86,7 +85,6 @@ 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這個帳戶已經有設定電子郵件了'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
email_already_used: '&b【AuthMe】&4這個電郵地址已被使用。'
|
||||
|
@ -4,6 +4,7 @@ import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -13,6 +14,8 @@ import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@ -71,4 +74,17 @@ public class UnregisterCommandTest {
|
||||
verify(management).performUnregister(player, password);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldStopIfSenderIsNotPlayer() {
|
||||
// given
|
||||
CommandSender sender = mock(CommandSender.class);
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, Collections.singletonList("password"));
|
||||
|
||||
// then
|
||||
verifyZeroInteractions(playerCache, management);
|
||||
verify(sender).sendMessage(argThat(containsString("/authme unregister <player>")));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class MessagesIntegrationTest {
|
||||
@Test
|
||||
public void shouldFormatColorCodes() {
|
||||
// given
|
||||
MessageKey key = MessageKey.UNSAFE_QUIT_LOCATION;
|
||||
MessageKey key = MessageKey.LOGIN_SUCCESS;
|
||||
|
||||
// when
|
||||
String[] message = messages.retrieve(key);
|
||||
@ -115,7 +115,7 @@ public class MessagesIntegrationTest {
|
||||
@Test
|
||||
public void shouldSendMessageToPlayer() {
|
||||
// given
|
||||
MessageKey key = MessageKey.UNSAFE_QUIT_LOCATION;
|
||||
MessageKey key = MessageKey.LOGIN_SUCCESS;
|
||||
Player player = Mockito.mock(Player.class);
|
||||
|
||||
// when
|
||||
|
91
src/test/java/tools/messages/CheckMessageKeyUsages.java
Normal file
91
src/test/java/tools/messages/CheckMessageKeyUsages.java
Normal file
@ -0,0 +1,91 @@
|
||||
package tools.messages;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import tools.utils.FileIoUtils;
|
||||
import tools.utils.ToolTask;
|
||||
import tools.utils.ToolsConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
/**
|
||||
* Task which checks for {@link MessageKey} usages.
|
||||
*/
|
||||
public class CheckMessageKeyUsages implements ToolTask {
|
||||
|
||||
private static final Predicate<File> SHOULD_CHECK_FILE =
|
||||
file -> file.getName().endsWith(".java") && !file.getName().endsWith("MessageKey.java");
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return "checkMessageUses";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Scanner scanner) {
|
||||
System.out.println("Enter a message key to find the files where it is used");
|
||||
System.out.println("Enter empty line to search for all unused message keys");
|
||||
String key = scanner.nextLine();
|
||||
|
||||
if (key.trim().isEmpty()) {
|
||||
List<MessageKey> unusedKeys = findUnusedKeys();
|
||||
if (unusedKeys.isEmpty()) {
|
||||
System.out.println("No unused MessageKey entries found :)");
|
||||
} else {
|
||||
System.out.println("Did not find usages for keys:\n- " +
|
||||
String.join("\n- ", Lists.transform(unusedKeys, MessageKey::name)));
|
||||
}
|
||||
} else {
|
||||
MessageKey messageKey = MessageKey.valueOf(key);
|
||||
List<File> filesUsingKey = findUsagesOfKey(messageKey);
|
||||
System.out.println("The following files use '" + key + "':\n- "
|
||||
+ filesUsingKey.stream().map(File::getName).collect(Collectors.joining("\n- ")));
|
||||
}
|
||||
}
|
||||
|
||||
private List<MessageKey> findUnusedKeys() {
|
||||
List<MessageKey> keys = new ArrayList<>(asList(MessageKey.values()));
|
||||
File sourceFolder = new File(ToolsConstants.MAIN_SOURCE_ROOT);
|
||||
|
||||
Consumer<File> fileProcessor = file -> {
|
||||
String source = FileIoUtils.readFromFile(file.toPath());
|
||||
keys.removeIf(key -> source.contains(key.name()));
|
||||
};
|
||||
|
||||
walkJavaFileTree(sourceFolder, fileProcessor);
|
||||
return keys;
|
||||
}
|
||||
|
||||
private List<File> findUsagesOfKey(MessageKey key) {
|
||||
List<File> filesUsingKey = new ArrayList<>();
|
||||
File sourceFolder = new File(ToolsConstants.MAIN_SOURCE_ROOT);
|
||||
|
||||
Consumer<File> usagesCollector = file -> {
|
||||
String source = FileIoUtils.readFromFile(file.toPath());
|
||||
if (source.contains(key.name())) {
|
||||
filesUsingKey.add(file);
|
||||
}
|
||||
};
|
||||
|
||||
walkJavaFileTree(sourceFolder, usagesCollector);
|
||||
return filesUsingKey;
|
||||
}
|
||||
|
||||
private static void walkJavaFileTree(File folder, Consumer<File> javaFileConsumer) {
|
||||
for (File file : FileIoUtils.listFilesOrThrow(folder)) {
|
||||
if (file.isDirectory()) {
|
||||
walkJavaFileTree(file, javaFileConsumer);
|
||||
} else if (file.isFile() && SHOULD_CHECK_FILE.test(file)) {
|
||||
javaFileConsumer.accept(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
# Sample messages file
|
||||
|
||||
unknown_user: 'We''ve got%nl%new lines%nl%and '' apostrophes'
|
||||
unsafe_spawn: '&cHere we have&bdefined some colors &dand some other <hings'
|
||||
login: '&cHere we have&bdefined some colors &dand some other <hings'
|
||||
reg_voluntarily: 'You can register yourself to the server with the command "/register <password> <ConfirmPassword>"'
|
||||
usage_log: '&cUsage: /login <password>'
|
||||
wrong_pwd: '&cWrong password!'
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Sample messages file
|
||||
|
||||
unknown_user: 'Message from test2'
|
||||
unsafe_spawn: 'test2 - unsafe spawn'
|
||||
login: 'test2 - login'
|
||||
not_logged_in: 'test2 - not logged in'
|
||||
wrong_pwd: 'test2 - wrong password'
|
||||
|
Loading…
Reference in New Issue
Block a user