refactor all class to use the message key for sending messages.

This commit is contained in:
DNx5
2015-11-26 10:18:53 +07:00
parent 2de0e0e819
commit 7a78b321e7
31 changed files with 197 additions and 133 deletions
@@ -39,6 +39,10 @@ public enum MessageKey {
REGISTER_EMAIL_MESSAGE("reg_email_msg"),
MAX_REGISTER_EXCEEDED("max_reg"),
USAGE_REGISTER("usage_reg"),
USAGE_UNREGISTER("usage_unreg"),
PASSWORD_CHANGED_SUCCESS("pwd_changed"),
@@ -57,7 +61,7 @@ public enum MessageKey {
ALREADY_LOGGED_IN_ERROR("logged_in"),
LOGOUT_SUCCESS("logout_success"),
LOGOUT_SUCCESS("logout"),
USERNAME_ALREADY_ONLINE_ERROR("same_nick"),
@@ -1,6 +1,7 @@
package fr.xephi.authme.settings;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.util.StringUtils;
import org.bukkit.command.CommandSender;
import java.io.File;
@@ -13,7 +14,7 @@ public class Messages extends CustomConfiguration {
/** The section symbol, used in Minecraft for formatting codes. */
private static final String SECTION_SIGN = "\u00a7";
private static Messages singleton = null;
private static Messages singleton;
private String language = "en";
@@ -26,7 +27,6 @@ public class Messages extends CustomConfiguration {
public Messages(File file, String lang) {
super(file);
load();
singleton = this;
this.language = lang;
}
@@ -70,6 +70,10 @@ public class Messages extends CustomConfiguration {
return retrieve(key.getKey());
}
public String retrieveSingle(MessageKey key) {
return StringUtils.join("\n", retrieve(key.getKey()));
}
/**
* Retrieve the message from the text file and returns it split by new line as an array.
*