diff --git a/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java b/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java index d1b9d35f..db4df769 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java +++ b/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java @@ -11,6 +11,7 @@ import java.util.List; *
* Contains all methods that must exist in yaml and json configurations.
*/
+@SuppressWarnings("unused")
public interface Config extends Cloneable {
/**
* Clears cache.
@@ -159,8 +160,34 @@ public interface Config extends Cloneable {
@Nullable
List
+ * Formatted by default.
*
* @param path The key to fetch the value from.
* @return The found value, or an empty string if not found.
@@ -176,8 +203,8 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
* @return The found value, or an empty string if not found.
+ * @apiNote This will be deprecated when {@link Config#getString(String)} no longer formats by default.
*/
- @NotNull
default String getString(@NotNull String path,
boolean format) {
return this.getString(path, format, StringUtils.FormatOption.WITH_PLACEHOLDERS);
@@ -189,8 +216,10 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or an empty string if not found.
+ * @deprecated Use {@link Config#getFormattedString(String, StringUtils.FormatOption)} instead.
*/
@NotNull
+ @Deprecated
default String getString(@NotNull String path,
@NotNull final StringUtils.FormatOption option) {
return this.getString(path, true, option);
@@ -209,8 +238,34 @@ public interface Config extends Cloneable {
boolean format,
@NotNull StringUtils.FormatOption option);
+ /**
+ * Get a formatted string from config.
+ *
+ * @param path The key to fetch the value from.
+ * @return The found value, or an empty string if not found.
+ */
+ @Nullable
+ default String getFormattedStringOrNull(@NotNull String path) {
+ return getStringOrNull(path, true);
+ }
+
+ /**
+ * Get a formatted string from config.
+ *
+ * @param path The key to fetch the value from.
+ * @param option The format option.
+ * @return The found value, or an empty string if not found.
+ */
+ @Nullable
+ default String getFormattedStringOrNull(@NotNull String path,
+ @NotNull StringUtils.FormatOption option) {
+ return getStringOrNull(path, true, option);
+ }
+
/**
* Get a string from config.
+ *
+ * Formatted by default.
*
* @param path The key to fetch the value from.
* @return The found value, or null if not found.
@@ -226,6 +281,7 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
* @return The found value, or null if not found.
+ * @apiNote This will be deprecated when {@link Config#getStringOrNull(String)} no longer formats by default.
*/
@Nullable
default String getStringOrNull(@NotNull String path,
@@ -239,8 +295,10 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or null if not found.
+ * @deprecated Use {@link Config#getFormattedString(String, StringUtils.FormatOption)} instead.
*/
@Nullable
+ @Deprecated
default String getStringOrNull(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return this.getStringOrNull(path, true, option);
@@ -251,7 +309,7 @@ public interface Config extends Cloneable {
*
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
- * @param option The format option.
+ * @param option The format option. If format is false, this will be ignored.
* @return The found value, or null if not found.
*/
@Nullable
@@ -268,6 +326,35 @@ public interface Config extends Cloneable {
* @return The found value, or a blank {@link java.util.ArrayList} if not found.
*/
@NotNull
+ default List
+ * Formatted by default.
+ *
+ * @param path The key to fetch the value from.
+ * @param option The format option.
+ * @return The found value, or a blank {@link java.util.ArrayList} if not found.
+ */
+ @NotNull
+ default List
+ * Formatted by default.
+ *
+ * @param path The key to fetch the value from.
+ * @return The found value, or a blank {@link java.util.ArrayList} if not found.
+ * @apiNote This will be changed in newer versions to not format by default.
+ */
+ @NotNull
default List
+ * Formatted by default.
*
* @param path The key to fetch the value from.
* @return The found value, or null if not found.
*/
@Nullable
+ default List
+ * Formatted by default.
+ *
+ * @param path The key to fetch the value from.
+ * @param option The format option.
+ * @return The found value, or null if not found.
+ */
+ @Nullable
+ default List
+ * Formatted by default.
+ *
+ * @param path The key to fetch the value from.
+ * @return The found value, or null if not found.
+ * @apiNote This will be changed in newer versions to not format by default.
+ */
+ @Nullable
default List