Skip to content

Commit a274d91

Browse files
committed
Initial introduction of spotless.
1 parent fb8c3b5 commit a274d91

File tree

21 files changed

+55
-83
lines changed

21 files changed

+55
-83
lines changed

build.gradle

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@ import java.util.zip.ZipOutputStream
66

77
buildscript {
88
ext {
9+
spotlessVersion = (project['spotless.version'] as String)
910
jvmDowngraderVersion = (project['jvm-downgrader.version'] as String)
1011
debugCompiler = false
1112
}
12-
dependencies {
13-
// classpath("xyz.wagyourtail.jvmdowngrader:jvmdowngrader-java-api:$jvmDowngraderVersion")
14-
}
1513
}
1614

1715
plugins {
1816
id 'java-base'
17+
id 'com.diffplug.spotless' version "$spotlessVersion" apply false
1918
id 'xyz.wagyourtail.jvmdowngrader' version "$jvmDowngraderVersion" apply false
2019
}
2120

2221
group 'com.fox2code'
2322
version project['foxloader.version']
2423

2524
tasks.register('publishToMavenLocal', Task)
25+
tasks.register('spotlessApply', Task)
2626

2727
subprojects {
2828
apply plugin: 'java-library'
29+
apply plugin: 'com.diffplug.spotless'
2930

3031
version project['foxloader.version']
3132

@@ -99,6 +100,12 @@ subprojects {
99100
withJavadocJar()
100101
}
101102

103+
spotless {
104+
java {
105+
formatAnnotations()
106+
}
107+
}
108+
102109
javadoc {
103110
failOnError false
104111
}
@@ -111,6 +118,8 @@ subprojects {
111118
}
112119

113120
afterEvaluate {
121+
rootProject.tasks.spotlessApply.dependsOn(spotlessApply)
122+
114123
tasks.withType(JavaCompile.class).configureEach {
115124
if (debugCompiler) {
116125
options.compilerArgs.addAll(['--release', '8'])

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ reindev.slimSHA256Sum=2fd437b85e4fb7e8f7d4bdf70cf2f5d5691386bd27b477074686c8f2e0
1717
reindev.version=2.9
1818
reindev.version.allowFrom=2.9
1919

20+
# https://plugins.gradle.org/plugin/com.diffplug.spotless
21+
spotless.version=7.0.4
22+
2023
# https://modrinth.com/mod/spark/versions
2124
#Spark properties
2225
spark.dependency=maven.modrinth:spark:1.10.138-fabric

loader/src/main/java/com/fox2code/foxloader/client/gui/GuiModListContainer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ protected boolean isSelected(int i) {
3737
return this.selected == i;
3838
}
3939

40-
@NotNull
41-
public ModContainer getSelectedModContainer() {
40+
@NotNull public ModContainer getSelectedModContainer() {
4241
return this.mods[this.selected];
4342
}
4443

loader/src/main/java/com/fox2code/foxloader/client/gui/GuiModMenuContainer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ protected int getContentHeight() {
7171
return this.slotHeight * this.mods.length;
7272
}
7373

74-
@NotNull
75-
public ModContainer getSelectedModContainer() {
74+
@NotNull public ModContainer getSelectedModContainer() {
7675
return this.mods[this.selected];
7776
}
7877

loader/src/main/java/com/fox2code/foxloader/energy/FoxPowerBlock.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ public interface FoxPowerBlock {
1414
* @param blockFace the blockFace to get a FoxPowerInterface from
1515
* @return the {@link FoxPowerInterface} for this block
1616
*/
17-
@Nullable
18-
default FoxPowerInterface getPowerInterfaceForFace(BlockAccess blockAccess, int x, int y, int z, int blockFace) {
17+
@Nullable default FoxPowerInterface getPowerInterfaceForFace(BlockAccess blockAccess, int x, int y, int z, int blockFace) {
1918
return this.getIntrinsicPowerInterface(blockAccess, x, y, z);
2019
}
2120

@@ -28,8 +27,7 @@ default FoxPowerInterface getPowerInterfaceForFace(BlockAccess blockAccess, int
2827
* @param z the z block pos coordinate
2928
* @return the {@link FoxPowerInterface} for this block
3029
*/
31-
@Nullable
32-
FoxPowerInterface getIntrinsicPowerInterface(BlockAccess blockAccess, int x, int y, int z);
30+
@Nullable FoxPowerInterface getIntrinsicPowerInterface(BlockAccess blockAccess, int x, int y, int z);
3331

3432
/**
3533
* Called to notify a block a new neighboring power block has updated its power interface.

loader/src/main/java/com/fox2code/foxloader/energy/FoxPowerInterface.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@ public abstract class FoxPowerInterface {
3232
*/
3333
public abstract int getCableSinkPriority();
3434

35-
@NotNull
36-
public abstract FoxPowerType getFoxPowerType();
35+
@NotNull public abstract FoxPowerType getFoxPowerType();
3736
}

loader/src/main/java/com/fox2code/foxloader/energy/FoxPowerItem.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ public interface FoxPowerItem {
1818

1919
long sendFoxPower(ItemStack itemStack, long amount);
2020

21-
@NotNull
22-
FoxPowerType getFoxPowerType();
21+
@NotNull FoxPowerType getFoxPowerType();
2322
}

loader/src/main/java/com/fox2code/foxloader/event/network/PlayerConnectEvent.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,15 @@ public PlayerConnectEvent(NetworkManager networkManager, String username, boolea
3030
this.cancelMessage = "Event cancelled";
3131
}
3232

33-
@NotNull
34-
public NetworkManager getNetworkManager() {
33+
@NotNull public NetworkManager getNetworkManager() {
3534
return this.networkManager;
3635
}
3736

38-
@Nullable
39-
public ClientHello getClientHello() {
37+
@Nullable public ClientHello getClientHello() {
4038
return this.clientHello;
4139
}
4240

43-
@NotNull
44-
public String getUsername() {
41+
@NotNull public String getUsername() {
4542
return this.username;
4643
}
4744

@@ -52,8 +49,7 @@ public boolean isIncompatibleClient() {
5249
return this.incompatibleClient;
5350
}
5451

55-
@NotNull
56-
public String getCancelMessage() {
52+
@NotNull public String getCancelMessage() {
5753
return this.cancelMessage;
5854
}
5955

loader/src/main/java/com/fox2code/foxloader/event/player/PlayerChatEvent.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ public PlayerChatEvent(EntityPlayer entityPlayer, String chatMessage) {
1616
this.formattedMessage = "<" + entityPlayer.username + "> " + chatMessage;
1717
}
1818

19-
@NotNull
20-
public String getChatMessage() {
19+
@NotNull public String getChatMessage() {
2120
return this.chatMessage;
2221
}
2322

24-
@NotNull
25-
public String getFormattedMessage() {
23+
@NotNull public String getFormattedMessage() {
2624
return this.formattedMessage;
2725
}
2826

loader/src/main/java/com/fox2code/foxloader/event/player/PlayerEvent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ protected PlayerEvent(EntityPlayer entityPlayer) {
1313
this.entityPlayer = Objects.requireNonNull(entityPlayer, "entityPlayer");
1414
}
1515

16-
@NotNull
17-
public final EntityPlayer getEntityPlayer() {
16+
@NotNull public final EntityPlayer getEntityPlayer() {
1817
return this.entityPlayer;
1918
}
2019
}

0 commit comments

Comments
 (0)