Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 20, 2025
2 parents 2910a90 + 6b8f9b7 commit aad5f70
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ 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.fancynpcs.FancyNPCsIntegration
import com.willfp.libreforge.integrations.jobs.JobsIntegration
import com.willfp.libreforge.integrations.levelledmobs.LevelledMobsIntegration
import com.willfp.libreforge.integrations.mcmmo.McMMOIntegration
Expand All @@ -31,6 +31,7 @@ import com.willfp.libreforge.integrations.scyther.ScytherIntegration
import com.willfp.libreforge.integrations.tab.TabIntegration
import com.willfp.libreforge.integrations.tmmobcoins.TMMobcoinsIntegration
import com.willfp.libreforge.integrations.vault.VaultIntegration
import com.willfp.libreforge.integrations.votifier.VotifierIntegration
import com.willfp.libreforge.integrations.worldguard.WorldGuardIntegration
import com.willfp.libreforge.levels.LevelTypes
import com.willfp.libreforge.levels.placeholder.*
Expand Down Expand Up @@ -195,8 +196,9 @@ class LibreforgeSpigotPlugin : EcoPlugin() {
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) }
IntegrationLoader("Votifier") { VotifierIntegration.load(this) },
IntegrationLoader("ModelEngine") { ModelEngineIntegration.load(this) },
IntegrationLoader("FancyNpcs") { FancyNPCsIntegration.load(this) }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ object FilterEnvoyType : Filter<NoCompileData, Collection<String>>("envoy_type")

override fun isMet(data: TriggerData, value: Collection<String>, compileData: NoCompileData): Boolean {
val event = data.event as? EnvoyCrateCollectEvent ?: return true

val crateType = event.crate?.handle?.name ?: return true

return value.contains(crateType)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.willfp.libreforge.integrations.fancynpcs

import com.willfp.eco.core.EcoPlugin
import com.willfp.libreforge.filters.Filters
import com.willfp.libreforge.integrations.LoadableIntegration
import com.willfp.libreforge.integrations.fancynpcs.impl.FilterNPC
import com.willfp.libreforge.integrations.fancynpcs.impl.TriggerLeftClickNPC
import com.willfp.libreforge.integrations.fancynpcs.impl.TriggerRightClickNPC
import com.willfp.libreforge.triggers.Triggers

object FancyNPCsIntegration : LoadableIntegration {
override fun load(plugin: EcoPlugin) {
Triggers.register(TriggerLeftClickNPC)
Triggers.register(TriggerRightClickNPC)
Filters.register(FilterNPC)
}

override fun getPluginName(): String {
return "FancyNpcs"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.willfp.libreforge.integrations.fancynpcs.impl

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
import de.oliver.fancynpcs.api.events.NpcInteractEvent

object FilterNPC : Filter<NoCompileData, Collection<String>>("npc") {
override fun getValue(config: Config, data: TriggerData?, key: String): Collection<String> {
return config.getStrings(key)
}

override fun isMet(data: TriggerData, value: Collection<String>, compileData: NoCompileData): Boolean {
val event = data.event as? NpcInteractEvent ?: return true

return value.contains(event.npc.data.id)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.willfp.libreforge.integrations.fancynpcs.impl

import com.willfp.libreforge.toDispatcher
import com.willfp.libreforge.triggers.Trigger
import com.willfp.libreforge.triggers.TriggerData
import com.willfp.libreforge.triggers.TriggerParameter
import de.oliver.fancynpcs.api.actions.ActionTrigger
import de.oliver.fancynpcs.api.events.NpcInteractEvent
import org.bukkit.event.EventHandler

object TriggerLeftClickNPC : Trigger("left_click_npc") {
override val parameters = setOf(
TriggerParameter.PLAYER,
TriggerParameter.EVENT
)

@EventHandler(ignoreCancelled = true)
fun handle(event: NpcInteractEvent) {
if (event.interactionType == ActionTrigger.LEFT_CLICK) {
val player = event.player ?: return

this.dispatch(
player.toDispatcher(),
TriggerData(
player = player,
event = event
)
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.willfp.libreforge.integrations.fancynpcs.impl

import com.willfp.libreforge.toDispatcher
import com.willfp.libreforge.triggers.Trigger
import com.willfp.libreforge.triggers.TriggerData
import com.willfp.libreforge.triggers.TriggerParameter
import de.oliver.fancynpcs.api.actions.ActionTrigger
import de.oliver.fancynpcs.api.events.NpcInteractEvent
import org.bukkit.event.EventHandler

object TriggerRightClickNPC : Trigger("right_click_npc") {
override val parameters = setOf(
TriggerParameter.PLAYER,
TriggerParameter.EVENT
)

@EventHandler(ignoreCancelled = true)
fun handle(event: NpcInteractEvent) {
if (event.interactionType == ActionTrigger.RIGHT_CLICK) {
val player = event.player ?: return

this.dispatch(
player.toDispatcher(),
TriggerData(
player = player,
event = event
)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ object FilterVoteService : Filter<NoCompileData, Collection<String>>("vote_servi

override fun isMet(data: TriggerData, value: Collection<String>, compileData: NoCompileData): Boolean {
val event = data.event as? VotifierEvent ?: return true

val service = event.vote.serviceName ?: return true

return value.contains(service)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ object TriggerHeadshot : Trigger("headshot") {
location = victim.location,
event = event,
velocity = projectile.velocity,
value = event.finalDamage
value = event.finalDamage,
projectile = projectile
)
)
}
Expand Down
1 change: 1 addition & 0 deletions core/common/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ softdepend:
- ModelEngine
- AxEnvoy
- Votifier
- FancyNpcs

commands:
lrcdb:
Expand Down
Binary file added lib/FancyNpcs-2.4.1.jar
Binary file not shown.

0 comments on commit aad5f70

Please sign in to comment.