Compare commits

...

9 Commits

Author SHA1 Message Date
Auxilor
ffe6f47e22 libreforge-updater 2023-07-25 14:38:31 +01:00
Auxilor
759f921287 libreforge-updater 2023-07-23 11:40:38 +01:00
Auxilor
2a0e27d7e1 libreforge-updater 2023-07-22 14:59:48 +01:00
Will FP
ad1e639d00 Merge pull request #44 from SenPr/master
Add total_pets placeholder, `has_pet` condition and fix `has_active_pet`
2023-07-22 13:37:26 +01:00
Sen2000
6b2ea93e3b imports... 2023-07-20 15:58:44 +07:00
Sen2000
9f55826f5e Add has_pet condition and fix has_active_pet 2023-07-20 15:44:22 +07:00
Sen2000
8e90f57364 imports oopsie part 2 2023-07-19 01:14:40 +07:00
Sen2000
682cfe6c8e imports oopsie AGAIN 2023-07-19 01:13:24 +07:00
Sen2000
a4983ffea0 Add total_pets placeholder 2023-07-19 01:10:40 +07:00
4 changed files with 40 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import com.willfp.eco.core.placeholder.PlayerPlaceholder
import com.willfp.ecopets.commands.CommandEcoPets
import com.willfp.ecopets.commands.CommandPets
import com.willfp.ecopets.libreforge.ConditionHasActivePet
import com.willfp.ecopets.libreforge.ConditionHasPet
import com.willfp.ecopets.libreforge.ConditionHasPetLevel
import com.willfp.ecopets.libreforge.EffectGivePetXp
import com.willfp.ecopets.libreforge.EffectPetXpMultiplier
@@ -19,6 +20,7 @@ import com.willfp.ecopets.pets.Pets
import com.willfp.ecopets.pets.SpawnEggHandler
import com.willfp.ecopets.pets.activePet
import com.willfp.ecopets.pets.activePetLevel
import com.willfp.ecopets.pets.hasPet
import com.willfp.ecopets.pets.entity.ModelEnginePetEntity
import com.willfp.ecopets.pets.entity.PetEntity
import com.willfp.libreforge.SimpleProvidedHolder
@@ -47,6 +49,7 @@ class EcoPetsPlugin : LibreforgePlugin() {
override fun handleEnable() {
Conditions.register(ConditionHasPetLevel)
Conditions.register(ConditionHasActivePet)
Conditions.register(ConditionHasPet)
Effects.register(EffectPetXpMultiplier)
Effects.register(EffectGivePetXp)
Triggers.register(TriggerGainPetXp)
@@ -68,6 +71,18 @@ class EcoPetsPlugin : LibreforgePlugin() {
this,
"pet_id"
) { it.activePet?.id ?: "" }.register()
PlayerPlaceholder(
this,
"total_pets"
) {
var pets = 0
for (pet in Pets.values()) {
if (it.hasPet(pet))
pets++
}
pets.toString()
}.register()
}
override fun handleReload() {

View File

@@ -14,9 +14,10 @@ object ConditionHasActivePet : Condition<NoCompileData>("has_active_pet") {
}
override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
return EcoPetsAPI.instance.hasPet(
player,
Pets.getByID(config.getString("pet").lowercase()) ?: 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
// )
}
}

View File

@@ -0,0 +1,17 @@
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.NoCompileData
import com.willfp.libreforge.conditions.Condition
import org.bukkit.entity.Player
object ConditionHasPet : Condition<NoCompileData>("has_pet") {
override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
return EcoPetsAPI.instance.hasPet(
player,
Pets.getByID(config.getString("pet").lowercase()) ?: return false
)
}
}

View File

@@ -1,5 +1,5 @@
#libreforge-updater
#Fri Jul 21 12:33:13 BST 2023
#Tue Jul 25 14:38:31 BST 2023
kotlin.code.style=official
libreforge-version=4.25.0
version=2.24.0
libreforge-version=4.25.3
version=2.24.3