Skip to content

Commit

Permalink
libreforge-updater
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Nov 21, 2023
1 parent cd6853b commit e080bff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import com.willfp.libreforge.SimpleProvidedHolder
import com.willfp.libreforge.conditions.Conditions
import com.willfp.libreforge.loader.LibreforgePlugin
import com.willfp.libreforge.loader.configs.ConfigCategory
import com.willfp.libreforge.registerGenericHolderProvider
import com.willfp.libreforge.registerHolderProvider
import com.willfp.libreforge.registerSpecificHolderProvider
import org.bukkit.Bukkit

class BoostersPlugin : LibreforgePlugin() {
Expand All @@ -24,7 +26,9 @@ class BoostersPlugin : LibreforgePlugin() {
override fun handleEnable() {
Conditions.register(ConditionIsBoosterActive)

registerHolderProvider { Bukkit.getServer().activeBoosters.map { it.booster }.map { SimpleProvidedHolder(it) } }
registerGenericHolderProvider {
Bukkit.getServer().activeBoosters.map { it.booster }.map { SimpleProvidedHolder(it) }
}
}

override fun handleReload() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package com.willfp.boosters.libreforge

import com.willfp.boosters.boosters.Boosters
import com.willfp.eco.core.config.interfaces.Config
import com.willfp.libreforge.Dispatcher
import com.willfp.libreforge.NoCompileData
import com.willfp.libreforge.ProvidedHolder
import com.willfp.libreforge.arguments
import com.willfp.libreforge.conditions.Condition
import org.bukkit.entity.Player
Expand All @@ -12,7 +14,12 @@ object ConditionIsBoosterActive : Condition<NoCompileData>("is_booster_active")
require("booster", "You must specify the booster!")
}

override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
override fun isMet(
dispatcher: Dispatcher<*>,
config: Config,
holder: ProvidedHolder,
compileData: NoCompileData
): Boolean {
return Boosters.getByID(config.getString("booster"))?.active != null
}
}
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#libreforge-updater
#Sun Nov 19 14:14:17 GMT 2023
#Tue Nov 21 22:41:33 GMT 2023
kotlin.code.style=official
libreforge-version=4.43.1
version=5.42.1
libreforge-version=4.44.0
version=5.43.0

0 comments on commit e080bff

Please sign in to comment.