Skip to content

Commit ac8f866

Browse files
committed
Enable -Werror for the core module
1 parent 1f1a2ef commit ac8f866

File tree

14 files changed

+28
-47
lines changed

14 files changed

+28
-47
lines changed

build-logic/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencies {
1515
implementation(libs.levelHeadered)
1616
implementation(libs.shadow)
1717
implementation(libs.jfrog.buildinfo)
18-
implementation(libs.paperweight)
1918
implementation(libs.gson)
2019

2120
constraints {

build-logic/src/main/kotlin/buildlogic.common-java.gradle.kts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ tasks
1313
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
1414
.configureEach {
1515
val disabledLint = listOf(
16-
"processing", "path", "fallthrough", "serial", "overloads",
16+
"processing", "path", "fallthrough", "serial", "overloads", "this-escape"
1717
)
1818
options.release.set(21)
1919
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
2020
options.isDeprecation = true
2121
options.encoding = "UTF-8"
2222
options.compilerArgs.add("-parameters")
23-
// options.compilerArgs.add("-Werror")
23+
if (project.name.contains("-core")) {
24+
options.compilerArgs.add("-Werror")
25+
}
2426
}
2527

2628
configure<CheckstyleExtension> {
@@ -50,7 +52,9 @@ dependencies {
5052
tasks.withType<Javadoc>().configureEach {
5153
options.encoding = "UTF-8"
5254
(options as StandardJavadocDocletOptions).apply {
53-
// addBooleanOption("Werror", true)
55+
if (project.name.contains("-core")) {
56+
addBooleanOption("Werror", true)
57+
}
5458
addBooleanOption("Xdoclint:all", true)
5559
addBooleanOption("Xdoclint:-missing", true)
5660
tags(

craftbook-bukkit/src/main/java/org/enginehub/craftbook/bukkit/BukkitCraftBookPlatform.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.enginehub.craftbook.util.profile.resolver.ProfileService;
4949
import org.enginehub.craftbook.util.report.ReportFlag;
5050
import org.enginehub.piston.CommandManager;
51+
import org.jspecify.annotations.Nullable;
5152

5253
import java.nio.file.Path;
5354
import java.util.ArrayList;
@@ -61,7 +62,7 @@ public class BukkitCraftBookPlatform implements CraftBookPlatform {
6162

6263
private final MechanicManager mechanicManager = new BukkitMechanicManager();
6364
private YamlConfiguration config;
64-
private String version;
65+
private @Nullable String version;
6566

6667
/**
6768
* The manager for SelfTriggering components.

craftbook-bukkit/src/main/java/org/enginehub/craftbook/bukkit/mechanics/piston/BukkitBetterPistons.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public void onPistonExtend(BlockPistonExtendEvent event) {
189189
continue;
190190
}
191191

192-
BlockFace facing = SignUtil.getFacing(event.getBlock().getRelative(face));
192+
BlockFace facing = SignUtil.getBack(event.getBlock().getRelative(face));
193193

194194
// Only care if it faces the piston
195195
if (face != BlockFace.UP
@@ -216,7 +216,7 @@ public void onPistonExtend(BlockPistonExtendEvent event) {
216216
}
217217
}
218218
}
219-
} while (SignUtil.isSign(sign.getRelative(face)) && SignUtil.getFacing(sign) == facing);
219+
} while (SignUtil.isSign(sign.getRelative(face)) && SignUtil.getBack(sign) == facing);
220220
}
221221
}
222222

@@ -242,7 +242,7 @@ public void onPistonRetract(BlockPistonRetractEvent event) {
242242
continue;
243243
}
244244

245-
BlockFace facing = SignUtil.getFacing(event.getBlock().getRelative(face));
245+
BlockFace facing = SignUtil.getBack(event.getBlock().getRelative(face));
246246

247247
// Only care if it faces the piston
248248
if (face != BlockFace.UP
@@ -267,7 +267,7 @@ public void onPistonRetract(BlockPistonRetractEvent event) {
267267
}
268268

269269

270-
} while (SignUtil.isSign(sign.getRelative(face)) && SignUtil.getFacing(sign) == facing);
270+
} while (SignUtil.isSign(sign.getRelative(face)) && SignUtil.getBack(sign) == facing);
271271
}
272272
}
273273

craftbook-bukkit/src/main/java/org/enginehub/craftbook/mechanics/ic/gates/world/blocks/SetBridge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public SetBridge(Server server, ChangedSign block, ICFactory factory) {
5959
@Override
6060
public void load() {
6161
center = getBackBlock();
62-
faceing = SignUtil.getFacing(getSign().getBlock());
62+
faceing = SignUtil.getBack(getSign().getBlock());
6363
String line = getLine(2);
6464
if (!line.isEmpty()) {
6565
String[] split = RegexUtil.MINUS_PATTERN.split(line);

craftbook-bukkit/src/main/java/org/enginehub/craftbook/mechanics/ic/gates/world/blocks/SetDoor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public SetDoor(Server server, ChangedSign block, ICFactory factory) {
5959
@Override
6060
public void load() {
6161

62-
faceing = SignUtil.getFacing(getSign().getBlock());
62+
faceing = SignUtil.getBack(getSign().getBlock());
6363
String line = getLine(2);
6464
if (!line.isEmpty()) {
6565
String[] split = RegexUtil.MINUS_PATTERN.split(line);

craftbook-bukkit/src/main/java/org/enginehub/craftbook/mechanics/minecart/blocks/CartReverser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void onVehicleImpact(CartBlockImpactEvent event) {
5151
return;
5252
}
5353

54-
BlockFace dir = SignUtil.getFacing(event.getBlocks().sign());
54+
BlockFace dir = SignUtil.getBack(event.getBlocks().sign());
5555

5656
Vector normalVelocity = event.getMinecart().getVelocity().normalize();
5757

craftbook-bukkit/src/main/java/org/enginehub/craftbook/util/LocationUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static boolean isWithinRadius(Location l1, Location l2, Vector3 radius) {
8686
public static Block getRelativeOffset(Block sign, int offsetX, int offsetY, int offsetZ) {
8787

8888
return getRelativeOffset(SignUtil.getBackBlock(sign),
89-
SignUtil.getFacing(sign),
89+
SignUtil.getBack(sign),
9090
offsetX, offsetY, offsetZ);
9191
}
9292

craftbook-bukkit/src/main/java/org/enginehub/craftbook/util/SignUtil.java

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,14 @@ public static boolean isWallSign(Material type) {
6363
return Tag.WALL_SIGNS.isTagged(type);
6464
}
6565

66-
/**
67-
* Get the back of the sign, the block that it is attached to.
68-
*
69-
* @param sign treated as sign post if it is such, or else assumed to be a wall sign (i.e.,
70-
* if you ask about a stone block, it's considered a wall
71-
* sign).
72-
* @return the direction a player would be facing when reading the sign; i.e. the face that is
73-
* actually the back
74-
* side of the sign.
75-
* @deprecated confusing, should use getBack or getFront explicitly
76-
*/
77-
@Deprecated
78-
public static BlockFace getFacing(Block sign) {
79-
return getBack(sign);
80-
}
81-
8266
/**
8367
* Get the front face of the sign.
8468
*
8569
* @param sign treated as sign post if it is such, or else assumed to be a wall sign (i.e.,
8670
* if you ask about a stone block, it's considered a wall
8771
* sign).
8872
* @return the side of the sign containing the text (in other words, when a player places a new
89-
* sign,
90-
* while facing north, this will return south).
73+
* sign, while facing north, this will return south).
9174
*/
9275
public static BlockFace getFront(Block sign) {
9376
BlockData blockData = sign.getBlockData();
@@ -112,9 +95,7 @@ public static Block getFrontBlock(Block sign) {
11295
* sign).
11396
* @return the blank side of the sign opposite the text. In the case of a wall sign,
11497
* the block in this direction is the block to which the sign is
115-
* attached. This is also the direction a player would be facing when reading the sign; see
116-
* {@link
117-
* #getFacing(Block)}.
98+
* attached. This is also the direction a player would be facing when reading the sign.
11899
*/
119100
public static BlockFace getBack(Block sign) {
120101
return getFront(sign).getOppositeFace();

craftbook-core/src/main/java/org/enginehub/craftbook/AbstractCraftBookMechanic.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import org.enginehub.craftbook.mechanic.CraftBookMechanic;
2121
import org.enginehub.craftbook.mechanic.MechanicType;
2222

23-
import java.io.File;
2423
import java.io.FileNotFoundException;
2524
import java.io.IOException;
25+
import java.nio.file.Path;
2626

2727
public abstract class AbstractCraftBookMechanic implements CraftBookMechanic {
2828

@@ -37,7 +37,7 @@ public MechanicType<? extends CraftBookMechanic> getMechanicType() {
3737
}
3838

3939
@Override
40-
public void loadConfiguration(File configFile) {
40+
public void loadConfiguration(Path configFile) {
4141
YAMLProcessor mechanicConfig = new YAMLProcessor(configFile, true, YAMLFormat.EXTENDED);
4242

4343
try {

0 commit comments

Comments
 (0)