Use certain Endstone features directly in your Bedrock add-ons through a JavaScript API. ScriptSDK bridges the gap between Minecraft Bedrock add-ons and Endstone plugin capabilities.
ScriptSDK is a dual-component system:
- JavaScript/TypeScript SDK: Import and use in your Bedrock add-ons
- Endstone Plugin: Python-based server plugin that enables the SDK functionality
- /debug : To enable/disable the plugin's communication logs.
- system.groups ā
Group[]: List of groups initialise
- player.ip ā
string | null: Player's IP address (automatically populated when player spawns) - player.xuid ā
string | null: Player's Xbox User ID (automatically populated when player spawns) - player.device_os ā
string | null: Player's device OS (automatically populated when player spawns) - player.setBossBar(title, color, style, percent) ā
Promise<void>: Create and assign a boss bar to a player with customizable progress percentage (0-100) - player.resetBossBar() ā
Promise<void>: Reset boss bar to a player. - player.sendToast(title, content) ā
Promise<void>: Send toast notification. - player.sendPopup(message) ā
Promise<void>: Send popup.
- entity.setNameTagForPlayer(target, newName) ā
Promise<void>: Set custom entity name visible to specific players - entity.resetNameTagForPlayer(target) ā
Promise<void>: Reset custom entity name to default for a specific target player - entity.getNameTagByPlayer(target) ā
string: Get the custom name tag that a specific entity sees for this player
Create and manage player groups with custom rules:
import { Group } from 'lib/ScriptSDK'; import { GroupRule } from 'lib/src/enums'; // Create a new group with a rule const safeZone = new Group('SafeZone', GroupRule.NO_DAMAGE); // Initialize the group (required before using it) await safeZone.init(); // Add players to the group await safeZone.addPlayer(player); // Remove players from the group await safeZone.removePlayer(player); // Get all players in the group const groupPlayers = safeZone.getPlayers(); // Destroy the group await safeZone.destroy();
Group Properties:
nameāstring: The name of the groupruleāGroupRule: The rule applied to the groupis_createdāboolean: Whether the group was successfully createdis_destroyāboolean: Whether the group has been destroyed
Group Methods:
init()āPromise<void>: Initialize the group on the server (must be called before using the group)addPlayer(player | playerName)āPromise<void>: Add a player to the groupremovePlayer(player | playerName)āPromise<void>: Remove a player from the grouphasPlayer(player | playerName)āboolean: Returns a boolean value indicating whether the player is in the groupgetPlayers()āPlayer[]: Get all players in the groupdestroy()āPromise<void>: Delete the group and remove all players from ittoJson()āobject: Export group to json
Available Rules:
GroupRule.NO_PVP(0) - Players in the group cannot attack each otherGroupRule.NO_DAMAGE(1) - Players in the group take no damage from any sourceGroupRule.PVP_ONLY_GROUP(3) - Players can only attack other players in the same groupGroupRule.NO_PVP_NO_DAMAGE(4) - Combination of NO_PVP and NO_DAMAGE rulesGroupRule.NO_PVP_ONLY_GROUP(5) - Players in the group cannot attack each other (PVP disabled within group only)
Available Colors:
BossBarColor.BLUE(0) - Blue boss barBossBarColor.GREEN(1) - Green boss barBossBarColor.PINK(2) - Pink boss barBossBarColor.PURPLE(3) - Purple boss barBossBarColor.REBECCA_PURPLE(4) - Rebecca purple boss barBossBarColor.RED(5) - Red boss barBossBarColor.WHITE(6) - White boss barBossBarColor.YELLOW(7) - Yellow boss bar
Available Styles:
BossBarStyle.SOLID(0) - Solid progress barBossBarStyle.SEGMENTED_6(1) - 6 segmentsBossBarStyle.SEGMENTED_10(2) - 10 segmentsBossBarStyle.SEGMENTED_12(3) - 12 segmentsBossBarStyle.SEGMENTED_20(4) - 20 segments
- Download the latest release from GitHub Releases
- Copy the following files to your add-on project in a
libfolder.
Your add-on structure should look like:
scripts/
āāā lib/
ā āāā ScriptSDK.js
ā āāā ScriptSDK.d.ts
ā āāā src/...
āāā your-script.js
- Download the latest plugin wheel (
.whl) from GitHub Releases - Place the
.whlfile in your Endstone server'spluginsfolder - Restart your server
After copying the SDK files to your lib folder, import it in your main file:
import 'lib/ScriptSDK'; // Initialisation of the library
Full TypeScript support with type definitions included:
import { Player } from '@minecraft/server'; import { BossBarColor, BossBarStyle } from 'lib/ScriptSDK'; import { GroupRule } from 'lib/src/enums'; import { Group } from 'lib/src/groups'; // TypeScript will provide autocomplete and type checking const pvpGroup = new Group('PvPArena', GroupRule.PVP_ONLY_GROUP); // Initialize the group before using it await pvpGroup.init(); const setupPlayer = async (player: Player) => { await player.setBossBar('Health Bar', BossBarColor.RED, BossBarStyle.SOLID, 80); await pvpGroup.addPlayer(player); };
This project is licensed under the GPL-2.0 License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please open an issue on GitHub.