A lightweight Tebex integration plugin for SerenityJS.
npm install tebexityOn first run, a config file is created at ./plugins/configs/tebexity/config.yml:
# Tebex API URL (don't change unless you know what you're doing)
url: https://plugin.buycraft.net
# Your Tebex server secret key
secret: ""
# How often to check for new purchases (in seconds)
checkInterval: 120Get your secret key from your Tebex server settings.
Listen for purchase commands in your plugin:
import { TebexManager } from "tebexity";
// In your plugin's onStartUp or onInitialize:
TebexManager.getInstance().on("message", (player, commands) => {
// player: Player - the online player who made a purchase
// commands: string[] - array of command strings to execute
for (const command of commands) {
// Handle the command however you want
// e.g. parse "give {username} diamond 64" and give items
console.log(`Executing for ${player.username}: ${command}`);
}
});- Plugin polls Tebex API on the configured interval
- When a player with pending commands comes online, their commands are fetched
- The
messageevent is emitted with the player and their commands - Commands are automatically deleted from Tebex queue after emitting
- Offline players are ignored - their commands stay in Tebex queue until they join
| Event | Parameters | Description |
|---|---|---|
message |
(player: Player, commands: string[]) |
Fired when an online player has pending commands |
MIT