@@ -121,15 +121,10 @@ def client_callback(command_info):
121121 return client_callback
122122
123123
124- class PlayerBasedFeatureCommand (BaseFeatureCommand ):
125- def __init__ (self , commands , feature , deny_mass_execution = False ):
126- super ().__init__ (commands , feature )
127-
128- self ._deny_mass_execution = deny_mass_execution
129-
130- def _execute (self , command_info , filter_str , filter_args ):
131- client = clients [command_info .index ]
124+ class BasePlayerBasedFeatureCommand (BaseFeatureCommand ):
125+ deny_mass_execution = False
132126
127+ def _get_target_players (self , client , filter_str , filter_args ):
133128 players = []
134129 for player in iter_filter_targets (
135130 filter_str , filter_args , client .player ):
@@ -139,10 +134,18 @@ def _execute(self, command_info, filter_str, filter_args):
139134
140135 players .append (player )
141136
142- if self ._deny_mass_execution and len (players ) > 1 :
143- return
137+ if self .deny_mass_execution and len (players ) > 1 :
138+ return []
139+
140+ return players
141+
142+
143+ class PlayerBasedFeatureCommand (BasePlayerBasedFeatureCommand ):
144+ def _execute (self , command_info , filter_str , filter_args ):
145+ client = clients [command_info .index ]
146+ for player in self ._get_target_players (
147+ client , filter_str , filter_args ):
144148
145- for player in players :
146149 client .sync_execution (self .feature .execute , (client , player ))
147150
148151 def _get_public_chat_callback (self ):
0 commit comments