New error
Closed this issue · 1 comments
\node_modules\haxball.js\src\index.js:2172
throw l.vi(ab instanceof l ? ab.Db : ab);
^
SyntaxError: JSON5: invalid character ',' at 1:8943
at syntaxError (C:\Users\moises\Documents\mxm\node_modules\json5\lib\parse.js:1110:17)
at invalidChar (C:\Users\moises\Documents\mxm\node_modules\json5\lib\parse.js:1055:12)
at Object.end (C:\Users\moises\Documents\mxm\node_modules\json5\lib\parse.js:704:15)
at Object.default (C:\Users\moises\Documents\mxm\node_modules\json5\lib\parse.js:168:37)
at lex (C:\Users\moises\Documents\mxm\node_modules\json5\lib\parse.js:100:42)
at Object.parse (C:\Users\moises\Documents\mxm\node_modules\json5\lib\parse.js:25:17)
at n.Xg (C:\Users\moises\Documents\mxm\node_modules\haxball.js\src\index.js:3198:21)
at Object.setCustomStadium (C:\Users\moises\Documents\mxm\node_modules\haxball.js\src\index.js:2170:17)
at startGame (C:\Users\moises\Documents\mxm\index.js:833:22)
at Timeout._onTimeout (C:\Users\moises\Documents\mxm\index.js:1032:30) {
lineNumber: 1,
columnNumber: 8943
}
Node.js v18.16.0
Do you know what this error could be? Happens when I call this function in onPlayerJoin:
function startGame(victory, player) { // Serve para Mover os players para os times corretos
const players = room.getPlayerList()
if (victory) {
room.stopGame()
if (players.length >= 6) {
const playersSpec = room.getPlayerList().filter(p => p.team === 0)
const playersPlaying = room.getPlayerList().filter(p => p.team !== 0)
for (let i = 0; i < playersSpec.length; i++) {
if (playersPlaying.length === 0) {
if (i <= 9) {
const team = (i % 2) + 1
room.setPlayerTeam(playersSpec[i].id, team)
}
} else if (playersPlaying.length === 1) {
if (i <= 8) {
const team = (i % 2) + 1
room.setPlayerTeam(playersSpec[i].id, team)
}
}
}
room.startGame()
} else {
room.stopGame()
centralizedMessages(`❌ Players insuficientes para começar um novo jogo.`, undefined, colors.red, "bold", 2)
centralizedMessages(`🔄 Iniciando mapa de treinamento...`, undefined, colors.cu, "bold", 2)
setTrainningMap()
}
} else {
if (players.length >= 6 && gameStage.ranked === false) {
room.stopGame()
setAutoTeam('all')
centralizedMessages(`🔁 Batemos 6/10 players! Iniciado a partida...`, undefined, colors.green, "bold", 2)
room.setCustomStadium(map)
gameStage.ranked = true
setTimeout(() => room.startGame(), 2000)
}
else if (players.length < 6 && gameStage.ranked === false) {
if (!gameStage.playing) room.startGame()
gameStage.ranked = false
centralizedMessages(`😒 Estamos em fase de aquecimento... Aguarde mais ${6 - players.length} players para começar o jogo.`, undefined, colors.cu, "bold", 2)
room.setPlayerTeam(player.id, 1)
}
}
}
Srry, I had an extra comma on my map.