Skip to content

Commit

Permalink
Add send messages when joining a server
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamesuta committed Feb 7, 2024
1 parent 9a094ab commit bb85501
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ public static void sendPowerSignal(CommandSender sender, String serverName, Stri
// Move player to the started server
ProxiedPlayer player = (ProxiedPlayer) sender;
if (plugin.config.joinDelay > 0) {
// Delay the join
plugin.getProxy().getScheduler().schedule(plugin, () -> player.connect(serverInfo), plugin.config.joinDelay, TimeUnit.SECONDS);
// Send a message
player.sendMessage(plugin.messages.success("server_startup_join_move_delayed", serverName, plugin.config.joinDelay));
} else {
// Join immediately
player.connect(serverInfo);
// Send a message
player.sendMessage(plugin.messages.success("server_startup_join_move", serverName));
}
}).exceptionally((Throwable e) -> {
sender.sendMessage(plugin.messages.warning("server_startup_join_failed", serverName));
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/messages_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ server_start_failed: "Failed to start server %s"
server_start_warning: "If the server %s is left unattended without any players joining, it will be stopped again in %s seconds to reduce server resources."
server_startup_join: "Starting the suspended server %s... Please wait you will be connected after it start."
server_startup_join_failed: "We could not connect you automatically to the server %s."
server_startup_join_move: "Server '%s' has started. Connecting..."
server_startup_join_move_delayed: "Server '%s' has started. Connecting in %d seconds..."
server_stop: "Stopping server %s..."
server_stop_failed: "Failed to stop server %s"
server_stop_warning: "You are the last player on server %s. The server will be stopped in %s seconds to reduce server resources."
2 changes: 2 additions & 0 deletions src/main/resources/messages_fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ server_start_failed: "Échec du démarrage du serveur %s"
server_start_warning: "Si le serveur %s est laissé sans surveillance sans qu'aucun joueur ne le rejoigne, il sera à nouveau arrêté dans %s secondes pour réduire les ressources du serveur."
server_startup_join: "Démarrage du serveur suspendu %s... Veuillez patienter jusqu'à ce que vous soyez connecté après le démarrage."
server_startup_join_failed: "Nous n'avons pas pu vous connecter au serveur %s."
server_startup_join_move: "Le serveur '%s' a démarré. Connexion en cours..."
server_startup_join_move_delayed: "Le serveur '%s' a démarré. Connexion dans %d secondes..."
server_stop: "Arrêt du serveur %s..."
server_stop_failed: "Échec de l'arrêt du serveur %s"
server_stop_warning: "Vous êtes le dernier joueur sur le serveur %s. Le serveur sera arrêté dans %s secondes pour réduire les ressources du serveur."
6 changes: 4 additions & 2 deletions src/main/resources/messages_ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ command_server_not_configured: "サーバー「%s」は設定されていませ
server_start: "休止中のサーバー「%s」を起動中... しばらく待ってから入り直してください。"
server_start_failed: "サーバー「%s」の起動に失敗しました"
server_start_warning: "なお、起動したサーバー「%s」にプレイヤーが入らないまま放置されますと、サーバーリソース削減のため%s秒後に再度停止されますのでご注意ください。"
server_startup_join: "休止中のサーバー 「%s」を開始しています... 起動後に接続されるのでお待ちください。"
server_startup_join_failed: "サーバー 「%s」 に自動的に接続できませんでした。"
server_startup_join: "休止中のサーバー「%s」を開始しています... 起動後に接続されるのでお待ちください。"
server_startup_join_failed: "サーバー「%s」に自動的に接続できませんでした。"
server_startup_join_move: "サーバー「%s」が起動しました。接続しています..."
server_startup_join_move_delayed: "サーバー「%s」が起動しました。%d秒後に接続します..."
server_stop: "サーバー「%s」を停止中..."
server_stop_failed: "サーバー「%s」の停止に失敗しました"
server_stop_warning: "あなたはサーバー「%s」の最後のプレイヤーです。サーバーリソース削減のため、%s秒後にサーバーを停止します。"
2 changes: 2 additions & 0 deletions src/main/resources/messages_ro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ server_start_failed: "Nu s-a reușit pornirea serverului %s"
server_start_warning: "Dacă serverul %s este lăsat nesupravegheat fără niciun jucător care să se alăture, acesta va fi oprit din nou în %s secunde pentru a reduce resursele serverului."
server_startup_join: "Se pornește serverul suspendat '%s'... Vă rugăm să așteptați, deoarece veți fi conectat după pornire."
server_startup_join_warning: "Nu s-a putut conecta automat la serverul '%s'."
server_startup_join_move: "Serverul '%s' a pornit. Se conectează..."
server_startup_join_move_delayed: "Serverul '%s' a pornit. Se conectează în %d secunde..."
server_stop: "Se oprește serverul %s..."
server_stop_failed: "Nu s-a reușit oprirea serverului %s"
server_stop_warning: "Ești ultimul jucător pe serverul %s. Serverul va fi oprit în %s secunde pentru a reduce resursele."

0 comments on commit bb85501

Please sign in to comment.