Skip to content

Commit de6a7e5

Browse files
committed
code cleanup
1 parent c440524 commit de6a7e5

22 files changed

+86
-108
lines changed

src/main/java/com/falsepattern/lib/DeprecationDetails.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212
@Retention(RetentionPolicy.RUNTIME)
1313
@StableAPI(since = "0.10.0")
1414
public @interface DeprecationDetails {
15-
@StableAPI.Expose
16-
String deprecatedSince();
15+
@StableAPI.Expose String deprecatedSince();
1716
}

src/main/java/com/falsepattern/lib/StableAPI.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@
5555
/**
5656
* The version this API was introduced/stabilized in. Used for library version tracking.
5757
*/
58-
@StableAPI.Expose
59-
String since();
58+
@StableAPI.Expose String since();
6059

6160
/**
6261
* You may use this annotation if you want a member to have an equal effective {@link #since()} value as its owner
@@ -73,8 +72,7 @@
7372
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
7473
@StableAPI(since = "0.10.0")
7574
@interface Expose {
76-
@StableAPI.Expose
77-
String since() default "__PARENT__";
75+
@StableAPI.Expose String since() default "__PARENT__";
7876
}
7977

8078
/**
@@ -87,5 +85,6 @@
8785
@Retention(RetentionPolicy.RUNTIME)
8886
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
8987
@StableAPI(since = "0.10.0")
90-
@interface Internal {}
88+
@interface Internal {
89+
}
9190
}

src/main/java/com/falsepattern/lib/compat/BlockPos.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ public static BlockPos fromLong(long serialized) {
105105
* In situations where it is usable, prefer
106106
* {@link #getAllInBoxMutable(BlockPos, BlockPos) instead as it has better performance (fewer allocations)
107107
* <p>
108+
*
108109
* @param from One corner of the box
109110
* @param to Another corner of the box
110-
* <p>
111+
* <p>
112+
*
111113
* @see #getAllInBox(int, int, int, int, int, int)
112114
* @see #getAllInBoxMutable(BlockPos, BlockPos)
113115
*/
@@ -125,13 +127,15 @@ public static Iterable<BlockPos> getAllInBox(@NonNull BlockPos from, @NonNull Bl
125127
* In situations where it is usable, prefer
126128
* {@link #getAllInBoxMutable(BlockPos, BlockPos) instead as it has better performance (fewer allocations)
127129
* <p>
130+
*
128131
* @param x0 The lower x coordinate
129132
* @param y0 The lower y coordinate
130133
* @param z0 The lower z coordinate
131134
* @param x1 The upper x coordinate
132135
* @param y1 The upper y coordinate
133136
* @param z1 The upper z coordinate
134-
* <p>
137+
* <p>
138+
*
135139
* @see #getAllInBox(BlockPos, BlockPos)
136140
* @see #getAllInBoxMutable(BlockPos, BlockPos)
137141
*/
@@ -440,6 +444,7 @@ public BlockPos rotate(@NonNull Rotation rotation) {
440444
return super.rotate(rotation).toImmutable();
441445
}
442446

447+
@Override
443448
@StableAPI.Expose
444449
public BlockPos toImmutable() {
445450
return new BlockPos(this);

src/main/java/com/falsepattern/lib/compat/Rotation.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@
2828

2929
@StableAPI(since = "0.6.0")
3030
public enum Rotation {
31-
@StableAPI.Expose
32-
NONE,
33-
@StableAPI.Expose
34-
CLOCKWISE_90,
35-
@StableAPI.Expose
36-
CLOCKWISE_180,
37-
@StableAPI.Expose
38-
COUNTERCLOCKWISE_90;
31+
@StableAPI.Expose NONE,
32+
@StableAPI.Expose CLOCKWISE_90,
33+
@StableAPI.Expose CLOCKWISE_180,
34+
@StableAPI.Expose COUNTERCLOCKWISE_90;
3935

4036
@StableAPI.Expose
4137
public Rotation add(@NonNull Rotation rotation) {

src/main/java/com/falsepattern/lib/config/Config.java

Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@
4444
/**
4545
* The mod id that this configuration is associated with.
4646
*/
47-
@StableAPI.Expose
48-
String modid();
47+
@StableAPI.Expose String modid();
4948

5049
/**
5150
* Root element category, defaults to "general". You must not specify an empty string.
5251
*/
53-
@StableAPI.Expose
54-
String category() default "general";
52+
@StableAPI.Expose String category() default "general";
5553

5654
/**
5755
* The lang file key of this configuration. Used in config GUIs.
@@ -61,8 +59,7 @@
6159
@Retention(RetentionPolicy.RUNTIME)
6260
@Target({ElementType.FIELD, ElementType.TYPE})
6361
@interface LangKey {
64-
@StableAPI.Expose
65-
String value();
62+
@StableAPI.Expose String value();
6663
}
6764

6865
/**
@@ -73,8 +70,7 @@
7370
@Retention(RetentionPolicy.RUNTIME)
7471
@Target(ElementType.FIELD)
7572
@interface Comment {
76-
@StableAPI.Expose
77-
String[] value();
73+
@StableAPI.Expose String[] value();
7874
}
7975

8076
/**
@@ -97,8 +93,7 @@
9793
@Retention(RetentionPolicy.RUNTIME)
9894
@Target(ElementType.FIELD)
9995
@interface DefaultBoolean {
100-
@StableAPI.Expose
101-
boolean value();
96+
@StableAPI.Expose boolean value();
10297
}
10398

10499
/**
@@ -109,10 +104,9 @@
109104
@Retention(RetentionPolicy.RUNTIME)
110105
@Target(ElementType.FIELD)
111106
@interface RangeInt {
112-
@StableAPI.Expose
113-
int min() default Integer.MIN_VALUE;
114-
@StableAPI.Expose
115-
int max() default Integer.MAX_VALUE;
107+
@StableAPI.Expose int min() default Integer.MIN_VALUE;
108+
109+
@StableAPI.Expose int max() default Integer.MAX_VALUE;
116110
}
117111

118112
/**
@@ -124,8 +118,7 @@
124118
@Retention(RetentionPolicy.RUNTIME)
125119
@Target(ElementType.FIELD)
126120
@interface DefaultInt {
127-
@StableAPI.Expose
128-
int value();
121+
@StableAPI.Expose int value();
129122
}
130123

131124
/**
@@ -139,10 +132,9 @@
139132
@Target(ElementType.FIELD)
140133
@StableAPI(since = "0.6.0")
141134
@interface RangeFloat {
142-
@StableAPI.Expose
143-
float min() default -Float.MAX_VALUE;
144-
@StableAPI.Expose
145-
float max() default Float.MAX_VALUE;
135+
@StableAPI.Expose float min() default -Float.MAX_VALUE;
136+
137+
@StableAPI.Expose float max() default Float.MAX_VALUE;
146138
}
147139

148140
/**
@@ -157,8 +149,7 @@
157149
@Target(ElementType.FIELD)
158150
@StableAPI(since = "0.6.0")
159151
@interface DefaultFloat {
160-
@StableAPI.Expose
161-
float value();
152+
@StableAPI.Expose float value();
162153
}
163154

164155
/**
@@ -169,10 +160,9 @@
169160
@Retention(RetentionPolicy.RUNTIME)
170161
@Target(ElementType.FIELD)
171162
@interface RangeDouble {
172-
@StableAPI.Expose
173-
double min() default -Double.MAX_VALUE;
174-
@StableAPI.Expose
175-
double max() default Double.MAX_VALUE;
163+
@StableAPI.Expose double min() default -Double.MAX_VALUE;
164+
165+
@StableAPI.Expose double max() default Double.MAX_VALUE;
176166
}
177167

178168
/**
@@ -184,8 +174,7 @@
184174
@Retention(RetentionPolicy.RUNTIME)
185175
@Target(ElementType.FIELD)
186176
@interface DefaultDouble {
187-
@StableAPI.Expose
188-
double value();
177+
@StableAPI.Expose double value();
189178
}
190179

191180
/**
@@ -197,8 +186,7 @@
197186
@Retention(RetentionPolicy.RUNTIME)
198187
@Target(ElementType.FIELD)
199188
@interface DefaultString {
200-
@StableAPI.Expose
201-
String value();
189+
@StableAPI.Expose String value();
202190
}
203191

204192

@@ -215,8 +203,7 @@
215203
@Retention(RetentionPolicy.RUNTIME)
216204
@Target(ElementType.FIELD)
217205
@interface StringMaxLength {
218-
@StableAPI.Expose
219-
int value();
206+
@StableAPI.Expose int value();
220207
}
221208

222209
/**
@@ -227,8 +214,7 @@
227214
@Retention(RetentionPolicy.RUNTIME)
228215
@Target(ElementType.FIELD)
229216
@interface Pattern {
230-
@StableAPI.Expose
231-
String value();
217+
@StableAPI.Expose String value();
232218
}
233219

234220
/**
@@ -240,8 +226,7 @@
240226
@Retention(RetentionPolicy.RUNTIME)
241227
@Target(ElementType.FIELD)
242228
@interface DefaultEnum {
243-
@StableAPI.Expose
244-
String value();
229+
@StableAPI.Expose String value();
245230
}
246231

247232
/**
@@ -253,8 +238,7 @@
253238
@Retention(RetentionPolicy.RUNTIME)
254239
@Target(ElementType.FIELD)
255240
@interface DefaultStringList {
256-
@StableAPI.Expose
257-
String[] value();
241+
@StableAPI.Expose String[] value();
258242
}
259243

260244
/**
@@ -266,8 +250,7 @@
266250
@Retention(RetentionPolicy.RUNTIME)
267251
@Target(ElementType.FIELD)
268252
@interface DefaultDoubleList {
269-
@StableAPI.Expose
270-
double[] value();
253+
@StableAPI.Expose double[] value();
271254
}
272255

273256
/**
@@ -279,8 +262,7 @@
279262
@Retention(RetentionPolicy.RUNTIME)
280263
@Target(ElementType.FIELD)
281264
@interface DefaultIntList {
282-
@StableAPI.Expose
283-
int[] value();
265+
@StableAPI.Expose int[] value();
284266
}
285267

286268
/**
@@ -292,8 +274,7 @@
292274
@Retention(RetentionPolicy.RUNTIME)
293275
@Target(ElementType.FIELD)
294276
@interface DefaultBooleanList {
295-
@StableAPI.Expose
296-
boolean[] value();
277+
@StableAPI.Expose boolean[] value();
297278
}
298279

299280
/**
@@ -319,8 +300,7 @@
319300
@Retention(RetentionPolicy.RUNTIME)
320301
@Target(ElementType.FIELD)
321302
@interface ListMaxLength {
322-
@StableAPI.Expose
323-
int value();
303+
@StableAPI.Expose int value();
324304
}
325305

326306

@@ -332,8 +312,7 @@
332312
@Retention(RetentionPolicy.RUNTIME)
333313
@Target(ElementType.FIELD)
334314
@interface Name {
335-
@StableAPI.Expose
336-
String value();
315+
@StableAPI.Expose String value();
337316
}
338317

339318
/**

src/main/java/com/falsepattern/lib/dependencies/DependencyLoader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ public static void loadLibraries(Library... libraries) {
5151
@DeprecationDetails(deprecatedSince = "0.10.0")
5252
@StableAPI.Expose
5353
public static void loadLibrary(@NonNull String loadingModId, @NonNull String groupId, @NonNull String artifactId, @NonNull Version minVersion, Version maxVersion, @NonNull Version preferredVersion, String regularSuffix, String devSuffix) {
54-
FalsePatternLib.getLog().warn(DependencyLoader.class.getName() + ".loadLibrary is deprecated and will be removed in FalsePatternLib 0.11! Use loadLibraries instead!");
54+
FalsePatternLib.getLog()
55+
.warn(DependencyLoader.class.getName() +
56+
".loadLibrary is deprecated and will be removed in FalsePatternLib 0.11! Use loadLibraries instead!");
5557
DependencyLoaderImpl.loadLibrary(loadingModId, groupId, artifactId, minVersion, maxVersion, preferredVersion,
5658
regularSuffix, devSuffix);
5759
}

src/main/java/com/falsepattern/lib/dependencies/Library.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66
@StableAPI(since = "0.10.0")
77
public class Library {
88
@StableAPI.Expose
9-
@NonNull public final String loadingModId;
9+
@NonNull
10+
public final String loadingModId;
1011
@StableAPI.Expose
11-
@NonNull public final String groupId;
12+
@NonNull
13+
public final String groupId;
1214
@StableAPI.Expose
13-
@NonNull public final String artifactId;
15+
@NonNull
16+
public final String artifactId;
1417
@StableAPI.Expose
15-
@NonNull public final Version minVersion;
18+
@NonNull
19+
public final Version minVersion;
1620
@StableAPI.Expose
1721
public final Version maxVersion;
1822
@StableAPI.Expose
19-
@NonNull public final Version preferredVersion;
23+
@NonNull
24+
public final Version preferredVersion;
2025
@StableAPI.Expose
2126
public final String regularSuffix;
2227
@StableAPI.Expose

src/main/java/com/falsepattern/lib/dependencies/SemanticVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ public int compareTo(@NonNull Version o) {
111111

112112
@Override
113113
public String toString() {
114-
return majorVersion + (minorVersion < 0 ? "" : "." + minorVersion) + (patchVersion < 0 ? "" : "." + patchVersion) + (preRelease == null ? "" : "-" + preRelease) +
114+
return majorVersion + (minorVersion < 0 ? "" : "." + minorVersion) +
115+
(patchVersion < 0 ? "" : "." + patchVersion) + (preRelease == null ? "" : "-" + preRelease) +
115116
(build == null ? "" : "+" + build);
116117
}
117118

src/main/java/com/falsepattern/lib/internal/config/LibraryConfig.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ public class LibraryConfig {
4646
public static ValidationLogging CONFIG_ERROR_LOUDNESS;
4747

4848
public enum ValidationLogging {
49-
@StableAPI.Expose(since = "__INTERNAL__")
50-
None,
51-
@StableAPI.Expose(since = "__INTERNAL__")
52-
Log,
53-
@StableAPI.Expose(since = "__INTERNAL__")
54-
LogAndToast
49+
@StableAPI.Expose(since = "__INTERNAL__") None,
50+
@StableAPI.Expose(since = "__INTERNAL__") Log,
51+
@StableAPI.Expose(since = "__INTERNAL__") LogAndToast
5552
}
5653
}

src/main/java/com/falsepattern/lib/internal/config/ToastConfig.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ public static boolean leftAlign() {
5555
}
5656

5757
public enum Side {
58-
@StableAPI.Expose(since = "__INTERNAL__")
59-
Left,
60-
@StableAPI.Expose(since = "__INTERNAL__")
61-
Right
58+
@StableAPI.Expose(since = "__INTERNAL__") Left,
59+
@StableAPI.Expose(since = "__INTERNAL__") Right
6260
}
6361
}

src/main/java/com/falsepattern/lib/internal/impl/config/ConfigurationManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ public static void receiveReply(DataInput input) throws IOException {
197197
val opt = serializedNames.keySet().stream().filter((key) -> key.equals(serializedName)).findFirst();
198198
if (!opt.isPresent()) {
199199
input.skipBytes(dataSize);
200-
FalsePatternLib.getLog().warn("Server tried to sync config not registered on our side: " + serializedName);
200+
FalsePatternLib.getLog()
201+
.warn("Server tried to sync config not registered on our side: " + serializedName);
201202
continue;
202203
}
203204
val clazz = serializedNames.get(opt.get());

0 commit comments

Comments
 (0)