File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed
Code/MethodSystem/Methods/PlayerMethods Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ using Exiled . API . Enums ;
2+ using Exiled . API . Features ;
3+ using JetBrains . Annotations ;
4+ using SER . Code . ArgumentSystem . Arguments ;
5+ using SER . Code . ArgumentSystem . BaseArguments ;
6+ using SER . Code . MethodSystem . BaseMethods ;
7+ using SER . Code . MethodSystem . Structures ;
8+ using SER . Code . ValueSystem ;
9+
10+ namespace SER . Code . MethodSystem . Methods . PlayerMethods ;
11+
12+ [ UsedImplicitly ]
13+ public class GetAmmoLimitMethod : ReturningMethod < NumberValue > , IExiledMethod
14+ {
15+ public override string Description => "Gets the player's limit on a certain ammunition type" ;
16+
17+ public override Argument [ ] ExpectedArguments { get ; } =
18+ [
19+ new PlayerArgument ( "player to get the limit from" ) ,
20+ new EnumArgument < AmmoType > ( "ammo type" )
21+ ] ;
22+
23+ public override void Execute ( )
24+ {
25+ var ammoType = Args . GetEnum < AmmoType > ( "ammo type" ) ;
26+ var player = Args . GetPlayer ( "player to get the limit from" ) ;
27+
28+ ReturnValue = Player . Get ( player ) . GetAmmoLimit ( ammoType ) ;
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ using Exiled . API . Enums ;
2+ using Exiled . API . Features ;
3+ using JetBrains . Annotations ;
4+ using SER . Code . ArgumentSystem . Arguments ;
5+ using SER . Code . ArgumentSystem . BaseArguments ;
6+ using SER . Code . MethodSystem . BaseMethods ;
7+ using SER . Code . MethodSystem . Structures ;
8+
9+ namespace SER . Code . MethodSystem . Methods . PlayerMethods ;
10+
11+ [ UsedImplicitly ]
12+ public class SetAmmoLimitMethod : SynchronousMethod , IExiledMethod
13+ {
14+ public override string Description => "Sets the players' limit on a certain ammunition type" ;
15+
16+ public override Argument [ ] ExpectedArguments { get ; } =
17+ [
18+ new PlayersArgument ( "players to set the limit to" ) ,
19+ new EnumArgument < AmmoType > ( "ammo type" ) ,
20+ new IntArgument ( "limit" , 0 , 65535 )
21+ {
22+ Description = "The min and max are there so the whole thing doesn't crash from int -> ushort conversion :trollface:"
23+ }
24+ ] ;
25+
26+ public override void Execute ( )
27+ {
28+ var ammoType = Args . GetEnum < AmmoType > ( "ammo type" ) ;
29+ var limit = ( ushort ) Args . GetInt ( "limit" ) ;
30+ var labApiPlayers = Args . GetPlayers ( "players to set the limit to" ) ;
31+ labApiPlayers . ForEach ( plr => Player . Get ( plr ) . SetAmmoLimit ( ammoType , limit ) ) ;
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments