Move Store/Js5MasterIndex providers to the game module

This prevents the archive module from failing on a machine without the
cache installed (like the archive.openrs2.org server).

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 7692862c7c
commit 7e8883b430
  1. 9
      cache/src/main/kotlin/org/openrs2/cache/CacheModule.kt
  2. 13
      game/src/main/kotlin/org/openrs2/game/GameModule.kt
  3. 5
      game/src/main/kotlin/org/openrs2/game/cache/Js5MasterIndexProvider.kt
  4. 3
      game/src/main/kotlin/org/openrs2/game/cache/StoreProvider.kt

@ -1,7 +1,6 @@
package org.openrs2.cache
import com.google.inject.AbstractModule
import com.google.inject.Scopes
import org.openrs2.buffer.BufferModule
import org.openrs2.crypto.CryptoModule
@ -9,13 +8,5 @@ public object CacheModule : AbstractModule() {
override fun configure() {
install(BufferModule)
install(CryptoModule)
bind(Store::class.java)
.toProvider(StoreProvider::class.java)
.`in`(Scopes.SINGLETON)
bind(Js5MasterIndex::class.java)
.toProvider(Js5MasterIndexProvider::class.java)
.`in`(Scopes.SINGLETON)
}
}

@ -2,10 +2,15 @@ package org.openrs2.game
import com.google.common.util.concurrent.Service
import com.google.inject.AbstractModule
import com.google.inject.Scopes
import com.google.inject.multibindings.Multibinder
import org.openrs2.buffer.BufferModule
import org.openrs2.cache.CacheModule
import org.openrs2.cache.Js5MasterIndex
import org.openrs2.cache.Store
import org.openrs2.conf.ConfigModule
import org.openrs2.game.cache.Js5MasterIndexProvider
import org.openrs2.game.cache.StoreProvider
import org.openrs2.game.net.NetworkService
import org.openrs2.game.net.js5.Js5Service
import org.openrs2.net.NetworkModule
@ -20,5 +25,13 @@ public object GameModule : AbstractModule() {
val binder = Multibinder.newSetBinder(binder(), Service::class.java)
binder.addBinding().to(Js5Service::class.java)
binder.addBinding().to(NetworkService::class.java)
bind(Store::class.java)
.toProvider(StoreProvider::class.java)
.`in`(Scopes.SINGLETON)
bind(Js5MasterIndex::class.java)
.toProvider(Js5MasterIndexProvider::class.java)
.`in`(Scopes.SINGLETON)
}
}

@ -1,5 +1,8 @@
package org.openrs2.cache
package org.openrs2.game.cache
import org.openrs2.cache.Js5MasterIndex
import org.openrs2.cache.MasterIndexFormat
import org.openrs2.cache.Store
import javax.inject.Inject
import javax.inject.Provider

@ -1,6 +1,7 @@
package org.openrs2.cache
package org.openrs2.game.cache
import io.netty.buffer.ByteBufAllocator
import org.openrs2.cache.Store
import java.nio.file.Path
import javax.inject.Inject
import javax.inject.Provider
Loading…
Cancel
Save