@@ -804,12 +804,12 @@ void InitBasicEventListeners() {
804804 EventBus& bus = EventBus::getInstance ();
805805
806806 bus.emplaceListener <ExecutingCommandEvent>([](ExecutingCommandEvent& ev) {
807- if (ev.commandContext ().getCommandOrigin ().getOriginType () == CommandOriginType::DedicatedServer) {
807+ auto originType = ev.commandContext ().getCommandOrigin ().getOriginType ();
808+ if (originType == CommandOriginType::DedicatedServer) {
808809 std::string cmd = ev.commandContext ().mCommand ;
809810 if (cmd.starts_with (" /" )) {
810811 cmd.erase (0 , 1 );
811812 }
812-
813813 if (!ProcessDebugEngine (cmd)) {
814814 ev.cancel ();
815815 return ;
@@ -831,8 +831,7 @@ void InitBasicEventListeners() {
831831 std::string prefix = LLSEFindCmdReg (false , cmd, paras, &isFromOtherEngine);
832832
833833 if (!prefix.empty ()) {
834- // LLSE Registered Cmd
835-
834+ // LSE Registered Cmd
836835 bool callbackRes = CallServerCmdCallback (prefix, paras);
837836 IF_LISTENED (EVENT_TYPES::onConsoleCmd) {
838837 if (!CallEvent (EVENT_TYPES::onConsoleCmd, String::newString (cmd))) {
@@ -858,7 +857,7 @@ void InitBasicEventListeners() {
858857 }
859858 IF_LISTENED_END (EVENT_TYPES::onConsoleCmd);
860859 }
861- } else if (ev. commandContext (). mOrigin -> getOriginType () == CommandOriginType::Player) {
860+ } else if (originType == CommandOriginType::Player) {
862861 std::string cmd = ev.commandContext ().mCommand ;
863862 if (cmd.starts_with (" /" )) {
864863 cmd.erase (0 , 1 );
@@ -903,9 +902,7 @@ void InitBasicEventListeners() {
903902 }
904903 IF_LISTENED_END (EVENT_TYPES::onPlayerCmd);
905904 }
906- return ;
907905 }
908- return ;
909906 });
910907
911908 // ===== onServerStarted =====
0 commit comments