Skip to content

Commit

Permalink
Improved help pages
Browse files Browse the repository at this point in the history
 - Space separator if the sender is a player;
 - added title to locate the beginning of the help;
 - fixed some forgotten arguments with spaces.
  • Loading branch information
AmauryCarrade committed Aug 18, 2014
1 parent e2bf107 commit bd1f4e0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/main/java/me/azenet/UHPlugin/UHPluginCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
* @param error True if the help is printed because the user typed an unknown command.
*/
private void help(CommandSender sender, boolean error) {
if(sender instanceof Player) sender.sendMessage("");
sender.sendMessage(i.t("cmd.titleHelp", p.getDescription().getDescription(), p.getDescription().getVersion()));

if(error) {
Expand Down Expand Up @@ -322,6 +323,9 @@ else if(args.length == 2) { // Two coordinates needed!
@SuppressWarnings("unused")
private void doTeam(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 1) { // No action provided: doc
if(sender instanceof Player) sender.sendMessage("");
sender.sendMessage(i.t("cmd.titleHelp", p.getDescription().getDescription(), p.getDescription().getVersion()));

sender.sendMessage(i.t("cmd.teamHelpAvailable"));
sender.sendMessage(i.t("cmd.teamHelpAdd"));
sender.sendMessage(i.t("cmd.teamHelpAddName"));
Expand Down Expand Up @@ -680,6 +684,9 @@ else if(UHUtils.safeTP(player, deathLocation)) {
@SuppressWarnings("unused")
private void doSpec(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 1) { // /uh spec
if(sender instanceof Player) sender.sendMessage("");
sender.sendMessage(i.t("cmd.titleHelp", p.getDescription().getDescription(), p.getDescription().getVersion()));

sender.sendMessage(i.t("cmd.specHelpAvailable"));
if(!p.getSpectatorPlusIntegration().isSPIntegrationEnabled()) {
sender.sendMessage(i.t("cmd.specHelpNoticeSpectatorPlusNotInstalled"));
Expand Down Expand Up @@ -752,6 +759,9 @@ else if(subcommand.equalsIgnoreCase("list")) {
@SuppressWarnings("unused")
private void doBorder(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 1) { // /uh border
if(sender instanceof Player) sender.sendMessage("");
sender.sendMessage(i.t("cmd.titleHelp", p.getDescription().getDescription(), p.getDescription().getVersion()));

sender.sendMessage(i.t("cmd.borderHelpAvailable"));
sender.sendMessage(i.t("cmd.borderHelpCurrent"));
sender.sendMessage(i.t("cmd.borderHelpSet"));
Expand Down Expand Up @@ -919,6 +929,9 @@ private void doTeamMessage(CommandSender sender, Command command, String label,
@SuppressWarnings("unused")
private void doFreeze(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 1) { // /uh freeze
if(sender instanceof Player) sender.sendMessage("");
sender.sendMessage(i.t("cmd.titleHelp", p.getDescription().getDescription(), p.getDescription().getVersion()));

sender.sendMessage(i.t("cmd.freezeHelpOn"));
sender.sendMessage(i.t("cmd.freezeHelpOff"));
sender.sendMessage(i.t("cmd.freezeHelpAll"));
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/i18n/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ keys:

teamHelpAvailable: "{ci}Available options are listed below."
teamHelpAdd: "{cc}/uh team add <color> {ci}: adds a team with the provided color."
teamHelpAddName: "{cc}/uh team add <color> <name> {ci}: adds a named team with the provided name and color."
teamHelpRemove: "{cc}/uh team remove <name> {ci}: removes a team"
teamHelpAddName: "{cc}/uh team add <color> <name ...> {ci}: adds a named team with the provided name and color."
teamHelpRemove: "{cc}/uh team remove <name ...> {ci}: removes a team"
teamHelpAddplayer: "{cc}/uh team addplayer <player> <teamName ...>{ci}: adds a player inside the given team. The name of the team is it color, or the explicit name given."
teamHelpRemoveplayer: "{cc}/uh team removeplayer <player> {ci}: removes a player from his team."
teamHelpList: "{cc}/uh team list {ci}: list the teams and their players."
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/i18n/fr_FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ keys:

teamHelpAvailable: "{ci}Les options disponibles sont listées ci-dessous."
teamHelpAdd: "{cc}/uh team add <couleur> {ci}: ajoute une équipe de la couleur donnée."
teamHelpAddName: "{cc}/uh team add <couleur> <nom> {ci}: ajoute une équipe avec le nom et la couleur donnés."
teamHelpRemove: "{cc}/uh team remove <nomÉquipe> {ci}: supprime une équipe."
teamHelpAddName: "{cc}/uh team add <couleur> <nom ...> {ci}: ajoute une équipe avec le nom et la couleur donnés."
teamHelpRemove: "{cc}/uh team remove <nom ...> {ci}: supprime une équipe."
teamHelpAddplayer: "{cc}/uh team addplayer <joueur> <nomÉquipe ...> {ci}: ajoute un joueur dans l'équipe donnée. Le nom de l'équipe est sa couleur, ou le nom explicite donné."
teamHelpRemoveplayer: "{cc}/uh team removeplayer <joueur> {ci}: retire un joueur de son équipe."
teamHelpList: "{cc}/uh team list {ci}: liste toutes les équipes et leurs membres."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/i18n/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.9 §cdev§r
version: 1.0
languages:
- en_US
- fr_FR
Expand Down

0 comments on commit bd1f4e0

Please sign in to comment.