From 39ec02d3c4cb5f5980b172d30404210de2479f0f Mon Sep 17 00:00:00 2001 From: marzavec Date: Tue, 13 Mar 2018 22:26:53 -0700 Subject: Streamlined modules, server tweaks, better feedback --- server/src/commands/admin/addmod.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'server/src/commands/admin/addmod.js') diff --git a/server/src/commands/admin/addmod.js b/server/src/commands/admin/addmod.js index dba5aba..e9dde2c 100644 --- a/server/src/commands/admin/addmod.js +++ b/server/src/commands/admin/addmod.js @@ -1,5 +1,5 @@ /* - + Description: Adds the target trip to the mod list then elevates the uType */ 'use strict'; @@ -16,14 +16,16 @@ exports.run = async (core, server, socket, data) => { core.config.mods.push(mod); // purposely not using `config.set()` to avoid auto-save - for (let client of server.clients) { - if (typeof client.trip !== 'undefined' && client.trip === data.trip) { - client.uType = 'mod'; + let newMod = server.findSockets({ trip: data.trip }); + + if (newMod.length !== 0) { + for (let i = 0, l = newMod.length; i < l; i++) { + newMod[i].uType = 'mod'; - server.reply({ + server.send({ cmd: 'info', text: 'You are now a mod.' - }, client); + }, newMod[i]); } } -- cgit v1.2.1