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 a8816cb commit 4f81d47
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import com.willfp.libreforge.loader.LibreforgePlugin
import com.willfp.libreforge.loader.configs.ConfigCategory
import com.willfp.libreforge.registerHolderProvider
import com.willfp.libreforge.registerPlayerRefreshFunction
import com.willfp.libreforge.registerSpecificHolderProvider
import com.willfp.libreforge.registerSpecificRefreshFunction
import com.willfp.talismans.bag.TalismanBag
import com.willfp.talismans.command.CommandTalismans
import com.willfp.talismans.display.TalismanDisplay
Expand All @@ -15,6 +17,7 @@ import com.willfp.talismans.talismans.Talismans
import com.willfp.talismans.talismans.util.BlockPlaceListener
import com.willfp.talismans.talismans.util.DiscoverRecipeListener
import com.willfp.talismans.talismans.util.TalismanChecks
import org.bukkit.entity.Player
import org.bukkit.event.Listener

class TalismansPlugin : LibreforgePlugin() {
Expand All @@ -31,8 +34,13 @@ class TalismansPlugin : LibreforgePlugin() {
}

override fun handleEnable() {
registerHolderProvider { TalismanChecks.getTalismansOnPlayer(it) }
registerPlayerRefreshFunction { TalismanChecks.clearCache(it) }
registerSpecificHolderProvider<Player> {
TalismanChecks.getTalismansOnPlayer(it)
}

registerSpecificRefreshFunction<Player> {
TalismanChecks.clearCache(it)
}
}

override fun loadConfigCategories(): List<ConfigCategory> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ package com.willfp.talismans.libreforge

import com.willfp.eco.core.config.interfaces.Config
import com.willfp.eco.util.containsIgnoreCase
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 com.willfp.libreforge.get
import com.willfp.talismans.talismans.Talisman
import com.willfp.talismans.talismans.util.TalismanChecks
import org.bukkit.entity.Player
Expand All @@ -14,7 +17,14 @@ object ConditionHasTalisman : Condition<NoCompileData>("has_talisman") {
require("talisman", "You must specify the talisman!")
}

override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
override fun isMet(
dispatcher: Dispatcher<*>,
config: Config,
holder: ProvidedHolder,
compileData: NoCompileData
): Boolean {
val player = dispatcher.get<Player>() ?: return false

return TalismanChecks.getTalismansOnPlayer(player)
.map { it.holder }
.filterIsInstance<Talisman>()
Expand Down
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:07 GMT 2023
#Tue Nov 21 22:41:23 GMT 2023
kotlin.code.style=official
libreforge-version=4.43.1
version=6.42.1
libreforge-version=4.44.0
version=6.43.0

0 comments on commit 4f81d47

Please sign in to comment.