Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ac576bb
Runtime startup check of PE version
Axionize Apr 20, 2025
245d239
Add /grim history command to see historical alerts
Axionize Apr 20, 2025
bad73fa
Add Inventory checks
Axionize Apr 26, 2025
6aed9df
- Re-add HitboxBlock and HitboxEntity (renamed to WallHit and EntityP…
Axionize Apr 30, 2025
a8bf6ac
Add support for Hitbox Debugging
Axionize Apr 30, 2025
32070a3
Cull dead entities from canHit()
Axionize Apr 30, 2025
da952f8
Update buildscript
Axionize Apr 30, 2025
434d12c
Buildscript Update & Dirty Painting Hack
Axionize Apr 30, 2025
d4a77a8
Heavy memory use optimization
Axionize May 3, 2025
706e3ca
* Remove space in names of new checks:
Axionize May 4, 2025
9d8aaa4
Optimize Bukkit PistonEvent() usage
Axionize May 7, 2025
cf3c78b
Runtime startup check of PE version
Axionize Apr 20, 2025
f54d265
Add /grim history command to see historical alerts
Axionize Apr 20, 2025
8e9ad26
Add Inventory checks
Axionize Apr 26, 2025
d434c4b
- Re-add HitboxBlock and HitboxEntity (renamed to WallHit and EntityP…
Axionize Apr 30, 2025
9b97ebe
Add support for Hitbox Debugging
Axionize Apr 30, 2025
1d5ed18
Cull dead entities from canHit()
Axionize Apr 30, 2025
a444ffe
Update buildscript
Axionize Apr 30, 2025
e162773
Buildscript Update & Dirty Painting Hack
Axionize Apr 30, 2025
6374878
Heavy memory use optimization
Axionize May 3, 2025
2f08694
* Remove space in names of new checks:
Axionize May 4, 2025
eba4105
Optimize Bukkit PistonEvent() usage
Axionize May 7, 2025
0880b5e
Temp stash
Axionize May 11, 2025
a667d8d
yay
GigaZelensky May 16, 2025
9ba9156
Merge branch 'Axionize:lightning' into lightninggg
GigaZelensky May 16, 2025
6cc1878
Track scaled VL separately
GigaZelensky May 16, 2025
ec893c5
translate
GigaZelensky May 17, 2025
3f2c776
Don't scale by default
GigaZelensky May 17, 2025
38a71ab
Update PunishmentManager.java
GigaZelensky May 19, 2025
4d6c9c6
Fix duplicate comment in English config
GigaZelensky May 19, 2025
2f51a64
undo vl scale delay
GigaZelensky May 19, 2025
69a0d7f
Add VL scale delay support
GigaZelensky May 19, 2025
0a3d73e
Add translated config comments
GigaZelensky May 19, 2025
9f5bb99
aesthetic thing
GigaZelensky May 19, 2025
628ced4
fix translation
GigaZelensky May 19, 2025
2a788e2
Merge pull request #25 from GigaZelensky/codex/add-translated-comment…
GigaZelensky May 19, 2025
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
266 changes: 219 additions & 47 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Gradle Package

on: [push, workflow_dispatch]
Expand All @@ -13,47 +6,226 @@ jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write # needed by build-tag-number and mc-publish
packages: write
actions: write

steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4 # Handles Gradle wrapper validation and basic caching

- name: Cache Gradle Loom Cache
uses: actions/cache@v4
with:
path: .gradle/loom-cache # Path to Loom cache relative to workspace root
key: loom-cache-${{ runner.os }}-${{ hashFiles('**/libs.versions.toml', 'fabric/**/build.gradle.kts') }}
restore-keys: |
loom-cache-${{ runner.os }}

- name: Build with Gradle (Actual Build for Artifacts)
run: ./gradlew build

- name: Upload Bukkit Artifact
uses: actions/upload-artifact@v4
with:
name: grimac-bukkit
# Adding if-no-files-found for robustness
path: ${{ github.workspace }}/bukkit/build/libs/grimac-bukkit-*.jar
if-no-files-found: error

- name: Upload Fabric Artifact
uses: actions/upload-artifact@v4
with:
name: grimac-fabric
# Adding if-no-files-found for robustness
path: ${{ github.workspace }}/fabric/build/libs/grimac-fabric-*.jar
if-no-files-found: error
#------------------------------------------------------------------
# 0) Checkout + JDK
#------------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v4
with:
# fetch the entire history and all tags
fetch-depth: 50

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}

#------------------------------------------------------------------
# 1) Gradle wrapper validation + caches
#------------------------------------------------------------------
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Cache Loom
uses: actions/cache@v4
with:
path: .gradle/loom-cache
key: loom-cache-${{ runner.os }}-${{ hashFiles('**/libs.versions.toml',
'fabric/**/build.gradle.kts',
'bukkit/**/build.gradle.kts') }}
restore-keys: |
loom-cache-${{ runner.os }}

#------------------------------------------------------------------
# 2) Resolve VERSIONs **before** building
#------------------------------------------------------------------
- name: Compute MAIN version (default build)
id: ver_main
run: |
VERSION=$(./gradlew -q printVersion | grep '^VERSION=' | cut -d'=' -f2)
echo "main_version=$VERSION" >> $GITHUB_OUTPUT
echo "MAIN_VERSION=$VERSION" >> $GITHUB_ENV
echo "Main version: $VERSION"

- name: Compute LITE version (-PshadePE=false)
id: ver_lite
run: |
VERSION=$(./gradlew -q -PshadePE=false printVersion | grep '^VERSION=' | cut -d'=' -f2)
echo "lite_version=$VERSION" >> $GITHUB_OUTPUT
echo "LITE_VERSION=$VERSION" >> $GITHUB_ENV
echo "Lite version: $VERSION"

#------------------------------------------------------------------
# 3) Build shaded / “main” jars (all modules)
#------------------------------------------------------------------
- name: Build (all platforms, shaded)
run: ./gradlew build

#------------------------------------------------------------------
# 4) Build **lite** Bukkit jar
#------------------------------------------------------------------
- name: Build Bukkit-Lite (no shaded PacketEvents)
run: ./gradlew :bukkit:build -PshadePE=false

#------------------------------------------------------------------
# 4.5) Rename jars to LightningGrim-* before we upload/publish
#------------------------------------------------------------------
- name: Rename jars to LightningGrim
shell: bash
run: |
set -e
mv "bukkit/build/libs/grimac-bukkit-${MAIN_VERSION}.jar" \
"bukkit/build/libs/LightningGrim-bukkit-${MAIN_VERSION}.jar"

mv "bukkit/build/libs/grimac-bukkit-${LITE_VERSION}.jar" \
"bukkit/build/libs/LightningGrim-bukkit-${LITE_VERSION}.jar"

mv "fabric/build/libs/grimac-fabric-${MAIN_VERSION}.jar" \
"fabric/build/libs/LightningGrim-fabric-${MAIN_VERSION}.jar"

#------------------------------------------------------------------
# 5) Upload MAIN Bukkit + Fabric artefacts
#------------------------------------------------------------------
- name: Upload Bukkit – MAIN
uses: actions/upload-artifact@v4
with:
name: grimac-bukkit
path: bukkit/build/libs/LightningGrim-bukkit-${{ env.MAIN_VERSION }}.jar
if-no-files-found: error

- name: Upload Fabric
uses: actions/upload-artifact@v4
with:
name: grimac-fabric
path: fabric/build/libs/LightningGrim-fabric-${{ env.MAIN_VERSION }}.jar
if-no-files-found: error

#------------------------------------------------------------------
# 6) Upload LITE artefact
#------------------------------------------------------------------
- name: Upload Bukkit – LITE
uses: actions/upload-artifact@v4
with:
name: grimac-bukkit-lite
path: bukkit/build/libs/LightningGrim-bukkit-${{ env.LITE_VERSION }}.jar
if-no-files-found: error

#------------------------------------------------------------------
# 7) Auto-generate CHANGELOG (since previous build tag)
#------------------------------------------------------------------
- name: Generate changelog
id: changelog
if: contains(fromJSON('["merge","release","main","lightning"]'), github.ref_name)
run: |
set -e
git fetch --tags --quiet

# Most recent tag that looks like “build-*”; empty if none exist
LAST_TAG=$(git describe --tags --match "build-*" --abbrev=0 2>/dev/null || echo "")
echo "Last tag: ${LAST_TAG:-<none>}"

if [ -z "$LAST_TAG" ]; then
# First build (or no previous tag) → grab latest 50 commits
NOTES=$(git log -n 50 --pretty=format:'* %s (%h)' --no-merges)
else
# Normal case → commits since the last build tag
NOTES=$(git log "$LAST_TAG"..HEAD --pretty=format:'* %s (%h)' --no-merges)
fi

# Fallback if there were no code changes
if [ -z "$NOTES" ]; then
NOTES="* No code changes since last build"
fi

# Export multiline output for downstream steps
{
echo "notes<<EOF"
echo "$NOTES"
echo "EOF"
} >> "$GITHUB_OUTPUT"

echo "Changelog generated:"
echo "$NOTES"

#------------------------------------------------------------------
# 8) Generate incremental build number (after changelog step!)
#------------------------------------------------------------------
- name: Generate build number
if: contains(fromJSON('["merge","release","main","lightning"]'), github.ref_name)
id: buildnumber
uses: onyxmueller/build-tag-number@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

#------------------------------------------------------------------
# 9-A) Publish **Bukkit** jars to Modrinth
#------------------------------------------------------------------
- name: Publish to Modrinth (Bukkit)
if: contains(fromJSON('["merge","release","main","lightning"]'), github.ref_name)
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ vars.MODRINTH_ID }} # Bukkit & Fabric can share or differ
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: subset

