@@ -21,10 +21,7 @@ public static void GnCmd(CommandArgs args)
2121 #region 列出禁止怪物表
2222 if ( args . Parameters . Count == 1 && args . Parameters [ 0 ] . ToLower ( ) == "list" )
2323 {
24- if ( Goodnight . Config . Npcs . Count < 1 )
25- args . Player . SendInfoMessage ( "当前禁止怪物生成表为空." ) ;
26- else
27- args . Player . SendInfoMessage ( "禁止怪物生成表: " + string . Join ( ", " , Goodnight . Config . Npcs . Select ( x => TShock . Utils . GetNPCById ( x ) ? . FullName + "({0})" . SFormat ( x ) ) ) ) ;
24+ args . Player . SendInfoMessage ( "禁止怪物生成表: " + string . Join ( ", " , Goodnight . Config . Npcs . Select ( x => TShock . Utils . GetNPCById ( x ) ? . FullName + "({0})" . SFormat ( x ) ) ) ) ;
2825 return ;
2926 }
3027 #endregion
@@ -119,23 +116,23 @@ public static void GnCmd(CommandArgs args)
119116 #endregion
120117
121118 #region 修改豁免名单方法
122- if ( args . Parameters . Count >= 3 && ( args . Parameters [ 0 ] . ToLower ( ) == "hm" ) )
119+ if ( args . Parameters . Count == 3 && ( args . Parameters [ 1 ] . ToLower ( ) == "hm" ) )
123120 {
124- switch ( args . Parameters [ 2 ] )
121+ switch ( args . Parameters [ 1 ] . ToLower ( ) )
125122 {
126123 case "update" :
127124 {
128- string text = args . Parameters [ 3 ] ;
129- if ( text != null && Goodnight . Config . Add ( text ) )
125+ string text = args . Parameters [ 2 ] ;
126+ if ( ! String . IsNullOrEmpty ( text ) && Goodnight . Config . Add ( text ) )
130127 args . Player . SendMessage ( "成功添加玩家 " + text + " 进入豁免名单" , Color . Aquamarine ) ;
131128 else
132129 args . Player . SendMessage ( "该玩家已存在豁免名单中" , Color . Salmon ) ;
133130 break ;
134131 }
135132 case "clear" :
136133 {
137- string text = args . Parameters [ 3 ] ;
138- if ( text != null && Goodnight . Config . Del ( text ) )
134+ string text = args . Parameters [ 2 ] ;
135+ if ( ! String . IsNullOrEmpty ( text ) && Goodnight . Config . Del ( text ) )
139136 {
140137 TSPlayer plr = TSPlayer . FindByNameOrID ( text ) [ 0 ] ;
141138 if ( plr != null && plr . Active && plr . ConnectionAlive )
0 commit comments