From 1acb9090015d93507bdb74a1f0f27a084b8c06b1 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Mon, 14 Jul 2025 00:08:06 -0700 Subject: [PATCH] Analyzed the current code and added tasks for updating. --- .cursor/plans/Modernize.md | 39 ++++++++++++++++++++++++++++++++++++-- TODO.md | 7 +++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 TODO.md diff --git a/.cursor/plans/Modernize.md b/.cursor/plans/Modernize.md index 29bf8c7..749b28b 100644 --- a/.cursor/plans/Modernize.md +++ b/.cursor/plans/Modernize.md @@ -4,7 +4,7 @@ This checklist will guide the process of updating the ScoreKeeper plugin for com ## Modernization Plan -- [ ] **Analyze current codebase** +- [x] **Analyze current codebase** - Review all source files and dependencies - Identify deprecated or removed APIs - [ ] **Update build system** @@ -224,4 +224,39 @@ A completely separate API and server implementation, not based on Bukkit/Spigot/ - Set the following environment variables in your shell: - `MINECRAFT_SERVER_PATH`: The root path of your Paper server directory. - `MINECRAFT_SERVER_JAR`: The path to your Paper server jar (relative to `MINECRAFT_SERVER_PATH` or absolute). -- See `CONTRIBUTING.md` for detailed setup instructions. \ No newline at end of file +- See `CONTRIBUTING.md` for detailed setup instructions. + +--- + +## Appendix: Codebase Analysis and Migration Notes + +### Deprecated or Removed API Usage +- **Player as HashMap key:** + - Uses `HashMap`. This is not reliable; use `UUID` as the key instead. +- **Logger usage:** + - Uses `Logger.getLogger("Minecraft")`. Use `getLogger()` from `JavaPlugin` for modern plugins. +- **Old event registration (commented out):** + - Uses deprecated Bukkit event registration. Modernize with `@EventHandler` and `registerEvents` if needed. +- **Player lookup:** + - Uses `getServer().getPlayer(name)`. This is case-sensitive and only matches exact names in modern Paper/Spigot. Consider using `getPlayerExact` or handling case-insensitivity. + +### Hardcoded Bukkit References +- All imports are from `org.bukkit.*`, which is compatible with Paper. No hardcoded Bukkit-only features found. +- No use of Bukkit’s old event system in active code (just commented out). + +### Recommendations for Paper Migration +- Switch all player score storage to use `UUID` instead of `Player` as the key. +- Use `getLogger()` from `JavaPlugin` for logging. +- If you add event listeners, use the modern event system (`@EventHandler`, `registerEvents`). +- Review and update player lookup logic for case sensitivity and exact matching. +- Ensure all commands are properly defined in `plugin.yml`. + +#### Summary Table +| Issue/Pattern | Status / Recommendation | +|------------------------------|----------------------------------------| +| Player as HashMap key | ❌ Use UUID instead | +| Logger | ❌ Use getLogger() | +| Old event registration | ❌ Use @EventHandler, registerEvents | +| Command registration | ✅ Valid, check plugin.yml | +| Player lookup | ⚠️ Use getPlayerExact for safety | +| Hardcoded Bukkit features | ✅ None found | diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..23168c0 --- /dev/null +++ b/TODO.md @@ -0,0 +1,7 @@ +# Migration TODOs for Paper Modernization + +- [ ] Switch all player score storage to use UUID instead of Player as the key +- [ ] Update logger usage to use getLogger() from JavaPlugin +- [ ] Remove or modernize any old/deprecated event registration (use @EventHandler and registerEvents) +- [ ] Review and update player lookup logic to use getPlayerExact or handle case sensitivity +- [ ] Ensure all commands are properly defined in plugin.yml