websender.js
v1.0.5
Published
A dual ESM/CJS TypeScript library for Minecraft Websender.
Readme
websender-js
A dual ESM/CJS TypeScript library for Minecraft Websender.
Usage
ESM
import { Websender } from 'websender-js';CommonJS
const { Websender } = require('websender-js');Features
- Connect to Minecraft servers via WebSocket
- Send commands and receive responses
- TypeScript support
- Easy to use and integrate
- Example applications and usage scenarios
Installation
npm install websender-jsBasic Connection
import { WebSender } from 'websender-js';
const sender = new WebSender({
host: 'localhost',
port: 8080,
password: 'your-password'
});
// Start connection
await sender.connect();
// Send command
const response = await sender.sendCommand('say Hello World!');
// Close connection
await sender.disconnect();Example Applications
The project includes various example applications:
connection_test.ts: Basic connection testcommand_line.ts: Command line interfacemerchant.ts: Merchant operations examplecommand_input.ts: User input command example
API Reference
WebSender Class
class WebSender {
constructor(config: WebSenderConfig);
connect(): Promise<void>;
disconnect(): Promise<void>;
sendCommand(command: string): Promise<string>;
}WebSenderConfig Interface
interface WebSenderConfig {
host: string;
port: number;
password: string;
}Development
To develop the project:
- Clone the repository
- Install dependencies:
npm install - Start the development server:
npm start
Testing
To run tests:
npm testLicense
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Contact
For questions or suggestions, please use GitHub Issues.
