File tree Expand file tree Collapse file tree
Code/MethodSystem/Methods/PlayerVariableMethods Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using JetBrains . Annotations ;
2+ using LabApi . Features . Wrappers ;
3+ using SER . Code . ArgumentSystem . Arguments ;
4+ using SER . Code . ArgumentSystem . BaseArguments ;
5+ using SER . Code . MethodSystem . BaseMethods . Synchronous ;
6+ using SER . Code . ValueSystem ;
7+ using SER . Code . VariableSystem . Variables ;
8+
9+ namespace SER . Code . MethodSystem . Methods . PlayerVariableMethods ;
10+
11+ [ UsedImplicitly ]
12+ public class OverlappingMethod : ReturningMethod < BoolValue >
13+ {
14+ public override string Description => "Checks if all player variables have the same players." ;
15+
16+ public override Argument [ ] ExpectedArguments { get ; } =
17+ [
18+ new VariableArgument < PlayerVariable > ( "player variables" )
19+ {
20+ ConsumesRemainingValues = true
21+ }
22+ ] ;
23+
24+ public override void Execute ( )
25+ {
26+ var variables = Args
27+ . GetRemainingArguments < PlayerVariable , VariableArgument < PlayerVariable > > ( "player variables" ) ;
28+
29+ if ( variables . Length <= 1 )
30+ {
31+ ReturnValue = true ;
32+ return ;
33+ } ;
34+
35+ int startHash = variables [ 0 ] . Value . GetHashCode ( ) ;
36+ ReturnValue = new BoolValue ( variables . Skip ( 1 ) . All ( v => v . Value . GetHashCode ( ) == startHash ) ) ;
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments