Compare commits

...

56 Commits

Author SHA1 Message Date
Auxilor
d34ad33c7d libreforge-updater 2023-10-14 14:19:18 +01:00
Auxilor
e0c1c27ea5 Updated to 2.36.2 2023-10-07 17:57:10 +01:00
Auxilor
a31b6a2a4c Fixed pets gui again 2023-10-07 17:57:00 +01:00
Auxilor
82decbb2cb Updated to 2.36.1 2023-10-07 14:09:39 +01:00
Auxilor
f143a90dd7 Fixed pet icon max level lore 2023-10-07 14:09:28 +01:00
Auxilor
58a16a33ec libreforge-updater 2023-10-02 11:54:46 +01:00
Auxilor
8626869a0f Updated to 2.35.0 2023-10-02 11:37:47 +01:00
Auxilor
88eea3c768 Added max level lore everywhere 2023-10-02 11:35:12 +01:00
Auxilor
0271c16357 Added /ecopets givecurrentxp <player> <amount> 2023-10-02 11:26:41 +01:00
Auxilor
2dc88624dd Updated to 2.34.1 2023-09-28 16:19:32 +01:00
Auxilor
20d7e3abf7 Added max level lore 2023-09-28 16:19:14 +01:00
Auxilor
2d1d423f83 libreforge-updater 2023-09-26 14:46:10 +01:00
Auxilor
2064bcc9f2 libreforge-updater 2023-09-20 15:34:00 +01:00
Auxilor
95b7bdc3db libreforge-updater 2023-09-17 11:20:29 +01:00
Auxilor
619d5fdde5 libreforge-updater 2023-09-13 15:09:07 +01:00
Auxilor
4226d544e9 libreforge-updater 2023-09-07 16:01:52 +01:00
Auxilor
cf8de5a182 libreforge-updater 2023-09-02 17:34:39 +01:00
Auxilor
26ef893d2c libreforge-updater 2023-08-31 16:59:40 +01:00
Auxilor
1e5836203a libreforge-updater 2023-08-30 11:31:35 +01:00
Auxilor
dcb06f6e25 Added use-local-storage 2023-08-30 09:49:33 +01:00
Auxilor
493d419e2c libreforge-updater 2023-08-26 18:11:39 +01:00
Auxilor
435160f626 libreforge-updater 2023-08-23 15:31:54 +01:00
Auxilor
dfe7af1e1b libreforge-updater 2023-08-19 15:32:47 +01:00
Auxilor
25fe58d2ab libreforge-updater 2023-08-15 18:54:18 +01:00
Auxilor
a538947fb8 libreforge-updater 2023-08-13 14:42:46 +01:00
Auxilor
345c8e9049 libreforge-updater 2023-08-10 19:59:39 +01:00
Auxilor
87e3a15d01 libreforge-updater 2023-08-10 19:57:45 +01:00
Auxilor
1ea152058c libreforge-updater 2023-08-09 15:58:48 +01:00
Auxilor
a1a08f750a libreforge-updater 2023-08-09 14:40:44 +01:00
Auxilor
0ec4e566b3 libreforge-updater 2023-08-09 14:37:35 +01:00
Auxilor
98c71e938c libreforge-updater 2023-08-08 17:59:36 +01:00
Auxilor
2e3db38e67 libreforge-updater 2023-08-05 21:07:17 +01:00
Auxilor
d3438a0db1 libreforge-updater 2023-07-27 15:21:49 +01:00
Auxilor
69b8179672 libreforge-updater 2023-07-27 15:18:57 +01:00
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
Auxilor
9f1f6b206c libreforge-updater 2023-07-21 12:33:13 +01:00
Auxilor
2a465013d4 libreforge-updater 2023-07-20 13:07:00 +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
Auxilor
ff9e2cbcba libreforge-updater 2023-07-19 14:14:53 +01: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
Auxilor
ebda2dd3c9 libreforge-updater 2023-07-17 18:32:30 +01:00
Auxilor
75794f4af7 libreforge-updater 2023-07-16 13:33:22 +01:00
Auxilor
53d7688436 libreforge-updater 2023-07-12 13:08:08 +01:00
Auxilor
e145b21cb8 libreforge-updater 2023-07-09 17:24:56 +01:00
Auxilor
bf436b239f libreforge-updater 2023-07-06 18:47:05 +01:00
Auxilor
4707291704 libreforge-updater 2023-07-04 14:49:52 +01:00
Auxilor
321d3ed92c libreforge-updater 2023-06-27 10:41:52 +01:00
Auxilor
88b25f93ce libreforge-updater 2023-06-21 10:23:26 +01:00
Auxilor
244626682e libreforge-updater 2023-06-19 11:12:39 +02:00
Will FP
af6b811458 Create CODEOWNERS 2023-06-17 21:22:30 +02:00
14 changed files with 185 additions and 11 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @WillFP

View File

@@ -3,7 +3,7 @@ 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.ticxo.modelengine:api:R3.1.8")
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")

View File

@@ -6,6 +6,7 @@ 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
@@ -19,6 +20,7 @@ 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
@@ -47,6 +49,7 @@ 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)
@@ -68,6 +71,18 @@ 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() {

View File

@@ -11,6 +11,7 @@ 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>) {

View File

@@ -0,0 +1,80 @@
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()
}
}

View File

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

@@ -363,6 +363,8 @@ 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")
@@ -370,7 +372,7 @@ class Pet(
.replace("%pet%", this.name) .replace("%pet%", this.name)
) )
.addLoreLines { .addLoreLines {
injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-icon.lore"), player) + injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-icon.$baseLoreLocation"), 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")
} }
@@ -379,6 +381,9 @@ 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")
@@ -386,7 +391,7 @@ class Pet(
.replace("%pet%", this.name) .replace("%pet%", this.name)
) )
.addLoreLines { .addLoreLines {
injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-info.active.lore"), player) injectPlaceholdersInto(plugin.configYml.getStrings("gui.pet-info.active.${prefix}lore"), player)
} }
.build() .build()
} }

View File

@@ -35,6 +35,8 @@ 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")
@@ -44,7 +46,7 @@ class PetLevelGUI(
) )
.addLoreLines( .addLoreLines(
pet.injectPlaceholdersInto( pet.injectPlaceholdersInto(
plugin.configYml.getFormattedStrings("level-gui.progression-slots.$key.lore"), plugin.configYml.getFormattedStrings("level-gui.progression-slots.$key.${prefix}lore"),
player, player,
forceLevel = level forceLevel = level
) )

View File

@@ -3,6 +3,11 @@
# 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:
@@ -64,6 +69,20 @@ 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:
@@ -76,6 +95,18 @@ 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!"
@@ -198,6 +229,17 @@ 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%"

View File

@@ -7,6 +7,8 @@ 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!"

View File

@@ -33,6 +33,7 @@ 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
@@ -55,6 +56,9 @@ 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

View File

@@ -35,6 +35,7 @@ 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
@@ -57,6 +58,9 @@ 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

View File

@@ -1,5 +1,5 @@
#libreforge-updater #libreforge-updater
#Sat Jun 10 13:32:44 BST 2023 #Sat Oct 14 14:19:18 BST 2023
kotlin.code.style=official kotlin.code.style=official
libreforge-version=4.19.0 libreforge-version=4.37.0
version=2.18.0 version=2.37.0