files: |
bukkit/build/libs/LightningGrim-bukkit-${{ env.MAIN_VERSION }}.jar
bukkit/build/libs/LightningGrim-bukkit-${{ env.LITE_VERSION }}.jar

name: Lightning Grim Anticheat (Bukkit) ${{ env.MAIN_VERSION }}-b${{ steps.buildnumber.outputs.build_number }}
version: ${{ env.MAIN_VERSION }}-b${{ steps.buildnumber.outputs.build_number }}
version-type: alpha
changelog: ${{ steps.changelog.outputs.notes }}

loaders: |
bukkit
spigot
paper
folia
purpur

game-versions: |
>=1.7

retry-attempts: 2
retry-delay: 10000
fail-mode: fail

#------------------------------------------------------------------
# 9-B) Publish **Fabric** jar to Modrinth
#------------------------------------------------------------------
- name: Publish to Modrinth (Fabric)
if: contains(fromJSON('["merge","release","main","lightning"]'), github.ref_name)
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ vars.MODRINTH_ID_FABRIC || vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: subset

files: |
fabric/build/libs/LightningGrim-fabric-${{ env.MAIN_VERSION }}.jar

name: Lightning Grim Anticheat (Fabric) ${{ env.MAIN_VERSION }}-b${{ steps.buildnumber.outputs.build_number }}
version: ${{ env.MAIN_VERSION }}-b${{ steps.buildnumber.outputs.build_number }}
version-type: alpha
changelog: ${{ steps.changelog.outputs.notes }}

