Compare commits

..

48 Commits

Author SHA1 Message Date
Auxilor
93ff547fcf libreforge-updater 2022-10-07 19:52:35 +01:00
Auxilor
60af2e8414 libreforge-updater 2022-10-06 12:05:31 +01:00
Auxilor
37b3aab105 libreforge-updater 2022-10-04 15:53:58 +01:00
Auxilor
1065989f7b libreforge-updater 2022-10-03 18:30:41 +01:00
Auxilor
39545ac9bd libreforge-updater 2022-10-02 14:59:26 +01:00
Auxilor
273b7ee712 libreforge-updater 2022-09-28 17:53:38 +01:00
Auxilor
6dfaf353b2 Fixed 2022-09-28 15:57:24 +01:00
Auxilor
6abcf482f1 Updated to 1.44.0 2022-09-28 15:56:33 +01:00
Auxilor
6f56b11b21 Refined PR 2022-09-28 15:56:20 +01:00
Will FP
6c1b283b1b Merge pull request #30
Custom default animation feature
2022-09-28 14:33:39 +01:00
Auxilor
864c909f18 Added custom GUI slots 2022-09-28 12:43:11 +01:00
Auxilor
6fc68f2121 Added custom GUI slots 2022-09-28 12:42:57 +01:00
mani123
27bef81957 Merge branch 'Auxilor:master' into master 2022-09-28 12:31:04 +02:00
Auxilor
73c9d85f61 Updated to 1.42.0 2022-09-28 09:01:38 +01:00
Auxilor
87e4669e29 Added /pets activate and /pets deactivate 2022-09-28 09:00:06 +01:00
mani1232
b1fcadc46d remove , and ; 2022-09-27 15:31:24 +02:00
mani1232
571b39f0a7 refactor default animation walk if not set 2022-09-27 11:54:40 +02:00
mani1232
db3120f1de add default animation walk if not set 2022-09-27 11:50:18 +02:00
mani1232
f1b5bac9cd add else if model animation not found 2022-09-27 11:29:40 +02:00
mani1232
c67eee5af9 small changes 2022-09-27 11:07:38 +02:00
mani123
068ca3e4d6 Merge branch 'Auxilor:master' into master 2022-09-27 11:05:17 +02:00
mani1232
f10084d523 Custom default animation feature 2022-09-27 11:04:39 +02:00
Auxilor
99d4b13715 libreforge-updater 2022-09-26 18:28:24 +01:00
Auxilor
03dcdb895e libreforge-updater 2022-09-26 14:42:58 +01:00
Auxilor
a166fe9457 Updated to 1.40.2 2022-09-26 13:51:26 +01:00
Will FP
a2f3ec89b8 Merge pull request #29 from mani1232/master
I think it's time to update modelengine to R3.0.0
2022-09-26 13:49:40 +01:00
Auxilor
28597a8777 libreforge-updater 2022-09-26 10:53:20 +01:00
mani1232
c9755066b4 I think it's time to update modelengine to R3.0.0 2022-09-25 21:59:47 +02:00
Auxilor
4215dafafd libreforge-updater 2022-09-22 17:31:36 +01:00
Auxilor
c09c7ae312 libreforge-updater 2022-09-21 15:29:24 +01:00
Auxilor
6e3933ff72 libreforge-updater 2022-09-20 10:57:52 +01:00
Auxilor
30595783e3 libreforge-updater 2022-09-17 15:46:12 +01:00
Auxilor
9898118bf1 libreforge-updater 2022-09-15 12:16:29 +01:00
Auxilor
2a301158b8 libreforge-updater 2022-09-15 12:10:13 +01:00
Auxilor
ba29170e32 libreforge-updater 2022-09-14 18:53:48 +01:00
Auxilor
94ebc73687 libreforge-updater 2022-09-14 15:12:55 +01:00
Auxilor
1cc853e498 libreforge-updater 2022-09-14 15:10:01 +01:00
Auxilor
d6fef2f64c libreforge-updater 2022-09-14 13:00:15 +01:00
Auxilor
bc341b0a86 libreforge-updater 2022-09-13 19:15:43 +01:00
Auxilor
d5d2e3fd00 libreforge-updater 2022-09-12 21:21:50 +01:00
Auxilor
00d2664653 libreforge-updater 2022-09-12 17:15:40 +01:00
Auxilor
b8e1d55242 libreforge-updater 2022-09-11 19:28:00 +01:00
Auxilor
26f381fcfc libreforge-updater 2022-09-10 12:58:52 +01:00
Auxilor
ad84ce7d45 libreforge-updater 2022-09-10 10:51:51 +01:00
Auxilor
dc1bd7ebcb libreforge-updater 2022-09-06 15:43:50 +01:00
Auxilor
0b658c72ee Updated libreforge 2022-09-06 13:47:47 +01:00
Auxilor
03c0d0e444 libreforge-updater 2022-09-06 13:46:33 +01:00
Auxilor
afd0b76b42 libreforge-updater 2022-09-06 11:25:55 +01:00
16 changed files with 169 additions and 16 deletions

View File

@@ -47,8 +47,8 @@ allprojects {
}
dependencies {
compileOnly 'com.willfp:eco:6.37.1'
implementation 'com.willfp:libreforge:3.93.2'
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'

View File

@@ -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

View File

@@ -54,7 +54,7 @@ class EcoPetsPlugin : LibReforgePlugin() {
return listOf(
IntegrationLoader("ModelEngine") {
PetEntity.registerPetEntity("modelengine") { pet, id ->
ModelEnginePetEntity(pet, id)
ModelEnginePetEntity(pet, id, this)
}
}
)

View File

@@ -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()
}
}

View File

@@ -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
}
}

View File

@@ -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)

View File

@@ -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")

View File

@@ -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)
)
}
}
}

View File

@@ -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
}

View File

@@ -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)
)
}
}
}

View File

@@ -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
}

View File

@@ -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.

View File

@@ -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"

View File

@@ -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=

View File

@@ -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

View File

@@ -1,4 +1,4 @@
#libreforge-updater
#Mon Sep 05 18:01:01 BST 2022
version=1.29.2
#Fri Oct 07 19:52:35 BST 2022
version=1.49.0
plugin-name=EcoPets