Minor refactoring in CustomConfiguration / Messages

- CustomConfiguration should be abstract
- Reduce visibility of internal method
- Fix typo in English messages
- Remove or replace unnecessary javadoc
This commit is contained in:
ljacqu 2015-11-22 02:02:49 +01:00
parent e456203fc6
commit 215fedc585
3 changed files with 8 additions and 34 deletions

View File

@ -15,13 +15,13 @@ import fr.xephi.authme.ConsoleLogger;
/** /**
*/ */
public class CustomConfiguration extends YamlConfiguration { public abstract class CustomConfiguration extends YamlConfiguration {
private File configFile; private File configFile;
/** /**
* Constructor for CustomConfiguration. * Constructor for CustomConfiguration.
* @param file File * @param file the config file
*/ */
public CustomConfiguration(File file) { public CustomConfiguration(File file) {
this.configFile = file; this.configFile = file;
@ -41,10 +41,6 @@ public class CustomConfiguration extends YamlConfiguration {
} }
} }
/**
* Method reLoad.
* @return boolean */
public boolean reLoad() { public boolean reLoad() {
boolean out = true; boolean out = true;
if (!configFile.exists()) { if (!configFile.exists()) {
@ -63,20 +59,11 @@ public class CustomConfiguration extends YamlConfiguration {
} }
} }
/**
* Method getConfigFile.
* @return File */
public File getConfigFile() { public File getConfigFile() {
return configFile; return configFile;
} }
/** private boolean loadResource(File file) {
* Method loadResource.
* @param file File
* @return boolean */
public boolean loadResource(File file) {
if (!file.exists()) { if (!file.exists()) {
try { try {
if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {

View File

@ -15,8 +15,8 @@ public class Messages extends CustomConfiguration {
/** /**
* Constructor for Messages. * Constructor for Messages.
* @param file File * @param file the configuration file
* @param lang String * @param lang the code of the language to use
*/ */
public Messages(File file, String lang) { public Messages(File file, String lang) {
super(file); super(file);
@ -25,14 +25,10 @@ public class Messages extends CustomConfiguration {
this.lang = lang; this.lang = lang;
} }
/**
* Method send.
* @param sender CommandSender
* @param msg String
*/
public void send(CommandSender sender, String msg) { public void send(CommandSender sender, String msg) {
if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) {
singleton.reloadMessages(); singleton.reloadMessages();
}
String loc = (String) singleton.get(msg); String loc = (String) singleton.get(msg);
if (loc == null) { if (loc == null) {
loc = "Error with Translation files, please contact the admin for verify or update translation"; loc = "Error with Translation files, please contact the admin for verify or update translation";
@ -43,11 +39,6 @@ public class Messages extends CustomConfiguration {
} }
} }
/**
* Method send.
* @param msg String
* @return String[] */
public String[] send(String msg) { public String[] send(String msg) {
if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) { if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) {
singleton.reloadMessages(); singleton.reloadMessages();
@ -71,10 +62,6 @@ public class Messages extends CustomConfiguration {
return loc; return loc;
} }
/**
* Method getInstance.
* @return Messages */
public static Messages getInstance() { public static Messages getInstance() {
if (singleton == null) { if (singleton == null) {
singleton = new Messages(Settings.messageFile, Settings.messagesLanguage); singleton = new Messages(Settings.messageFile, Settings.messagesLanguage);

View File

@ -52,7 +52,7 @@ email_added: '&2Email address successfully added to your account!'
email_confirm: '&cPlease confirm your email address!' email_confirm: '&cPlease confirm your email address!'
email_changed: '&2Email address changed correctly!' email_changed: '&2Email address changed correctly!'
email_send: '&2Recovery email sent correctly! Check your email inbox!' email_send: '&2Recovery email sent correctly! Check your email inbox!'
email_exists: '&cA recovery email was already sent! You can discart it and send a new one using the command below:' email_exists: '&cA recovery email was already sent! You can discard it and send a new one using the command below:'
country_banned: '&4Your country is banned from this server!' country_banned: '&4Your country is banned from this server!'
antibot_auto_enabled: '&4[AntiBotService] AntiBot enabled due to the huge number of connections!' antibot_auto_enabled: '&4[AntiBotService] AntiBot enabled due to the huge number of connections!'
antibot_auto_disabled: '&2[AntiBotService] AntiBot disabled disabled after %m minutes!' antibot_auto_disabled: '&2[AntiBotService] AntiBot disabled disabled after %m minutes!'