2020-09-09 18:51:02 -05:00
|
|
|
export default {
|
|
|
|
name: 'intervalled-broadcasts',
|
|
|
|
description:
|
2020-09-10 16:53:02 -05:00
|
|
|
'The `intervalled-broadcasts` plugin allows you to set broadcasts, which will be broadcasted at preset intervals',
|
2020-09-09 18:51:02 -05:00
|
|
|
|
|
|
|
defaultEnabled: false,
|
|
|
|
optionsSpec: {
|
|
|
|
broadcasts: {
|
|
|
|
required: false,
|
2020-09-12 13:00:25 -05:00
|
|
|
description: 'The broadcasted messages.',
|
|
|
|
default: ['Server powered by SquadJS.']
|
2020-09-09 18:51:02 -05:00
|
|
|
},
|
|
|
|
interval: {
|
|
|
|
required: false,
|
2020-09-12 13:00:25 -05:00
|
|
|
description: 'How frequently to broadcast in seconds.',
|
|
|
|
default: 5 * 60 * 1000
|
2020-09-09 18:51:02 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
init: async (server, options) => {
|
|
|
|
setInterval(() => {
|
|
|
|
server.rcon.broadcast(options.broadcasts[0]);
|
|
|
|
|
|
|
|
options.broadcasts.push(options.broadcasts.shift());
|
2020-09-10 16:53:02 -05:00
|
|
|
}, options.interval);
|
2020-09-09 18:51:02 -05:00
|
|
|
}
|
|
|
|
};
|