Skip to content

Commit

Permalink
feat(skymp5-client): add blockedEventSources config option (skyrim-mu…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pospelove authored Apr 6, 2024
1 parent 988c2b0 commit 0f74746
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@ export class GamemodeEventSourceService extends ClientListener {
ctx._expired = true;
});
}
const eventNames = Object.keys(event.message.eventSources);

let eventNames = Object.keys(event.message.eventSources);

let blockedEventSources = this.sp.settings["skymp5-client"]["blockedEventSources"];

if (Array.isArray(blockedEventSources)) {
blockedEventSources.forEach((blockedEventSource: unknown) => {
eventNames = eventNames.filter((eventName) => eventName !== blockedEventSource);
logTrace(this, `'eventSources`, blockedEventSource, `- Blocked by the client`);
});
}

eventNames.forEach((eventName) => {
try {
const fn = new Function('ctx', event.message.eventSources[eventName]);
Expand Down

0 comments on commit 0f74746

Please sign in to comment.