Updates documentation and adds scripts to start/stop the server.
This commit is contained in:
227
.cursor/plans/Modernize.md
Normal file
227
.cursor/plans/Modernize.md
Normal file
@@ -0,0 +1,227 @@
|
||||
# Modernize ScoreKeeper Minecraft Plugin
|
||||
|
||||
This checklist will guide the process of updating the ScoreKeeper plugin for compatibility with modern Minecraft Java servers (e.g., PaperMC, Spigot, or Bukkit 1.19+).
|
||||
|
||||
## Modernization Plan
|
||||
|
||||
- [ ] **Analyze current codebase**
|
||||
- Review all source files and dependencies
|
||||
- Identify deprecated or removed APIs
|
||||
- [ ] **Update build system**
|
||||
- Update `pom.xml` to use a modern Bukkit/Spigot/PaperMC API version (e.g., 1.19+)
|
||||
- Remove or update old repositories
|
||||
- Ensure Java version compatibility (Java 17+ for latest servers)
|
||||
- [ ] **Update plugin.yml**
|
||||
- Ensure all required fields are present and up to date
|
||||
- Update API version and commands
|
||||
- [ ] **Refactor deprecated API usage**
|
||||
- Replace removed or changed Bukkit/Spigot API calls
|
||||
- Update event listeners and command registration
|
||||
- [ ] **Test on a modern server**
|
||||
- Build the plugin
|
||||
- Run on a local PaperMC/Spigot server (latest LTS)
|
||||
- Use the provided scripts (`tools/bash/start-server.sh` and `tools/bash/stop-server.sh`) to manage the server, and set the `MINECRAFT_SERVER_PATH` and `MINECRAFT_SERVER_JAR` environment variables as described in CONTRIBUTING.md.
|
||||
- Check for errors and warnings
|
||||
- [ ] **Fix bugs and incompatibilities**
|
||||
- Address any issues found during testing
|
||||
- [ ] **Add/update documentation**
|
||||
- Update README with new usage instructions
|
||||
- Document any new features or changes
|
||||
- [ ] **Optional: Add new features or improvements**
|
||||
- Consider adding quality-of-life improvements or new features
|
||||
|
||||
---
|
||||
|
||||
Check off each step as you complete it to track your progress!
|
||||
|
||||
---
|
||||
|
||||
## Appendix: Gradle vs. Maven
|
||||
|
||||
### Maven
|
||||
**Pros:**
|
||||
- Stability & Maturity: Very stable, predictable builds.
|
||||
- Convention over Configuration: Standard structure and lifecycle.
|
||||
- Dependency Management: Handles dependencies well, large central repository.
|
||||
- Documentation: Extensive documentation and community support.
|
||||
- IDE Support: Excellent integration with Java IDEs.
|
||||
- Widely Used: Many Minecraft plugins and tutorials use Maven.
|
||||
|
||||
**Cons:**
|
||||
- Verbose Configuration: `pom.xml` can become large and hard to read.
|
||||
- Less Flexible: Custom build logic is harder to implement.
|
||||
- Slower for Large Projects: Can be slower than Gradle for complex builds.
|
||||
|
||||
### Gradle
|
||||
**Pros:**
|
||||
- Performance: Generally faster builds, supports incremental builds and caching.
|
||||
- Flexibility: Build scripts in Groovy/Kotlin allow complex logic.
|
||||
- Concise Configuration: `build.gradle` files are usually shorter and easier to read.
|
||||
- Modern Tooling: Better support for modern build features.
|
||||
- Growing Popularity: Increasingly popular in the Java ecosystem.
|
||||
|
||||
**Cons:**
|
||||
- Learning Curve: More complex for beginners, especially for custom logic.
|
||||
- Less Convention: More freedom can lead to less consistency.
|
||||
- Slightly Less Documentation: Not as much Minecraft-specific documentation as Maven.
|
||||
|
||||
### Which is Most Common for Minecraft Plugins?
|
||||
- **Maven** is still the most common for Bukkit, Spigot, and Paper plugins, with most guides and examples using it.
|
||||
- **Gradle** is gaining popularity, especially for newer projects or those needing more flexibility and speed.
|
||||
|
||||
**Summary:**
|
||||
- For maximum compatibility with community resources, Maven is the safest choice.
|
||||
- For a modern, flexible, and fast build system, Gradle is a great option if you're comfortable with it.
|
||||
|
||||
---
|
||||
|
||||
## Appendix: Choosing a Plugin API
|
||||
|
||||
### Bukkit
|
||||
**Description:**
|
||||
The original plugin API for Minecraft servers, now largely unmaintained. Most modern APIs are built on or forked from Bukkit.
|
||||
|
||||
**Pros:**
|
||||
- Huge legacy plugin library.
|
||||
- Simple, well-documented API.
|
||||
- Good for very basic plugins.
|
||||
|
||||
**Cons:**
|
||||
- No longer actively maintained.
|
||||
- Lacks support for modern Minecraft features.
|
||||
- Not recommended for new projects.
|
||||
|
||||
### Spigot
|
||||
**Description:**
|
||||
A high-performance fork of Bukkit, Spigot is the most widely used server software for plugins. It adds performance improvements and bug fixes.
|
||||
|
||||
**Pros:**
|
||||
- Actively maintained and widely used.
|
||||
- Large plugin ecosystem.
|
||||
- Good documentation and community support.
|
||||
- Compatible with most Bukkit plugins.
|
||||
|
||||
**Cons:**
|
||||
- Lags behind the latest Minecraft features compared to Paper.
|
||||
- Fewer advanced features than Paper.
|
||||
|
||||
### Paper
|
||||
**Description:**
|
||||
A fork of Spigot with additional performance optimizations, bug fixes, and new API features. Paper is now the de facto standard for modern plugin development.
|
||||
|
||||
**Pros:**
|
||||
- Actively maintained and very popular.
|
||||
- Superior performance and stability.
|
||||
- Adds many new API features not in Spigot/Bukkit.
|
||||
- Backwards compatible with most Spigot/Bukkit plugins.
|
||||
- Large, active community.
|
||||
|
||||
**Cons:**
|
||||
- Some Paper-specific APIs may not work on Spigot (if you ever want to support both).
|
||||
- Slightly faster update cycle may require more frequent plugin updates.
|
||||
|
||||
### Purpur
|
||||
**Description:**
|
||||
A fork of Paper with even more features, configuration options, and experimental changes. Aimed at server owners who want maximum customization.
|
||||
|
||||
**Pros:**
|
||||
- All benefits of Paper, plus more features and config options.
|
||||
- Great for highly customized servers.
|
||||
|
||||
**Cons:**
|
||||
- Some features are experimental and may be unstable.
|
||||
- Smaller community than Paper/Spigot.
|
||||
- Plugins using Purpur-specific features may not work elsewhere.
|
||||
|
||||
### Sponge
|
||||
**Description:**
|
||||
A completely separate API and server implementation, not based on Bukkit/Spigot/Paper. Aimed at modded servers (Forge) but also works standalone.
|
||||
|
||||
**Pros:**
|
||||
- Designed for both plugins and mods (Forge integration).
|
||||
- Modern, flexible API.
|
||||
- Good for modded servers.
|
||||
|
||||
**Cons:**
|
||||
- Much smaller plugin ecosystem for vanilla servers.
|
||||
- Not compatible with Bukkit/Spigot/Paper plugins.
|
||||
- Less relevant for standard server-only plugins.
|
||||
|
||||
### Summary & Recommendation
|
||||
- **Paper** is the best choice for most modern server-only plugins: it’s fast, stable, actively maintained, and has the richest API.
|
||||
- **Spigot** is a safe fallback if you want maximum compatibility, but Paper is almost always preferred now.
|
||||
- **Purpur** is great for highly customized servers, but not necessary unless you want its extra features.
|
||||
- **Sponge** is only recommended if you want to support modded servers or need its unique API.
|
||||
|
||||
**For your use case (server-only, modern, not needing experimental features):**
|
||||
**Paper** is the best option. It gives you the most features, best performance, and widest compatibility for new plugin development.
|
||||
|
||||
---
|
||||
|
||||
## Appendix: Development Setup
|
||||
|
||||
### Minecraft Launchers (Java Edition)
|
||||
|
||||
**Official Minecraft Launcher**
|
||||
- Fully supported by Mojang/Microsoft.
|
||||
- Works on Windows, macOS, and Linux (including WSL with GUI support).
|
||||
- Easiest for vanilla play and account management.
|
||||
|
||||
**Prism Launcher** (formerly PolyMC)
|
||||
- Open source, cross-platform (Windows, macOS, Linux).
|
||||
- Great for managing multiple Minecraft instances, modpacks, and versions.
|
||||
- Works well in Linux environments.
|
||||
|
||||
**MultiMC**
|
||||
- Similar to Prism Launcher, but older and less actively maintained.
|
||||
- Good for managing multiple instances.
|
||||
|
||||
**Recommendation:**
|
||||
- Use the Official Minecraft Launcher for playing and account management.
|
||||
- Use Prism Launcher for advanced instance/modpack management, especially on Linux/macOS.
|
||||
|
||||
### Server Software for Plugin Development
|
||||
|
||||
**Paper**
|
||||
- Most popular for plugin development.
|
||||
- Fast, stable, and actively maintained.
|
||||
- Easy to run in headless/automated environments (Linux containers, CI).
|
||||
- [Download Paper](https://papermc.io/downloads)
|
||||
|
||||
**Spigot**
|
||||
- Still widely used, but less feature-rich than Paper.
|
||||
- Requires building with BuildTools ([spigotmc.org/wiki/buildtools](https://www.spigotmc.org/wiki/buildtools/))
|
||||
|
||||
**Purpur**
|
||||
- Fork of Paper with more options.
|
||||
- [Download Purpur](https://purpurmc.org/downloads)
|
||||
|
||||
**Recommendation:**
|
||||
- Use Paper for your main development and testing server.
|
||||
- Download the latest Paper jar and run it directly in your Linux environment or containers.
|
||||
|
||||
### Automated Testing & Linux Containers
|
||||
- Paper runs perfectly in headless Linux environments (including WSL, Docker, CI/CD).
|
||||
- You can script server startup, plugin deployment, and automated plugin tests using bash scripts.
|
||||
- For CI/CD, use GitHub Actions, GitLab CI, or any Linux-based runner.
|
||||
|
||||
### Summary Table
|
||||
|
||||
| Use Case | Recommended Launcher | Recommended Server |
|
||||
|-------------------------|-----------------------------|-------------------|
|
||||
| Playing Minecraft | Official Launcher / Prism | N/A |
|
||||
| Plugin Development | N/A | Paper |
|
||||
| Automated Testing/CI | N/A | Paper |
|
||||
| Multi-instance/modpacks | Prism Launcher | Paper |
|
||||
|
||||
### Next Steps
|
||||
- Download the Official Minecraft Launcher for playing.
|
||||
- Download Prism Launcher if you want advanced management.
|
||||
- Download the latest Paper server jar for plugin development and testing.
|
||||
|
||||
#### Server Management Scripts and Environment Variables
|
||||
- Use the `tools/bash/start-server.sh` and `tools/bash/stop-server.sh` scripts to start and stop your Paper server for development and testing.
|
||||
- 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.
|
||||
9
.cursor/rules.md
Normal file
9
.cursor/rules.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Cursor Rules for Modernizing ScoreKeeper
|
||||
|
||||
- All plans should be created in `.cursor/plans`.
|
||||
- All plans should use checkboxes to track the completion state of action items or implementation steps.
|
||||
- Do not add checkboxes to items that are informational, such as notes or descriptions.
|
||||
- Use `bash` or `zsh` as the shell for development tasks.
|
||||
- Any tool scripts should use `bash` as their shell.
|
||||
- By default, the user will manually run build or test commands and provide the output. However, if the user requests, commands may be run directly—always show the command and ask for output unless instructed otherwise.
|
||||
- When creating or updating plans, do not make changes to the project code or files (other than the plan files themselves). Only update plan files to reflect progress or changes.
|
||||
45
CONTRIBUTING.md
Normal file
45
CONTRIBUTING.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Contributing to ScoreKeeper
|
||||
|
||||
Thank you for your interest in contributing to the ScoreKeeper plugin! This guide will help you set up your development environment and follow best practices for working with the project.
|
||||
|
||||
## Development Environment Setup
|
||||
|
||||
To develop and test the ScoreKeeper plugin, you will need:
|
||||
- A Paper Minecraft server (for plugin deployment and testing)
|
||||
- The official Minecraft Java Edition client (for connecting to your test server)
|
||||
|
||||
### 1. Setting up the Paper Server (macOS/Linux/WSL)
|
||||
1. Download the latest Paper server jar from [https://papermc.io/downloads](https://papermc.io/downloads).
|
||||
2. Create a directory for your test server and place the Paper jar inside.
|
||||
3. Set the following environment variables in your shell profile (e.g., `.bashrc`, `.zshrc`, or manually in your terminal):
|
||||
```bash
|
||||
export MINECRAFT_SERVER_PATH=/path/to/your/server
|
||||
export MINECRAFT_SERVER_JAR=paper-<version>.jar # Can be relative to MINECRAFT_SERVER_PATH or absolute
|
||||
```
|
||||
4. Use the provided scripts to manage your server:
|
||||
- To start (or restart) the server: `tools/bash/start-server.sh`
|
||||
- To stop the server: `tools/bash/stop-server.sh`
|
||||
These scripts use the environment variables above to locate and manage your server.
|
||||
5. On first run, accept the EULA by editing `eula.txt` and setting `eula=true` in your server directory.
|
||||
6. Place your built plugin jar in the `plugins/` directory.
|
||||
7. Use the start script again to restart the server and load the plugin.
|
||||
|
||||
### 2. Setting up the Minecraft Client
|
||||
- **macOS/Linux:**
|
||||
- Download and install the official Minecraft Launcher from [minecraft.net](https://www.minecraft.net/en-us/download).
|
||||
- Log in with your Mojang/Microsoft account and launch the Java Edition client.
|
||||
- **WSL (Windows Subsystem for Linux):**
|
||||
- For best performance, run the Minecraft client directly under Windows, not inside WSL.
|
||||
- Download and install the official Minecraft Launcher for Windows from [minecraft.net](https://www.minecraft.net/en-us/download).
|
||||
- Use WSL for server and plugin development, and connect to your test server from the Windows client.
|
||||
|
||||
### 3. Connecting the Client to Your Server
|
||||
- Start your Paper server (see above).
|
||||
- In the Minecraft client, add a new server with the address:
|
||||
- `localhost` (if running both client and server on the same machine)
|
||||
- Or use your machine's IP address if connecting across devices.
|
||||
|
||||
### 4. Notes
|
||||
- You can automate server startup and plugin deployment with bash scripts for faster testing.
|
||||
- For automated testing or CI, run the Paper server in a headless Linux environment (including WSL, Docker, or CI runners).
|
||||
- Always use the provided scripts and environment variables for consistent server management.
|
||||
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# ScoreKeeper Plugin
|
||||
|
||||
## Running
|
||||
|
||||
### Commands
|
||||
|
||||
* `/score-get [playerName]` - Displays the player's score.
|
||||
* `/score-add [playerName] <amount>` - Add amount points to the player's score.
|
||||
* `/score-subtract [playerName] <amount>` - Subtracts amount points from the player's score.
|
||||
* `/score-reset [playerName]` - Resets the player's score to 0.
|
||||
* `/score-archive [playerName]` - Saves the player's score to a "High Scores" table and resets their current score to 0.
|
||||
|
||||
NOTES:
|
||||
* All commands will use the executing player in place of [playerName] if it is omitted.
|
||||
* Permissions support is coming AFTER I get archive to work.
|
||||
* The commands aside from get are intended for admins and whatnot as some other plugin should be using the methods instead of letting player's execute commands.
|
||||
|
||||
## Development
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for development environment setup instructions.
|
||||
|
||||
12
Readme.txt
12
Readme.txt
@@ -1,12 +0,0 @@
|
||||
Commands:
|
||||
/score-get [playerName] - Displays the player's score.
|
||||
/score-add [playerName] <amount> - Add amount points to the player's score.
|
||||
/score-subtract [playerName] <amount> - Subtracts amount points from the player's score.
|
||||
/score-reset [playerName] - Resets the player's score to 0.
|
||||
/score-archive [playerName] - Saves the player's score to a "High Scores" table and resets their current score to 0.
|
||||
|
||||
NOTES:
|
||||
* All commands will use the executing player in place of [playerName] if it is omitted.
|
||||
* Permissions support is coming AFTER I get archive to work.
|
||||
* The commands aside from get are intended for admins and whatnot as some other plugin should be using the methods instead of letting player's execute commands.
|
||||
|
||||
27
tools/bash/start-server.sh
Executable file
27
tools/bash/start-server.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Check required environment variables
|
||||
if [[ -z "$MINECRAFT_SERVER_PATH" || -z "$MINECRAFT_SERVER_JAR" ]]; then
|
||||
echo "Error: MINECRAFT_SERVER_PATH and MINECRAFT_SERVER_JAR must be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$MINECRAFT_SERVER_PATH"
|
||||
|
||||
# Find running server process (java with the server jar)
|
||||
SERVER_PID=$(pgrep -f "java.*$MINECRAFT_SERVER_JAR" || true)
|
||||
|
||||
if [[ -n "$SERVER_PID" ]]; then
|
||||
echo "Minecraft server is running (PID: $SERVER_PID). Stopping it..."
|
||||
kill "$SERVER_PID"
|
||||
sleep 5
|
||||
else
|
||||
echo "Minecraft server is not running."
|
||||
fi
|
||||
|
||||
# Start the server (in a detached screen session)
|
||||
pushd "${MINECRAFT_SERVER_PATH}"
|
||||
java -jar "${MINECRAFT_SERVER_JAR}"
|
||||
popd
|
||||
21
tools/bash/stop-server.sh
Executable file
21
tools/bash/stop-server.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -z "$MINECRAFT_SERVER_PATH" || -z "$MINECRAFT_SERVER_JAR" ]]; then
|
||||
echo "Error: MINECRAFT_SERVER_PATH and MINECRAFT_SERVER_JAR must be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$MINECRAFT_SERVER_PATH"
|
||||
|
||||
SERVER_PID=$(pgrep -f "java.*$MINECRAFT_SERVER_JAR" || true)
|
||||
|
||||
if [[ -n "$SERVER_PID" ]]; then
|
||||
echo "Minecraft server is running (PID: $SERVER_PID). Stopping it..."
|
||||
kill "$SERVER_PID"
|
||||
sleep 5
|
||||
echo "Minecraft server stopped."
|
||||
else
|
||||
echo "Minecraft server is not running."
|
||||
fi
|
||||
Reference in New Issue
Block a user