Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import buildlogic.primaryJavaReleaseVersion
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration

plugins {
Expand All @@ -15,15 +16,13 @@ tasks.named("assemble") {
dependsOn("reobfJar")
}

crankcaseJava {
// We use Java 21 for most of the pre-existing adapters.
javaRelease = 21
}

java {
// Required when we de-sync release option and declared Java versions.
disableAutoTargetJvm()
toolchain.languageVersion = JavaLanguageVersion.of(primaryJavaReleaseVersion)
}

tasks
.withType<JavaCompile>()
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
.configureEach {
// We use Java 21 for most of the pre-existing adapters.
options.release.set(21)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import buildlogic.stringyLibs
import buildlogic.getLibrary
import buildlogic.primaryJavaReleaseVersion

plugins {
id("eclipse")
Expand All @@ -10,7 +11,7 @@ plugins {
}

crankcaseJava {
javaRelease = 25
javaRelease = primaryJavaReleaseVersion
disabledLints = listOf("processing", "path", "fallthrough", "serial", "overloads")
disabledErrorprone = listOf(
// We use reference equality intentionally in several places
Expand Down
3 changes: 3 additions & 0 deletions build-logic/src/main/kotlin/buildlogic/GradleExtras.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ val Project.ext: ExtraPropertiesExtension
val Project.stringyLibs: VersionCatalog
get() = extensions.getByType<VersionCatalogsExtension>().named("libs")

val Project.primaryJavaReleaseVersion: Int
get() = stringyLibs.getVersion("primaryJavaRelease").requiredVersion.toInt()

val Project.internalVersion: Provider<String>
get() {
val version = version.toString()
Expand Down
2 changes: 0 additions & 2 deletions config/checkstyle/checkstyle-suppression.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<!-- TODO: Apply these Checkstyle rules -->
<suppress files=".*" checks="UnusedLocalVariable|UnusedCatchParameterShouldBeUnnamed|UnusedLambdaParameterShouldBeUnnamed|UnusedTryResourceShouldBeUnnamed"/>
<suppress files=".*DataFixer\.java" checks="MethodName|FallThrough|EmptyStatement|UseEnhancedSwitch"/>
<suppress files=".*DataConverters\.java"
checks="MethodName|FallThrough|EmptyStatement|UseEnhancedSwitch|DefaultComesLast|JavadocParagraph"/>
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ sponge-vanillagradle = { id = "org.spongepowered.gradle.vanilla", version.ref =
fabric-loom = "net.fabricmc.fabric-loom:1.18.2"

[versions]
primaryJavaRelease = "25"

kyoriText = "3.0.4"
piston = "0.6.0"
autoValue = "1.10.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter {

public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
// A simple test
@SuppressWarnings({"ReturnValueIgnored", "unused"})
var unused = CraftServer.class.cast(Bukkit.getServer());
checkState(Bukkit.getServer() instanceof CraftServer, "Bukkit Server isn't a CraftServer");

int dataVersion = SharedConstants.getCurrentVersion().dataVersion().version();
if (dataVersion != Constants.DATA_VERSION_MC_1_21_11) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2438,8 +2438,6 @@ public int getDataVersion() {
}

public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
boolean flag = true;

try {
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompoundOrEmpty("Level");
int i = nbttagcompound1.getIntOr("xPos", 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter {

public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
// A simple test
@SuppressWarnings({"ReturnValueIgnored", "unused"})
var unused = CraftServer.class.cast(Bukkit.getServer());
checkState(Bukkit.getServer() instanceof CraftServer, "Bukkit Server isn't a CraftServer");

int dataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
if (dataVersion != Constants.DATA_VERSION_MC_1_21_4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter {

public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
// A simple test
@SuppressWarnings({"ReturnValueIgnored", "unused"})
var unused = CraftServer.class.cast(Bukkit.getServer());
checkState(Bukkit.getServer() instanceof CraftServer, "Bukkit Server isn't a CraftServer");

int dataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
if (dataVersion != Constants.DATA_VERSION_MC_1_21_5) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2438,8 +2438,6 @@ public int getDataVersion() {
}

public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
boolean flag = true;

try {
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompoundOrEmpty("Level");
int i = nbttagcompound1.getIntOr("xPos", 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter {

public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
// A simple test
@SuppressWarnings({"ReturnValueIgnored", "unused"})
var unused = CraftServer.class.cast(Bukkit.getServer());
checkState(Bukkit.getServer() instanceof CraftServer, "Bukkit Server isn't a CraftServer");

int dataVersion = SharedConstants.getCurrentVersion().dataVersion().version();
if (dataVersion < Constants.DATA_VERSION_MC_1_21_6 || dataVersion > Constants.DATA_VERSION_MC_1_21_8) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2438,8 +2438,6 @@ public int getDataVersion() {
}

public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
boolean flag = true;

try {
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompoundOrEmpty("Level");
int i = nbttagcompound1.getIntOr("xPos", 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter {

public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
// A simple test
@SuppressWarnings({"ReturnValueIgnored", "unused"})
var unused = CraftServer.class.cast(Bukkit.getServer());
checkState(Bukkit.getServer() instanceof CraftServer, "Bukkit Server isn't a CraftServer");

int dataVersion = SharedConstants.getCurrentVersion().dataVersion().version();
if (dataVersion != Constants.DATA_VERSION_MC_1_21_9 && dataVersion != Constants.DATA_VERSION_MC_1_21_10) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2438,8 +2438,6 @@ public int getDataVersion() {
}

public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
boolean flag = true;

try {
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompoundOrEmpty("Level");
int i = nbttagcompound1.getIntOr("xPos", 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
try {
Class.forName("org.spigotmc.WatchdogThread");
watchdog = new SpigotWatchdog();
} catch (ClassNotFoundException | NoSuchFieldException e) {
} catch (ClassNotFoundException | NoSuchFieldException _) {
try {
watchdog = new MojangWatchdog(((CraftServer) Bukkit.getServer()).getServer());
} catch (NoSuchFieldException ex) {
} catch (NoSuchFieldException _) {
watchdog = null;
}
}
Expand All @@ -273,7 +273,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
try {
Class.forName("org.spigotmc.SpigotConfig");
SpigotConfig.config.set("world-settings.worldeditregentempworld.verbose", false);
} catch (ClassNotFoundException ignored) {
} catch (ClassNotFoundException _) {
// It's fine if we couldn't set it
}
}
Expand Down Expand Up @@ -608,17 +608,17 @@ public BlockMaterial getBlockMaterial(BlockType blockType) {
@Override
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) {
return switch (state) {
case net.minecraft.world.level.block.state.properties.BooleanProperty ignored ->
case net.minecraft.world.level.block.state.properties.BooleanProperty _ ->
new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
case net.minecraft.world.level.block.state.properties.EnumProperty ignored -> {
case net.minecraft.world.level.block.state.properties.EnumProperty _ -> {
if (state.getValueClass() == net.minecraft.core.Direction.class) {
yield new DirectionalProperty(state.getName(),
(List<Direction>) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).toList());
}
yield new EnumProperty(state.getName(),
(List<String>) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).toList());
}
case net.minecraft.world.level.block.state.properties.IntegerProperty ignored ->
case net.minecraft.world.level.block.state.properties.IntegerProperty _ ->
new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
default ->
throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName());
Expand Down Expand Up @@ -649,7 +649,7 @@ public void sendFakeNBT(Player player, BlockVector3 pos, LinCompoundTag nbtData)
structureBlock.setLevel(((CraftPlayer) player).getHandle().level());
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
structureBlock,
(blockEntity, registryAccess) -> (net.minecraft.nbt.CompoundTag) fromNative(nbtData)
(_, _) -> (net.minecraft.nbt.CompoundTag) fromNative(nbtData)
));
}

Expand Down Expand Up @@ -715,7 +715,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item
PaperweightFakePlayer fakePlayer;
try {
fakePlayer = fakePlayers.get(worldServer);
} catch (ExecutionException ignored) {
} catch (ExecutionException _) {
return false;
}
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
Expand Down Expand Up @@ -809,7 +809,7 @@ private void doRegen(World bukkitWorld, Region region, Extent extent, RegenOptio
@SuppressWarnings("unchecked")
Map<String, World> map = (Map<String, World>) serverWorldsField.get(Bukkit.getServer());
map.remove("worldeditregentempworld");
} catch (IllegalAccessException ignored) {
} catch (IllegalAccessException _) {
// It's fine if we couldn't remove it
}
SafeFiles.tryHardToDeleteDir(tempDir);
Expand Down Expand Up @@ -1030,7 +1030,7 @@ public boolean generateStructure(StructureType type, World world, EditSession se
structureRegistry.wrapAsHolder(structure), originalWorld.dimension(), originalWorld.registryAccess(),
chunkManager.getGenerator(), chunkManager.getGenerator().getBiomeSource(), chunkManager.randomState(),
originalWorld.getStructureManager(), originalWorld.getSeed(), chunkPos, 0,
proxyLevel.level(), biome -> true
proxyLevel.level(), _ -> true
);

if (!structureStart.isValid()) {
Expand Down Expand Up @@ -1273,7 +1273,7 @@ private static class MojangWatchdog implements Watchdog {
public void tick() {
try {
tickField.set(server, Util.getMillis());
} catch (IllegalAccessException ignored) {
} catch (IllegalAccessException _) {
// It's fine if we couldn't set it
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,13 @@ public interface DataConverter {


private void registerInspector(LegacyType type, DataInspector inspector) {
this.inspectors.computeIfAbsent(type, k -> new ArrayList<>()).add(inspector);
this.inspectors.computeIfAbsent(type, _ -> new ArrayList<>()).add(inspector);
}

private void registerConverter(LegacyType type, DataConverter converter) {
int version = converter.getDataVersion();

List<DataConverter> list = this.converters.computeIfAbsent(type, k -> new ArrayList<>());
List<DataConverter> list = this.converters.computeIfAbsent(type, _ -> new ArrayList<>());
if (!list.isEmpty() && list.get(list.size() - 1).getDataVersion() > version) {
for (int j = 0; j < list.size(); ++j) {
if (list.get(j).getDataVersion() > version) {
Expand Down Expand Up @@ -1894,22 +1894,22 @@ public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp)
if (object == null) {
object = Component.literal("");
}
} catch (JsonParseException jsonparseexception) {
} catch (JsonParseException _) {
;
}

if (object == null) {
try {
object = ComponentConverter.Serializer.fromJson(s, MinecraftServer.getServer().registryAccess());
} catch (JsonParseException jsonparseexception1) {
} catch (JsonParseException _) {
;
}
}

if (object == null) {
try {
object = ComponentConverter.Serializer.fromJsonLenient(s, MinecraftServer.getServer().registryAccess());
} catch (JsonParseException jsonparseexception2) {
} catch (JsonParseException _) {
;
}
}
Expand Down Expand Up @@ -1972,7 +1972,7 @@ public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp)
i = cmp.getInt("VillagerProfession").flatMap(profession -> {
try {
return Optional.of(this.convert(profession));
} catch (RuntimeException runtimeexception) {
} catch (RuntimeException _) {
return Optional.empty();
}
}).orElse(i);
Expand Down Expand Up @@ -2438,8 +2438,6 @@ public int getDataVersion() {
}

public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
boolean flag = true;

try {
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompoundOrEmpty("Level");
int i = nbttagcompound1.getIntOr("xPos", 0);
Expand Down Expand Up @@ -2467,7 +2465,7 @@ public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp)
}
}
}
} catch (Exception exception) {
} catch (Exception _) {
DataConverterBedBlock.a.warn("Unable to datafix Bed blocks, level format may be missing tags.");
}

Expand Down Expand Up @@ -2557,22 +2555,22 @@ private void convert(net.minecraft.nbt.CompoundTag nbttagcompound, String s) {
if (object == null) {
object = Component.literal("");
}
} catch (JsonParseException jsonparseexception) {
} catch (JsonParseException _) {
;
}

if (object == null) {
try {
object = ComponentConverter.Serializer.fromJson(s1, MinecraftServer.getServer().registryAccess());
} catch (JsonParseException jsonparseexception1) {
} catch (JsonParseException _) {
;
}
}

if (object == null) {
try {
object = ComponentConverter.Serializer.fromJsonLenient(s1, MinecraftServer.getServer().registryAccess());
} catch (JsonParseException jsonparseexception2) {
} catch (JsonParseException _) {
;
}
}
Expand Down
Loading
Loading