Analyzes code to add more tasks and adds our tools scripts.

This commit is contained in:
Tom Hicks
2025-07-14 06:04:58 -07:00
parent bbc512a044
commit 85a4ac0585
3 changed files with 46 additions and 9 deletions

20
TODO.md
View File

@@ -1,18 +1,20 @@
# Modernize MobScores Plugin: Implementation Tasks # Modernize MobScores Plugin: Implementation Tasks
- [ ] Analyze all Java source files for deprecated or removed Bukkit API usage, including logger, event registration, listener classes, configuration API, and entity/player mapping. - [x] Analyze all Java source files for deprecated or removed Bukkit API usage, including logger, event registration, listener classes, configuration API, and entity/player mapping.
- [ ] Identify and document any hardcoded Bukkit references or legacy patterns (e.g., Player as HashMap key, old event registration, CraftBukkit class names). _(Depends on: code analysis)_ - [x] Identify and document any hardcoded Bukkit references or legacy patterns (e.g., Player as HashMap key, old event registration, CraftBukkit class names).
- [ ] Review and list any custom scripts or resources (e.g., bash scripts in tools/bash/) that may need migration or updates. _(Depends on: code analysis)_ - [ ] Review and list any custom scripts or resources (e.g., bash scripts in tools/bash/) that may need migration or updates.
- [ ] Initialize Gradle in the project root and create a build.gradle file with project metadata, PaperMC API dependency, JUnit, Java toolchain, repository, resource handling, and plugins as needed. _(Depends on: code analysis)_ - [ ] Initialize Gradle in the project root and create a build.gradle file with project metadata, PaperMC API dependency, JUnit, Java toolchain, repository, resource handling, and plugins as needed.
- [ ] Remove Maven-specific files (pom.xml, .mvn/ directory, Maven wrapper scripts) and Eclipse-specific files (.classpath, .project, .settings/) if present. _(Depends on: Gradle init)_ - [ ] Remove Maven-specific files (pom.xml, .mvn/ directory, Maven wrapper scripts) and Eclipse-specific files (.classpath, .project, .settings/) if present. _(Depends on: Gradle init)_
- [ ] Update .gitignore to add Gradle-specific ignores and remove Maven/Eclipse-specific ignores. _(Depends on: Gradle init)_ - [ ] Update .gitignore to add Gradle-specific ignores and remove Maven/Eclipse-specific ignores. _(Depends on: Gradle init)_
- [ ] Ensure plugin.yml is present in src/main/resources and update for PaperMC compatibility (api-version, commands, required fields). _(Depends on: Gradle init)_ - [ ] Ensure plugin.yml is present in src/main/resources and update for PaperMC compatibility (api-version, commands, required fields). _(Depends on: Gradle init)_
- [ ] Refactor all logger usage to use getLogger() from JavaPlugin. _(Depends on: code analysis)_ - [ ] Refactor all logger usage to use getLogger() from JavaPlugin.
- [ ] Refactor all event listeners to use the modern event system (Listener interface, @EventHandler, registerEvents). _(Depends on: code analysis)_ - [ ] Refactor all event listeners to use the modern event system (Listener interface, @EventHandler, registerEvents).
- [ ] Replace use of org.bukkit.util.config.Configuration with the modern configuration API (getConfig(), saveConfig(), etc.). _(Depends on: code analysis)_ - [ ] Replace use of org.bukkit.util.config.Configuration with the modern configuration API (getConfig(), saveConfig(), etc.).
- [ ] Update score table to use Bukkit entity types or enums instead of CraftBukkit class names. _(Depends on: code analysis)_ - [ ] Update score table to use Bukkit entity types or enums instead of CraftBukkit class names.
- [ ] If storing player scores, refactor to use UUID as the key instead of Player or String. _(Depends on: code analysis)_ - [ ] If storing player scores, refactor to use UUID as the key instead of Player or String.
- [ ] Build the plugin with Gradle (./gradlew build) and test on a modern Paper server using the provided bash scripts. _(Depends on: all refactors and plugin.yml update)_ - [ ] Build the plugin with Gradle (./gradlew build) and test on a modern Paper server using the provided bash scripts. _(Depends on: all refactors and plugin.yml update)_
- [ ] Address any bugs or incompatibilities found during testing on a modern server. _(Depends on: build and test)_ - [ ] Address any bugs or incompatibilities found during testing on a modern server. _(Depends on: build and test)_
- [ ] Update README.md and CONTRIBUTING.md with new build, usage, and development instructions. _(Depends on: bugfixes)_ - [ ] Update README.md and CONTRIBUTING.md with new build, usage, and development instructions. _(Depends on: bugfixes)_
- [ ] (Optional) Add new features, quality-of-life improvements, automated tests, or CI configuration. _(Depends on: docs update)_ - [ ] (Optional) Add new features, quality-of-life improvements, automated tests, or CI configuration. _(Depends on: docs update)_
- [ ] Update MobScores to depend on the latest version of the ScoreKeeper plugin (update dependency in build.gradle and plugin.yml as needed).
- [ ] Test MobScores with the latest ScoreKeeper to ensure score tracking, awarding, and all integration points work as expected (including with players who have changed names).

10
tools/bash/build-plugin.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
# Find project root (two directories above this script)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
./gradlew build

25
tools/bash/deploy-plugin.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -e
if [[ -z "$MINECRAFT_SERVER_PATH" ]]; then
echo "Error: MINECRAFT_SERVER_PATH environment variable is not set."
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
PLUGIN_JAR=$(ls -t "$PROJECT_ROOT"/build/libs/*.jar 2>/dev/null | head -n1)
if [[ ! -f "$PLUGIN_JAR" ]]; then
echo "Error: No plugin jar found in $PROJECT_ROOT/build/libs. Build the plugin first."
exit 1
fi
# Optional: Warn if jar is older than any source file
if find "$PROJECT_ROOT/src/main/java" "$PROJECT_ROOT/src/main/resources" -type f -newer "$PLUGIN_JAR" | grep -q .; then
echo "Warning: The built plugin jar is older than some source files. Consider rebuilding."
fi
mkdir -p "$MINECRAFT_SERVER_PATH/plugins"
cp "$PLUGIN_JAR" "$MINECRAFT_SERVER_PATH/plugins/"
echo "Deployed $PLUGIN_JAR to $MINECRAFT_SERVER_PATH/plugins/"