bukkit-openhab-client
Version:
Client for the Minecraft bukkit-openhab-plugin
61 lines (60 loc) • 1.88 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from 'events';
export declare enum CommandType {
PLAYER_HEALTH = "PLAYER_HEALTH",
PLAYER_WALKSPEED = "PLAYER_WALK_SPEED",
PLAYER_LEVEL = "PLAYER_LEVEL",
PLAYER_GAMEMODE = "PLAYER_GAME_MODE",
PLAYER_LOCATION = "PLAYER_LOCATION",
SIGN_STATE = "COMMAND_SIGN_ACTIVE"
}
interface PlayerCommand {
playerName: string;
}
interface SignCommand {
signName: string;
}
export interface PlayerHealthCommand extends PlayerCommand {
health: number;
}
export interface PlayerWalkSpeedCommand extends PlayerCommand {
walkSpeed: number;
}
export interface PlayerLevelCommand extends PlayerCommand {
level: number;
}
export interface PlayerGameModeCommand extends PlayerCommand {
gameMode: GameMode;
}
export interface PlayerLocationCommand extends PlayerCommand {
location: string;
}
export interface SignStateCommand extends SignCommand {
state: boolean;
}
declare type CommandArgs = PlayerHealthCommand | PlayerWalkSpeedCommand | PlayerLevelCommand | PlayerGameModeCommand | PlayerLocationCommand | SignStateCommand;
export declare type GameMode = 'CREATIVE' | 'SURVIVAL' | 'ADVENTURE' | 'SPECTATOR';
export interface ClientOptions {
port?: number;
reconnect?: boolean;
reconnectInterval?: number;
maxReconnects?: number;
}
export declare class Client extends EventEmitter {
private options;
private url;
private ws;
private reconnectCount;
constructor(host: string, options?: ClientOptions);
private connect;
close(): void;
private reconnect;
private onMessage;
private onPlayerMessage;
private onServerMessage;
private onSignMessage;
send(command: CommandType, commandArgs: CommandArgs): void;
private sendCommand;
}
export declare function connect(host: string, options?: ClientOptions): Client;
export {};