|
7 | 7 | import java.lang.annotation.RetentionPolicy;
|
8 | 8 | import java.lang.annotation.Target;
|
9 | 9 |
|
| 10 | +/** |
| 11 | + * A modern configuration system to replace the old and obtuse forge config system. |
| 12 | + * |
| 13 | + * Note that just annotating a configuration class with {@link Config} is not enough, you must also register it using |
| 14 | + * {@link com.falsepattern.lib.config.ConfigurationManager#registerConfig}! |
| 15 | + */ |
10 | 16 | @Documented
|
11 | 17 | @Retention(RetentionPolicy.RUNTIME)
|
12 | 18 | @Target(ElementType.TYPE)
|
|
22 | 28 | */
|
23 | 29 | String category() default "general";
|
24 | 30 |
|
| 31 | + /** |
| 32 | + * The lang file key of this configuration. Used in config GUIs. |
| 33 | + */ |
| 34 | + @Documented |
25 | 35 | @Retention(RetentionPolicy.RUNTIME)
|
26 | 36 | @Target({ElementType.FIELD, ElementType.TYPE})
|
27 | 37 | @interface LangKey {
|
28 | 38 | String value();
|
29 | 39 | }
|
30 | 40 |
|
| 41 | + /** |
| 42 | + * The description of the configuration. |
| 43 | + */ |
| 44 | + @Documented |
31 | 45 | @Retention(RetentionPolicy.RUNTIME)
|
32 | 46 | @Target(ElementType.FIELD)
|
33 | 47 | @interface Comment {
|
34 | 48 | String[] value();
|
35 | 49 | }
|
36 | 50 |
|
| 51 | + /** |
| 52 | + * If you have extra fields in the config class used for anything else other than configuring, you must annotate |
| 53 | + * the using this so that the config engine doesn't pick them up. |
| 54 | + */ |
| 55 | + @Documented |
37 | 56 | @Retention(RetentionPolicy.RUNTIME)
|
38 | 57 | @Target(ElementType.FIELD)
|
39 | 58 | @interface Ignore {
|
40 | 59 | }
|
41 | 60 |
|
| 61 | + /** |
| 62 | + * The default value for a boolean field. Not having a default is deprecated since 0.10, and will be strongly |
| 63 | + * enforced in 0.11+! |
| 64 | + */ |
| 65 | + @Documented |
42 | 66 | @Retention(RetentionPolicy.RUNTIME)
|
43 | 67 | @Target(ElementType.FIELD)
|
44 | 68 | @interface DefaultBoolean {
|
45 | 69 | boolean value();
|
46 | 70 | }
|
47 | 71 |
|
| 72 | + /** |
| 73 | + * The range of possible values an int config can have. |
| 74 | + */ |
| 75 | + @Documented |
48 | 76 | @Retention(RetentionPolicy.RUNTIME)
|
49 | 77 | @Target(ElementType.FIELD)
|
50 | 78 | @interface RangeInt {
|
|
53 | 81 | int max() default Integer.MAX_VALUE;
|
54 | 82 | }
|
55 | 83 |
|
| 84 | + /** |
| 85 | + * The default value for an int field. Not having a default is deprecated since 0.10, and will be strongly |
| 86 | + * enforced in 0.11+! |
| 87 | + */ |
| 88 | + @Documented |
56 | 89 | @Retention(RetentionPolicy.RUNTIME)
|
57 | 90 | @Target(ElementType.FIELD)
|
58 | 91 | @interface DefaultInt {
|
59 | 92 | int value();
|
60 | 93 | }
|
61 | 94 |
|
| 95 | + /** |
| 96 | + * The range of possible values a float config can have. |
| 97 | + */ |
| 98 | + @Documented |
62 | 99 | @Retention(RetentionPolicy.RUNTIME)
|
63 | 100 | @Target(ElementType.FIELD)
|
64 | 101 | @interface RangeFloat {
|
|
67 | 104 | float max() default Float.MAX_VALUE;
|
68 | 105 | }
|
69 | 106 |
|
| 107 | + /** |
| 108 | + * The default value for a float field. Not having a default is deprecated since 0.10, and will be strongly |
| 109 | + * enforced in 0.11+! |
| 110 | + */ |
| 111 | + @Documented |
70 | 112 | @Retention(RetentionPolicy.RUNTIME)
|
71 | 113 | @Target(ElementType.FIELD)
|
72 | 114 | @interface DefaultFloat {
|
73 | 115 | float value();
|
74 | 116 | }
|
75 | 117 |
|
| 118 | + /** |
| 119 | + * The default value for a String field. Not having a default is deprecated since 0.10, and will be strongly |
| 120 | + * enforced in 0.11+! |
| 121 | + */ |
| 122 | + @Documented |
76 | 123 | @Retention(RetentionPolicy.RUNTIME)
|
77 | 124 | @Target(ElementType.FIELD)
|
78 | 125 | @interface DefaultString {
|
79 | 126 | String value();
|
80 | 127 | }
|
81 | 128 |
|
| 129 | + /** |
| 130 | + * A regex pattern for restricting the allowed strings. |
| 131 | + */ |
| 132 | + @Documented |
82 | 133 | @Retention(RetentionPolicy.RUNTIME)
|
83 | 134 | @Target(ElementType.FIELD)
|
84 | 135 | @interface Pattern {
|
85 | 136 | String value();
|
86 | 137 | }
|
87 | 138 |
|
| 139 | + /** |
| 140 | + * The default value for an Enum field. Not having a default is deprecated since 0.10, and will be strongly |
| 141 | + * enforced in 0.11+! |
| 142 | + */ |
| 143 | + @Documented |
88 | 144 | @Retention(RetentionPolicy.RUNTIME)
|
89 | 145 | @Target(ElementType.FIELD)
|
90 | 146 | @interface DefaultEnum {
|
91 | 147 | String value();
|
92 | 148 | }
|
93 | 149 |
|
| 150 | + /** |
| 151 | + * The default value for a string array field. Not having a default is deprecated since 0.10, and will be strongly |
| 152 | + * enforced in 0.11+! |
| 153 | + */ |
| 154 | + @Documented |
94 | 155 | @Retention(RetentionPolicy.RUNTIME)
|
95 | 156 | @Target(ElementType.FIELD)
|
96 | 157 | @interface DefaultStringList {
|
97 | 158 | String[] value();
|
98 | 159 | }
|
99 | 160 |
|
| 161 | + /** |
| 162 | + * The name of this config property in the config file. If not specified, the field's name will be used instead. |
| 163 | + */ |
| 164 | + @Documented |
100 | 165 | @Retention(RetentionPolicy.RUNTIME)
|
101 | 166 | @Target(ElementType.FIELD)
|
102 | 167 | @interface Name {
|
103 | 168 | String value();
|
104 | 169 | }
|
105 | 170 |
|
| 171 | + /** |
| 172 | + * Whether the specific configuration needs a minecraft restart to be applied. |
| 173 | + */ |
| 174 | + @Documented |
106 | 175 | @Retention(RetentionPolicy.RUNTIME)
|
107 | 176 | @Target({ElementType.FIELD, ElementType.TYPE})
|
108 | 177 | @interface RequiresMcRestart {
|
109 | 178 | }
|
110 | 179 |
|
| 180 | + /** |
| 181 | + * Whether the specific configuration needs a world/server rejoin to be applied. |
| 182 | + */ |
| 183 | + @Documented |
111 | 184 | @Retention(RetentionPolicy.RUNTIME)
|
112 | 185 | @Target({ElementType.FIELD, ElementType.TYPE})
|
113 | 186 | @interface RequiresWorldRestart {
|
|
0 commit comments