Skip to content

Commit 70d4993

Browse files
committed
fix some mistakes
1 parent d074fac commit 70d4993

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

src/NativeModules/Kit/Commands/CommandEditKit.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,7 @@ public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) {
8989
/* ekit name additem normal id amount durability */
9090
case "additem":
9191
if (args.Length < 3) {
92-
return CommandResult.InvalidArgs("Use /ekit [kit] additem [type] [id] [amount] [durability]");
93-
}
94-
95-
byte? durability = null;
96-
byte? amount = null;
97-
98-
// Try to convert 'amount'
99-
if (args.Length >= 5 && args[4].TryConvertToByte(out amount, out var error)) {
100-
return error;
101-
}
102-
103-
// Try to convert 'durability'
104-
if (args.Length >= 6 && args[5].TryConvertToByte(out durability, out error)) {
105-
return error;
92+
return CommandResult.InvalidArgs("Use /ekit [kit] additem [type]");
10693
}
10794

10895
switch (args[2].ToLowerString) {
@@ -111,6 +98,19 @@ public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) {
11198
return CommandResult.InvalidArgs("Use /ekit [kit] additem normal [id] [amount] [durability]");
11299
}
113100

101+
byte? durability = 100;
102+
byte? amount = 1;
103+
104+
// Try to convert 'amount'
105+
if (args.Length >= 5 && !args[4].TryConvertToByte(out amount, out var error)) {
106+
return error;
107+
}
108+
109+
// Try to convert 'durability'
110+
if (args.Length >= 6 && !args[5].TryConvertToByte(out durability, out error)) {
111+
return error;
112+
}
113+
114114
var optAsset = ItemUtil.GetItem(args[3].ToString());
115115

116116
if (optAsset.IsAbsent) {

0 commit comments

Comments
 (0)