fix illegal username bug
This commit is contained in:
parent
6093ecb08c
commit
a1f858080c
1 changed files with 2 additions and 2 deletions
4
index.js
4
index.js
|
@ -62,8 +62,8 @@ app.ws('/', function (ws, req) {
|
|||
}
|
||||
);
|
||||
j = await j.json();
|
||||
if (game.ws.findIndex(x => x.username == j.username) != -1) {
|
||||
console.log(`Player ${player.you} uses username ${ws.username} illegally`)
|
||||
if (game.ws.findIndex(x => x.username == j.username && x.health >= 0) != -1) {
|
||||
console.log(`Player ${player.you} uses username ${x.username} illegally`)
|
||||
return;
|
||||
}
|
||||
ws.username = j.username;
|
||||
|
|
Loading…
Reference in a new issue