Fixed postInit
This commit is contained in:
@@ -48,6 +48,7 @@ import com.willfp.eco.internal.items.ArgParserUnbreakable
|
||||
import com.willfp.eco.internal.spigot.arrows.ArrowDataListener
|
||||
import com.willfp.eco.internal.spigot.data.DataListener
|
||||
import com.willfp.eco.internal.spigot.data.DataYml
|
||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
||||
import com.willfp.eco.internal.spigot.data.PlayerBlockListener
|
||||
import com.willfp.eco.internal.spigot.data.storage.ProfileSaver
|
||||
import com.willfp.eco.internal.spigot.display.PacketAutoRecipe
|
||||
@@ -215,6 +216,7 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
CustomItemsManager.registerAllItems()
|
||||
CustomEntitiesManager.registerAllEntities()
|
||||
ShopManager.registerEcoProvider()
|
||||
(Eco.getHandler().profileHandler as EcoProfileHandler).runPostInit()
|
||||
}
|
||||
|
||||
override fun loadIntegrationLoaders(): List<IntegrationLoader> {
|
||||
|
||||
@@ -63,4 +63,8 @@ class EcoProfileHandler(
|
||||
override fun save() {
|
||||
handler.save()
|
||||
}
|
||||
|
||||
fun runPostInit() {
|
||||
handler.runPostInit()
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,13 @@ import org.bukkit.NamespacedKey
|
||||
import java.util.UUID
|
||||
|
||||
interface DataHandler {
|
||||
fun save() {
|
||||
fun save()
|
||||
fun saveAll(uuids: Iterable<UUID>)
|
||||
|
||||
fun runPostInit() {
|
||||
|
||||
}
|
||||
|
||||
fun saveAll(uuids: Iterable<UUID>)
|
||||
|
||||
fun savePlayer(uuid: UUID) {
|
||||
saveKeysFor(uuid, PersistentDataKey.values())
|
||||
}
|
||||
|
||||
@@ -95,6 +95,11 @@ class MySQLDataHandler(
|
||||
)
|
||||
plugin.dataYml.save()
|
||||
}
|
||||
|
||||
override fun runPostInit() {
|
||||
playerHandler.runPostInit()
|
||||
serverHandler.runPostInit()
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@@ -102,7 +107,7 @@ private class ImplementedMySQLHandler(
|
||||
private val handler: EcoProfileHandler,
|
||||
private val table: UUIDTable,
|
||||
plugin: EcoPlugin,
|
||||
knownKeys: Collection<NamespacedKey>
|
||||
private val knownKeys: Collection<NamespacedKey>
|
||||
) {
|
||||
private val columns = mutableMapOf<String, Column<*>>()
|
||||
private val threadFactory = ThreadFactoryBuilder().setNameFormat("eco-mysql-thread-%d").build()
|
||||
@@ -136,11 +141,11 @@ private class ImplementedMySQLHandler(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin.scheduler.runLater(1) {
|
||||
for (key in knownKeys) {
|
||||
ensureKeyRegistration(key)
|
||||
}
|
||||
fun runPostInit() {
|
||||
for (key in knownKeys) {
|
||||
ensureKeyRegistration(key)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user