4040use pocketmine \network \mcpe \NetworkSession ;
4141use pocketmine \network \mcpe \protocol \AvailableCommandsPacket ;
4242use pocketmine \network \mcpe \protocol \types \command \CommandEnum ;
43+ use pocketmine \network \mcpe \protocol \types \command \CommandOverload ;
4344use pocketmine \network \mcpe \protocol \types \command \CommandParameter ;
4445use pocketmine \plugin \Plugin ;
4546use pocketmine \Server ;
@@ -90,7 +91,7 @@ public static function register(Plugin $registrant): void {
9091 * @param CommandSender $cs
9192 * @param BaseCommand $command
9293 *
93- * @return CommandParameter [][]
94+ * @return CommandOverload [][]
9495 */
9596 private static function generateOverloads (CommandSender $ cs , BaseCommand $ command ): array {
9697 $ overloads = [];
@@ -113,11 +114,10 @@ private static function generateOverloads(CommandSender $cs, BaseCommand $comman
113114 $ overloadList = self ::generateOverloadList ($ subCommand );
114115 if (!empty ($ overloadList )){
115116 foreach ($ overloadList as $ overload ) {
116- array_unshift ($ overload , $ scParam );
117- $ overloads [] = $ overload ;
117+ $ overloads [] = new CommandOverload (false , [$ scParam , ...$ overload ->getParameters ()]);
118118 }
119119 } else {
120- $ overloads [] = [$ scParam ];
120+ $ overloads [] = new CommandOverload ( false , [$ scParam ]) ;
121121 }
122122 }
123123
@@ -131,7 +131,7 @@ private static function generateOverloads(CommandSender $cs, BaseCommand $comman
131131 /**
132132 * @param IArgumentable $argumentable
133133 *
134- * @return CommandParameter [][]
134+ * @return CommandOverload [][]
135135 */
136136 private static function generateOverloadList (IArgumentable $ argumentable ): array {
137137 $ input = $ argumentable ->getArgumentList ();
@@ -154,7 +154,7 @@ private static function generateOverloadList(IArgumentable $argumentable): array
154154 $ refProp ->setValue ($ param ->enum , "enum# " . spl_object_id ($ param ->enum ));
155155 }
156156 }
157- $ combinations [] = $ set ;
157+ $ combinations [] = new CommandOverload ( false , $ set) ;
158158
159159 foreach ($ indexes as $ k => $ v ){
160160 $ indexes [$ k ]++;
0 commit comments