@@ -31,25 +31,28 @@ internal DatabaseManager()
3131
3232 private bool KeyVailed ( CDKData cdk )
3333 {
34- if ( cdk . Items . Length != cdk . Amount . Length )
34+ if ( cdk . Items != string . Empty && cdk . Amount != string . Empty )
3535 {
36- Logger . LogError ( String . Format ( "CDK:{0} Items and Amount Column length not equal! " , cdk . CDK ) ) ;
37- return false ;
38- }
39- for ( int i = 0 ; i < cdk . Items . Length ; i ++ )
40- {
41- if ( ! ushort . TryParse ( cdk . Items [ i ] . ToString ( ) , out ushort id ) )
36+ if ( cdk . Items . Split ( ',' ) . Length != cdk . Amount . Split ( ',' ) . Length )
4237 {
43- Logger . LogError ( String . Format ( "CDK:{0} has id in Items not a ushort!" , cdk . CDK ) ) ;
38+ Logger . LogError ( String . Format ( "CDK:{0} Items and Amount Column length not equal! " , cdk . CDK ) ) ;
4439 return false ;
4540 }
46- }
47- for ( int i = 0 ; i < cdk . Amount . Length ; i ++ )
48- {
49- if ( ! byte . TryParse ( cdk . Amount [ i ] . ToString ( ) , out byte am ) )
41+ for ( int i = 0 ; i < cdk . Items . Split ( ',' ) . Length ; i ++ )
5042 {
51- Logger . LogError ( String . Format ( "CDK:{0} has amount in Amount not a byte. MAX 255!" , cdk . CDK ) ) ;
52- return false ;
43+ if ( ! ushort . TryParse ( cdk . Items [ i ] . ToString ( ) , out ushort id ) )
44+ {
45+ Logger . LogError ( String . Format ( "CDK:{0} has id in Items not a ushort!" , cdk . CDK ) ) ;
46+ return false ;
47+ }
48+ }
49+ for ( int i = 0 ; i < cdk . Amount . Split ( ',' ) . Length ; i ++ )
50+ {
51+ if ( ! byte . TryParse ( cdk . Amount [ i ] . ToString ( ) , out byte am ) )
52+ {
53+ Logger . LogError ( String . Format ( "CDK:{0} has amount in Amount not a byte. MAX 255!" , cdk . CDK ) ) ;
54+ return false ;
55+ }
5356 }
5457 }
5558
0 commit comments