diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 308d46ed..6ab4081f 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -7,7 +7,8 @@ dependencies { compileOnly("com.willfp:eco:6.71.0") compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT") compileOnly("net.kyori:adventure-text-minimessage:4.14.0") - + compileOnly("com.github.Artillex-Studios:AxEnvoys:master") + compileOnly("com.github.NuVotifier:NuVotifier:2.7.2") compileOnly("dev.aurelium:auraskills-api-bukkit:2.0.0") compileOnly("com.github.Archy-X:AureliumSkills:Beta1.2.4") compileOnly("com.gmail.nossr50.mcMMO:mcMMO:2.1.202") { diff --git a/core/src/main/kotlin/com/willfp/libreforge/LibreforgeSpigotPlugin.kt b/core/src/main/kotlin/com/willfp/libreforge/LibreforgeSpigotPlugin.kt index c415d4cc..5308d430 100644 --- a/core/src/main/kotlin/com/willfp/libreforge/LibreforgeSpigotPlugin.kt +++ b/core/src/main/kotlin/com/willfp/libreforge/LibreforgeSpigotPlugin.kt @@ -15,7 +15,9 @@ import com.willfp.libreforge.effects.arguments.custom.CustomEffectArguments import com.willfp.libreforge.effects.impl.bossbar.BossBarProgressPlaceholder import com.willfp.libreforge.integrations.auraskills.AuraSkillsIntegration import com.willfp.libreforge.integrations.aureliumskills.AureliumSkillsIntegration +import com.willfp.libreforge.integrations.axenvoy.AxEnvoyIntegration import com.willfp.libreforge.integrations.citizens.CitizensIntegration +import com.willfp.libreforge.integrations.votifier.VotifierIntegration import com.willfp.libreforge.integrations.custombiomes.impl.CustomBiomesTerra import com.willfp.libreforge.integrations.custombiomes.impl.CustomBiomesTerraformGenerator import com.willfp.libreforge.integrations.jobs.JobsIntegration @@ -184,6 +186,8 @@ class LibreforgeSpigotPlugin : EcoPlugin() { IntegrationLoader("TAB") { TabIntegration.load(this) }, IntegrationLoader("Terra") { CustomBiomesTerra.load(this) }, IntegrationLoader("TerraformGenerator") { CustomBiomesTerraformGenerator.load(this) }, + IntegrationLoader("AxEnvoy") { AxEnvoyIntegration.load(this) }, + IntegrationLoader("Votifier") { VotifierIntegration.load(this)}, IntegrationLoader("ModelEngine") { ModelEngineIntegration.load(this) } ) } diff --git a/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/AxEnvoyIntegration.kt b/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/AxEnvoyIntegration.kt new file mode 100644 index 00000000..3a64d834 --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/AxEnvoyIntegration.kt @@ -0,0 +1,19 @@ +package com.willfp.libreforge.integrations.axenvoy + +import com.willfp.eco.core.EcoPlugin +import com.willfp.libreforge.filters.Filters +import com.willfp.libreforge.integrations.LoadableIntegration +import com.willfp.libreforge.integrations.axenvoy.impl.FilterEnvoyType +import com.willfp.libreforge.integrations.axenvoy.impl.TriggerCollectEnvoy +import com.willfp.libreforge.triggers.Triggers + +object AxEnvoyIntegration : LoadableIntegration { + override fun load(plugin: EcoPlugin) { + Triggers.register(TriggerCollectEnvoy) + Filters.register(FilterEnvoyType) + } + + override fun getPluginName(): String { + return "AxEnvoy" + } +} diff --git a/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/FilterEnvoyType.kt b/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/FilterEnvoyType.kt new file mode 100644 index 00000000..d916535e --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/FilterEnvoyType.kt @@ -0,0 +1,20 @@ +package com.willfp.libreforge.integrations.axenvoy.impl + +import com.artillexstudios.axenvoy.event.EnvoyCrateCollectEvent +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.libreforge.NoCompileData +import com.willfp.libreforge.filters.Filter +import com.willfp.libreforge.triggers.TriggerData + +object FilterEnvoyType : Filter>("envoy_type") { + override fun getValue(config: Config, data: TriggerData?, key: String): Collection { + return config.getStrings(key) + } + + override fun isMet(data: TriggerData, value: Collection, compileData: NoCompileData): Boolean { + val event = data.event as? EnvoyCrateCollectEvent ?: return true + + val crateType = event.crate?.handle?.name ?: return true + return value.contains(crateType) + } +} diff --git a/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/TriggerCollectEnvoy.kt b/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/TriggerCollectEnvoy.kt new file mode 100644 index 00000000..a5ede44e --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/TriggerCollectEnvoy.kt @@ -0,0 +1,35 @@ +package com.willfp.libreforge.integrations.axenvoy.impl + +import com.artillexstudios.axenvoy.event.EnvoyCrateCollectEvent +import com.willfp.libreforge.toDispatcher +import com.willfp.libreforge.triggers.Trigger +import com.willfp.libreforge.triggers.TriggerData +import com.willfp.libreforge.triggers.TriggerParameter +import org.bukkit.event.EventHandler + +object TriggerCollectEnvoy : Trigger("collect_envoy") { + override val parameters = setOf( + TriggerParameter.PLAYER, + TriggerParameter.LOCATION, + TriggerParameter.EVENT, + TriggerParameter.TEXT + ) + + @EventHandler(ignoreCancelled = true) + fun handle(event: EnvoyCrateCollectEvent) { + val player = event.player ?: return + val crate = event.crate ?: return + val location = crate.finishLocation ?: return + val crateType = crate.handle?.name ?: return + + this.dispatch( + player.toDispatcher(), + TriggerData( + player = player, + location = location, + event = event, + text = crateType + ) + ) + } +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/VotifierIntegration.kt b/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/VotifierIntegration.kt new file mode 100644 index 00000000..b4dbd8e2 --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/VotifierIntegration.kt @@ -0,0 +1,19 @@ +package com.willfp.libreforge.integrations.votifier + +import com.willfp.eco.core.EcoPlugin +import com.willfp.libreforge.filters.Filters +import com.willfp.libreforge.integrations.LoadableIntegration +import com.willfp.libreforge.integrations.votifier.impl.FilterVoteService +import com.willfp.libreforge.integrations.votifier.impl.TriggerRegisterVote +import com.willfp.libreforge.triggers.Triggers + +object VotifierIntegration : LoadableIntegration { + override fun load(plugin: EcoPlugin) { + Triggers.register(TriggerRegisterVote) + Filters.register(FilterVoteService) + } + + override fun getPluginName(): String { + return "Votifier" + } +} diff --git a/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/FilterVoteService.kt b/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/FilterVoteService.kt new file mode 100644 index 00000000..71cc4d4e --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/FilterVoteService.kt @@ -0,0 +1,20 @@ +package com.willfp.libreforge.integrations.votifier.impl + +import com.vexsoftware.votifier.model.VotifierEvent +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.libreforge.NoCompileData +import com.willfp.libreforge.filters.Filter +import com.willfp.libreforge.triggers.TriggerData + +object FilterVoteService : Filter>("vote_service") { + override fun getValue(config: Config, data: TriggerData?, key: String): Collection { + return config.getStrings(key) + } + + override fun isMet(data: TriggerData, value: Collection, compileData: NoCompileData): Boolean { + val event = data.event as? VotifierEvent ?: return true + + val service = event.vote.serviceName ?: return true + return value.contains(service) + } +} diff --git a/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/TriggerRegisterVote.kt b/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/TriggerRegisterVote.kt new file mode 100644 index 00000000..8118b92d --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/TriggerRegisterVote.kt @@ -0,0 +1,33 @@ +package com.willfp.libreforge.integrations.votifier.impl + +import com.vexsoftware.votifier.model.VotifierEvent +import com.willfp.libreforge.toDispatcher +import com.willfp.libreforge.triggers.Trigger +import com.willfp.libreforge.triggers.TriggerData +import com.willfp.libreforge.triggers.TriggerParameter +import org.bukkit.Bukkit +import org.bukkit.event.EventHandler + +object TriggerRegisterVote : Trigger("register_vote") { + override val parameters = setOf( + TriggerParameter.PLAYER, + TriggerParameter.EVENT, + TriggerParameter.TEXT + ) + + @EventHandler(ignoreCancelled = true) + fun handle(event: VotifierEvent) { + val username = event.vote.username ?: return + val player = Bukkit.getPlayerExact(username) ?: return + val service = event.vote.serviceName ?: return + + this.dispatch( + player.toDispatcher(), + TriggerData( + player = player, + event = event, + text = service + ) + ) + } +} diff --git a/core/src/main/resources/plugin.yml b/core/src/main/resources/plugin.yml index a241eda4..2225c536 100644 --- a/core/src/main/resources/plugin.yml +++ b/core/src/main/resources/plugin.yml @@ -26,6 +26,8 @@ softdepend: - Terra - TerraformGenerator - ModelEngine + - AxEnvoy + - Votifier commands: lrcdb: