generated from EndstoneMC/python-example-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac54b9d
commit a9281fe
Showing
8 changed files
with
27 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,3 @@ | ||
# Endstone Python Example Plugin | ||
# Endstone Test | ||
|
||
Welcome to the example Python plugin for Endstone servers. | ||
|
||
## Prerequisites | ||
|
||
- Python 3.9 or higher. | ||
- Endstone installed and set up in your Python environment. | ||
|
||
## Structure Overview | ||
|
||
``` | ||
python-example-plugin/ | ||
├── src/ # Main source directory | ||
│ └── endstone_example/ # Directory for the plugin package | ||
│ ├── __init__.py # Initializer for the package, importing ExamplePlugin class from example_plugin.py | ||
│ ├── example_plugin.py # Implementation of ExamplePlugin class | ||
│ └── python_command.py # Custom command executor for /python | ||
├── .gitignore # Git ignore rules | ||
├── LICENSE # License details | ||
├── README.md # This file | ||
└── pyproject.toml # Plugin configuration file which specifies the entrypoint | ||
``` | ||
|
||
## Getting Started | ||
|
||
1. **Clone this Repository** | ||
|
||
```bash | ||
git clone https://github.com/EndstoneMC/python-example-plugin.git | ||
``` | ||
|
||
2. **Navigate to the Cloned Directory** | ||
|
||
```bash | ||
cd python-example-plugin | ||
``` | ||
|
||
3. **Install Your Plugin** | ||
|
||
When developing the plugin, you may want to install an editable package to your Python environment, this allows you | ||
to update the codes without having to reinstall the package everytime: | ||
```bash | ||
pip install -e . | ||
``` | ||
**NOTE: It is strongly recommended to create a virtual environment for your Endstone server and plugins. When | ||
installing your plugin using `pip install`, please ensure the virtual environment is activated.** | ||
|
||
Ensure your plugin is loaded correctly by checking the server logs or console for the log messages. | ||
|
||
4. **Package and Distribute Your Plugin** | ||
|
||
When everything is good to go, you can package your plugin into a `.whl` (Wheel) file for easier distribution: | ||
|
||
```bash | ||
pip install pipx | ||
pipx run build --wheel | ||
``` | ||
|
||
This command will produce a `.whl` file in the `dist` directory. Copy the `.whl` file to the `plugins` directory | ||
of your Endstone server. Start the Endstone server and check the logs to ensure your plugin loads and operates | ||
as expected. | ||
|
||
To publish your plugin to a package index such as PyPI, please refer to: | ||
- [Using TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/) | ||
- [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/) | ||
|
||
## Documentation | ||
|
||
For a deeper dive into the Endstone API and its functionalities, refer to the main | ||
Endstone [documentation](https://endstone.readthedocs.io) (WIP). | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | ||
Endstone plugin that tests the functionality of APIs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,20 @@ requires = ["hatchling"] | |
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "endstone-example" | ||
version = "0.4.0" | ||
name = "endstone-test" | ||
version = "0.0.1" | ||
dependencies = [] | ||
authors = [ | ||
{ name = "Vincent Wu", email = "[email protected]" }, | ||
{ name = "Endstone Developers", email = "[email protected]" }, | ||
] | ||
description = "Python example plugin for Endstone servers" | ||
description = "Endstone plugin that tests the functionality of APIs." | ||
readme = "README.md" | ||
license = { file = "LICENSE" } | ||
keywords = ["endstone", "plugin"] | ||
keywords = ["endstone", "plugin", "test"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/EndstoneMC/python-example-plugin" | ||
Homepage = "https://github.com/EndstoneMC/endstone-test" | ||
|
||
[project.entry-points."endstone"] | ||
example = "endstone_example:ExamplePlugin" | ||
test = "endstone_test:TestPlugin" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from endstone_test.plugin import TestPlugin | ||
|
||
__all__ = ["TestPlugin"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from endstone.plugin import Plugin | ||
|
||
|
||
class TestPlugin(Plugin): | ||
name = "EndstoneTest" | ||
api_version = "0.4" | ||
|
||
def on_load(self) -> None: | ||
self.logger.info("on_load is called!") | ||
|
||
def on_enable(self) -> None: | ||
self.logger.info("on_enable is called!") | ||
|
||
def on_disable(self) -> None: | ||
self.logger.info("on_disable is called!") |