loaders: |
fabric

game-versions: |
>=1.16.1

retry-attempts: 2
retry-delay: 10000
fail-mode: fail
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.jetbrains", "ac.grim.grimac.shaded.jetbrains")
relocate("org.incendo", "ac.grim.grimac.shaded.incendo")
relocate("io.leangen.geantyref", "ac.grim.grimac.shaded.geantyref") // Required by cloud
relocate("com.zaxxer", "ac.grim.grimac.shaded.zaxxer") // Database history
}
mergeServiceFiles()
}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/versioning/VersionUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ object VersionUtil {
val branch = stdout.toString().trim()

return when (branch) {
"lightning" -> null
"main", "2.0" -> null // ← ignore these branches
else -> branch.replace("/", "_")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public PlatformWorld getWorld() {
if (bukkitPlatformWorld == null || !bukkitPlatformWorld.getBukkitWorld().equals(entity.getWorld())) {
bukkitPlatformWorld = new BukkitPlatformWorld(entity.getWorld());
}

return bukkitPlatformWorld;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ac.grim.grimac.platform.bukkit.utils.convert.BukkitConversionUtils;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;
import ac.grim.grimac.utils.data.PistonData;
import ac.grim.grimac.utils.data.PistonTemplate;
import com.github.retrooper.packetevents.protocol.world.BlockFace;
import org.bukkit.Material;
import org.bukkit.block.Block;
Expand Down Expand Up @@ -55,17 +55,8 @@ public void onPistonPushEvent(BlockPistonExtendEvent event) {
piston.getY() + event.getDirection().getModY(),
piston.getZ() + event.getDirection().getModZ()));

boolean finalHasSlimeBlock = hasSlimeBlock;
boolean finalHasHoneyBlock = hasHoneyBlock;
for (GrimPlayer player : GrimAPI.INSTANCE.getPlayerDataManager().getEntries()) {
int lastTrans = player.lastTransactionSent.get();
player.runSafely(() -> {
if (player.compensatedWorld.isChunkLoaded(event.getBlock().getX() >> 4, event.getBlock().getZ() >> 4)) {
PistonData data = new PistonData(BukkitConversionUtils.fromBukkitFace(event.getDirection()), boxes, lastTrans, true, finalHasSlimeBlock, finalHasHoneyBlock);
player.latencyUtils.addRealTimeTaskAsync(lastTrans, () -> player.compensatedWorld.activePistons.add(data));
}
});
}
PistonTemplate data = new PistonTemplate(BukkitConversionUtils.fromBukkitFace(event.getDirection()), boxes, true, hasSlimeBlock, hasHoneyBlock);
addPistonData(data, event.getBlock().getX() >> 4, event.getBlock().getZ() >> 4);
}

// For some unknown reason, bukkit handles this stupidly
Expand Down Expand Up @@ -113,15 +104,18 @@ public void onPistonRetractEvent(BlockPistonRetractEvent event) {
}
}

