Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b862de2fdc |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +0,0 @@
|
|||||||
* @WillFP
|
|
||||||
@@ -2,7 +2,7 @@ plugins {
|
|||||||
java
|
java
|
||||||
`java-library`
|
`java-library`
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
kotlin("jvm") version "1.9.20"
|
kotlin("jvm") version "1.7.10"
|
||||||
id("com.github.johnrengelman.shadow") version "8.0.0"
|
id("com.github.johnrengelman.shadow") version "8.0.0"
|
||||||
id("com.willfp.libreforge-gradle-plugin") version "1.0.0"
|
id("com.willfp.libreforge-gradle-plugin") version "1.0.0"
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ allprojects {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("com.willfp:eco:6.55.0")
|
compileOnly("com.willfp:eco:6.55.0")
|
||||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.20")
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@@ -52,7 +52,6 @@ allprojects {
|
|||||||
shadowJar {
|
shadowJar {
|
||||||
relocate("com.willfp.libreforge.loader", "com.willfp.ecopets.libreforge.loader")
|
relocate("com.willfp.libreforge.loader", "com.willfp.ecopets.libreforge.loader")
|
||||||
relocate("com.willfp.ecomponent", "com.willfp.ecopets.ecomponent")
|
relocate("com.willfp.ecomponent", "com.willfp.ecopets.ecomponent")
|
||||||
relocate("com.willfp.modelenginebridge", "com.willfp.ecopets.modelenginebridge")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ version = rootProject.version
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
|
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
|
||||||
|
compileOnly("com.ticxo.modelengine:api:R3.1.5")
|
||||||
compileOnly("com.github.ben-manes.caffeine:caffeine:3.0.2")
|
compileOnly("com.github.ben-manes.caffeine:caffeine:3.0.2")
|
||||||
|
|
||||||
implementation("com.willfp:ecomponent:1.3.0")
|
implementation("com.willfp:ecomponent:1.3.0")
|
||||||
implementation("com.willfp:ModelEngineBridge:1.2.0")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.willfp.eco.core.placeholder.PlayerPlaceholder
|
|||||||
import com.willfp.ecopets.commands.CommandEcoPets
|
import com.willfp.ecopets.commands.CommandEcoPets
|
||||||
import com.willfp.ecopets.commands.CommandPets
|
import com.willfp.ecopets.commands.CommandPets
|
||||||
import com.willfp.ecopets.libreforge.ConditionHasActivePet
|
import com.willfp.ecopets.libreforge.ConditionHasActivePet
|
||||||
import com.willfp.ecopets.libreforge.ConditionHasPet
|
|
||||||
import com.willfp.ecopets.libreforge.ConditionHasPetLevel
|
import com.willfp.ecopets.libreforge.ConditionHasPetLevel
|
||||||
import com.willfp.ecopets.libreforge.EffectGivePetXp
|
import com.willfp.ecopets.libreforge.EffectGivePetXp
|
||||||
import com.willfp.ecopets.libreforge.EffectPetXpMultiplier
|
import com.willfp.ecopets.libreforge.EffectPetXpMultiplier
|
||||||
@@ -20,7 +19,6 @@ import com.willfp.ecopets.pets.Pets
|
|||||||
import com.willfp.ecopets.pets.SpawnEggHandler
|
import com.willfp.ecopets.pets.SpawnEggHandler
|
||||||
import com.willfp.ecopets.pets.activePet
|
import com.willfp.ecopets.pets.activePet
|
||||||
import com.willfp.ecopets.pets.activePetLevel
|
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.ModelEnginePetEntity
|
||||||
import com.willfp.ecopets.pets.entity.PetEntity
|
import com.willfp.ecopets.pets.entity.PetEntity
|
||||||
import com.willfp.libreforge.SimpleProvidedHolder
|
import com.willfp.libreforge.SimpleProvidedHolder
|
||||||
@@ -30,9 +28,7 @@ import com.willfp.libreforge.filters.Filters
|
|||||||
import com.willfp.libreforge.loader.LibreforgePlugin
|
import com.willfp.libreforge.loader.LibreforgePlugin
|
||||||
import com.willfp.libreforge.loader.configs.ConfigCategory
|
import com.willfp.libreforge.loader.configs.ConfigCategory
|
||||||
import com.willfp.libreforge.registerHolderProvider
|
import com.willfp.libreforge.registerHolderProvider
|
||||||
import com.willfp.libreforge.registerSpecificHolderProvider
|
|
||||||
import com.willfp.libreforge.triggers.Triggers
|
import com.willfp.libreforge.triggers.Triggers
|
||||||
import org.bukkit.entity.Player
|
|
||||||
import org.bukkit.event.Listener
|
import org.bukkit.event.Listener
|
||||||
|
|
||||||
class EcoPetsPlugin : LibreforgePlugin() {
|
class EcoPetsPlugin : LibreforgePlugin() {
|
||||||
@@ -51,16 +47,15 @@ class EcoPetsPlugin : LibreforgePlugin() {
|
|||||||
override fun handleEnable() {
|
override fun handleEnable() {
|
||||||
Conditions.register(ConditionHasPetLevel)
|
Conditions.register(ConditionHasPetLevel)
|
||||||
Conditions.register(ConditionHasActivePet)
|
Conditions.register(ConditionHasActivePet)
|
||||||
Conditions.register(ConditionHasPet)
|
|
||||||
Effects.register(EffectPetXpMultiplier)
|
Effects.register(EffectPetXpMultiplier)
|
||||||
Effects.register(EffectGivePetXp)
|
Effects.register(EffectGivePetXp)
|
||||||
Triggers.register(TriggerGainPetXp)
|
Triggers.register(TriggerGainPetXp)
|
||||||
Triggers.register(TriggerLevelUpPet)
|
Triggers.register(TriggerLevelUpPet)
|
||||||
Filters.register(FilterPet)
|
Filters.register(FilterPet)
|
||||||
|
|
||||||
registerSpecificHolderProvider<Player> {
|
registerHolderProvider {
|
||||||
it.activePetLevel?.let { p ->
|
it.activePetLevel?.let { l ->
|
||||||
listOf(SimpleProvidedHolder(p))
|
listOf(SimpleProvidedHolder(l))
|
||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,18 +68,6 @@ class EcoPetsPlugin : LibreforgePlugin() {
|
|||||||
this,
|
this,
|
||||||
"pet_id"
|
"pet_id"
|
||||||
) { it.activePet?.id ?: "" }.register()
|
) { 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() {
|
override fun handleReload() {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ class CommandEcoPets(plugin: EcoPlugin) : PluginCommand(plugin, "ecopets", "ecop
|
|||||||
.addSubcommand(CommandGiveEgg(plugin))
|
.addSubcommand(CommandGiveEgg(plugin))
|
||||||
.addSubcommand(CommandGiveXP(plugin))
|
.addSubcommand(CommandGiveXP(plugin))
|
||||||
.addSubcommand(CommandReset(plugin))
|
.addSubcommand(CommandReset(plugin))
|
||||||
.addSubcommand(CommandGiveCurrentXP(plugin))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onExecute(sender: CommandSender, args: List<String>) {
|
override fun onExecute(sender: CommandSender, args: List<String>) {
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
package com.willfp.ecopets.commands
|
|
||||||
|
|
||||||
import com.willfp.eco.core.EcoPlugin
|
|
||||||
import com.willfp.eco.core.command.impl.Subcommand
|
|
||||||
import com.willfp.eco.util.StringUtils
|
|
||||||
import com.willfp.eco.util.savedDisplayName
|
|
||||||
import com.willfp.eco.util.toNiceString
|
|
||||||
import com.willfp.ecopets.pets.Pets
|
|
||||||
import com.willfp.ecopets.pets.activePet
|
|
||||||
import com.willfp.ecopets.pets.givePetExperience
|
|
||||||
import com.willfp.ecopets.pets.hasPet
|
|
||||||
import org.bukkit.Bukkit
|
|
||||||
import org.bukkit.command.CommandSender
|
|
||||||
import org.bukkit.entity.Player
|
|
||||||
import org.bukkit.util.StringUtil
|
|
||||||
|
|
||||||
class CommandGiveCurrentXP(plugin: EcoPlugin) : Subcommand(plugin, "givecurrentxp", "ecopets.command.givecurrentxp", false) {
|
|
||||||
override fun onExecute(sender: CommandSender, args: List<String>) {
|
|
||||||
if (args.isEmpty()) {
|
|
||||||
sender.sendMessage(plugin.langYml.getMessage("needs-player"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size == 1) {
|
|
||||||
sender.sendMessage(plugin.langYml.getMessage("needs-amount"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val playerName = args[0]
|
|
||||||
|
|
||||||
val player = Bukkit.getPlayer(playerName)
|
|
||||||
|
|
||||||
if (player == null) {
|
|
||||||
sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pet = player.activePet
|
|
||||||
|
|
||||||
if (pet == null) {
|
|
||||||
sender.sendMessage(plugin.langYml.getMessage("no-pet"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.hasPet(pet)) {
|
|
||||||
sender.sendMessage(plugin.langYml.getMessage("doesnt-have-pet"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val amount = args[1].toDoubleOrNull()
|
|
||||||
|
|
||||||
if (amount == null) {
|
|
||||||
sender.sendMessage(plugin.langYml.getMessage("invalid-amount"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
player.givePetExperience(
|
|
||||||
pet,
|
|
||||||
amount
|
|
||||||
)
|
|
||||||
|
|
||||||
sender.sendMessage(
|
|
||||||
plugin.langYml.getMessage("gave-current-xp", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)
|
|
||||||
.replace("%player%", player.savedDisplayName)
|
|
||||||
.replace("%xp%", amount.toNiceString())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
|
||||||
if (args.size == 1) {
|
|
||||||
return Bukkit.getOnlinePlayers().map { it.name }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size == 2) {
|
|
||||||
return listOf("10", "100", "1000", "10000")
|
|
||||||
}
|
|
||||||
|
|
||||||
return emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,12 +3,9 @@ package com.willfp.ecopets.libreforge
|
|||||||
import com.willfp.eco.core.config.interfaces.Config
|
import com.willfp.eco.core.config.interfaces.Config
|
||||||
import com.willfp.ecopets.api.EcoPetsAPI
|
import com.willfp.ecopets.api.EcoPetsAPI
|
||||||
import com.willfp.ecopets.pets.Pets
|
import com.willfp.ecopets.pets.Pets
|
||||||
import com.willfp.libreforge.Dispatcher
|
|
||||||
import com.willfp.libreforge.NoCompileData
|
import com.willfp.libreforge.NoCompileData
|
||||||
import com.willfp.libreforge.ProvidedHolder
|
|
||||||
import com.willfp.libreforge.arguments
|
import com.willfp.libreforge.arguments
|
||||||
import com.willfp.libreforge.conditions.Condition
|
import com.willfp.libreforge.conditions.Condition
|
||||||
import com.willfp.libreforge.get
|
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
|
|
||||||
object ConditionHasActivePet : Condition<NoCompileData>("has_active_pet") {
|
object ConditionHasActivePet : Condition<NoCompileData>("has_active_pet") {
|
||||||
@@ -16,14 +13,10 @@ object ConditionHasActivePet : Condition<NoCompileData>("has_active_pet") {
|
|||||||
require("pet", "You must specify the pet!")
|
require("pet", "You must specify the pet!")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isMet(
|
override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
|
||||||
dispatcher: Dispatcher<*>,
|
return EcoPetsAPI.instance.hasPet(
|
||||||
config: Config,
|
player,
|
||||||
holder: ProvidedHolder,
|
Pets.getByID(config.getString("pet").lowercase()) ?: return false
|
||||||
compileData: NoCompileData
|
)
|
||||||
): Boolean {
|
|
||||||
val player = dispatcher.get<Player>() ?: return false
|
|
||||||
|
|
||||||
return EcoPetsAPI.instance.getActivePet(player) == Pets.getByID(config.getString("pet").lowercase())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
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(
|
|
||||||
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,13 +4,9 @@ import com.willfp.eco.core.config.interfaces.Config
|
|||||||
import com.willfp.ecopets.api.EcoPetsAPI
|
import com.willfp.ecopets.api.EcoPetsAPI
|
||||||
import com.willfp.ecopets.api.event.PlayerPetLevelUpEvent
|
import com.willfp.ecopets.api.event.PlayerPetLevelUpEvent
|
||||||
import com.willfp.ecopets.pets.Pets
|
import com.willfp.ecopets.pets.Pets
|
||||||
import com.willfp.libreforge.Dispatcher
|
|
||||||
import com.willfp.libreforge.NoCompileData
|
import com.willfp.libreforge.NoCompileData
|
||||||
import com.willfp.libreforge.ProvidedHolder
|
|
||||||
import com.willfp.libreforge.arguments
|
import com.willfp.libreforge.arguments
|
||||||
import com.willfp.libreforge.conditions.Condition
|
import com.willfp.libreforge.conditions.Condition
|
||||||
import com.willfp.libreforge.get
|
|
||||||
import com.willfp.libreforge.toDispatcher
|
|
||||||
import com.willfp.libreforge.updateEffects
|
import com.willfp.libreforge.updateEffects
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.event.EventHandler
|
import org.bukkit.event.EventHandler
|
||||||
@@ -24,17 +20,10 @@ object ConditionHasPetLevel : Condition<NoCompileData>("has_pet_level") {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
fun handle(event: PlayerPetLevelUpEvent) {
|
fun handle(event: PlayerPetLevelUpEvent) {
|
||||||
event.player.toDispatcher().updateEffects()
|
event.player.updateEffects()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isMet(
|
override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
|
||||||
dispatcher: Dispatcher<*>,
|
|
||||||
config: Config,
|
|
||||||
holder: ProvidedHolder,
|
|
||||||
compileData: NoCompileData
|
|
||||||
): Boolean {
|
|
||||||
val player = dispatcher.get<Player>() ?: return false
|
|
||||||
|
|
||||||
return EcoPetsAPI.instance.getPetLevel(
|
return EcoPetsAPI.instance.getPetLevel(
|
||||||
player,
|
player,
|
||||||
Pets.getByID(config.getString("pet").lowercase()) ?: return false
|
Pets.getByID(config.getString("pet").lowercase()) ?: return false
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.willfp.ecopets.api.event.PlayerPetExpGainEvent
|
|||||||
import com.willfp.ecopets.pets.Pet
|
import com.willfp.ecopets.pets.Pet
|
||||||
import com.willfp.ecopets.pets.Pets
|
import com.willfp.ecopets.pets.Pets
|
||||||
import com.willfp.libreforge.effects.templates.MultiMultiplierEffect
|
import com.willfp.libreforge.effects.templates.MultiMultiplierEffect
|
||||||
import com.willfp.libreforge.toDispatcher
|
|
||||||
import org.bukkit.event.EventHandler
|
import org.bukkit.event.EventHandler
|
||||||
|
|
||||||
object EffectPetXpMultiplier : MultiMultiplierEffect<Pet>("pet_xp_multiplier") {
|
object EffectPetXpMultiplier : MultiMultiplierEffect<Pet>("pet_xp_multiplier") {
|
||||||
@@ -22,6 +21,6 @@ object EffectPetXpMultiplier : MultiMultiplierEffect<Pet>("pet_xp_multiplier") {
|
|||||||
fun handle(event: PlayerPetExpGainEvent) {
|
fun handle(event: PlayerPetExpGainEvent) {
|
||||||
val player = event.player
|
val player = event.player
|
||||||
|
|
||||||
event.amount *= getMultiplier(player.toDispatcher(), event.pet)
|
event.amount *= getMultiplier(player, event.pet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.willfp.ecopets.libreforge
|
package com.willfp.ecopets.libreforge
|
||||||
|
|
||||||
import com.willfp.ecopets.api.event.PlayerPetExpGainEvent
|
import com.willfp.ecopets.api.event.PlayerPetExpGainEvent
|
||||||
import com.willfp.libreforge.toDispatcher
|
|
||||||
import com.willfp.libreforge.triggers.Trigger
|
import com.willfp.libreforge.triggers.Trigger
|
||||||
import com.willfp.libreforge.triggers.TriggerData
|
import com.willfp.libreforge.triggers.TriggerData
|
||||||
import com.willfp.libreforge.triggers.TriggerParameter
|
import com.willfp.libreforge.triggers.TriggerParameter
|
||||||
@@ -19,7 +18,7 @@ object TriggerGainPetXp : Trigger("gain_pet_xp") {
|
|||||||
val player = event.player
|
val player = event.player
|
||||||
|
|
||||||
this.dispatch(
|
this.dispatch(
|
||||||
player.toDispatcher(),
|
player,
|
||||||
TriggerData(
|
TriggerData(
|
||||||
player = player,
|
player = player,
|
||||||
location = player.location,
|
location = player.location,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.willfp.ecopets.libreforge
|
package com.willfp.ecopets.libreforge
|
||||||
|
|
||||||
import com.willfp.ecopets.api.event.PlayerPetLevelUpEvent
|
import com.willfp.ecopets.api.event.PlayerPetLevelUpEvent
|
||||||
import com.willfp.libreforge.toDispatcher
|
|
||||||
import com.willfp.libreforge.triggers.Trigger
|
import com.willfp.libreforge.triggers.Trigger
|
||||||
import com.willfp.libreforge.triggers.TriggerData
|
import com.willfp.libreforge.triggers.TriggerData
|
||||||
import com.willfp.libreforge.triggers.TriggerParameter
|
import com.willfp.libreforge.triggers.TriggerParameter
|
||||||
@@ -19,7 +18,7 @@ object TriggerLevelUpPet : Trigger("level_up_pet") {
|
|||||||
val player = event.player
|
val player = event.player
|
||||||
|
|
||||||
this.dispatch(
|
this.dispatch(
|
||||||
player.toDispatcher(),
|
player,
|
||||||
TriggerData(
|
TriggerData(
|
||||||
player = player,
|
player = player,
|
||||||
location = player.location,
|
location = player.location,
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class Pet(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val entityTexture = config.getString("entity-texture")
|
val entityTexture = config.getString("entity-texture")
|
||||||
|
val modelEngineAnimation = config.getStringOrNull("modelengine-animation")
|
||||||
|
|
||||||
private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements")
|
private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements")
|
||||||
|
|
||||||
@@ -362,8 +363,6 @@ class Pet(
|
|||||||
val level = player.getPetLevel(this)
|
val level = player.getPetLevel(this)
|
||||||
val isActive = player.activePet == this
|
val isActive = player.activePet == this
|
||||||
|
|
||||||
val baseLoreLocation = if (level == this.maxLevel) "max-level-lore" else "lore"
|
|
||||||
|
|
||||||
return ItemStackBuilder(base)
|
return ItemStackBuilder(base)
|
||||||
.setDisplayName(
|
.setDisplayName(
|
||||||
plugin.configYml.getFormattedString("gui.pet-icon.name")
|
plugin.configYml.getFormattedString("gui.pet-icon.name")
|
||||||
@@ -371,7 +370,7 @@ class Pet(
|
|||||||
.replace("%pet%", this.name)
|
.replace("%pet%", this.name)
|
||||||
)
|
)
|
||||||
.addLoreLines {
|
.addLoreLines {
|
||||||
injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-icon.$baseLoreLocation"), player) +
|
injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-icon.lore"), player) +
|
||||||
if (isActive) plugin.configYml.getStrings("gui.pet-icon.active-lore") else
|
if (isActive) plugin.configYml.getStrings("gui.pet-icon.active-lore") else
|
||||||
plugin.configYml.getStrings("gui.pet-icon.not-active-lore")
|
plugin.configYml.getStrings("gui.pet-icon.not-active-lore")
|
||||||
}
|
}
|
||||||
@@ -380,9 +379,6 @@ class Pet(
|
|||||||
|
|
||||||
fun getPetInfoIcon(player: Player): ItemStack {
|
fun getPetInfoIcon(player: Player): ItemStack {
|
||||||
val base = baseItem.clone()
|
val base = baseItem.clone()
|
||||||
|
|
||||||
val prefix = if (player.getPetLevel(this) == this.maxLevel) "max-level-" else ""
|
|
||||||
|
|
||||||
return ItemStackBuilder(base)
|
return ItemStackBuilder(base)
|
||||||
.setDisplayName(
|
.setDisplayName(
|
||||||
plugin.configYml.getFormattedString("gui.pet-info.active.name")
|
plugin.configYml.getFormattedString("gui.pet-info.active.name")
|
||||||
@@ -390,7 +386,7 @@ class Pet(
|
|||||||
.replace("%pet%", this.name)
|
.replace("%pet%", this.name)
|
||||||
)
|
)
|
||||||
.addLoreLines {
|
.addLoreLines {
|
||||||
injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-info.active.${prefix}lore"), player)
|
injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-info.active.lore"), player)
|
||||||
}
|
}
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ class PetLevelGUI(
|
|||||||
override fun getLevelItem(player: Player, menu: Menu, level: Int, levelState: LevelState): ItemStack {
|
override fun getLevelItem(player: Player, menu: Menu, level: Int, levelState: LevelState): ItemStack {
|
||||||
val key = levelState.name.lowercase().replace("_", "-")
|
val key = levelState.name.lowercase().replace("_", "-")
|
||||||
|
|
||||||
val prefix = if (player.getPetLevel(pet) == pet.maxLevel) "max-level-" else ""
|
|
||||||
|
|
||||||
return ItemStackBuilder(Items.lookup(plugin.configYml.getString("level-gui.progression-slots.$key.item")))
|
return ItemStackBuilder(Items.lookup(plugin.configYml.getString("level-gui.progression-slots.$key.item")))
|
||||||
.setDisplayName(
|
.setDisplayName(
|
||||||
plugin.configYml.getFormattedString("level-gui.progression-slots.$key.name")
|
plugin.configYml.getFormattedString("level-gui.progression-slots.$key.name")
|
||||||
@@ -46,7 +44,7 @@ class PetLevelGUI(
|
|||||||
)
|
)
|
||||||
.addLoreLines(
|
.addLoreLines(
|
||||||
pet.injectPlaceholdersInto(
|
pet.injectPlaceholdersInto(
|
||||||
plugin.configYml.getFormattedStrings("level-gui.progression-slots.$key.${prefix}lore"),
|
plugin.configYml.getFormattedStrings("level-gui.progression-slots.$key.lore"),
|
||||||
player,
|
player,
|
||||||
forceLevel = level
|
forceLevel = level
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.willfp.ecopets.pets.entity
|
package com.willfp.ecopets.pets.entity
|
||||||
|
|
||||||
|
import com.ticxo.modelengine.api.ModelEngineAPI
|
||||||
import com.willfp.ecopets.EcoPetsPlugin
|
import com.willfp.ecopets.EcoPetsPlugin
|
||||||
import com.willfp.ecopets.pets.Pet
|
import com.willfp.ecopets.pets.Pet
|
||||||
import com.willfp.modelenginebridge.ModelEngineBridge
|
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
import org.bukkit.entity.ArmorStand
|
import org.bukkit.entity.ArmorStand
|
||||||
|
|
||||||
@@ -13,11 +13,29 @@ class ModelEnginePetEntity(
|
|||||||
) : PetEntity(pet) {
|
) : PetEntity(pet) {
|
||||||
override fun spawn(location: Location): ArmorStand {
|
override fun spawn(location: Location): ArmorStand {
|
||||||
val stand = emptyArmorStandAt(location, pet)
|
val stand = emptyArmorStandAt(location, pet)
|
||||||
|
val meAnimation = pet.modelEngineAnimation
|
||||||
|
|
||||||
val model = ModelEngineBridge.instance.createActiveModel(modelID) ?: return stand
|
val model = ModelEngineAPI.createActiveModel(modelID)
|
||||||
|
|
||||||
val modelled = ModelEngineBridge.instance.createModeledEntity(stand)
|
if (meAnimation != null) {
|
||||||
modelled.addModel(model)
|
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)
|
||||||
|
|
||||||
return stand
|
return stand
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,6 @@
|
|||||||
# by Auxilor
|
# by Auxilor
|
||||||
#
|
#
|
||||||
|
|
||||||
# Even if eco is set up to use a database, you can
|
|
||||||
# force EcoPets to save to local storage to disable
|
|
||||||
# cross-server sync.
|
|
||||||
use-local-storage: false
|
|
||||||
|
|
||||||
discover-recipes: true
|
discover-recipes: true
|
||||||
|
|
||||||
gui:
|
gui:
|
||||||
@@ -69,20 +64,6 @@ gui:
|
|||||||
- ""
|
- ""
|
||||||
- "&eClick to view Level Progression!"
|
- "&eClick to view Level Progression!"
|
||||||
|
|
||||||
# By default, the lore for the max level is the same,
|
|
||||||
# but you can change this if you want.
|
|
||||||
max-level-lore:
|
|
||||||
- "%description%"
|
|
||||||
- "&f"
|
|
||||||
- "&fEffects:"
|
|
||||||
- "%effects%"
|
|
||||||
- ""
|
|
||||||
- "&fProgress:"
|
|
||||||
- "&8» &e%percentage_progress%%"
|
|
||||||
- "&8» &e%current_xp%&8/&7%required_xp% &fXP"
|
|
||||||
- ""
|
|
||||||
- "&eClick to view Level Progression!"
|
|
||||||
|
|
||||||
pet-icon:
|
pet-icon:
|
||||||
name: "%pet% &fLvl. &a%level%"
|
name: "%pet% &fLvl. &a%level%"
|
||||||
lore:
|
lore:
|
||||||
@@ -95,18 +76,6 @@ gui:
|
|||||||
- "&8» &e%percentage_progress%%"
|
- "&8» &e%percentage_progress%%"
|
||||||
- "&8» &e%current_xp%&8/&7%required_xp% &fXP"
|
- "&8» &e%current_xp%&8/&7%required_xp% &fXP"
|
||||||
|
|
||||||
# By default, the lore for the max level is the same,
|
|
||||||
# but you can change this if you want.
|
|
||||||
max-level-lore:
|
|
||||||
- "%description%"
|
|
||||||
- "&f"
|
|
||||||
- "&fEffects:"
|
|
||||||
- "%effects%"
|
|
||||||
- ""
|
|
||||||
- "&fProgress:"
|
|
||||||
- "&8» &e%percentage_progress%%"
|
|
||||||
- "&8» &e%current_xp%&8/&7%required_xp% &fXP"
|
|
||||||
|
|
||||||
active-lore:
|
active-lore:
|
||||||
- ""
|
- ""
|
||||||
- "&cThis pet is already active!"
|
- "&cThis pet is already active!"
|
||||||
@@ -229,17 +198,6 @@ level-gui:
|
|||||||
- "&fProgress:"
|
- "&fProgress:"
|
||||||
- "&8» &e%percentage_progress%%"
|
- "&8» &e%percentage_progress%%"
|
||||||
- "&8» &e%current_xp%&8/&7%required_xp% &fXP"
|
- "&8» &e%current_xp%&8/&7%required_xp% &fXP"
|
||||||
|
|
||||||
# By default, the lore for the max level is the same,
|
|
||||||
# but you can change this if you want.
|
|
||||||
max-level-lore:
|
|
||||||
- "&f"
|
|
||||||
- "&fRewards:"
|
|
||||||
- "%rewards%"
|
|
||||||
- "&f"
|
|
||||||
- "&fProgress:"
|
|
||||||
- "&8» &e%percentage_progress%%"
|
|
||||||
- "&8» &e%current_xp%&8/&7%required_xp% &fXP"
|
|
||||||
locked:
|
locked:
|
||||||
item: red_stained_glass_pane
|
item: red_stained_glass_pane
|
||||||
name: "%pet% &fLvl. &a%level%"
|
name: "%pet% &fLvl. &a%level%"
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ messages:
|
|||||||
|
|
||||||
needs-player: "&cYou must specify a player!"
|
needs-player: "&cYou must specify a player!"
|
||||||
gave-xp: "&fYou have given &a%xp% &fXP to %player%&f's %pet%&f!"
|
gave-xp: "&fYou have given &a%xp% &fXP to %player%&f's %pet%&f!"
|
||||||
gave-current-xp: "&fYou have given &a%xp% &fXP to %player%&f's currently active pet!"
|
|
||||||
no-pet: "&cThe player doesn't have a pet active!"
|
|
||||||
reset-xp: "&fYou have reset %player%&f's %pet%&f XP!"
|
reset-xp: "&fYou have reset %player%&f's %pet%&f XP!"
|
||||||
needs-pet: "&cYou must specify a pet!"
|
needs-pet: "&cYou must specify a pet!"
|
||||||
need-amount: "&cYou must specify a amount!"
|
need-amount: "&cYou must specify a amount!"
|
||||||
|
|||||||
79
eco-core/core-plugin/src/main/resources/paper-plugin.yml
Normal file
79
eco-core/core-plugin/src/main/resources/paper-plugin.yml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
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.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.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,6 +116,7 @@ conditions: [ ]
|
|||||||
# The texture of the pet entity in game
|
# The texture of the pet entity in game
|
||||||
# If you're using modelengine, use modelengine:id as the texture
|
# If you're using modelengine, use modelengine:id as the texture
|
||||||
entity-texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0="
|
entity-texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0="
|
||||||
|
modelengine-animation: "fly" # If you're using ModelEngine, you can specify an animation here
|
||||||
|
|
||||||
# The icon in GUIs
|
# The icon in GUIs
|
||||||
icon: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0=
|
icon: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0=
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ permissions:
|
|||||||
ecopets.command.give: true
|
ecopets.command.give: true
|
||||||
ecopets.command.giveegg: true
|
ecopets.command.giveegg: true
|
||||||
ecopets.command.givexp: true
|
ecopets.command.givexp: true
|
||||||
ecopets.command.givecurrentxp: true
|
|
||||||
ecopets.command.reset: true
|
ecopets.command.reset: true
|
||||||
ecopets.command.activate: true
|
ecopets.command.activate: true
|
||||||
ecopets.command.deactivate: true
|
ecopets.command.deactivate: true
|
||||||
@@ -58,9 +57,6 @@ permissions:
|
|||||||
ecopets.command.givexp:
|
ecopets.command.givexp:
|
||||||
description: Allows the use of /ecopets givexp.
|
description: Allows the use of /ecopets givexp.
|
||||||
default: op
|
default: op
|
||||||
ecopets.command.givecurrentxp:
|
|
||||||
description: Allows the use of /ecopets givecurrentxp.
|
|
||||||
default: op
|
|
||||||
ecopets.command.reset:
|
ecopets.command.reset:
|
||||||
description: Allows the use of /ecopets reset.
|
description: Allows the use of /ecopets reset.
|
||||||
default: op
|
default: op
|
||||||
@@ -72,14 +68,14 @@ permissions:
|
|||||||
default: true
|
default: true
|
||||||
|
|
||||||
ecopets.xpmultiplier.50percent:
|
ecopets.xpmultiplier.50percent:
|
||||||
description: Gives the player 50% more skill experience
|
description: Gives the player 50% more pet experience
|
||||||
default: false
|
default: false
|
||||||
ecopets.xpmultiplier.double:
|
ecopets.xpmultiplier.double:
|
||||||
description: Gives the player 2x skill experience
|
description: Gives the player 2x pet experience
|
||||||
default: false
|
default: false
|
||||||
ecopets.xpmultiplier.triple:
|
ecopets.xpmultiplier.triple:
|
||||||
description: Gives the player 3x skill experience
|
description: Gives the player 3x pet experience
|
||||||
default: false
|
default: false
|
||||||
ecopets.xpmultiplier.quadruple:
|
ecopets.xpmultiplier.quadruple:
|
||||||
description: Gives the player 4x skill experience
|
description: Gives the player 4x pet experience
|
||||||
default: false
|
default: false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#libreforge-updater
|
#libreforge-updater
|
||||||
#Sat Mar 02 15:20:58 GMT 2024
|
#Sat Jun 10 13:32:44 BST 2023
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
libreforge-version=4.56.3
|
libreforge-version=4.19.0
|
||||||
version=2.55.3
|
version=2.18.0
|
||||||
|
|||||||
Reference in New Issue
Block a user