Skip to content

Commit 6301474

Browse files
move framework type to FrameworkBridge
1 parent 4e7b0c4 commit 6301474

15 files changed

Lines changed: 44 additions & 29 deletions

Code/Helpers/FrameworkBridge.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ namespace SER.Code.Helpers;
99

1010
public class FrameworkBridge
1111
{
12-
protected record struct Framework(string Name, IDependOnFramework.Type Type);
12+
protected record struct Framework(string Name, Type Type);
1313

1414
private readonly List<Framework> _found = [];
1515
private readonly List<CoroutineHandle> _handles = [];
1616

17+
public enum Type
18+
{
19+
None,
20+
Exiled,
21+
Callvote,
22+
Ucr
23+
}
24+
1725
private readonly Framework[] _frameworks =
1826
[
19-
new("Callvote", IDependOnFramework.Type.Callvote),
20-
new("Exiled Loader", IDependOnFramework.Type.Exiled),
21-
new("UncomplicatedCustomRoles", IDependOnFramework.Type.Ucr)
27+
new("Callvote", Type.Callvote),
28+
new("Exiled Loader", Type.Exiled),
29+
new("UncomplicatedCustomRoles", Type.Ucr)
2230
];
2331

2432
public void Load()
@@ -66,7 +74,7 @@ private static bool IsLabAPIComatibleFrameworkLoaded(Framework framework)
6674
private static bool IsExiledCompatibleFrameworkLoaded(Framework framework)
6775
{
6876
// As of right now, Callvote-Exiled is not compatible with SER.
69-
if (framework.Type == IDependOnFramework.Type.Callvote)
77+
if (framework.Type == FrameworkBridge.Type.Callvote)
7078
{
7179
return false;
7280
}

Code/MethodSystem/MethodIndex.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Reflection;
22
using LabApi.Features.Console;
33
using SER.Code.Extensions;
4+
using SER.Code.Helpers;
45
using SER.Code.Helpers.ResultSystem;
56
using SER.Code.MethodSystem.BaseMethods;
67
using SER.Code.MethodSystem.Structures;
@@ -10,7 +11,7 @@ namespace SER.Code.MethodSystem;
1011
public static class MethodIndex
1112
{
1213
private static readonly Dictionary<string, Method> NameToMethodIndex = [];
13-
private static readonly Dictionary<IDependOnFramework.Type, List<Method>> FrameworkDependentMethods = [];
14+
private static readonly Dictionary<FrameworkBridge.Type, List<Method>> FrameworkDependentMethods = [];
1415

1516
/// <summary>
1617
/// Initializes the method index.
@@ -97,7 +98,7 @@ public static TryGet<Method> TryGetMethod(string name)
9798
return $"There is no method with name '{name}'. Did you mean '{closestMethod ?? "<error>"}'?";
9899
}
99100

100-
internal static void LoadMethodsOfFramework(IDependOnFramework.Type framework)
101+
internal static void LoadMethodsOfFramework(FrameworkBridge.Type framework)
101102
{
102103
foreach (var method in FrameworkDependentMethods.TryGetValue(framework, out var methods) ? methods : [])
103104
{

Code/MethodSystem/Methods/CASSIEMethods/PlayerCassieMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using JetBrains.Annotations;
44
using SER.Code.ArgumentSystem.Arguments;
55
using SER.Code.ArgumentSystem.BaseArguments;
6+
using SER.Code.Helpers;
67
using SER.Code.MethodSystem.BaseMethods.Synchronous;
78
using SER.Code.MethodSystem.Structures;
89

@@ -11,7 +12,7 @@ namespace SER.Code.MethodSystem.Methods.CASSIEMethods;
1112
[UsedImplicitly]
1213
public class PlayerCassieMethod : SynchronousMethod, IDependOnFramework
1314
{
14-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Exiled;
15+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Exiled;
1516

1617
public override string Description => "Makes a CASSIE announcement to specified players only.";
1718

Code/MethodSystem/Methods/CallvoteMethods/StartVoteAndWaitMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using SER.Code.ArgumentSystem.Arguments;
88
using SER.Code.ArgumentSystem.BaseArguments;
99
using SER.Code.Extensions;
10+
using SER.Code.Helpers;
1011
using SER.Code.MethodSystem.BaseMethods.Yielding;
1112
using SER.Code.MethodSystem.MethodDescriptors;
1213
using SER.Code.MethodSystem.Structures;
@@ -63,7 +64,7 @@ namespace SER.Code.MethodSystem.Methods.CallvoteMethods;
6364
[UsedImplicitly]
6465
public class StartVoteAndWaitMethod : YieldingReturningMethod<TextValue>, IAdditionalDescription, IDependOnFramework
6566
{
66-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Callvote;
67+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Callvote;
6768

6869
public override string Description => "Starts a vote and waits until it is completed.";
6970

Code/MethodSystem/Methods/CallvoteMethods/StartVoteMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using LabApi.Features.Wrappers;
66
using SER.Code.ArgumentSystem.Arguments;
77
using SER.Code.ArgumentSystem.BaseArguments;
8+
using SER.Code.Helpers;
89
using SER.Code.MethodSystem.BaseMethods.Synchronous;
910
using SER.Code.MethodSystem.Structures;
1011

@@ -13,7 +14,7 @@ namespace SER.Code.MethodSystem.Methods.CallvoteMethods;
1314
[UsedImplicitly]
1415
public class StartVoteMethod : SynchronousMethod, IDependOnFramework
1516
{
16-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Callvote;
17+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Callvote;
1718

1819
public override string Description => "Starts a vote.";
1920

Code/MethodSystem/Methods/CallvoteMethods/VoteOptionMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using JetBrains.Annotations;
22
using SER.Code.ArgumentSystem.Arguments;
33
using SER.Code.ArgumentSystem.BaseArguments;
4+
using SER.Code.Helpers;
45
using SER.Code.MethodSystem.BaseMethods.Synchronous;
56
using SER.Code.MethodSystem.Structures;
67

@@ -9,7 +10,7 @@ namespace SER.Code.MethodSystem.Methods.CallvoteMethods;
910
[UsedImplicitly]
1011
public class VoteOptionMethod : ReferenceReturningMethod<VoteOptionMethod.VoteOption>, IDependOnFramework
1112
{
12-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Callvote;
13+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Callvote;
1314

1415
public record VoteOption(string Option, string DisplayText);
1516

Code/MethodSystem/Methods/PlayerMethods/GetAmmoLimitMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using JetBrains.Annotations;
44
using SER.Code.ArgumentSystem.Arguments;
55
using SER.Code.ArgumentSystem.BaseArguments;
6+
using SER.Code.Helpers;
67
using SER.Code.MethodSystem.BaseMethods.Synchronous;
78
using SER.Code.MethodSystem.Structures;
89
using SER.Code.ValueSystem;
@@ -12,7 +13,7 @@ namespace SER.Code.MethodSystem.Methods.PlayerMethods;
1213
[UsedImplicitly]
1314
public class GetAmmoLimitMethod : ReturningMethod<NumberValue>, IDependOnFramework
1415
{
15-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Exiled;
16+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Exiled;
1617

1718
public override string Description => "Gets the player's limit on a certain ammunition type";
1819

Code/MethodSystem/Methods/PlayerMethods/GiveEffectMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using JetBrains.Annotations;
44
using SER.Code.ArgumentSystem.Arguments;
55
using SER.Code.ArgumentSystem.BaseArguments;
6+
using SER.Code.Helpers;
67
using SER.Code.MethodSystem.BaseMethods.Synchronous;
78
using SER.Code.MethodSystem.Structures;
89

@@ -11,7 +12,7 @@ namespace SER.Code.MethodSystem.Methods.PlayerMethods;
1112
[UsedImplicitly]
1213
public class GiveEffectMethod : SynchronousMethod, IDependOnFramework
1314
{
14-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Exiled;
15+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Exiled;
1516

1617
public override string Description => "Adds a provided effect to a player.";
1718

Code/MethodSystem/Methods/PlayerMethods/SetAmmoLimitMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using JetBrains.Annotations;
44
using SER.Code.ArgumentSystem.Arguments;
55
using SER.Code.ArgumentSystem.BaseArguments;
6+
using SER.Code.Helpers;
67
using SER.Code.MethodSystem.BaseMethods.Synchronous;
78
using SER.Code.MethodSystem.Structures;
89

@@ -11,7 +12,7 @@ namespace SER.Code.MethodSystem.Methods.PlayerMethods;
1112
[UsedImplicitly]
1213
public class SetAmmoLimitMethod : SynchronousMethod, IDependOnFramework
1314
{
14-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Exiled;
15+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Exiled;
1516

1617
public override string Description => "Sets the players' limit on a certain ammunition type";
1718

Code/MethodSystem/Methods/PlayerMethods/SetAppearanceMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using SER.Code.ArgumentSystem.Arguments;
66
using SER.Code.ArgumentSystem.BaseArguments;
77
using SER.Code.Extensions;
8+
using SER.Code.Helpers;
89
using SER.Code.MethodSystem.BaseMethods.Synchronous;
910
using SER.Code.MethodSystem.Structures;
1011

@@ -13,7 +14,7 @@ namespace SER.Code.MethodSystem.Methods.PlayerMethods;
1314
[UsedImplicitly]
1415
public class SetAppearanceMethod : SynchronousMethod, IDependOnFramework
1516
{
16-
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Exiled;
17+
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Exiled;
1718

1819
public override string Description => "Changes the appearance of a player (or reskins)";
1920

0 commit comments

Comments
 (0)