import type { MultiplePlayersArgumentOf } from 'sandstone/arguments' import type { Macroable } from 'sandstone/core' import { CommandNode } from 'sandstone/core/nodes' import { targetParser } from 'sandstone/variables/parsers' import { CommandArguments } from '../../helpers' export class TransferCommandNode extends CommandNode { command = 'transfer' as const } export class TransferCommand extends CommandArguments { protected NodeType = TransferCommandNode /** * Forces the targeted player(s) to directly connect to another minecraft server. * * Defaults to targeting `@s`. */ transfer( hostname: Macroable, port?: Macroable, targets?: Macroable, MACRO>, ) { const args: unknown[] = [hostname] if (port) { args.push(port) if (targets !== undefined) { args.push(targetParser(targets)) } } else { args.push(25565, targets === undefined ? undefined : targetParser(targets)) } return this.finalCommand(args) } }