Skip to content

Commit

Permalink
fix papi expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
makeevrserg committed Jun 9, 2024
1 parent 5a78849 commit 8c143b7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ makeevrserg.java.ktarget=21
# Project
makeevrserg.project.name=AstraRating
makeevrserg.project.group=ru.astrainteractive.astrarating
makeevrserg.project.version.string=1.17.0
makeevrserg.project.version.string=1.17.1
makeevrserg.project.description=Rating plugin for EmpireProjekt
makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com
makeevrserg.project.url=https://empireprojekt.ru
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ internal class RatingPAPILifecycle(dependencies: PapiDependencies) : Lifecycle {
get() = Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null

override fun onEnable() {
if (!isPapiExists) return
if (!isPapiExists) {
Bukkit.getLogger().warning("Could not find PlaceholderAPI. Placeholders disabled")
return
}
Bukkit.getLogger().warning("Found PlaceholderAPI. Placeholders are now enabled")
if (expansion.isRegistered) {
expansion.unregister()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ru.astrainteractive.klibs.kdi.Dependency
import ru.astrainteractive.klibs.kdi.getValue

interface PapiModule {
val ratingPAPILifecycle: Lifecycle
val lifecycle: Lifecycle

class Default(
cachedApi: CachedApi,
Expand All @@ -21,7 +21,7 @@ interface PapiModule {
override val config by config
override val scope: CoroutineScope = scope
}
override val ratingPAPILifecycle: Lifecycle by lazy {
override val lifecycle: Lifecycle by lazy {
RatingPAPILifecycle(papiDependencies)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import ru.astrainteractive.astrarating.di.impl.RootModuleImpl
class AstraRating : JavaPlugin() {
private val rootModule = RootModuleImpl()
private val lifecycles: List<Lifecycle>
get() = listOf(
get() = listOfNotNull(
rootModule.coreModule.lifecycle,
rootModule.bukkitModule.lifecycle,
rootModule.dbRatingModule.lifecycle,
rootModule.commandsModule.lifecycle,
rootModule.eventModule.lifecycle,
rootModule.papiModule?.lifecycle
)

init {
Expand Down

0 comments on commit 8c143b7

Please sign in to comment.