Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93ff547fcf | ||
|
|
60af2e8414 | ||
|
|
37b3aab105 | ||
|
|
1065989f7b | ||
|
|
39545ac9bd | ||
|
|
273b7ee712 | ||
|
|
6dfaf353b2 | ||
|
|
6abcf482f1 | ||
|
|
6f56b11b21 | ||
|
|
6c1b283b1b | ||
|
|
864c909f18 | ||
|
|
6fc68f2121 | ||
|
|
27bef81957 | ||
|
|
73c9d85f61 | ||
|
|
87e4669e29 | ||
|
|
b1fcadc46d | ||
|
|
571b39f0a7 | ||
|
|
db3120f1de | ||
|
|
f1b5bac9cd | ||
|
|
c67eee5af9 | ||
|
|
068ca3e4d6 | ||
|
|
f10084d523 | ||
|
|
99d4b13715 | ||
|
|
03dcdb895e | ||
|
|
a166fe9457 | ||
|
|
a2f3ec89b8 | ||
|
|
28597a8777 | ||
|
|
c9755066b4 | ||
|
|
4215dafafd | ||
|
|
c09c7ae312 | ||
|
|
6e3933ff72 | ||
|
|
30595783e3 | ||
|
|
9898118bf1 | ||
|
|
2a301158b8 | ||
|
|
ba29170e32 | ||
|
|
94ebc73687 | ||
|
|
1cc853e498 | ||
|
|
d6fef2f64c | ||
|
|
bc341b0a86 | ||
|
|
d5d2e3fd00 | ||
|
|
00d2664653 | ||
|
|
b8e1d55242 | ||
|
|
26f381fcfc | ||
|
|
ad84ce7d45 | ||
|
|
dc1bd7ebcb | ||
|
|
0b658c72ee | ||
|
|
03c0d0e444 | ||
|
|
afd0b76b42 | ||
|
|
2736d1fc7a |
@@ -47,8 +47,8 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.willfp:eco:6.37.1'
|
||||
implementation 'com.willfp:libreforge:3.93.1'
|
||||
compileOnly 'com.willfp:eco:6.42.0'
|
||||
implementation 'com.willfp:libreforge:3.110.0'
|
||||
implementation 'org.joml:joml:1.10.4'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
compileOnly 'net.kyori:adventure-api:4.10.1'
|
||||
compileOnly 'net.essentialsx:EssentialsX:2.19.0'
|
||||
compileOnly 'com.github.ben-manes.caffeine:caffeine:3.0.6'
|
||||
compileOnly 'com.ticxo.modelengine:api:R2.5.0'
|
||||
compileOnly 'com.ticxo.modelengine:api:R3.0.0'
|
||||
}
|
||||
|
||||
build.dependsOn publishToMavenLocal
|
||||
|
||||
@@ -54,7 +54,7 @@ class EcoPetsPlugin : LibReforgePlugin() {
|
||||
return listOf(
|
||||
IntegrationLoader("ModelEngine") {
|
||||
PetEntity.registerPetEntity("modelengine") { pet, id ->
|
||||
ModelEnginePetEntity(pet, id)
|
||||
ModelEnginePetEntity(pet, id, this)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
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.ecopets.pets.Pets
|
||||
import com.willfp.ecopets.pets.activePet
|
||||
import com.willfp.ecopets.pets.hasPet
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.util.StringUtil
|
||||
|
||||
class CommandActivate(plugin: EcoPlugin) : Subcommand(plugin, "activate", "ecopets.command.activate", true) {
|
||||
override fun onExecute(player: CommandSender, args: List<String>) {
|
||||
player as Player
|
||||
|
||||
if (args.isEmpty()) {
|
||||
player.sendMessage(plugin.langYml.getMessage("needs-pet"))
|
||||
return
|
||||
}
|
||||
|
||||
val id = args[0]
|
||||
|
||||
val pet = Pets.getByID(id)
|
||||
|
||||
if (pet == null || !player.hasPet(pet)) {
|
||||
player.sendMessage(plugin.langYml.getMessage("invalid-pet"))
|
||||
return
|
||||
}
|
||||
|
||||
if (player.activePet == pet) {
|
||||
player.sendMessage(plugin.langYml.getMessage("pet-already-active"))
|
||||
return
|
||||
}
|
||||
|
||||
player.sendMessage(
|
||||
plugin.langYml.getMessage("activated-pet", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)
|
||||
.replace("%pet%", pet.name)
|
||||
)
|
||||
player.activePet = pet
|
||||
}
|
||||
|
||||
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||
if (sender !is Player) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val completions = mutableListOf<String>()
|
||||
if (args.isEmpty()) {
|
||||
// Currently, this case is not ever reached
|
||||
return Pets.values().filter { sender.hasPet(it) }.map { it.id }
|
||||
}
|
||||
|
||||
if (args.size == 1) {
|
||||
StringUtil.copyPartialMatches(
|
||||
args[1],
|
||||
Pets.values().filter { sender.hasPet(it) }.map { it.id },
|
||||
completions
|
||||
)
|
||||
return completions
|
||||
}
|
||||
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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.ecopets.pets.activePet
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class CommandDeactivate(plugin: EcoPlugin) : Subcommand(plugin, "deactivate", "ecopets.command.deactivate", true) {
|
||||
override fun onExecute(player: CommandSender, args: List<String>) {
|
||||
player as Player
|
||||
|
||||
if (player.activePet == null) {
|
||||
player.sendMessage(plugin.langYml.getMessage("no-pet-active"))
|
||||
return
|
||||
}
|
||||
|
||||
player.sendMessage(
|
||||
plugin.langYml.getMessage("deactivated-pet", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)
|
||||
.replace("%pet%", player.activePet?.name ?: "")
|
||||
)
|
||||
|
||||
player.activePet = null
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,11 @@ import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class CommandPets(plugin: EcoPlugin) : PluginCommand(plugin, "pets", "ecopets.command.pets", true) {
|
||||
init {
|
||||
this.addSubcommand(CommandActivate(plugin))
|
||||
.addSubcommand(CommandDeactivate(plugin))
|
||||
}
|
||||
|
||||
override fun onExecute(player: CommandSender, args: List<String>) {
|
||||
player as Player
|
||||
PetsGUI.open(player)
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
import java.util.*
|
||||
import java.util.Objects
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.abs
|
||||
|
||||
@@ -113,6 +113,7 @@ class Pet(
|
||||
}
|
||||
|
||||
val entityTexture = config.getString("entity-texture")
|
||||
val modelEngineAnimation = config.getStringOrNull("modelengine-animation")
|
||||
|
||||
private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements")
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.gui.menu
|
||||
import com.willfp.eco.core.gui.menu.Menu
|
||||
import com.willfp.eco.core.gui.slot
|
||||
import com.willfp.eco.core.gui.slot.ConfigSlot
|
||||
import com.willfp.eco.core.gui.slot.FillerMask
|
||||
import com.willfp.eco.core.gui.slot.MaskItems
|
||||
import com.willfp.eco.core.items.Items
|
||||
@@ -178,6 +179,14 @@ class PetLevelGUI(
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
for (config in plugin.configYml.getSubsections("level-gui.custom-slots")) {
|
||||
setSlot(
|
||||
config.getInt("row"),
|
||||
config.getInt("column"),
|
||||
ConfigSlot(config)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.willfp.ecopets.pets
|
||||
import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.libreforge.conditions.ConfiguredCondition
|
||||
import com.willfp.libreforge.events.TriggerPreProcessEvent
|
||||
import com.willfp.libreforge.filters.ConfiguredFilter
|
||||
import com.willfp.libreforge.filters.Filter
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
@@ -31,7 +31,7 @@ object PetTriggerXPGainListener : Listener {
|
||||
return
|
||||
}
|
||||
|
||||
if (!ConfiguredFilter(xpGain.filters).matches(data)) {
|
||||
if (!Filter.matches(data, xpGain.filters)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.willfp.eco.core.config.updating.ConfigUpdater
|
||||
import com.willfp.eco.core.gui.menu
|
||||
import com.willfp.eco.core.gui.menu.Menu
|
||||
import com.willfp.eco.core.gui.slot
|
||||
import com.willfp.eco.core.gui.slot.ConfigSlot
|
||||
import com.willfp.eco.core.gui.slot.FillerMask
|
||||
import com.willfp.eco.core.gui.slot.MaskItems
|
||||
import com.willfp.eco.core.items.Items
|
||||
@@ -200,6 +201,14 @@ object PetsGUI {
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
for (config in plugin.configYml.getSubsections("gui.custom-slots")) {
|
||||
setSlot(
|
||||
config.getInt("row"),
|
||||
config.getInt("column"),
|
||||
ConfigSlot(config)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,41 @@
|
||||
package com.willfp.ecopets.pets.entity
|
||||
|
||||
import com.ticxo.modelengine.api.ModelEngineAPI
|
||||
import com.willfp.ecopets.EcoPetsPlugin
|
||||
import com.willfp.ecopets.pets.Pet
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.entity.ArmorStand
|
||||
|
||||
class ModelEnginePetEntity(
|
||||
pet: Pet,
|
||||
private val modelID: String
|
||||
private val modelID: String,
|
||||
private val plugin: EcoPetsPlugin
|
||||
) : PetEntity(pet) {
|
||||
override fun spawn(location: Location): ArmorStand {
|
||||
val stand = emptyArmorStandAt(location, pet)
|
||||
val meAnimation = pet.modelEngineAnimation
|
||||
|
||||
val model = ModelEngineAPI.createActiveModel(modelID)
|
||||
val modelled = ModelEngineAPI.createModeledEntity(stand)
|
||||
modelled.addActiveModel(model)
|
||||
|
||||
// ModelEngine removed addActiveModel in new API release... for no reason.
|
||||
//modelled.addModel(model,true)
|
||||
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)
|
||||
|
||||
return stand
|
||||
}
|
||||
|
||||
@@ -116,6 +116,9 @@ gui:
|
||||
row: 6
|
||||
column: 2
|
||||
|
||||
# Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots
|
||||
custom-slots: [ ]
|
||||
|
||||
level-gui:
|
||||
rows: 6
|
||||
|
||||
@@ -210,6 +213,9 @@ level-gui:
|
||||
row: 6
|
||||
column: 5
|
||||
|
||||
# Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots
|
||||
custom-slots: [ ]
|
||||
|
||||
pet-entity:
|
||||
name: "%player%&f's %pet%&f (Lvl. %level%)"
|
||||
|
||||
@@ -257,7 +263,6 @@ point-names: # If you have point names that look ugly (eg g_souls) then you can
|
||||
|
||||
use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements
|
||||
raytrace-distance: 80 # The distance that alt_click should check for a location
|
||||
block-item-drop-place-check: true # If the block_item_drop trigger should only fire on naturally placed blocks (prevents dupes)
|
||||
|
||||
potions:
|
||||
icon:
|
||||
@@ -268,4 +273,6 @@ potions:
|
||||
triggered: true
|
||||
particles:
|
||||
permanent: false
|
||||
triggered: true
|
||||
triggered: true
|
||||
|
||||
share-configs: true # If your configs are allowed to be used to gather data and improve the plugin. Nothing identifying (IP, Name, etc) is shared.
|
||||
@@ -21,6 +21,10 @@ messages:
|
||||
gave-pet-egg: "&fSuccessfully gave %player%&f the %pet%&f pet egg!"
|
||||
cannot-spawn-pet: "&cYou already have this pet unlocked!"
|
||||
invalid-amount: "&cInvalid amount!"
|
||||
pet-already-active: "&cYou already have this pet active!"
|
||||
no-pet-active: "&cYou don't have a pet active!"
|
||||
activated-pet: "&fYou have activated the %pet%&f pet!"
|
||||
deactivated-pet: "&fYou have deactivated the %pet%&f pet!"
|
||||
|
||||
menu:
|
||||
title: "Pets"
|
||||
|
||||
@@ -116,6 +116,7 @@ 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=
|
||||
|
||||
@@ -52,6 +52,8 @@ permissions:
|
||||
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
|
||||
@@ -74,6 +76,12 @@ permissions:
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#libreforge-updater
|
||||
#Sun Sep 04 17:23:04 BST 2022
|
||||
version=1.29.1
|
||||
#Fri Oct 07 19:52:35 BST 2022
|
||||
version=1.49.0
|
||||
plugin-name=EcoPets
|
||||
|
||||
Reference in New Issue
Block a user