Skip to content

Commit

Permalink
Merge pull request #12 from m626zNq/main
Browse files Browse the repository at this point in the history
Username Profanity
  • Loading branch information
codergautam authored Jan 1, 2024
2 parents 90ad3f5 + be4f7f8 commit 1d0521f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/src/game/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const GlobalEntities = require('./GlobalEntities');
const Player = require('./entities/Player');
const helpers = require('../helpers');
const config = require('../config');

const filter = require('leo-profanity')
class Game {
constructor() {
this.entities = new Set();
Expand Down Expand Up @@ -218,12 +218,13 @@ class Game {
// : (client.account ? client.account.username : this.handleNickname(data.name || ''));
const name = client.account && client.account.username ? client.account.username : (
client.player && client.player.name ? client.player.name
: this.handleNickname(data.name || '')
: this.handleNickname(filter.clean(data.name) || '')
)
if(data?.name && data.name !== name) {
data.name = name;
}


// if (this.isNameReserved(name)) return;

const player = new Player(this, name);
Expand Down

0 comments on commit 1d0521f

Please sign in to comment.