-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from Exanthiax/master
AxEnvoy & NuVotifier Integration
- Loading branch information
Showing
9 changed files
with
154 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/AxEnvoyIntegration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/FilterEnvoyType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<NoCompileData, Collection<String>>("envoy_type") { | ||
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? EnvoyCrateCollectEvent ?: return true | ||
|
||
val crateType = event.crate?.handle?.name ?: return true | ||
return value.contains(crateType) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
core/src/main/kotlin/com/willfp/libreforge/integrations/axenvoy/impl/TriggerCollectEnvoy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/VotifierIntegration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/FilterVoteService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<NoCompileData, Collection<String>>("vote_service") { | ||
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? VotifierEvent ?: return true | ||
|
||
val service = event.vote.serviceName ?: return true | ||
return value.contains(service) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
core/src/main/kotlin/com/willfp/libreforge/integrations/votifier/impl/TriggerRegisterVote.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,8 @@ softdepend: | |
- Terra | ||
- TerraformGenerator | ||
- ModelEngine | ||
- AxEnvoy | ||
- Votifier | ||
|
||
commands: | ||
lrcdb: | ||
|