@@ -50,10 +50,11 @@ public abstract class BaseMenu(string title, BasePlugin plugin) : IMenu
5050 /// </summary>
5151 /// <param name="display">The text to display for the item.</param>
5252 /// <param name="onSelect">The action to perform when the item is selected.</param>
53+ /// <param name="disableOption">The disable option for the item.</param>
5354 /// <returns>The created item option.</returns>
54- public virtual ItemOption AddItem ( string display , Action < CCSPlayerController , ItemOption > onSelect )
55+ public virtual ItemOption AddItem ( string display , Action < CCSPlayerController , ItemOption > onSelect , DisableOption disableOption = DisableOption . None )
5556 {
56- ItemOption option = new ( display , DisableOption . None , onSelect ) ;
57+ ItemOption option = new ( display , disableOption , onSelect ) ;
5758 ItemOptions . Add ( option ) ;
5859 return option ;
5960 }
@@ -272,18 +273,12 @@ internal void DeregisterOnKeyPress()
272273 if ( Menu is WasdMenu || ( Menu is ScreenMenu screenMenu && screenMenu . MenuType == MenuType . Scrollable ) )
273274 return ;
274275
275- foreach ( KeyValuePair < string , CommandCallback > kvp in _keyCommands )
276- {
277- if ( _keyCommands . ContainsKey ( kvp . Key ) )
278- {
279- Menu . Plugin . RemoveCommand ( kvp . Key , kvp . Value ) ;
280- }
281- }
276+ foreach ( var kvp in _keyCommands )
277+ Menu . Plugin . RemoveCommand ( kvp . Key , kvp . Value ) ;
282278
283279 _keyCommands . Clear ( ) ;
284280 }
285281
286-
287282 internal void RegisterPlayerDisconnectEvent ( )
288283 {
289284 Menu . Plugin . RegisterEventHandler < EventPlayerDisconnect > ( OnPlayerDisconnect ) ;
0 commit comments