#why cant the property "startsWith" be read?
1 messages · Page 1 of 1 (latest)
okay good
What is msg? i mean what is the vlue of it?
yes i mean what is message, the value of it you entered?
okay
Ill change the code a little bit
BTW what is the const cmds?
i meant commands[0]
the variable arg is an object so there is no way to use startWith on it
use arg[0]
or arg[1]
if that doesn't work you can try something like arg.includes('value')
I cant really help cuz i dont really understand the code sorry
okay btw if you want to have all the args in a array you cnan use the spread operator like:
const [cmds, ...arg] = msg.split(" ");
okay
try to replace:
const [cmds, arg] = msg.split(" ");
with:
const [cmds, ...arg] = msg.split(" ");
it will add the rest to arg:
msg = '.call 1 2 3'
const [cmds, ...arg] = msg.split(" ");
cmds // [".call"]
arg // ["1", "2", "3"]
i cant really explain what it does
it just adds the rest of the splitted thing to arg as a array
okay good
you'll need to save the warps in a scoreboard so you can awalys load and save them
thats my syste, i use to save and load things
import { overworld } from './dimensions'
export default class Scoreboard {
/**
* @param {string} target
* @param {string} objective
* @param {number} value
*/
static add (target, objective, value) {
overworld.runCommandAsync(`scoreboard players add ${target} "${objective}" ${value}`)
}
/**
* @param {string} target
* @param {string} objective
* @param {number} value
*/
static remove (target, objective, value) {
overworld.runCommandAsync(`scoreboard players remove "${target}" "${objective}" ${value}`)
}
/**
* @param {string} target
* @param {string} objective
* @param {number} value
*/
static set (target, objective, value) {
overworld.runCommandAsync(`scoreboard players set "${target}" "${objective}" ${value}`)
}
/**
* @param {string} target
* @param {string} objective
*/
static reset (target, objective) {
overworld.runCommandAsync(`scoreboard players reset "${target}" "${objective}"`)
}
/**
* @param {string} objective
*/
static clear (objective) {
overworld.runCommandAsync(`scoreboard players reset * "${objective}"`)
}
}