boolean finalHasSlimeBlock = hasSlimeBlock;
boolean finalHasHoneyBlock = hasHoneyBlock;
PistonTemplate data = new PistonTemplate(face, boxes, false, hasSlimeBlock, hasHoneyBlock);
addPistonData(data, event.getBlock().getX() >> 4, event.getBlock().getZ() >> 4);
}

private void addPistonData(PistonTemplate pistonTemplate, int chunkX, int chunkZ) {
for (GrimPlayer player : GrimAPI.INSTANCE.getPlayerDataManager().getEntries()) {
if (player.compensatedWorld.isChunkLoaded(chunkX, chunkZ)) continue;

int lastTrans = player.lastTransactionSent.get();
player.runSafely(() -> {
if (player.compensatedWorld.isChunkLoaded(event.getBlock().getX() >> 4, event.getBlock().getZ() >> 4)) {
PistonData data = new PistonData(BukkitConversionUtils.fromBukkitFace(event.getDirection()), boxes, lastTrans, false, finalHasSlimeBlock, finalHasHoneyBlock);
player.latencyUtils.addRealTimeTaskAsync(lastTrans, () -> player.compensatedWorld.activePistons.add(data));
}

player.latencyUtils.addRealTimeTaskAsync(lastTrans, () -> {
player.compensatedWorld.addPiston(pistonTemplate, lastTrans);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package ac.grim.grimac.platform.bukkit.player;

import ac.grim.grimac.platform.api.player.OfflinePlatformPlayer;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;

import java.util.UUID;

public class BukkitOfflinePlatformPlayer implements OfflinePlatformPlayer {
private final OfflinePlayer offlinePlayer;

public BukkitOfflinePlatformPlayer(OfflinePlayer offlinePlayer) {
this.offlinePlayer = offlinePlayer;
}

@Override
public boolean isOnline() {
return offlinePlayer.isOnline();
}

@Override
public @NotNull String getName() {
return offlinePlayer.getName();
}

@Override
public @NotNull UUID getUniqueId() {
return offlinePlayer.getUniqueId();
}

@Override
public boolean equals(Object o) {
if (o instanceof OfflinePlatformPlayer offlinePlatformPlayer) {
return this.getUniqueId().equals(offlinePlatformPlayer.getUniqueId());
}
return false;
}
}
Loading