|
| 1 | +# Endstone Python Example Plugin |
| 2 | + |
| 3 | +Welcome to the example Python plugin for Endstone servers. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python 3.9 or higher. |
| 8 | +- Endstone installed and set up in your Python environment. |
| 9 | + |
| 10 | +## Structure Overview |
| 11 | + |
| 12 | +``` |
| 13 | +python-example-plugin/ |
| 14 | +├── src/ # Main source directory |
| 15 | +│ └── endstone_example/ # Directory for the plugin package |
| 16 | +│ ├── __init__.py # Initializer for the package, importing ExamplePlugin class from example_plugin.py |
| 17 | +│ ├── example_plugin.py # Implementation of ExamplePlugin class |
| 18 | +│ └── python_command.py # Custom command executor for /python |
| 19 | +├── .gitignore # Git ignore rules |
| 20 | +├── LICENSE # License details |
| 21 | +├── README.md # This file |
| 22 | +└── pyproject.toml # Plugin configuration file which specifies the entrypoint |
| 23 | +``` |
| 24 | + |
| 25 | +## Getting Started |
| 26 | + |
| 27 | +1. **Clone this Repository** |
| 28 | + |
| 29 | + ```bash |
| 30 | + git clone https://github.com/EndstoneMC/python-example-plugin.git |
| 31 | + ``` |
| 32 | + |
| 33 | +2. **Navigate to the Cloned Directory** |
| 34 | + |
| 35 | + ```bash |
| 36 | + cd python-example-plugin |
| 37 | + ``` |
| 38 | + |
| 39 | +3. **Install Your Plugin** |
| 40 | + |
| 41 | + When developing the plugin, you may want to install an editable package to your Python environment, this allows you |
| 42 | + to update the codes without having to reinstall the package everytime: |
| 43 | + ```bash |
| 44 | + pip install -e . |
| 45 | + ``` |
| 46 | + **NOTE: It is strongly recommended to create a virtual environment for your Endstone server and plugins. When |
| 47 | + installing your plugin using `pip install`, please ensure the virtual environment is activated.** |
| 48 | + |
| 49 | + Ensure your plugin is loaded correctly by checking the server logs or console for the log messages. |
| 50 | + |
| 51 | +4. **Package and Distribute Your Plugin** |
| 52 | + |
| 53 | + When everything is good to go, you can package your plugin into a `.whl` (Wheel) file for easier distribution: |
| 54 | + |
| 55 | + ```bash |
| 56 | + pip install pipx |
| 57 | + pipx run build --wheel |
| 58 | + ``` |
| 59 | + |
| 60 | + This command will produce a `.whl` file in the `dist` directory. Copy the `.whl` file to the `plugins` directory |
| 61 | + of your Endstone server. Start the Endstone server and check the logs to ensure your plugin loads and operates |
| 62 | + as expected. |
| 63 | + |
| 64 | + To publish your plugin to a package index such as PyPI, please refer to: |
| 65 | + - [Using TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/) |
| 66 | + - [Publishing package distribution releases using GitHub Actions CI/CD workflows](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/) |
| 67 | + |
| 68 | +## Documentation |
| 69 | + |
| 70 | +For a deeper dive into the Endstone API and its functionalities, refer to the main |
| 71 | +Endstone [documentation](https://endstone.readthedocs.io) (WIP). |
| 72 | + |
| 73 | +## License |
| 74 | + |
| 75 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
0 commit comments