@@ -145,7 +145,7 @@ private static void OnNonArgumentedEvent(string evName)
145145 continue ;
146146 }
147147
148- script . Run ( RunContext . Event ) ;
148+ script . Run ( RunReason . Event ) ;
149149 }
150150 }
151151
@@ -179,7 +179,7 @@ private static void OnArgumentedEvent<T>(string evName, T ev) where T : EventArg
179179 }
180180
181181 script . AddLocalVariables ( variables ) ;
182- var isAllowed = script . RunForEvent ( RunContext . Event ) ;
182+ var isAllowed = script . RunForEvent ( RunReason . Event ) ;
183183 if ( isAllowed . HasValue && ev is ICancellableEvent cancellable1 )
184184 cancellable1 . IsAllowed = isAllowed . Value ;
185185 }
@@ -219,37 +219,12 @@ where value is not null
219219 private static Variable [ ] InternalGetVariablesFromProperties ( List < ( object value , string name , Type type ) > properties )
220220 {
221221 List < Variable > variables = [ ] ;
222- foreach ( var ( value , name , type ) in properties )
222+ foreach ( var ( value , name , _ ) in properties )
223223 {
224- switch ( value )
225- {
226- case Enum enumValue :
227- variables . Add ( new LiteralVariable < TextValue > ( GetName ( ) , new StaticTextValue ( enumValue . ToString ( ) ) ) ) ;
228- continue ;
229- case Player player :
230- variables . Add ( new PlayerVariable ( GetName ( ) , new ( player ) ) ) ;
231- continue ;
232- case IEnumerable < Player > players :
233- variables . Add ( new PlayerVariable ( GetName ( ) , new ( players ) ) ) ;
234- continue ;
235- case null :
236- if ( type == typeof ( Player ) )
237- {
238- // todo: wtf is this?
239- // variables.Add(new PlayerVariable(GetName(), []));
240- }
241- continue ;
242- default :
243- {
244- variables . Add ( Variable . Create ( GetName ( ) , Value . Parse ( value , null ) ) ) ;
245- continue ;
246- }
247- }
248-
249- string GetName ( )
250- {
251- return $ "ev{ name . First ( ) . ToString ( ) . ToUpper ( ) } { name [ 1 ..] } ";
252- }
224+ variables . Add ( Variable . Create (
225+ $ "ev{ name . First ( ) . ToString ( ) . ToUpper ( ) } { name [ 1 ..] } ",
226+ Value . Parse ( value , null ) )
227+ ) ;
253228 }
254229
255230 return variables . ToArray ( ) ;
0 commit comments