Lortseam 4 năm trước cách đây
mục cha
commit
69c767ed94

+ 5 - 5
lib/src/main/java/me/lortseam/completeconfig/api/ConfigContainer.java

@@ -11,7 +11,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * A container of config entries.
+ * A container for config entries.
  */
  */
 public interface ConfigContainer {
 public interface ConfigContainer {
 
 
@@ -29,9 +29,9 @@ public interface ConfigContainer {
     }
     }
 
 
     /**
     /**
-     * Used to register other containers, located at the level of this container.
+     * Used to register transitive containers, located at the level of this container.
      *
      *
-     * @return an array of other containers
+     * @return an array of containers
      * @see Transitive
      * @see Transitive
      */
      */
     default ConfigContainer[] getTransitives() {
     default ConfigContainer[] getTransitives() {
@@ -39,8 +39,8 @@ public interface ConfigContainer {
     }
     }
 
 
     /**
     /**
-     * Applied to declare that a field or a class of type {@link ConfigContainer} is transitive, which means the object
-     * will be registered at the level of this container.
+     * Applied to declare that a field or a nested class of type {@link ConfigContainer} is transitive. Transitive
+     * containers will be registered at the level of this container.
      *
      *
      * @see #getTransitives()
      * @see #getTransitives()
      */
      */

+ 7 - 0
lib/src/main/java/me/lortseam/completeconfig/api/ConfigEntries.java

@@ -5,6 +5,13 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.annotation.Target;
 
 
+/**
+ * Applied to declare that every field of a class should be resolved as config entry.
+ *
+ * <p>Use {@link ConfigContainer.Ignore} to exclude a field.
+ *
+ * @see ConfigEntry
+ */
 @Target(ElementType.TYPE)
 @Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
 @Retention(RetentionPolicy.RUNTIME)
 public @interface ConfigEntries {
 public @interface ConfigEntries {

+ 11 - 12
lib/src/main/java/me/lortseam/completeconfig/api/ConfigEntry.java

@@ -8,8 +8,7 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.annotation.Target;
 
 
 /**
 /**
- * Applied to declare that a field is an entry inside a config.
- * Also contains various options to modify the entry.
+ * Applied to declare that a field should be resolved as config entry.
  */
  */
 @Target(ElementType.FIELD)
 @Target(ElementType.FIELD)
 @Retention(RetentionPolicy.RUNTIME)
 @Retention(RetentionPolicy.RUNTIME)
@@ -23,7 +22,7 @@ public @interface ConfigEntry {
     String value() default "";
     String value() default "";
 
 
     /**
     /**
-     * Specifies a comment which describes the purpose of this entry. The comment will only be visible in the config
+     * Specifies a comment to describe the purpose of this entry. The comment will only be visible in the config
      * save file.
      * save file.
      *
      *
      * <p>If blank, no comment will be applied to the entry.
      * <p>If blank, no comment will be applied to the entry.
@@ -48,10 +47,10 @@ public @interface ConfigEntry {
     String[] tooltipTranslationKeys() default {};
     String[] tooltipTranslationKeys() default {};
 
 
     /**
     /**
-     * Specifies if the entry's field should get updated while at least one listener exists in the field's class.
+     * Specifies whether the field should always get updated, regardless of the number of listeners.
      *
      *
-     * <p>In that case, by default, the entry's field will not get modified when the config is saved, but all listeners
-     * will be called. Set this to true to always update the field when saving.
+     * <p>If at least one listener exists in the field's class, by default, the field will not get modified when the
+     * config is saved. Instead, all listeners will be called. Set this to true to disable that behaviour.
      *
      *
      * @return true if the field should always get updated, else false
      * @return true if the field should always get updated, else false
      */
      */
@@ -64,6 +63,9 @@ public @interface ConfigEntry {
      */
      */
     boolean requiresRestart() default false;
     boolean requiresRestart() default false;
 
 
+    /**
+     * Applied to an entry of type Boolean.
+     */
     @Target(ElementType.FIELD)
     @Target(ElementType.FIELD)
     @Retention(RetentionPolicy.RUNTIME)
     @Retention(RetentionPolicy.RUNTIME)
     @interface Boolean {
     @interface Boolean {
@@ -181,7 +183,7 @@ public @interface ConfigEntry {
     }
     }
 
 
     /**
     /**
-     * Applied to an entry of type Enum to change the render behaviour.
+     * Applied to an entry of type Enum.
      *
      *
      * <p>This annotation is optional.
      * <p>This annotation is optional.
      */
      */
@@ -192,17 +194,14 @@ public @interface ConfigEntry {
         /**
         /**
          * Specifies how the entry should be rendered.
          * Specifies how the entry should be rendered.
          *
          *
-         * @return the desired {@link me.lortseam.completeconfig.data.EnumEntry.DisplayType}
+         * @return the desired {@link EnumEntry.DisplayType}
          */
          */
         EnumEntry.DisplayType displayType() default EnumEntry.DisplayType.BUTTON;
         EnumEntry.DisplayType displayType() default EnumEntry.DisplayType.BUTTON;
 
 
     }
     }
 
 
     /**
     /**
-     * Specifies that the annotated field is a color entry.
-     *
-     * <p>This annotation is optional for known color types, such as {@link net.minecraft.text.TextColor}, but is
-     * required for unknown types.
+     * Applied to an entry which represents a color.
      */
      */
     @Target(ElementType.FIELD)
     @Target(ElementType.FIELD)
     @Retention(RetentionPolicy.RUNTIME)
     @Retention(RetentionPolicy.RUNTIME)

+ 2 - 3
lib/src/main/java/me/lortseam/completeconfig/api/ConfigEntryListener.java

@@ -6,10 +6,9 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.annotation.Target;
 
 
 /**
 /**
- * Applied to declare that a method listens to a config entry's value updates.
+ * Applied to declare that a method listens to a config entry's value changes.
  *
  *
- * <p>The annotated method requires a parameter of the same type as the entry's field. This parameter contains the
- * updated value which then can be used to modify the field itself.
+ * <p>The annotated method requires a parameter of the same type as the entry's field and a {@code void} return type.
  */
  */
 @Target(ElementType.METHOD)
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)
 @Retention(RetentionPolicy.RUNTIME)

+ 12 - 1
lib/src/main/java/me/lortseam/completeconfig/api/ConfigGroup.java

@@ -3,7 +3,7 @@ package me.lortseam.completeconfig.api;
 import com.google.common.base.CaseFormat;
 import com.google.common.base.CaseFormat;
 
 
 /**
 /**
- * A group of config entries. Inside its parent node, every group is uniquely defined by an identifier.
+ * A group of config entries.
  */
  */
 public interface ConfigGroup extends ConfigContainer {
 public interface ConfigGroup extends ConfigContainer {
 
 
@@ -16,10 +16,21 @@ public interface ConfigGroup extends ConfigContainer {
         return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, getClass().getSimpleName());
         return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, getClass().getSimpleName());
     }
     }
 
 
+    /**
+     * Used to specify one or more custom translation keys for this group's tooltip, declared line by line. If empty,
+     * the default single-line or multi-line keys will be used, depending on which are defined in the language file(s).
+     *
+     * @return an array of custom tooltip translation keys
+     */
     default String[] getTooltipTranslationKeys() {
     default String[] getTooltipTranslationKeys() {
         return null;
         return null;
     }
     }
 
 
+    /**
+     * Used to specify a comment to describe this group. The comment will only be visible in the config save file.
+     *
+     * @return a comment
+     */
     default String getComment() {
     default String getComment() {
         return null;
         return null;
     }
     }