Integrate CoreProtect logging for bounty head metadata #11

Merged
NotAlexNoyle merged 1 commits from codex/use-coreprotect-api-for-head-metadata into main 2026-03-09 09:13:46 -04:00
NotAlexNoyle commented 2026-03-09 09:13:36 -04:00 (Migrated from github.com)

Motivation

  • Ensure custom player-head metadata (display name, lore and persistent data) is recorded with CoreProtect so rollbacks/restores preserve bounty head information.
  • Add a guarded runtime integration so the plugin can use CoreProtect API v11+ when available without failing when it is absent.

Description

  • Added the PlayPro repository and net.coreprotect:coreprotect:23.1 as a compile-only dependency in build.gradle.kts to compile against CoreProtect v11 (maven.playpro.com).
  • Introduced CoreProtectHook (com.tcoded.playerbountiesplus.hook.logging.CoreProtectHook) that safely discovers CoreProtect, verifies APIVersion() >= 11, and exposes guarded wrapper methods like logPlacement and logRemoval.
  • Initialized the core-protect hook in PlayerBountiesOG and passed it into BountyHeadListener, logging a warning when CoreProtect is unavailable.
  • Updated BountyHeadListener to call logPlacement(user, skullBlockState) after placing a skull and logRemoval(user, snapshotBlockState) when breaking a skull so CoreProtect records the skull BlockState (preserving custom meta/lore).

Testing

  • Ran ./gradlew -version which completed successfully and printed the Gradle/JVM info.
  • Ran ./gradlew compileJava --stacktrace which failed before compilation due to the environment using Java 25.0.1 causing a Kotlin DSL bootstrap parsing error (IllegalArgumentException: 25.0.1), so project compilation could not be validated in this environment.

Codex Task

### Motivation - Ensure custom player-head metadata (display name, lore and persistent data) is recorded with CoreProtect so rollbacks/restores preserve bounty head information. - Add a guarded runtime integration so the plugin can use CoreProtect API v11+ when available without failing when it is absent. ### Description - Added the PlayPro repository and `net.coreprotect:coreprotect:23.1` as a compile-only dependency in `build.gradle.kts` to compile against CoreProtect v11 (`maven.playpro.com`). - Introduced `CoreProtectHook` (`com.tcoded.playerbountiesplus.hook.logging.CoreProtectHook`) that safely discovers CoreProtect, verifies `APIVersion() >= 11`, and exposes guarded wrapper methods like `logPlacement` and `logRemoval`. - Initialized the core-protect hook in `PlayerBountiesOG` and passed it into `BountyHeadListener`, logging a warning when CoreProtect is unavailable. - Updated `BountyHeadListener` to call `logPlacement(user, skullBlockState)` after placing a skull and `logRemoval(user, snapshotBlockState)` when breaking a skull so CoreProtect records the skull `BlockState` (preserving custom meta/lore). ### Testing - Ran `./gradlew -version` which completed successfully and printed the Gradle/JVM info. - Ran `./gradlew compileJava --stacktrace` which failed before compilation due to the environment using Java `25.0.1` causing a Kotlin DSL bootstrap parsing error (`IllegalArgumentException: 25.0.1`), so project compilation could not be validated in this environment. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69aec62fa720832f90ac47cf01ef8d8f)
Sign in to join this conversation.