/** * Wrapper around `Broadcast.at` for all except given Array of players * @see {@link Broadcast#at} * * @param {Broadcastable} source Target source for the message (e.g., Room, Party, Player) * @param {string} message The message to be broadcasted * @param {Player|Array<Player>} excludes Player or Array of players to exclude from the broadcast * @param {?number|Boolean} wrapWidth Width to wrap the message, or false to not wrap at all * @param {?Boolean} useColor Whether to parse color tags in the message * @param {?function(target, message): string} formatter Function to call to format the message to each target */ static atExcept(source, message, excludes, wrapWidth, useColor, formatter) { // Could be an array or a single target. excludes = [].concat(excludes); const targets = source.getBroadcastTargets() .filter(target => !excludes.includes(target)); const newSource = { getBroadcastTargets: () => targets }; Broadcast.at(newSource, message, wrapWidth, useColor, formatter); }
const targets = source.getBroadcastTargets(); targets.forEach(target => { if (target.socket && target.socket.writable) {