Skip to content

Commit 3578ec0

Browse files
rename GetIntAmount to GetInt, fix amount argument for GiveCandy not having default value
1 parent 640f0f8 commit 3578ec0

File tree

7 files changed

+19
-23
lines changed

7 files changed

+19
-23
lines changed

ArgumentSystem/ProvidedArguments.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,6 @@ public string GetText(string argName)
185185
return GetValue<string, TextArgument>(argName);
186186
}
187187

188-
/// <summary>
189-
/// Retrieves the integer amount associated with the specified argument name.
190-
/// </summary>
191-
/// <param name="argName">The name of the argument to retrieve the integer value from.</param>
192-
/// <returns>The integer value associated with the specified argument.</returns>
193-
public int GetIntAmount(string argName)
194-
{
195-
return GetValue<int, IntArgument>(argName);
196-
}
197-
198188
/// <summary>
199189
/// Retrieves the unprocessed raw text value associated with the specified argument name.
200190
/// </summary>

MethodSystem/Methods/ItemMethods/DestroyItemMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public override void Execute()
2222
{
2323
var players = Args.GetPlayers("players");
2424
var item = Args.GetEnum<ItemType>("item");
25-
var amount = Args.GetIntAmount("amount");
25+
var amount = Args.GetInt("amount");
2626

2727
foreach (var plr in players)
2828
{

MethodSystem/Methods/ItemMethods/DropItemMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public override void Execute()
2424
{
2525
var players = Args.GetPlayers("players");
2626
var itemTypeToDrop = Args.GetEnum<ItemType>("itemTypeToDrop");
27-
var amountToDrop = Args.GetIntAmount("amountToDrop");
27+
var amountToDrop = Args.GetInt("amountToDrop");
2828

2929
foreach (var plr in players)
3030
{

MethodSystem/Methods/ItemMethods/GiveCandyMethod.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ public class GiveCandyMethod : SynchronousMethod
1414
new PlayersArgument("players"),
1515
new EnumArgument<CandyKindID>("candyType"),
1616
new IntArgument("amount", 1)
17+
{
18+
DefaultValue = 1
19+
}
1720
];
1821

1922
public override void Execute()
2023
{
2124
var players = Args.GetPlayers("players");
2225
var candyType = Args.GetEnum<CandyKindID>("candyType");
23-
var amount = Args.GetIntAmount("amount");
26+
var amount = Args.GetInt("amount");
2427

2528
foreach (var plr in players)
2629
{

MethodSystem/Methods/ItemMethods/GiveItemMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public override void Execute()
2222
{
2323
var players = Args.GetPlayers("players");
2424
var item = Args.GetEnum<ItemType>("item");
25-
var amount = Args.GetIntAmount("amount");
25+
var amount = Args.GetInt("amount");
2626

2727
foreach (var plr in players)
2828
{

MethodSystem/Methods/PlayerVariableMethods/LimitPlayersMethod.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ namespace SER.MethodSystem.Methods.PlayerVariableMethods;
99
public class LimitPlayersMethod : ReturningMethod<PlayerValue>
1010
{
1111
public override string Description =>
12-
"Returns a player variable with amount of players being equal or lower than the provided amount.";
12+
"Returns a player variable with amount of players being equal or lower than the limit.";
1313

1414
public override Argument[] ExpectedArguments { get; } =
1515
[
1616
new PlayersArgument("players"),
17-
new IntArgument("amount", 1)
17+
new IntArgument("limit", 1)
1818
];
1919

2020
public override void Execute()
2121
{
2222
var players = Args.GetPlayers("players");
23-
var amount = Args.GetIntAmount("amount");
23+
var amount = Args.GetInt("limit");
2424

2525
while (amount > players.Len && players.Len > 0)
2626
{

Plugin/Commands/HelpSystem/HelpCommand.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class HelpCommand : ICommand
3838
[HelpOption.RefResMethods] = GetReferenceResolvingMethodsHelpPage,
3939
[HelpOption.PlayerProperty] = GetPlayerInfoAccessorsHelpPage,
4040
[HelpOption.Flags] = GetFlagHelpPage,
41-
[HelpOption.Keywords] = GetKeywordHelpPage
41+
//[HelpOption.Keywords] = GetKeywordHelpPage
4242
};
4343

4444
public bool Execute(ArraySegment<string> arguments, ICommandSender _, out string response)
@@ -468,10 +468,9 @@ private static string GetMethodHelp(Method method)
468468

469469
if (method is IAdditionalDescription addDesc)
470470
{
471+
sb.AppendLine();
471472
sb.AppendLine($"> {addDesc.AdditionalDescription}");
472473
}
473-
474-
sb.AppendLine();
475474

476475
switch (method)
477476
{
@@ -489,17 +488,21 @@ private static string GetMethodHelp(Method method)
489488
{
490489
typeReturn = "a literal value depending on your input";
491490
}
492-
491+
492+
sb.AppendLine();
493493
sb.AppendLine($"This method returns {typeReturn}, which can be saved or used directly. ");
494494
break;
495495
}
496496
case ReturningMethod<CollectionValue>:
497+
sb.AppendLine();
497498
sb.AppendLine("This method returns a collection of values, which can be saved or used directly.");
498499
break;
499500
case ReturningMethod<PlayerValue>:
501+
sb.AppendLine();
500502
sb.AppendLine("This method returns players, which can be saved or used directly.");
501503
break;
502504
case ReferenceReturningMethod refMethod:
505+
sb.AppendLine();
503506
sb.AppendLine($"This method returns a reference to {refMethod.ReturnType.Name} object, which can be saved or used directly.\n" +
504507
$"References represent an object which cannot be fully represented in text.\n" +
505508
$"If you wish to use that reference further, find methods supporting references of this type.");
@@ -523,15 +526,15 @@ private static string GetMethodHelp(Method method)
523526
break;
524527
}
525528
}
526-
527-
sb.AppendLine();
528529

529530
if (method.ExpectedArguments.Length == 0)
530531
{
532+
sb.AppendLine();
531533
sb.AppendLine("This method does not expect any arguments.");
532534
return sb.ToString();
533535
}
534536

537+
sb.AppendLine();
535538
sb.AppendLine("This method expects the following arguments:");
536539
for (var index = 0; index < method.ExpectedArguments.Length; index++)
537540
{

0 commit comments

Comments
 (0)