File tree 1 file changed +9
-2
lines changed
src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/providers
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ import com.mairwunnx.projectessentials.core.api.v1.configuration.IConfiguration
7
7
import com.mairwunnx.projectessentials.core.api.v1.module.IModule
8
8
import com.mairwunnx.projectessentials.core.api.v1.providersMarker
9
9
import org.apache.logging.log4j.LogManager
10
+ import java.util.*
11
+ import kotlin.collections.HashMap
12
+
10
13
11
14
/* *
12
15
* Provider API class. If you build new module
@@ -16,7 +19,9 @@ import org.apache.logging.log4j.LogManager
16
19
*/
17
20
object ProviderAPI {
18
21
private val logger = LogManager .getLogger()
19
- private val providers = mutableMapOf<ProviderType , MutableList <Class <* >>>()
22
+ private val providers = Collections .synchronizedMap(
23
+ HashMap <ProviderType , MutableList <Class <* >>>()
24
+ )
20
25
21
26
/* *
22
27
* Adds target provider. (provider type will determine automatically)
@@ -54,7 +59,9 @@ object ProviderAPI {
54
59
* @since 2.0.0-SNAPSHOT.1.
55
60
*/
56
61
fun addProvider (type : ProviderType , clazz : Class <* >) {
57
- providers[type]?.add(clazz) ? : providers.put(type, mutableListOf (clazz))
62
+ synchronized(providers) {
63
+ providers[type]?.add(clazz) ? : providers.put(type, mutableListOf (clazz))
64
+ }
58
65
}
59
66
60
67
/* *
You can’t perform that action at this time.
0 commit comments