mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-15 21:54:45 +00:00
Deprecate the StableAPI annotations, switch to JB annotations
This commit is contained in:
96 files changed
+1079
-762
No files matched your search
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package com.falsepattern.lib.config;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
@@ -75,7 +74,6 @@ import java.util.function.BiConsumer;
|
||||
* <br>
|
||||
* {@link NoSync} - You MUST add this to fields that you don't want to be synchronized by {@link Synchronize}.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@@ -85,19 +83,21 @@ public @interface Config {
|
||||
* If {@link #customPath()} is not set, this is used for the config file name (.minecraft/config/modid.cfg)
|
||||
* @see #customPath()
|
||||
*/
|
||||
@StableAPI.Expose String modid();
|
||||
String modid();
|
||||
|
||||
/**
|
||||
* Root element category, defaults to "general". MUST NOT be an empty string.
|
||||
*/
|
||||
@StableAPI.Expose String category() default "general";
|
||||
String category() default "general";
|
||||
|
||||
/**
|
||||
* Define category migrations here.
|
||||
* Used to rename config categories without losing data.
|
||||
* @see #pathMigrations()
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@StableAPI.Expose(since = "1.5.0") String[] categoryMigrations() default {};
|
||||
String[] categoryMigrations() default {};
|
||||
|
||||
/**
|
||||
* A custom configuration file path. Relative to the .minecraft/config folder.
|
||||
@@ -110,8 +110,10 @@ public @interface Config {
|
||||
* customPath = "mymod.config" -> .minecraft/config/mymod.config
|
||||
* <br>
|
||||
* @see #modid()
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@StableAPI.Expose(since = "1.5.0") String customPath() default "";
|
||||
String customPath() default "";
|
||||
|
||||
/**
|
||||
* Define file migration paths here.
|
||||
@@ -124,8 +126,10 @@ public @interface Config {
|
||||
* the category of this config.
|
||||
* @see #customPath()
|
||||
* @see #categoryMigrations()
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@StableAPI.Expose(since = "1.5.0") String[] pathMigrations() default {};
|
||||
String[] pathMigrations() default {};
|
||||
|
||||
// region Common
|
||||
|
||||
@@ -133,12 +137,11 @@ public @interface Config {
|
||||
* The description of the configuration or the category. Should be in the primary language of the mod.
|
||||
* @see LangKey
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
@interface Comment {
|
||||
@StableAPI.Expose String[] value();
|
||||
String[] value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,19 +155,17 @@ public @interface Config {
|
||||
* Also applies to categories, where it gets autogenerated from the modid and category (config.MODID.CATEGORY)
|
||||
* @see Comment
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
@interface LangKey {
|
||||
@StableAPI.Expose String value() default "";
|
||||
String value() default "";
|
||||
}
|
||||
|
||||
/**
|
||||
* If you have extra fields in the config class used for anything else other than configuring, you must annotate
|
||||
* the using this so that the config engine doesn't pick them up.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@@ -173,23 +174,23 @@ public @interface Config {
|
||||
/**
|
||||
* The name of this config property in the config file. If not specified, the field's name will be used instead.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface Name {
|
||||
@StableAPI.Expose String value();
|
||||
String value();
|
||||
|
||||
/**
|
||||
* Use this to migrate from old config names. "" is resolved to the name of the field
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@StableAPI.Expose(since = "1.5.0") String[] migrations() default {};
|
||||
String[] migrations() default {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the specific configuration needs a minecraft restart to be applied.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
@@ -198,7 +199,6 @@ public @interface Config {
|
||||
/**
|
||||
* Whether the specific configuration needs a world/server rejoin to be applied.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
@@ -214,8 +214,9 @@ public @interface Config {
|
||||
* <p>
|
||||
* Note that synchronization ALWAYS happens FROM the server TO the client. The server should NEVER attempt to get
|
||||
* configuration values from a client. This is to avoid malicious clients manipulating the server configs.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@@ -223,8 +224,9 @@ public @interface Config {
|
||||
|
||||
/**
|
||||
* Use this to mark config fields you don't want to synchronize in a class marked with {@link Synchronize}.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@@ -238,12 +240,11 @@ public @interface Config {
|
||||
* The default value for a boolean field. Not having a default is deprecated since 0.10, and will be strongly
|
||||
* enforced in 0.11+!
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultBoolean {
|
||||
@StableAPI.Expose boolean value();
|
||||
boolean value();
|
||||
}
|
||||
|
||||
// endregion
|
||||
@@ -254,25 +255,23 @@ public @interface Config {
|
||||
* The default value for an int field.
|
||||
* @see RangeInt
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultInt {
|
||||
@StableAPI.Expose int value();
|
||||
int value();
|
||||
}
|
||||
|
||||
/**
|
||||
* The range of possible values an int config can have.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface RangeInt {
|
||||
@StableAPI.Expose int min() default Integer.MIN_VALUE;
|
||||
int min() default Integer.MIN_VALUE;
|
||||
|
||||
@StableAPI.Expose int max() default Integer.MAX_VALUE;
|
||||
int max() default Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
@@ -282,26 +281,28 @@ public @interface Config {
|
||||
/**
|
||||
* The default value for a double field.
|
||||
* @see RangeDouble
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultDouble {
|
||||
@StableAPI.Expose double value();
|
||||
double value();
|
||||
}
|
||||
|
||||
/**
|
||||
* The range of possible values a double config can have.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface RangeDouble {
|
||||
@StableAPI.Expose double min() default -Double.MAX_VALUE;
|
||||
double min() default -Double.MAX_VALUE;
|
||||
|
||||
@StableAPI.Expose double max() default Double.MAX_VALUE;
|
||||
double max() default Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
@@ -313,37 +314,36 @@ public @interface Config {
|
||||
* @see StringMaxLength
|
||||
* @see Pattern
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultString {
|
||||
@StableAPI.Expose String value();
|
||||
String value();
|
||||
}
|
||||
|
||||
/**
|
||||
* This annotation limits the maximum number of characters present in a string configuration.
|
||||
* <p>
|
||||
* When used with a string list, this limit will apply to each element individually, not to the size of the list as a whole.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface StringMaxLength {
|
||||
@StableAPI.Expose int value();
|
||||
int value();
|
||||
}
|
||||
|
||||
/**
|
||||
* A regex pattern for restricting the allowed strings.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface Pattern {
|
||||
@Language("RegExp")
|
||||
@StableAPI.Expose String value();
|
||||
String value();
|
||||
}
|
||||
|
||||
// endregion
|
||||
@@ -353,12 +353,11 @@ public @interface Config {
|
||||
/**
|
||||
* The default value for an Enum field.
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultEnum {
|
||||
@StableAPI.Expose String value();
|
||||
String value();
|
||||
}
|
||||
|
||||
// endregion
|
||||
@@ -369,13 +368,14 @@ public @interface Config {
|
||||
* The default value for a boolean array field.
|
||||
* @see ListFixedLength
|
||||
* @see ListMaxLength
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultBooleanList {
|
||||
@StableAPI.Expose boolean[] value();
|
||||
boolean[] value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -383,13 +383,14 @@ public @interface Config {
|
||||
* @see ListFixedLength
|
||||
* @see ListMaxLength
|
||||
* @see RangeInt
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultIntList {
|
||||
@StableAPI.Expose int[] value();
|
||||
int[] value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -397,13 +398,14 @@ public @interface Config {
|
||||
* @see ListFixedLength
|
||||
* @see ListMaxLength
|
||||
* @see RangeDouble
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultDoubleList {
|
||||
@StableAPI.Expose double[] value();
|
||||
double[] value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,20 +415,20 @@ public @interface Config {
|
||||
* @see StringMaxLength
|
||||
* @see Pattern
|
||||
*/
|
||||
@StableAPI(since = "0.6.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface DefaultStringList {
|
||||
@StableAPI.Expose String[] value();
|
||||
String[] value();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this annotation is present, the list in the config will be forced to have exactly the amount of elements as
|
||||
* the default value.
|
||||
* @see ListMaxLength
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@@ -435,13 +437,14 @@ public @interface Config {
|
||||
/**
|
||||
* This annotation limits the maximum number of elements present in an array configuration. Only effective if
|
||||
* {@link ListFixedLength} is NOT present.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@StableAPI(since = "0.10.0")
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@interface ListMaxLength {
|
||||
@StableAPI.Expose int value();
|
||||
int value();
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
Reference in new issue
Block a user