浏览代码

Prevent circle definitions in atcommands.yml (#9019)

The map-server will now produce an error, if you try to define a circle definition and not silently override internal command definitions.
This may have happened to a certain developer, while testing ban/unban and this is how he noticed.
Lemongrass3110 3 月之前
父节点
当前提交
17f0447b21
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/map/atcommand.cpp

+ 7 - 0
src/map/atcommand.cpp

@@ -163,6 +163,13 @@ uint64 AtcommandAliasDatabase::parseBodyNode( const ryml::NodeRef& node ){
 			std::string alias;
 			subNode >> alias;
 
+			AtCommandInfo* parent_cmd = get_atcommandinfo_byname( alias.c_str() );
+
+			if( parent_cmd != nullptr ){
+				this->invalidWarning( subNode, "\"%s\" cannot be used as alias for \"%s\", since a command with this name exists.\n", alias.c_str(), command.c_str() );
+				return 0;
+			}
+
 			info->aliases.insert( alias );
 			this->aliases[alias] = command;
 		}