@@ -10,11 +10,8 @@ public class CmdPoll : BattleCommand
1010 public override string Shortcut => "poll" ;
1111 public override AccessType Access => AccessType . NoCheck ;
1212 public override BattleCommand Create ( ) => new CmdPoll ( ) ;
13+ public BattleCommand InternalCommand { get ; private set ; }
1314
14- private BattleCommand commandToRun ;
15-
16- public BattleCommand InternalCommand { get { return commandToRun ; } }
17-
1815 public override string Arm ( ServerBattle battle , Say e , string arguments = null )
1916 {
2017 if ( string . IsNullOrEmpty ( arguments ) )
@@ -25,11 +22,11 @@ public override string Arm(ServerBattle battle, Say e, string arguments = null)
2522 var parts = arguments . Split ( new [ ] { ' ' } , 2 ) ;
2623 var commandName = parts [ 0 ] ?? "" ;
2724 var commandArgs = parts . Length > 1 ? parts [ 1 ] : null ;
28- commandToRun = battle . GetCommandByName ( commandName ) ;
25+ InternalCommand = battle . GetCommandByName ( commandName ) ;
2926 string reason ;
30- if ( commandToRun . GetRunPermissions ( battle , e . User , out reason ) >= RunPermission . Vote && commandToRun . Access != AccessType . NoCheck && commandToRun . Access != AccessType . Admin && ! ( commandToRun . Access == AccessType . NotIngameNotAutohost && battle . IsAutohost ) )
27+ if ( InternalCommand . GetRunPermissions ( battle , e . User , out reason ) >= RunPermission . Vote && InternalCommand . Access != AccessType . NoCheck && InternalCommand . Access != AccessType . Admin && ! ( InternalCommand . Access == AccessType . NotIngameNotAutohost && battle . IsAutohost ) )
3128 {
32- return commandToRun . Arm ( battle , e , commandArgs ) ;
29+ return InternalCommand . Arm ( battle , e , commandArgs ) ;
3330 }
3431 battle . Respond ( e , reason ) ;
3532 return null ;
@@ -38,13 +35,13 @@ public override string Arm(ServerBattle battle, Say e, string arguments = null)
3835
3936 public override async Task ExecuteArmed ( ServerBattle battle , Say e )
4037 {
41- await commandToRun . ExecuteArmed ( battle , e ) ;
38+ await InternalCommand . ExecuteArmed ( battle , e ) ;
4239 }
4340
4441 public override RunPermission GetRunPermissions ( ServerBattle battle , string userName , out string reason )
4542 {
46- if ( commandToRun == null ) return base . GetRunPermissions ( battle , userName , out reason ) >= RunPermission . Vote ? RunPermission . Vote : RunPermission . None ;
47- return commandToRun . GetRunPermissions ( battle , userName , out reason ) ;
43+ if ( InternalCommand == null ) return base . GetRunPermissions ( battle , userName , out reason ) >= RunPermission . Vote ? RunPermission . Vote : RunPermission . None ;
44+ return InternalCommand . GetRunPermissions ( battle , userName , out reason ) ;
4845 }
4946 }
5047}
0 commit comments