Skip to content

Commit

Permalink
use SPT config setting to blacklist instead of delete profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtlaggy committed Jan 8, 2025
1 parent 9ad82b1 commit 08c4188
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 65 deletions.
21 changes: 21 additions & 0 deletions src/Fika.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { FikaPlayerRelationsCacheService } from "./services/cache/FikaPlayerRela
import { FikaDedicatedProfileService } from "./services/dedicated/FikaDedicatedProfileService";
import { FikaConfig } from "./utils/FikaConfig";
import { FikaServerTools } from "./utils/FikaServerTools";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";

@injectable()
export class Fika {
Expand All @@ -24,6 +27,7 @@ export class Fika {

constructor(
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
@inject("ConfigServer") protected configServer: ConfigServer,
@inject("Overrider") protected overrider: Overrider,
@inject("FikaServerTools") protected fikaServerTools: FikaServerTools,
@inject("FikaConfig") protected fikaConfig: FikaConfig,
Expand Down Expand Up @@ -52,6 +56,7 @@ export class Fika {
}

this.addFikaClientLocales();
this.blacklistSpecialProfiles();
this.fikaPlayerRelationCacheServce.postInit();

if (this.backgroundConfig.enable) {
Expand All @@ -75,4 +80,20 @@ export class Fika {
}
}
}

private async blacklistSpecialProfiles() {
const coreConfig: ICoreConfig = this.configServer.getConfig(ConfigTypes.CORE);
const profileBlacklist = coreConfig.features.createNewProfileTypesBlacklist;

if (!this.fikaConfig.getConfig().server.showDevProfile) {
// biome-ignore lint/performance/noDelete: Only ran once.
profileBlacklist.push("SPT Developer");
}

if (!this.fikaConfig.getConfig().server.showNonStandardProfile) {
for (const id of ["Tournament", "SPT Easy start", "SPT Zero to hero"]) {
profileBlacklist.push(id);
}
}
}
}
3 changes: 0 additions & 3 deletions src/di/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { DialogueControllerOverride } from "../overrides/controllers/DialogueCon
import { ProfileControllerOverride } from "../overrides/controllers/ProfileController";
// import { LocalesOverride } from "../overrides/other/Locales";
import { HttpRouterOverride } from "../overrides/routers/HttpRouter";
import { LauncherControllerOverride } from "../overrides/controllers/LauncherController";
import { MatchControllerOverride } from "../overrides/controllers/MatchController";

import { FikaMatchService } from "../services/FikaMatchService";
Expand Down Expand Up @@ -86,7 +85,6 @@ export class Container {
container.registerType("Overrides", "HttpRouterOverride");
// container.registerType("Overrides", "LocalesOverride");
container.registerType("Overrides", "AchievementControllerOverride");
container.registerType("Overrides", "LauncherControllerOverride");
container.registerType("Overrides", "LocationLifecycleServiceOverride");
container.registerType("Overrides", "MatchControllerOverride");

Expand Down Expand Up @@ -117,7 +115,6 @@ export class Container {
// container.register<LocalesOverride>("LocalesOverride", LocalesOverride, { lifecycle: Lifecycle.Singleton });
container.register<Overrider>("Overrider", Overrider, { lifecycle: Lifecycle.Singleton });
container.register<AchievementControllerOverride>("AchievementControllerOverride", AchievementControllerOverride, { lifecycle: Lifecycle.Singleton });
container.register<LauncherControllerOverride>("LauncherControllerOverride", LauncherControllerOverride, { lifecycle: Lifecycle.Singleton });
container.register<LocationLifecycleServiceOverride>("LocationLifecycleServiceOverride", LocationLifecycleServiceOverride, { lifecycle: Lifecycle.Singleton });
container.register<MatchControllerOverride>("MatchControllerOverride", MatchControllerOverride, { lifecycle: Lifecycle.Singleton });
}
Expand Down
62 changes: 0 additions & 62 deletions src/overrides/controllers/LauncherController.ts

This file was deleted.

0 comments on commit 08c4188

Please sign in to comment.