#450 Make reload & messages functionality use NewSetting

- Change ReloadCommand to use the new setting functionality
- Check and construct the messages file in NewSetting
- Unrelated: change MessagesManager not to extend CustomConfiguration anymore
This commit is contained in:
ljacqu
2016-01-31 09:55:02 +01:00
parent 059175f14e
commit e747dfeb7f
11 changed files with 185 additions and 123 deletions
@@ -4,6 +4,7 @@ import net.ricecode.similarity.LevenshteinDistanceStrategy;
import net.ricecode.similarity.StringSimilarityService;
import net.ricecode.similarity.StringSimilarityServiceImpl;
import java.io.File;
import java.util.Arrays;
/**
@@ -37,12 +38,12 @@ public final class StringUtils {
}
/**
* Returns whether the given string contains any of the provided elements.
* Return whether the given string contains any of the provided elements.
*
* @param str the string to analyze
* @param pieces the items to check the string for
* @param str The string to analyze
* @param pieces The items to check the string for
*
* @return true if the string contains at least one of the items
* @return True if the string contains at least one of the items
*/
public static boolean containsAny(String str, String... pieces) {
if (str == null) {
@@ -60,21 +61,21 @@ public final class StringUtils {
* Null-safe method for checking whether a string is empty. Note that the string
* is trimmed, so this method also considers a string with whitespace as empty.
*
* @param str the string to verify
* @param str The string to verify
*
* @return true if the string is empty, false otherwise
* @return True if the string is empty, false otherwise
*/
public static boolean isEmpty(String str) {
return str == null || str.trim().isEmpty();
}
/**
* Joins a list of elements into a single string with the specified delimiter.
* Join a list of elements into a single string with the specified delimiter.
*
* @param delimiter the delimiter to use
* @param elements the elements to join
* @param delimiter The delimiter to use
* @param elements The elements to join
*
* @return a new String that is composed of the elements separated by the delimiter
* @return A new String that is composed of the elements separated by the delimiter
*/
public static String join(String delimiter, Iterable<String> elements) {
if (delimiter == null) {
@@ -95,12 +96,12 @@ public final class StringUtils {
}
/**
* Joins a list of elements into a single string with the specified delimiter.
* Join a list of elements into a single string with the specified delimiter.
*
* @param delimiter the delimiter to use
* @param elements the elements to join
* @param delimiter The delimiter to use
* @param elements The elements to join
*
* @return a new String that is composed of the elements separated by the delimiter
* @return A new String that is composed of the elements separated by the delimiter
*/
public static String join(String delimiter, String... elements) {
return join(delimiter, Arrays.asList(elements));
@@ -117,4 +118,15 @@ public final class StringUtils {
return "[" + th.getClass().getSimpleName() + "]: " + th.getMessage();
}
/**
* Construct a file path from the given elements, i.e. separate the given elements by the file separator.
*
* @param elements The elements to create a path with
*
* @return The created path
*/
public static String makePath(String... elements) {
return join(File.separator, elements);
}
}