Skip to content

Commit

Permalink
do the other thing
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git authored May 4, 2024
1 parent 9301669 commit a0605da
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions server/chat-plugins/randombattles/ssb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,17 @@ function SSBSets(target: string) {
return buf;
}


export const disabledSets = Chat.oldPlugins.ssb?.disabledSets || [];

function enforceDisabledSets() {
for (const process of Rooms.PM.processes) {
process.getProcess().send(`EVAL\n\nConfig.disabledssbsets = ${JSON.stringify(disabledSets)}`);
}
}

enforceDisabledSets();

export const commands: Chat.ChatCommands = {
ssb(target, room, user) {
if (!this.runBroadcast()) return;
Expand All @@ -387,4 +398,27 @@ export const commands: Chat.ChatCommands = {
ssbhelp: [
`/ssb [staff member] - Displays a staff member's Super Staff Bros. set and custom features.`,
],
enablessbset: 'disablessbset',
disablessbset(target, room, user, connection, cmd) {
this.checkCan('rangeban');
target = toID(target);
if (!Object.keys(ssbSets).map(toID).includes(target as ID)) {
return this.errorReply(`${target} has no SSB set.`);
}
const disableIdx = disabledSets.indexOf(target);
if (cmd.startsWith('enable')) {
if (disableIdx < 0) {
return this.errorReply(`${target}'s set is not disabled.`);
}
disabledSets.splice(disableIdx, 1);
this.privateGlobalModAction(`${user.name} enabled ${target}'s SSB set.`);
} else {
if (disableIdx > -1) {
return this.errorReply(`That set is already disabled.`);
}
disabledSets.push(target);
this.privateGlobalModAction(`${user.name} disabled the SSB set for ${target}`);
}
enforceDisabledSets();
},
};

0 comments on commit a0605da

Please sign in to comment.