Releases: HRTK92/mcws.js
Releases · HRTK92/mcws.js
Release v1.1.5
仕様の変更はありません
What's Changed
- Bump ts-node from 10.9.1 to 10.9.2 by @dependabot in #5
- Bump uuid from 9.0.0 to 9.0.1 by @dependabot in #8
- Bump ws and @types/ws by @dependabot in #9
- Bump @types/node from 18.11.13 to 20.10.6 by @dependabot in #6
- Bump typescript from 4.9.4 to 5.3.3 by @dependabot in #7
- Bump @types/node from 20.10.6 to 20.10.7 by @dependabot in #10
- Bump @types/node from 20.10.7 to 20.11.0 by @dependabot in #11
- Bump @types/node from 20.11.0 to 20.11.5 by @dependabot in #12
- Bump @types/node from 20.11.5 to 20.11.10 by @dependabot in #13
- Bump @types/node from 20.11.10 to 20.11.16 by @dependabot in #14
- Bump @types/node from 20.11.16 to 20.11.17 by @dependabot in #15
- Bump @types/node from 20.11.17 to 20.11.19 by @dependabot in #16
- Bump @types/node from 20.11.19 to 20.11.20 by @dependabot in #17
- Bump @types/node from 20.11.20 to 20.11.24 by @dependabot in #18
- Bump @types/node from 20.11.24 to 20.11.25 by @dependabot in #19
- Bump typescript from 5.3.3 to 5.4.2 by @dependabot in #20
New Contributors
- @dependabot made their first contribution in #5
Full Changelog: v1.1.4...v1.1.5
Release v1.1.4
Release v1.1.3
- サーバーから受け取ったデータに一部型を追加
Full Changelog: v1.1.2...v1.1.3
Release v1.1.2
- MITライセンスの追加
- npmのkeywordsを追加
Full Changelog: v1.1.1...v1.1.2
Release v1.1.1
READMEを更新
Full Changelog: v1.1.0...v1.1.1
Release v1.1.0
mcwsjs
mcwsjsは簡単にMinecraftのWebSocketサーバーを立てることができるライブラリです。
Install
yarn add @hrtk92/mcwsjs
Example
import { mcws, Events } from '@hrtk92/mcwsjs'
const mcserver = new mcws()
mcserver.onReady((host, port) => {
console.log('サーバーが起動しました')
})
mcserver.onConnection(() => {
console.log('Minecraftと接続しました')
mcserver.sendCommand('say 接続しました') // コマンドを送信
mcserver.subscribe(Events.PlayerMessage) // 受け取るイベントを登録
})
mcserver.on(Events.PlayerMessage, (data) => {
console.log(`${data.body.message} by ${data.body.sender}`)
})
mcserver.onDisconnect(() => {
console.log('接続が切断されました')
})
mcserver.createServer() // サーバーを起動
イベント
onReady
サーバーが起動したときに呼ばれる
onConnect
MineCraftと接続したときに呼ばれる
onDisconnect
接続が切断されたときに呼ばれる
on(event, callback)
eventで指定したイベントが発生したときに呼ばれる
コマンド
mcserver.sendCommand('say hello')
コマンドを送信することができます。
注意: 先頭の/
をつけないでください。
Release v1.0.2
v1.0.2
Release v1.0.1
v1.0.1
Release v1.0.0
v1.0.0
Release v0.2.5
v0.2.5