Money Connectv0.1.0
Pythonby yuhangleUnify the interfaces of various economy plugins for Endstone, provide unified calls, and support C++.
- Stars
- 2
PLUGINSMONEY CONNECT
# Install
Use the animation for reference. Follow the plugin's README for exact steps.
# README
MoneyConnect is an Endstone economy bridge plugin that provides a unified economic service interface, allowing Python and C++ plugins to seamlessly work with various Python economy plugins without having to adapt to each one individually.
Features
- 🔌 Unified Interface: Provides standardized economy service API
- 🔄 Multiple Economy Plugins: Supports UMoney, JSONMoney, JWEconomy and more
- 🚀 pybind11 Bindings: C++ plugins can call directly
- 🔧 Auto Adaptation: Automatically detects and adapts to available economy plugins
Supported Economy Plugins
| Plugin | Status | Description |
|---|---|---|
| UMoney | ✅ Supported | Adapted via UMoney API |
| JSONMoney | ✅ Supported | Adapted via JSONMoney API |
| JWEconomy | ✅ Supported | Adapted via JWEconomy API (async API with sync wrapper) |
Installation
Install from wheel
Download the .whl file for your server platform and Python version from Releases, and place it in the server's plugins/ directory.
Build from source
git clone https://github.com/EndstoneMC/endstone_money_connect.git
cd endstone_money_connect
# Install dependencies
uv sync
# Build wheel (default current Python version, requires Clang compiler)
CC=clang CXX=clang++ uv build
# Build for specific Python version (e.g., Python 3.14)
CC=clang CXX=clang++ UV_PYTHON=python3.14 uv build
# Copy build artifact to server's plugins/ directory
cp dist/endstone_money_connect-*.whl /path/to/server/plugins/Use as C++ library
Add to your C++ project's CMakeLists.txt:
FetchContent_Declare(
endstone_money_connect
GIT_REPOSITORY https://github.com/yuhangle/endstone-money-connect.git
GIT_TAG main
)
FetchContent_MakeAvailable(endstone_money_connect)
target_link_libraries(your_plugin PRIVATE endstone_money_connect)Then include the header in your C++ code:
#include <money_connect/money_connect.h>Usage
C++ Plugin (Recommended)
C++ plugins can call economy services directly via pybind11 bindings:
#include <endstone/endstone.hpp>
#include <money_connect/money_connect.h>
class MyPlugin : public endstone::Plugin {
public:
void onEnable() override
{
// Check if money_connect plugin is loaded
if (!getServer().getPluginManager().getPlugin("money_connect")) {
getLogger().warning("MoneyConnect plugin is required!");
getServer().getPluginManager().disablePlugin(*this);
return;
}
// Load the economy service
economy_ = getServer().getServiceManager().load<money_connect::EconomyService>("MoneyConnect");
if (!economy_) {
getLogger().warning("MoneyConnect economy service not available!");
getServer().getPluginManager().disablePlugin(*this);
return;
}
// Get player balance
double balance = economy_->get_balance("Steve");
getLogger().info("Steve's balance: {}", balance);
// Add balance to player
economy_->add_balance("Steve", 100);
// Remove balance from player
economy_->remove_balance("Steve", 50);
// Set player balance
economy_->set_balance("Steve", 1000);
// Check if player has enough balance
bool has_enough = economy_->has_enough("Steve", 100);
}
private:
std::shared_ptr<money_connect::EconomyService> economy_;
};Python Plugin
Python plugins can call economy services via ServiceManager:
from endstone.plugin import Plugin
class MyPlugin(Plugin):
def on_enable(self):
# Load economy service
economy = self.server.service_manager.load("MoneyConnect")
if economy:
# Get balance
balance = economy.get_balance("Steve")
# Add balance
economy.add_balance("Steve", 100)
# Remove balance
economy.remove_balance("Steve", 50)
# Set balance
economy.set_balance("Steve", 1000)
# Check balance
has_enough = economy.has_enough("Steve", 100)Development
Project Structure
money_connect/
__init__.py # Plugin entry point
plugin.py # Main plugin class
economy_service.py # Economy service interface
adapters/
__init__.py
umoney_adapter.py # UMoney adapter
jsonmoney_adapter.py # JSONMoney adapter
jweconomy_adapter.py # JWEconomy adapter
include/money_connect/
money_connect.h # C++ header file
money_connect/
_money_connect.cpp # pybind11 bindings
CMakeLists.txt # CMake build configuration
pyproject.toml # Python project configurationAdding a New Economy Plugin Adapter
- Create a new adapter file in the
adapters/directory - Inherit from
EconomyServiceclass - Implement all interface methods
- Add the new plugin name to
SUPPORTED_ECONOMIESlist inplugin.py - Add adapter creation logic in
_create_adaptermethod
Example:
# adapters/my_economy_adapter.py
from endstone.plugin import Plugin
from ..economy_service import EconomyService
class MyEconomyAdapter(EconomyService):
def __init__(self, plugin: Plugin):
super().__init__()
self._plugin = plugin
def get_balance(self, player_name: str) -> float:
# Implement get balance logic
pass
def add_balance(self, player_name: str, amount: float) -> bool:
# Implement add balance logic
pass
def remove_balance(self, player_name: str, amount: float) -> bool:
# Implement remove balance logic
pass
def set_balance(self, player_name: str, amount: float) -> bool:
# Implement set balance logic
pass
def has_enough(self, player_name: str, amount: float) -> bool:
# Implement has enough logic
pass
def get_name(self) -> str:
return "MyEconomy"
def get_version(self) -> str:
return "1.0.0"Build
# Install dependencies
uv sync
# Code linting
uv run ruff check money_connect/
# Build plugin (default current Python version)
CC=clang CXX=clang++ uv build
# Build for specific Python version (e.g., Python 3.14)
CC=clang CXX=clang++ UV_PYTHON=python3.14 uv buildLicense
MIT License
Related Links
Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.
Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.