This repository has been archived on 2026-06-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

28 lines
730 B
JavaScript

function inject (bot) {
bot.on('player_data_loaded', (player, data) => {
data.data.seen ??= {}
const seenData = data.data.seen
if (seenData.first == null) {
seenData.first = createSeenValue()
bot.tellraw([
{ text: 'Welcome ', ...bot.styles.primary },
{ text: player.username, ...bot.styles.secondary },
' to the server!'
], '@a')
}
seenData.last = createSeenValue()
})
bot.on('player_data_unloading', (player, data) => {
const seenData = data.data.seen
if (seenData != null) seenData.last = createSeenValue()
})
function createSeenValue () {
return { date: new Date(), host: bot.host, port: bot.port ?? 25565 }
}
}
module.exports = inject