File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/providers Expand file tree Collapse file tree 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
77import com.mairwunnx.projectessentials.core.api.v1.module.IModule
88import com.mairwunnx.projectessentials.core.api.v1.providersMarker
99import org.apache.logging.log4j.LogManager
10+ import java.util.*
11+ import kotlin.collections.HashMap
12+
1013
1114/* *
1215 * Provider API class. If you build new module
@@ -16,7 +19,9 @@ import org.apache.logging.log4j.LogManager
1619 */
1720object ProviderAPI {
1821 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+ )
2025
2126 /* *
2227 * Adds target provider. (provider type will determine automatically)
@@ -54,7 +59,9 @@ object ProviderAPI {
5459 * @since 2.0.0-SNAPSHOT.1.
5560 */
5661 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+ }
5865 }
5966
6067 /* *
You can’t perform that action at this time.
0 commit comments