@@ -375,9 +375,17 @@ void onExecute(CommandOrigin const& origin, CommandOutput& output, RuntimeComman
375375 if (info.type == ParamKind::Kind::Enum || info.type == ParamKind::Kind::SoftEnum) {
376376 auto & param = runtime[info.enumName ];
377377 args.set (info.name , convertResult (param, origin, output));
378+ if (!info.identifier .empty ()
379+ && info.identifier != info.name ) { // Keep compatibility with old plugins
380+ args.set (info.identifier , convertResult (param, origin, output));
381+ }
378382 } else {
379383 auto & param = runtime[info.name ];
380384 args.set (info.name , convertResult (param, origin, output));
385+ if (!info.identifier .empty ()
386+ && info.identifier != info.name ) { // Keep compatibility with old plugins
387+ args.set (info.identifier , convertResult (param, origin, output));
388+ }
381389 }
382390 }
383391 } catch (std::out_of_range&) {
@@ -411,7 +419,8 @@ Local<Value> CommandClass::newParameter(const Arguments& args) {
411419 option = (CommandParameterOption)args[index++].asNumber ().toInt32 ();
412420 if (index != args.size ()) throw std::runtime_error (" Error Argument in newParameter" );
413421
414- getEngineOwnData ()->plugin ->registeredCommands [commandName].push_back ({name, type, optional, enumName, option}
422+ getEngineOwnData ()->plugin ->registeredCommands [commandName].push_back (
423+ {name, type, optional, enumName, option, identifier}
415424 ); // Stores the parameter name for onExecute use
416425
417426 return Boolean::newBoolean (true );
@@ -437,7 +446,8 @@ Local<Value> CommandClass::mandatory(const Arguments& args) {
437446 option = (CommandParameterOption)args[index++].asNumber ().toInt32 ();
438447 if (index != args.size ()) throw std::runtime_error (" Error Argument in newParameter" );
439448
440- getEngineOwnData ()->plugin ->registeredCommands [commandName].push_back ({name, type, false , enumName, option}
449+ getEngineOwnData ()->plugin ->registeredCommands [commandName].push_back (
450+ {name, type, false , enumName, option, identifier}
441451 ); // Stores the parameter name for onExecute use
442452
443453 return Boolean::newBoolean (true );
@@ -463,7 +473,8 @@ Local<Value> CommandClass::optional(const Arguments& args) {
463473 option = (CommandParameterOption)args[index++].asNumber ().toInt32 ();
464474 if (index != args.size ()) throw std::runtime_error (" Error Argument in newParameter" );
465475
466- getEngineOwnData ()->plugin ->registeredCommands [commandName].push_back ({name, type, true , enumName, option}
476+ getEngineOwnData ()->plugin ->registeredCommands [commandName].push_back (
477+ {name, type, true , enumName, option, identifier}
467478 ); // Stores the parameter name for onExecute use
468479
469480 return Boolean::newBoolean (true );
@@ -479,7 +490,7 @@ Local<Value> CommandClass::addOverload(const Arguments& args) {
479490 )](RuntimeOverload& cmd, std::string const & commandName, std::string const & paramName) {
480491 auto & paramList = getEngineData (e)->plugin ->registeredCommands [commandName];
481492 for (auto & info : paramList) {
482- if (info.name == paramName || info.enumName == paramName) {
493+ if (info.name == paramName || info.enumName == paramName || info. identifier == paramName ) {
483494 if (info.optional ) {
484495 if (info.type == ParamKind::Kind::Enum || info.type == ParamKind::Kind::SoftEnum) {
485496 cmd.optional (info.enumName , info.type , info.enumName ).option (info.option );
0 commit comments