{"id":23252625,"url":"https://github.com/biyuehu/mcwss","last_synced_at":"2025-07-03T22:35:59.300Z","repository":{"id":135094655,"uuid":"386241873","full_name":"BIYUEHU/mcwss","owner":"BIYUEHU","description":"A simple Minecraft Bedrock Edition websocket server framework, help developer to setup websocket server faster for Minecraft or your self package depend on it","archived":false,"fork":false,"pushed_at":"2024-06-07T10:46:27.000Z","size":7289,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T18:47:27.179Z","etag":null,"topics":["javascript","js","minecraft-bedrock","minecraft-bedrock-edition","minecraft-bedrock-plugin","minecraft-mod","minecraft-plugin","minecraft-server","node","nodejs","websocket","websocket-server","ws"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BIYUEHU.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-15T09:56:14.000Z","updated_at":"2024-08-14T01:27:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"617123d5-ceb2-4dce-9dd3-2c359fe04762","html_url":"https://github.com/BIYUEHU/mcwss","commit_stats":null,"previous_names":["biyuehu/mcwss"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/BIYUEHU/mcwss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIYUEHU%2Fmcwss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIYUEHU%2Fmcwss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIYUEHU%2Fmcwss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIYUEHU%2Fmcwss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BIYUEHU","download_url":"https://codeload.github.com/BIYUEHU/mcwss/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIYUEHU%2Fmcwss/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260519336,"owners_count":23021446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","js","minecraft-bedrock","minecraft-bedrock-edition","minecraft-bedrock-plugin","minecraft-mod","minecraft-plugin","minecraft-server","node","nodejs","websocket","websocket-server","ws"],"created_at":"2024-12-19T10:17:25.754Z","updated_at":"2025-07-03T22:35:59.258Z","avatar_url":"https://github.com/BIYUEHU.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mcwss [![npm package](https://badgen.net/npm/v/mcwss)](https://npmjs.com/package/mcwss) [![wakatime](https://wakatime.com/badge/user/018dc603-712a-4205-a226-d4c9ccd0d02b/project/018dceb3-4749-44d6-93be-b3e581301a74.svg)](https://wakatime.com/badge/user/018dc603-712a-4205-a226-d4c9ccd0d02b/project/018dceb3-4749-44d6-93be-b3e581301a74)\n\n\u003e The project is refactory version for version of three years (2021) ago base on TypeScript.\n\nA simple Minecraft Bedrock Edition websocket server framework, help developer to setup websocket server faster for Minecraft or your self package depend on it.Its core `Mcwss` base a events emiter and provide many of events which can be listened.In addition,it provides `Client` instance object to interact with every client.\n\n## 🧊 Usage\n\n\u003e What? You donot know how to install Node.js program? Are you kidding me? Please find [Google Search](https://google.com) to help you.\n\nBase on program cli to start:\n\n```sh\nmcwss\n```\n\nFor C(~~Z~~)hinese(English understanding hard population):\n\n```sh\nmcwss --lang zh_CN\n```\n\nStart your Minecraft Bedrock Edition and input commands:\n\n```sh\n/wsserver ws://localhost:1\n# or:\n/connect ws://localhost:1\n```\n\nTest a few:\n\n```sh\n*/help\n*/helph\n```\n\n### Options\n\n- `--port [num]` Set websocket server port\n- `--mode [type]` Set logger level, debug or build\n- `--lang [locale]` Set view language, en_US, ja_JP, zh_TW, zh_CN\n- `-v, --version` Display version number\n- `-h, --help` Display this message\n\nExample:\n\n```sh\nmcwss --port 2333 --mode debug --lang ja_JP\n```\n\n### built-in commands\n\n- `*/help` Show Mcwss command help\n- `*/connect` Show WebSocket connection time\n- `*/about` Show about informatio\n- `*/clears` Clear chat content\n- `*/func \u003cpath\u003e` Execute mcfunction on server\n- `*/helph` Show hidden command help,\n\nGame hidden Command:\n\n- `./closewebsocket` Close websocket connection\n- `./gettopsolidblock \u003cx\u003e \u003cy\u003e \u003cz\u003e` Get top solid block coordinates\n- `./querytarget \u003cselector\u003e` Get precise float coordinates of entity\n- `./agent` Mascot\n- `./enableencryption` Unknown\n- `./closechat` Close chat\n- `./geteduclientinfo` Get version info\n- `./getlocalplayername` Return player name\n\n## 🎯 Events\n\nLifecycle Events:\n\n- ready\n- dispose\n- error\n- connection\n- message\n- close\n\nMinecraft Events:\n\n- block_broken\n- block_placed\n- end_of_day\n- entity_spawned\n- item_acquired\n- item_crafted\n- item_destroyed\n- item_smelted\n- item_used\n- jukebox_used\n- mob_interacted\n- mob_killed\n- player_bounced\n- player_died\n- player_message\n- player_teleported\n- player_transform\n- player_travelled\n- unknown_minecraft_event\n- command_response\n\n## 🚀 Class\n\n### Mcwss\n\n- `start(): void` Start a websocket server\n- `stop(): void` Stop a websocket server\n\nExtends `Events`:\n\n- `emit\u003cT extends keyof EventsList\u003e(type: T, ...data: [...Parameters\u003cEventsList[T]\u003e]): void` Emit a event\n- `parallel\u003cT extends keyof EventsList\u003e(type: T, ...data: [...Parameters\u003cEventsList[T]\u003e]): Promise\u003cvoid\u003e` Emit a event asynchronous\n- `on\u003cT extends keyof EventsList\u003e(type: T, callback: EventsList[T]): void` Listen a event\n- `once\u003cT extends keyof EventsList\u003e(type: T, callback: EventsList[T]): void` Listen a event once\n- `off\u003cT extends keyof EventsList\u003e(type: T, callback: EventsList[T]): void` Cancel to listen a event\n- `offAll\u003cT extends keyof EventsList\u003e(type: T): void` Cancel to listen all events\n\n### Client\n\n- `req: IncomingMessage` Client websocket object\n- `sessionId: number` Connection identify at `Mcwss`\n- `sessionDate: Date` Connection setup time\n- `send(data: SendPacket): void` Send a packet to client\n- `close(): void` Close connection with client\n- `subscribe(event: MinecraftEvents): void` Subscribe a minecraft event\n- `unsubscribe(event: MinecraftEvents): void` Unsubscribe a minecraft event\n- `run(cmd: string | string[]): void` Run a or many of command to client\n- `chat(message: string): void` Send a normal message to client (Base for `/say`)\n- `chatf(message: string, color?: TextColor, sender?: string, target: CommandTarget = CommandTarget.SELF): void` Send a advanced message to client (Base for `/tellraw`)\n- `func(file: string): void` Run a `.mcfunction` file to client\n\n```typescript\nconst enum TextColor {\n  GREEN = '§a',\n  RED = '§c',\n  BLUE = '§b',\n  YELLOW = '§e'\n}\n\nconst enum CommandTarget {\n  ALL = '@a',\n  SELF = '@s',\n  RANDOM = '@r',\n  EVERY = '@e',\n  NEAR = '@p'\n}\n```\n\n## 🧩 Internationalization\n\nSupports languages:\n\n- English\n- 日本語 (Japanese)\n- 繁體中文 (Traditional Chinese)\n- 简体中文（Simplified Chinese）\n\n## 🌰 Example\n\nSetup your self program or package base on Mcwss, refer to `src/utils/line.ts` for more information.\n\n```typescript\nimport Mcwss from 'mcwss';\nimport { log, error } from 'console';\n\nconst mcwss = new Mcwss({ port: 2333 });\n\n/* events register */\nmcwss.on('ready', () =\u003e log(`WebSocketServer started at ws://localehost:${port} `));\n\nmcwss.on('dispose', () =\u003e log('WebSocketServer stopped'));\n\nmcwss.on('error', (data) =\u003e\n  error(data.client ? `[Client:${data.client.sessionId}]` : '[Server]', data.error.name, data.error.message)\n);\n\nmcwss.on('connection', (data) =\u003e\n  log(`[Client:${data.client.sessionId}]`, 'new connection from', data.client.req.socket.remoteAddress)\n);\n\nmcwss.on('close', (data) =\u003e {\n  if (data.raw) {\n    log(`[Client:${data.raw.client.sessionId}]`, 'Closing in progress code:', data.raw.code);\n    return;\n  }\n  log('WebSocketServer is closeing...');\n});\n\nmcwss.on('block_broken', (data) =\u003e {\n  const { block, player, tool } = data.body;\n  /* ... */\n});\n\nmcwss.on('end_of_day', (data) =\u003e {\n  const { player } = data.body;\n  /* ... */\n});\n\n/* ... */\n\nmcwss.start();\n```\n\n## 📜 License\n\nComply with The GNU General Public License v3.0 open-source license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiyuehu%2Fmcwss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiyuehu%2Fmcwss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiyuehu%2Fmcwss/lists"}