diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 180146f..b1bca69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,8 +17,8 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4.7.0 with: - distribution: adopt - java-version: 17 + distribution: temurin + java-version: 25 - name: Build LimboFilter run: ./gradlew build - name: Upload LimboFilter diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a7a13a..c6e9830 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,8 +13,8 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4.7.0 with: - distribution: adopt - java-version: 17 + distribution: temurin + java-version: 25 - name: Build LimboFilter run: ./gradlew build - name: Upload LimboFilter diff --git a/build.gradle b/build.gradle index 735bcfd..7d0930b 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,9 @@ plugins { id("java") id("checkstyle") - id("com.github.spotbugs").version("6.1.7") - id("org.cadixdev.licenser").version("0.6.1") - id("com.gradleup.shadow").version("8.3.6") + id("com.github.spotbugs").version("6.4.8") + id("net.minecraftforge.licenser").version("1.2.0") + id("com.gradleup.shadow").version("9.4.0") } setGroup("net.elytrium") @@ -16,8 +16,8 @@ compileJava { } java { - setSourceCompatibility(JavaVersion.VERSION_17) - setTargetCompatibility(JavaVersion.VERSION_17) + setSourceCompatibility(JavaVersion.VERSION_21) + setTargetCompatibility(JavaVersion.VERSION_21) } repositories { @@ -66,7 +66,6 @@ license { } checkstyle { - setToolVersion("10.1") setConfigFile(file("${this.getRootDir()}/config/checkstyle/checkstyle.xml")) setConfigProperties("configDirectory": "${this.getRootDir()}/config/checkstyle") @@ -103,16 +102,7 @@ sourceSets.main.getJava().srcDir( assemble.dependsOn(shadowJar) String getCurrentShortRevision() { - OutputStream outputStream = new ByteArrayOutputStream() - exec { - if (System.getProperty("os.name").toLowerCase().contains("win")) { - commandLine("cmd", "/c", "git rev-parse --short HEAD") - } else { - commandLine("bash", "-c", "git rev-parse --short HEAD") - } - - setStandardOutput(outputStream) - } - - return outputStream.toString().trim() + return System.getProperty("os.name").toLowerCase().contains("win") + ? ["cmd", "/c", "git rev-parse --short HEAD"].execute().text.trim() + : ["bash", "-c", "git rev-parse --short HEAD"].execute().text.trim() } diff --git a/config/spotbugs/suppressions.xml b/config/spotbugs/suppressions.xml index eb21bfb..1e4e2e6 100644 --- a/config/spotbugs/suppressions.xml +++ b/config/spotbugs/suppressions.xml @@ -7,4 +7,7 @@ + + + diff --git a/gradle.properties b/gradle.properties index 4497806..2a8d17d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ limboapiVersion=1.1.27 -velocityVersion=3.4.0-SNAPSHOT +velocityVersion=3.5.0-SNAPSHOT nettyVersion=4.1.86.Final fastutilVersion=8.5.11 log4jVersion=2.19.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2733ed5..221c4f9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/elytrium/limbofilter/LimboFilter.java b/src/main/java/net/elytrium/limbofilter/LimboFilter.java index 362b4d0..d671110 100644 --- a/src/main/java/net/elytrium/limbofilter/LimboFilter.java +++ b/src/main/java/net/elytrium/limbofilter/LimboFilter.java @@ -30,7 +30,6 @@ import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.scheduler.ScheduledTask; import com.velocitypowered.proxy.console.VelocityConsole; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.File; import java.io.FileNotFoundException; import java.io.IOError; @@ -164,7 +163,6 @@ public void onProxyInitialization(ProxyInitializeEvent event) { Configurator.setLevel(consoleLogger.getName(), consoleLogger.getLevel()); } - @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH", justification = "LEGACY_AMPERSAND can't be null in velocity.") public void reload() { Settings.IMP.reload(this.configFile, Settings.IMP.PREFIX); @@ -299,6 +297,7 @@ public void reload() { new PacketMapping(0x16, ProtocolVersion.MINECRAFT_1_20_5, false), new PacketMapping(0x18, ProtocolVersion.MINECRAFT_1_21_2, false), new PacketMapping(0x19, ProtocolVersion.MINECRAFT_1_21_6, false), + new PacketMapping(0x1A, ProtocolVersion.MINECRAFT_26_1, false), }) .registerPacket(PacketDirection.CLIENTBOUND, SetEntityMetadata.class, null, new PacketMapping[]{ new PacketMapping(0x1C, ProtocolVersion.MINIMUM_VERSION, true), @@ -318,6 +317,7 @@ public void reload() { new PacketMapping(0x5D, ProtocolVersion.MINECRAFT_1_21_2, true), new PacketMapping(0x5C, ProtocolVersion.MINECRAFT_1_21_5, true), new PacketMapping(0x61, ProtocolVersion.MINECRAFT_1_21_9, true), + new PacketMapping(0x63, ProtocolVersion.MINECRAFT_26_1, true), }) .registerPacket(PacketDirection.CLIENTBOUND, SpawnEntity.class, null, new PacketMapping[]{ new PacketMapping(0x0E, ProtocolVersion.MINIMUM_VERSION, true), diff --git a/src/main/java/net/elytrium/limbofilter/protocol/packets/Interact.java b/src/main/java/net/elytrium/limbofilter/protocol/packets/Interact.java index a47bdf2..c29b71d 100644 --- a/src/main/java/net/elytrium/limbofilter/protocol/packets/Interact.java +++ b/src/main/java/net/elytrium/limbofilter/protocol/packets/Interact.java @@ -22,6 +22,7 @@ import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; +import net.elytrium.limbofilter.protocol.data.PackedVector; public class Interact implements MinecraftPacket { @@ -35,7 +36,15 @@ public class Interact implements MinecraftPacket { @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { - if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_7_6) > 0) { + if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_26_1) >= 0) { + this.entityId = ProtocolUtils.readVarInt(buf); + this.hand = ProtocolUtils.readVarInt(buf); + PackedVector target = PackedVector.read(buf); + this.targetX = (float) target.x(); + this.targetY = (float) target.y(); + this.targetZ = (float) target.z(); + this.sneaking = buf.readBoolean(); + } else if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_7_6) > 0) { this.entityId = ProtocolUtils.readVarInt(buf); this.type = ProtocolUtils.readVarInt(buf); if (this.type == 2) {