@flymeth/datapackjs
Version:
A great library to create your own minecraft datapack with javascript!
10 lines (8 loc) • 386 B
text/typescript
function executeCmd(executor:string, command: string) {
if(executor.endsWith('run')) return `execute ${executor} ${command}`
if(command.startsWith('execute ')) return `execute ${executor} ${command.replace('execute ', '')}`
if(!executor) return command
if(!command) return ""
return `execute ${executor} run ${command}`
}
export default executeCmd