mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 16:24:25 -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');
|
console.log('logging player connected');
|
||||||
data.player = await this.getPlayerBySteamID(data.steamID);
|
data.player = await this.getPlayerBySteamID(data.steamID);
|
||||||
if (data.player) data.player.suffix = data.playerSuffix;
|
if (data.player) data.player.suffix = data.playerSuffix;
|
||||||
else {
|
|
||||||
console.log(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete data.steamID;
|
delete data.steamID;
|
||||||
delete data.playerSuffix;
|
delete data.playerSuffix;
|
||||||
@ -227,8 +224,6 @@ export default class SquadServer extends EventEmitter {
|
|||||||
this.logParser.on('PLAYER_DISCONNECTED', async (data) => {
|
this.logParser.on('PLAYER_DISCONNECTED', async (data) => {
|
||||||
data.player = await this.getPlayerBySteamID(data.steamID);
|
data.player = await this.getPlayerBySteamID(data.steamID);
|
||||||
|
|
||||||
if (!data.player) console.log(data);
|
|
||||||
|
|
||||||
delete data.steamID;
|
delete data.steamID;
|
||||||
|
|
||||||
this.emit('PLAYER_DISCONNECTED', data);
|
this.emit('PLAYER_DISCONNECTED', data);
|
||||||
@ -368,6 +363,12 @@ export default class SquadServer extends EventEmitter {
|
|||||||
|
|
||||||
for (const player of this.players) {
|
for (const player of this.players) {
|
||||||
if (typeof oldPlayerInfo[player.steamID] === 'undefined') continue;
|
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)
|
if (player.teamID !== oldPlayerInfo[player.steamID].teamID)
|
||||||
this.emit('PLAYER_TEAM_CHANGE', {
|
this.emit('PLAYER_TEAM_CHANGE', {
|
||||||
player: player,
|
player: player,
|
||||||
|
Loading…
Reference in New Issue
Block a user