Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fdb3f65df | ||
|
|
a6fe3b095c | ||
|
|
86c0c4d391 | ||
|
|
b42dfe9be2 | ||
|
|
ea66d98df8 | ||
|
|
2cc0d6b3c2 | ||
|
|
8e2006fa2c | ||
|
|
e8c387e85c | ||
|
|
7a82b73b96 | ||
|
|
4049a429d6 | ||
|
|
5895c12c6b | ||
|
|
0b6112408f | ||
|
|
8ee3852ad8 | ||
|
|
5aab3af9ea | ||
|
|
e83d8d4b14 | ||
|
|
0241b2fb2a | ||
|
|
ac9147463a |
@@ -2,7 +2,7 @@ plugins {
|
||||
java
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
kotlin("jvm") version "1.7.10"
|
||||
kotlin("jvm") version "1.9.20"
|
||||
id("com.github.johnrengelman.shadow") version "8.0.0"
|
||||
id("com.willfp.libreforge-gradle-plugin") version "1.0.0"
|
||||
}
|
||||
@@ -40,7 +40,7 @@ allprojects {
|
||||
dependencies {
|
||||
compileOnly("com.willfp:eco:6.55.0")
|
||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.20")
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -52,6 +52,7 @@ allprojects {
|
||||
shadowJar {
|
||||
relocate("com.willfp.libreforge.loader", "com.willfp.ecopets.libreforge.loader")
|
||||
relocate("com.willfp.ecomponent", "com.willfp.ecopets.ecomponent")
|
||||
relocate("com.willfp.modelenginebridge", "com.willfp.ecopets.modelenginebridge")
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
|
||||
@@ -3,10 +3,10 @@ version = rootProject.version
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
|
||||
compileOnly("com.ticxo.modelengine:api:R3.1.8")
|
||||
compileOnly("com.github.ben-manes.caffeine:caffeine:3.0.2")
|
||||
|
||||
implementation("com.willfp:ecomponent:1.3.0")
|
||||
implementation("com.willfp:ModelEngineBridge:1.2.0")
|
||||
}
|
||||
|
||||
publishing {
|
||||
|
||||
@@ -30,7 +30,9 @@ import com.willfp.libreforge.filters.Filters
|
||||
import com.willfp.libreforge.loader.LibreforgePlugin
|
||||
import com.willfp.libreforge.loader.configs.ConfigCategory
|
||||
import com.willfp.libreforge.registerHolderProvider
|
||||
import com.willfp.libreforge.registerSpecificHolderProvider
|
||||
import com.willfp.libreforge.triggers.Triggers
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.Listener
|
||||
|
||||
class EcoPetsPlugin : LibreforgePlugin() {
|
||||
@@ -56,9 +58,9 @@ class EcoPetsPlugin : LibreforgePlugin() {
|
||||
Triggers.register(TriggerLevelUpPet)
|
||||
Filters.register(FilterPet)
|
||||
|
||||
registerHolderProvider {
|
||||
it.activePetLevel?.let { l ->
|
||||
listOf(SimpleProvidedHolder(l))
|
||||
registerSpecificHolderProvider<Player> {
|
||||
it.activePetLevel?.let { p ->
|
||||
listOf(SimpleProvidedHolder(p))
|
||||
} ?: emptyList()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.willfp.ecopets.libreforge
|
||||
import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.ecopets.api.EcoPetsAPI
|
||||
import com.willfp.ecopets.pets.Pets
|
||||
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 org.bukkit.entity.Player
|
||||
|
||||
object ConditionHasActivePet : Condition<NoCompileData>("has_active_pet") {
|
||||
@@ -13,11 +16,14 @@ object ConditionHasActivePet : Condition<NoCompileData>("has_active_pet") {
|
||||
require("pet", "You must specify the pet!")
|
||||
}
|
||||
|
||||
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 EcoPetsAPI.instance.getActivePet(player) == Pets.getByID(config.getString("pet").lowercase())
|
||||
// return EcoPetsAPI.instance.hasPet(
|
||||
// player,
|
||||
// Pets.getByID(config.getString("pet").lowercase()) ?: return false
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,22 @@ package com.willfp.ecopets.libreforge
|
||||
import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.ecopets.api.EcoPetsAPI
|
||||
import com.willfp.ecopets.pets.Pets
|
||||
import com.willfp.libreforge.Dispatcher
|
||||
import com.willfp.libreforge.NoCompileData
|
||||
import com.willfp.libreforge.ProvidedHolder
|
||||
import com.willfp.libreforge.conditions.Condition
|
||||
import com.willfp.libreforge.get
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
object ConditionHasPet : Condition<NoCompileData>("has_pet") {
|
||||
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 EcoPetsAPI.instance.hasPet(
|
||||
player,
|
||||
Pets.getByID(config.getString("pet").lowercase()) ?: return false
|
||||
|
||||
@@ -4,9 +4,13 @@ import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.ecopets.api.EcoPetsAPI
|
||||
import com.willfp.ecopets.api.event.PlayerPetLevelUpEvent
|
||||
import com.willfp.ecopets.pets.Pets
|
||||
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.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.updateEffects
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
@@ -20,10 +24,17 @@ object ConditionHasPetLevel : Condition<NoCompileData>("has_pet_level") {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
fun handle(event: PlayerPetLevelUpEvent) {
|
||||
event.player.updateEffects()
|
||||
event.player.toDispatcher().updateEffects()
|
||||
}
|
||||
|
||||
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 EcoPetsAPI.instance.getPetLevel(
|
||||
player,
|
||||
Pets.getByID(config.getString("pet").lowercase()) ?: return false
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.willfp.ecopets.api.event.PlayerPetExpGainEvent
|
||||
import com.willfp.ecopets.pets.Pet
|
||||
import com.willfp.ecopets.pets.Pets
|
||||
import com.willfp.libreforge.effects.templates.MultiMultiplierEffect
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import org.bukkit.event.EventHandler
|
||||
|
||||
object EffectPetXpMultiplier : MultiMultiplierEffect<Pet>("pet_xp_multiplier") {
|
||||
@@ -21,6 +22,6 @@ object EffectPetXpMultiplier : MultiMultiplierEffect<Pet>("pet_xp_multiplier") {
|
||||
fun handle(event: PlayerPetExpGainEvent) {
|
||||
val player = event.player
|
||||
|
||||
event.amount *= getMultiplier(player, event.pet)
|
||||
event.amount *= getMultiplier(player.toDispatcher(), event.pet)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.willfp.ecopets.libreforge
|
||||
|
||||
import com.willfp.ecopets.api.event.PlayerPetExpGainEvent
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import com.willfp.libreforge.triggers.TriggerData
|
||||
import com.willfp.libreforge.triggers.TriggerParameter
|
||||
@@ -18,7 +19,7 @@ object TriggerGainPetXp : Trigger("gain_pet_xp") {
|
||||
val player = event.player
|
||||
|
||||
this.dispatch(
|
||||
player,
|
||||
player.toDispatcher(),
|
||||
TriggerData(
|
||||
player = player,
|
||||
location = player.location,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.willfp.ecopets.libreforge
|
||||
|
||||
import com.willfp.ecopets.api.event.PlayerPetLevelUpEvent
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import com.willfp.libreforge.triggers.TriggerData
|
||||
import com.willfp.libreforge.triggers.TriggerParameter
|
||||
@@ -18,7 +19,7 @@ object TriggerLevelUpPet : Trigger("level_up_pet") {
|
||||
val player = event.player
|
||||
|
||||
this.dispatch(
|
||||
player,
|
||||
player.toDispatcher(),
|
||||
TriggerData(
|
||||
player = player,
|
||||
location = player.location,
|
||||
|
||||
@@ -114,7 +114,6 @@ class Pet(
|
||||
}
|
||||
|
||||
val entityTexture = config.getString("entity-texture")
|
||||
val modelEngineAnimation = config.getStringOrNull("modelengine-animation")
|
||||
|
||||
private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements")
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecopets.pets.entity
|
||||
|
||||
import com.ticxo.modelengine.api.ModelEngineAPI
|
||||
import com.willfp.ecopets.EcoPetsPlugin
|
||||
import com.willfp.ecopets.pets.Pet
|
||||
import com.willfp.modelenginebridge.ModelEngineBridge
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.entity.ArmorStand
|
||||
|
||||
@@ -13,29 +13,11 @@ class ModelEnginePetEntity(
|
||||
) : PetEntity(pet) {
|
||||
override fun spawn(location: Location): ArmorStand {
|
||||
val stand = emptyArmorStandAt(location, pet)
|
||||
val meAnimation = pet.modelEngineAnimation
|
||||
|
||||
val model = ModelEngineAPI.createActiveModel(modelID)
|
||||
val model = ModelEngineBridge.instance.createActiveModel(modelID) ?: return stand
|
||||
|
||||
if (meAnimation != null) {
|
||||
val animationHandler = model.animationHandler
|
||||
val animationProperty = animationHandler.getAnimation(meAnimation)
|
||||
|
||||
if (animationProperty != null) {
|
||||
animationHandler.playAnimation(animationProperty, true)
|
||||
} else {
|
||||
plugin.logger.warning("Animation $meAnimation not found in model $modelID, defaulting to walk!")
|
||||
val animationPropertyWalk = animationHandler.getAnimation("walk")
|
||||
if (animationPropertyWalk != null) {
|
||||
animationHandler.playAnimation(animationPropertyWalk, true)
|
||||
} else {
|
||||
plugin.logger.warning("Walk animation not found in $modelID!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val modelled = ModelEngineAPI.createModeledEntity(stand)
|
||||
modelled.addModel(model, true)
|
||||
val modelled = ModelEngineBridge.instance.createModeledEntity(stand)
|
||||
modelled.addModel(model)
|
||||
|
||||
return stand
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
name: ${pluginName}
|
||||
version: ${version}
|
||||
main: com.willfp.ecopets.EcoPetsPlugin
|
||||
api-version: 1.19
|
||||
|
||||
dependencies:
|
||||
- name: eco
|
||||
required: true
|
||||
bootstrap: false
|
||||
|
||||
- name: libreforge
|
||||
required: false
|
||||
bootstrap: false
|
||||
|
||||
load-after:
|
||||
- name: eco
|
||||
bootstrap: false
|
||||
|
||||
|
||||
permissions:
|
||||
ecopets.*:
|
||||
description: All ecopets permissions
|
||||
default: op
|
||||
children:
|
||||
ecopets.command.*: true
|
||||
ecopets.command.*:
|
||||
description: All commands
|
||||
default: op
|
||||
children:
|
||||
ecopets.command.ecopets: true
|
||||
ecopets.command.reload: true
|
||||
ecopets.command.pets: true
|
||||
ecopets.command.give: true
|
||||
ecopets.command.giveegg: true
|
||||
ecopets.command.givexp: true
|
||||
ecopets.command.givecurrentxp: true
|
||||
ecopets.command.reset: true
|
||||
ecopets.command.activate: true
|
||||
ecopets.command.deactivate: true
|
||||
|
||||
ecopets.command.reload:
|
||||
description: Allows reloading the config
|
||||
default: op
|
||||
ecopets.command.ecopets:
|
||||
description: Allows the use of /ecopets.
|
||||
default: true
|
||||
ecopets.command.pets:
|
||||
description: Allows the use of /pets.
|
||||
default: true
|
||||
ecopets.command.give:
|
||||
description: Allows the use of /ecopets give.
|
||||
default: op
|
||||
ecopets.command.giveegg:
|
||||
description: Allows the use of /ecopets giveegg.
|
||||
default: op
|
||||
ecopets.command.givexp:
|
||||
description: Allows the use of /ecopets givexp.
|
||||
default: op
|
||||
ecopets.command.givecurrentxp:
|
||||
description: Allows the use of /ecopets givecurrentxp.
|
||||
default: op
|
||||
ecopets.command.reset:
|
||||
description: Allows the use of /ecopets reset.
|
||||
default: op
|
||||
ecopets.command.activate:
|
||||
description: Allows the use of /pets activate.
|
||||
default: true
|
||||
ecopets.command.deactivate:
|
||||
description: Allows the use of /pets deactivate.
|
||||
default: true
|
||||
|
||||
ecopets.xpmultiplier.50percent:
|
||||
description: Gives the player 50% more skill experience
|
||||
default: false
|
||||
ecopets.xpmultiplier.double:
|
||||
description: Gives the player 2x skill experience
|
||||
default: false
|
||||
ecopets.xpmultiplier.triple:
|
||||
description: Gives the player 3x skill experience
|
||||
default: false
|
||||
ecopets.xpmultiplier.quadruple:
|
||||
description: Gives the player 4x skill experience
|
||||
default: false
|
||||
@@ -116,7 +116,6 @@ conditions: [ ]
|
||||
# The texture of the pet entity in game
|
||||
# If you're using modelengine, use modelengine:id as the texture
|
||||
entity-texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0="
|
||||
modelengine-animation: "fly" # If you're using ModelEngine, you can specify an animation here
|
||||
|
||||
# The icon in GUIs
|
||||
icon: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0=
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#libreforge-updater
|
||||
#Fri Nov 10 13:59:34 GMT 2023
|
||||
#Thu Jan 04 17:25:31 GMT 2024
|
||||
kotlin.code.style=official
|
||||
libreforge-version=4.41.0
|
||||
version=2.41.0
|
||||
libreforge-version=4.53.0
|
||||
version=2.52.0
|
||||
|
||||
Reference in New Issue
Block a user