From 408abebbfa5a68da2db48921cbd98fd06d8b84d1 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 8 Jun 2017 14:01:23 +0200 Subject: [PATCH] Added header and footer to help message (translatable) + Fixed translations with one or more equal signs in its value --- .../java/de/epiceric/shopchest/command/ShopCommand.java | 8 ++++++++ .../epiceric/shopchest/config/LanguageConfiguration.java | 3 +++ .../de/epiceric/shopchest/language/LanguageUtils.java | 2 ++ .../de/epiceric/shopchest/language/LocalizedMessage.java | 2 ++ src/main/resources/lang/de_DE.lang | 2 ++ src/main/resources/lang/en_US.lang | 8 ++++++++ 6 files changed, 25 insertions(+) diff --git a/src/main/java/de/epiceric/shopchest/command/ShopCommand.java b/src/main/java/de/epiceric/shopchest/command/ShopCommand.java index 5cc0459..491cf1a 100644 --- a/src/main/java/de/epiceric/shopchest/command/ShopCommand.java +++ b/src/main/java/de/epiceric/shopchest/command/ShopCommand.java @@ -214,6 +214,10 @@ public class ShopCommand { plugin.debug("Sending basic help message to " + sender.getName()); sender.sendMessage(" "); + String header = LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_HEADER, + new LocalizedMessage.ReplacedPlaceholder(Placeholder.COMMAND, plugin.getShopChestConfig().main_command_name)); + + if (!header.trim().isEmpty()) sender.sendMessage(header); for (ShopSubCommand subCommand : subCommands) { String msg = subCommand.getHelpMessage(sender); @@ -224,6 +228,10 @@ public class ShopCommand { sender.sendMessage(msg); } + String footer = LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_FOOTER, + new LocalizedMessage.ReplacedPlaceholder(Placeholder.COMMAND, plugin.getShopChestConfig().main_command_name)); + + if (!footer.trim().isEmpty()) sender.sendMessage(footer); sender.sendMessage(" "); } diff --git a/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java b/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java index 156a9b9..f6cce8b 100644 --- a/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java +++ b/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java @@ -83,6 +83,9 @@ public class LanguageConfiguration extends FileConfiguration { StringBuilder sbValue = new StringBuilder(); for (int i = 1; i < line.split("=").length; i++) { + if (i > 1) { + sbValue.append("="); + } sbValue.append(line.split("=")[i]); } diff --git a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java index 15af3f8..eda0bef 100644 --- a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java +++ b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java @@ -1077,6 +1077,8 @@ public class LanguageUtils { messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_CONFIG, langConfig.getString("message.noPermission.config", "&cYou don't have permission to change configuration values."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_EXTEND_OTHERS, langConfig.getString("message.noPermission.extend-others", "&cYou don't have permission to extend this chest."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_EXTEND_PROTECTED, langConfig.getString("message.noPermission.extend-protected", "&cYou don't have permission to extend this chest to here."))); + messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_HEADER, langConfig.getString("message.commandDescription.header", "&6==== &c/%COMMAND% &6Help"))); + messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_FOOTER, langConfig.getString("message.commandDescription.footer", "&6==== End"))); messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE, langConfig.getString("message.commandDescription.create", "&a/%COMMAND% create - Create a shop."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE_ADMIN, langConfig.getString("message.commandDescription.create-admin", "&a/%COMMAND% create [normal|admin] - Create a shop."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_REMOVE, langConfig.getString("message.commandDescription.remove", "&a/%COMMAND% remove - Remove a shop."))); diff --git a/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java b/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java index 39beef9..074d9bc 100644 --- a/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java +++ b/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java @@ -108,6 +108,8 @@ public class LocalizedMessage { NO_PERMISSION_CONFIG, NO_PERMISSION_EXTEND_OTHERS, NO_PERMISSION_EXTEND_PROTECTED, + COMMAND_DESC_HEADER, + COMMAND_DESC_FOOTER, COMMAND_DESC_CREATE, COMMAND_DESC_CREATE_ADMIN, COMMAND_DESC_REMOVE, diff --git a/src/main/resources/lang/de_DE.lang b/src/main/resources/lang/de_DE.lang index 72789ed..b754918 100644 --- a/src/main/resources/lang/de_DE.lang +++ b/src/main/resources/lang/de_DE.lang @@ -78,6 +78,8 @@ message.noPermission.update=&cDu hast keine Berechtigung nach Aktualisierungen z message.noPermission.config=&cDu hast keine Berechtigung Konfigurationswerte zu verändern. message.noPermission.extend-others=&cDu hast keine Berechtigung diesen Shop zu erweitern. message.noPermission.extend-protected=&cDu hast keine Berechtigung diesen Shop nach hier zu erweitern. +message.commandDescription.header=&6==== &c/%COMMAND% &6Hilfe +message.commandDescription.footer=&6==== Ende message.commandDescription.create=&a/%COMMAND% create - Erstelle einen Shop. message.commandDescription.create-admin=&a/%COMMAND% create [normal|admin] - Erstelle einen Shop. message.commandDescription.remove=&a/%COMMAND% remove - Entferne einen Shop. diff --git a/src/main/resources/lang/en_US.lang b/src/main/resources/lang/en_US.lang index 053e461..db1f652 100644 --- a/src/main/resources/lang/en_US.lang +++ b/src/main/resources/lang/en_US.lang @@ -272,6 +272,14 @@ message.noPermission.extend-others=&cYou don't have permission to extend this ch # Set the message when a not permitted player tries to extend a chest into a protected region/plot (e.g. WorldGuard/Towny). message.noPermission.extend-protected=&cYou don't have permission to extend this chest to here. +# Set the header of the help message the player gets after entering '/shop' or an invalid command. +# Usable Placeholders: %COMMAND% +message.commandDescription.header=&6==== &c/%COMMAND% &6Help + +# Set the footer of the help message the player gets after entering '/shop' or an invalid command. +# Usable Placeholders: %COMMAND% +message.commandDescription.footer=&6==== End + # Set the command description message for '/shop create' when you type '/shop'. # Usable Placeholders: %COMMAND% message.commandDescription.create=&a/%COMMAND% create - Create a shop.