From 0c49e0f6939bcde42bf110bae9a3e62fa90b7e99 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sat, 22 Jun 2019 09:23:03 +0300 Subject: [PATCH] Display panel link after registration - Added language to 'Cmd SUCCESS - WebUser register' to inform about the link - Added link messages to the root of the web panel since it redirects Tickets: Close #1063 --- .../command/commands/RegisterCommand.java | 19 +++++++++++++++++++ .../plan/system/locale/lang/CommandLang.java | 2 +- .../assets/plan/locale/locale_CN.txt | 2 +- .../assets/plan/locale/locale_DE.txt | 2 +- .../assets/plan/locale/locale_EN.txt | 2 +- .../assets/plan/locale/locale_FI.txt | 2 +- .../assets/plan/locale/locale_FR.txt | 2 +- .../assets/plan/locale/locale_IT.txt | 2 +- .../assets/plan/locale/locale_JA.txt | 2 +- 9 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java b/Plan/common/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java index 21fd98d37..d1f47b080 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java @@ -21,6 +21,7 @@ import com.djrapitops.plan.db.Database; import com.djrapitops.plan.db.access.queries.objects.WebUserQueries; import com.djrapitops.plan.db.access.transactions.commands.RegisterWebUserTransaction; import com.djrapitops.plan.system.database.DBSystem; +import com.djrapitops.plan.system.info.connection.ConnectionSystem; import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.locale.lang.CmdHelpLang; import com.djrapitops.plan.system.locale.lang.CommandLang; @@ -58,6 +59,7 @@ public class RegisterCommand extends CommandNode { private final Locale locale; private final Processing processing; private final DBSystem dbSystem; + private final ConnectionSystem connectionSystem; private final PluginLogger logger; private final ErrorHandler errorHandler; @@ -66,6 +68,7 @@ public class RegisterCommand extends CommandNode { Locale locale, Processing processing, DBSystem dbSystem, + ConnectionSystem connectionSystem, PluginLogger logger, ErrorHandler errorHandler ) { @@ -74,6 +77,7 @@ public class RegisterCommand extends CommandNode { this.locale = locale; this.processing = processing; + this.connectionSystem = connectionSystem; this.logger = logger; this.dbSystem = dbSystem; this.errorHandler = errorHandler; @@ -161,11 +165,26 @@ public class RegisterCommand extends CommandNode { return; } database.executeTransaction(new RegisterWebUserTransaction(webUser)); + sender.sendMessage(locale.getString(CommandLang.WEB_USER_REGISTER_SUCCESS, userName)); + sendLink(sender); logger.info(locale.getString(CommandLang.WEB_USER_REGISTER_NOTIFY, userName, webUser.getPermLevel())); } catch (Exception e) { errorHandler.log(L.WARN, this.getClass(), e); } }); } + + private void sendLink(Sender sender) { + String url = connectionSystem.getMainAddress(); + String linkPrefix = locale.getString(CommandLang.LINK_PREFIX); + // Link + boolean console = !CommandUtils.isPlayer(sender); + if (console) { + sender.sendMessage(linkPrefix + url); + } else { + sender.sendMessage(linkPrefix); + sender.sendLink(" ", locale.getString(CommandLang.LINK_CLICK_ME), url); + } + } } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/locale/lang/CommandLang.java b/Plan/common/src/main/java/com/djrapitops/plan/system/locale/lang/CommandLang.java index ff5a00475..7395f4471 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/locale/lang/CommandLang.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/locale/lang/CommandLang.java @@ -36,7 +36,7 @@ public enum CommandLang implements Lang { FEATURE_DISABLED("Cmd SUCCESS - Feature disabled", "§aDisabled '${0}' temporarily until next plugin reload."), - WEB_USER_REGISTER_SUCCESS("Cmd SUCCESS - WebUser register", "§aAdded a new user (${0}) successfully!"), + WEB_USER_REGISTER_SUCCESS("Cmd SUCCESS - WebUser register", "§aAdded a new user (${0}) successfully! You can view the web panel in the following link."), WEB_USER_REGISTER_NOTIFY("Cmd Notify - WebUser register", "Registered new user: '${0}' Perm level: ${1}"), WEB_USER_LIST("Web User Listing", " §2${0} §7: §f${1}"), NO_WEB_USER_NOTIFY("Cmd Notify - No WebUser", "You might not have a web user, use /plan register "), diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_CN.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_CN.txt index 1bab9873b..b8e38af5a 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_CN.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_CN.txt @@ -47,7 +47,7 @@ Cmd Setup - Unauthorized || §e连接成功,但接收 Cmd Setup - Url mistake || §c请确保您所输入的是完整地址(以 http:// 或 https:// 开头)- 请检查 Bungee 启用日志获取完整地址。 Cmd Setup - WebServer not Enabled || §c未在此服务器上启用网页服务器!请确保其在开机时启用! Cmd SUCCESS - Feature disabled || §a已在下次插件重载前暂时禁用 '${0}'。 -Cmd SUCCESS - WebUser register || §a已成功添加新用户(${0})! +Cmd SUCCESS - WebUser register || §a已成功添加新用户(${0})!您可以在以下链接中查看Web面板。 Cmd Update - Cancel Success || §a已完成取消操作。 Cmd Update - Cancelled || §c已取消更新。 Cmd Update - Change log || 更新日志 版本${0}: diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt index 571043643..e4959eddc 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt @@ -47,7 +47,7 @@ Cmd Setup - Unauthorized || §eVerbindung erfolgreich, ab Cmd Setup - Url mistake || §cNutze die gesamte Adresse (Beginnend mit http:// oder https://) - Diese kannst du dem Bungee enable log entnehmen. Cmd Setup - WebServer not Enabled || §cWebServer ist auf diesem Server deaktiviert! Dies sollte beim Start aktiviert werden! Cmd SUCCESS - Feature disabled || §a'${0}' wurde bis zum nächsten Reload des Plugins deaktiviert. -Cmd SUCCESS - WebUser register || §aNeuer Account (${0}) erfolgreich hinzugefügt! +Cmd SUCCESS - WebUser register || §aNeuer Account (${0}) erfolgreich hinzugefügt! Sie können das Web-Panel über den folgenden Link anzeigen. Cmd Update - Cancel Success || §aErfolgreich abgebrochen. Cmd Update - Cancelled || §cUpdate abgebrochen. Cmd Update - Change log || Change Log v${0}: diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt index f3308126b..270ad2cca 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt @@ -47,7 +47,7 @@ Cmd Setup - Unauthorized || §eConnection succeeded, but Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. -Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! You can view the web panel in the following link. Cmd Update - Cancel Success || §aCancel operation performed. Cmd Update - Cancelled || §cUpdate cancelled. Cmd Update - Change log || Change Log v${0}: diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt index ef57fff47..50acb2c8d 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt @@ -47,7 +47,7 @@ Cmd Setup - Unauthorized || §eYhteys onnistui, mutta Vas Cmd Setup - Url mistake || §cVarmista käyttäväsi kokonaista osoitetta (http:// tai https:// alkuinen) - Tarkista osoite BungeeCord:in käynnistyslokista. Cmd Setup - WebServer not Enabled || §cWeb Palevlin ei ole käynnissä tällä palvelimella! Varmista että se käynnistyy pelin mukana! Cmd SUCCESS - Feature disabled || §aSammutettiin '${0}' toistaiseksi, kunnes Plan ladataan uudelleen. -Cmd SUCCESS - WebUser register || §aLisättiin uusi Web Käyttäjä (${0})! +Cmd SUCCESS - WebUser register || §aLisättiin uusi Web Käyttäjä (${0})! Voit tarkastella web-paneelia seuraavasta linkistä. Cmd Update - Cancel Success || §aPeruutettu. Cmd Update - Cancelled || §cPäivitys peruutettu. Cmd Update - Change log || Muutosloki v${0}: diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt index 63abee222..22f005147 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt @@ -47,7 +47,7 @@ Cmd Setup - Unauthorized || §eConnexion réussie, mais l Cmd Setup - Url mistake || §cAssurez-vous d'utiliser l'adresse complète (commençant par http:// ou https://). Consultez les logs du Bungee pour la connaître. Cmd Setup - WebServer not Enabled || §cLe serveur Web n'est pas activé sur ce serveur ! Assurez-vous qu'il se soit démarré lors du lancement du serveur ! Cmd SUCCESS - Feature disabled || §aFontionnalité '${0}' temporairement désactivée jusqu'au prochain rechargement du plugin. -Cmd SUCCESS - WebUser register || §aAjout d'un nouvel utilisateur (${0}) avec succès ! +Cmd SUCCESS - WebUser register || §aAjout d'un nouvel utilisateur (${0}) avec succès ! Vous pouvez afficher le panneau Web dans le lien suivant. Cmd Update - Cancel Success || §aAnnulation de l'opération... Cmd Update - Cancelled || §cMise à jour annulée. Cmd Update - Change log || Changements v${0}: diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt index f3308126b..270ad2cca 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt @@ -47,7 +47,7 @@ Cmd Setup - Unauthorized || §eConnection succeeded, but Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. -Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! You can view the web panel in the following link. Cmd Update - Cancel Success || §aCancel operation performed. Cmd Update - Cancelled || §cUpdate cancelled. Cmd Update - Change log || Change Log v${0}: diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt index 112047d37..4c48d83f6 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt @@ -48,7 +48,7 @@ Cmd Setup - Unauthorized || §e接続は成功しまし Cmd Setup - Url mistake || §cウェブアドレスの入力を確かめて下さい(「http://」もしくは「https://」で始まります )。アドレスについてはBungeeCordの「Plan」を有効化した時のログを確認して下さい。 Cmd Setup - WebServer not Enabled || §cこのBukkit/Spigotサーバーでウェブサーバーは有効になっていません。Bukkit/Spigotサーバー起動時にウェブサーバーが有効になっていることを確認して下さい! Cmd SUCCESS - Feature disabled || §a次にプラグインがリロードされるまで一時的に「${0}」を無効にしました。 -Cmd SUCCESS - WebUser register || §a新規ユーザー「(${0})」の登録に成功しました! +Cmd SUCCESS - WebUser register || §a新規ユーザー「(${0})」の登録に成功しました!次のリンクでWebパネルを見ることができます。 Cmd WARN - Database not open || §eデータベースは${0}です - 予想以上に時間がかかるかもしれません Cmd Web - Permission Levels || >\§70: 全てのページにアクセスできます\§71:「/players」と全てのプレイヤーページにアクセスできます\§72: ウェブユーザーと同じユーザー名でプレイヤーページにアクセスできます\§73+:権限を保持していません Command Help - /plan analyze || サーバーページのURLを表示します