Skip to content

Commit

Permalink
Fixed stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NaoUnderscore committed Jul 3, 2024
1 parent 79a268c commit 270b9f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Exiled.API/Features/Core/StaticActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public static StaticActor CreateNewInstance<T>()
/// <returns>The created or already existing <see cref="StaticActor"/> instance.</returns>
public static StaticActor CreateNewInstance(Type type)
{
EObject @object = Get(type) ?? CreateDefaultSubobject<StaticActor>(type);
EObject @object = CreateDefaultSubobject<StaticActor>(type);

@object.Name = "__" + type.Name + " (StaticActor)";

if (Server.Host.GameObject)
Expand Down
12 changes: 6 additions & 6 deletions Exiled.CustomModules/CustomModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@ public override void OnEnabled()
}

if (Config.Modules.Contains(ModuleType.CustomRoles) && Config.UseDefaultRoleAssigner)
StaticActor.CreateNewInstance<RoleAssigner>();
StaticActor.Get<RoleAssigner>();

if (Config.Modules.Contains(ModuleType.CustomTeams) && Config.UseDefaultRespawnManager)
StaticActor.CreateNewInstance<RespawnManager>();
StaticActor.Get<RespawnManager>();

if (Config.Modules.Contains(ModuleType.CustomGameModes))
World.CreateNewInstance();
World.Get();

if (Config.Modules.Contains(ModuleType.CustomAbilities))
StaticActor.CreateNewInstance<AbilityTracker>();
StaticActor.Get<AbilityTracker>();

if (Config.Modules.Contains(ModuleType.CustomItems))
{
StaticActor.CreateNewInstance<ItemTracker>();
StaticActor.CreateNewInstance<PickupTracker>();
StaticActor.Get<ItemTracker>();
StaticActor.Get<PickupTracker>();
}

base.OnEnabled();
Expand Down

0 comments on commit 270b9f9

Please sign in to comment.