mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 11:54:23 -05:00
add player_name_changed event
This commit is contained in:
parent
8c34efce76
commit
38fa85b64b
@ -214,9 +214,6 @@ export default class SquadServer extends EventEmitter {
|
||||
console.log('logging player connected');
|
||||
data.player = await this.getPlayerBySteamID(data.steamID);
|
||||
if (data.player) data.player.suffix = data.playerSuffix;
|
||||
else {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
delete data.steamID;
|
||||
delete data.playerSuffix;
|
||||
@ -226,8 +223,6 @@ export default class SquadServer extends EventEmitter {
|
||||
|
||||
this.logParser.on('PLAYER_DISCONNECTED', async (data) => {
|
||||
data.player = await this.getPlayerBySteamID(data.steamID);
|
||||
|
||||
if (!data.player) console.log(data);
|
||||
|
||||
delete data.steamID;
|
||||
|
||||
@ -368,6 +363,12 @@ export default class SquadServer extends EventEmitter {
|
||||
|
||||
for (const player of this.players) {
|
||||
if (typeof oldPlayerInfo[player.steamID] === 'undefined') continue;
|
||||
if (player.name !== oldPlayerInfo[player.steamID].name)
|
||||
this.emit('PLAYER_NAME_CHANGE', {
|
||||
player: player,
|
||||
oldName: oldPlayerInfo[player.steamID].name,
|
||||
newName: player.name
|
||||
});
|
||||
if (player.teamID !== oldPlayerInfo[player.steamID].teamID)
|
||||
this.emit('PLAYER_TEAM_CHANGE', {
|
||||
player: player,
|
||||
|
Loading…
Reference in New Issue
Block a user