If you are using version 6.9.0 or higher, you can use the built in player tracker component to make a very concise notifier plugin
Code:
import { NrPlugin, PluginManager, Log } from '../core/plugin-module';
import { PlayerTracker } from './player-tracker';
import { IPlayerData } from '../models/playerdata';
/*
* The // here is to avoid tagging NRP. Remove it before compiling this plugin.
*/
@//NrPlugin({ name: 'Player Notifier', author: 'Killer Be Killed' })
class PlayerNotifier {
names = [
'Eendi',
'Oshyu',
'Saylt'
];
constructor() {
PluginManager.afterInit(() => {
const tracker = PluginManager.getInstanceOf(PlayerTracker);
tracker.trackAllPlayers();
tracker.on('enter', (player: IPlayerData) => {
if (this.names.indexOf(player.name) > -1) {
Log('Notifier', `${player.name} entered ${player.server}`);
}
});
});
}
}
This will work just fine, but you may want to move the 'names' array to an external config file to make it easier to change.