Skip to content

smartcmd/python-example-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Endstone Python Plugin Template

Welcome to the official Python plugin template for Endstone. This repository provides a basic structure and a sample plugin to help developers start writing plugins for the Bedrock Dedicated Servers in Python using the Endstone API.

Prerequisites

  • Python 3.9 or higher.
  • Endstone installed and set up in your Python environment.

Structure Overview

python-plugin-template/ 
├── src/                          # Main source directory 
│   └── endstone_plugin/          # 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
├── CHANGELOG.md                  # Changelogs
├── LICENSE                       # License details
├── README.md                     # This file
└── pyproject.toml                # Plugin configuration file which specifies the entrypoint

Getting Started

  1. Clone this Repository

    git clone https://github.com/EndstoneMC/python-plugin-template.git
  2. Navigate to the Cloned Directory

    cd python-plugin-template
  3. Configurate

    1. Open the pyproject.toml and change the name under the [project] section from endstone-plugin to your own name for your plugin.
    2. Rename the folder src/endstone_plugin to src/{your_plugin_name}.
    3. Rename the PythonSamplePlugin class within src/{your_plugin_name}/__init__.py to, for example.
    4. Open the pyproject.toml again and update the entrypoint under the [project.entry-points."endstone"] section.
  4. Test 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:

    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.

  5. Package and Distribute Your Plugin

    When everything is good to go, you can package your plugin into a .whl (Wheel) file for easier distribution:

    pip install wheel
    python -m pip wheel . --no-deps --wheel-dir=wheelhouse

    This command will produce a .whl file in the wheelhouse directory which can be installed. To publish your plugin to a package index such as PyPI, please refer to:

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Python example plugin for Endstone servers

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%