Compare commits

...

39 Commits

Author SHA1 Message Date
Auxilor
d36551a94b libreforge-updater 2022-10-18 14:15:28 +01:00
Auxilor
42ed601fd7 libreforge-updater 2022-10-16 23:27:52 +01:00
Auxilor
3cd800aeac libreforge-updater 2022-10-13 20:13:29 +01:00
Auxilor
a8e4f886a5 Updated to 1.50.2 2022-10-11 13:06:54 +01:00
Auxilor
fffdca4515 libreforge-updater 2022-10-10 21:05:04 +01:00
Auxilor
03fe0f6116 libreforge-updater 2022-10-09 15:03:50 +01:00
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
18 changed files with 226 additions and 21 deletions

View File

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

@@ -1,16 +1,29 @@
package com.willfp.ecopets.commands
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.command.impl.PluginCommand
import com.willfp.ecopets.pets.Pets
import com.willfp.libreforge.LibReforgePlugin
import com.willfp.libreforge.lrcdb.CommandExport
import com.willfp.libreforge.lrcdb.CommandImport
import com.willfp.libreforge.lrcdb.ExportableConfig
import org.bukkit.command.CommandSender
class CommandEcopets(plugin: EcoPlugin) : PluginCommand(plugin, "ecopets", "ecopets.command.ecopets", false) {
class CommandEcopets(plugin: LibReforgePlugin) : PluginCommand(plugin, "ecopets", "ecopets.command.ecopets", false) {
init {
this.addSubcommand(CommandReload(plugin))
.addSubcommand(CommandGive(plugin))
.addSubcommand(CommandGiveEgg(plugin))
.addSubcommand(CommandGiveXP(plugin))
.addSubcommand(CommandReset(plugin))
.addSubcommand(CommandImport("pets", plugin))
.addSubcommand(CommandExport(plugin) {
Pets.values().map {
ExportableConfig(
it.id,
it.config
)
}
})
}
override fun onExecute(sender: CommandSender, args: List<String>) {

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

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerQuitEvent
import java.util.*
import java.util.UUID
import kotlin.math.PI
import kotlin.math.abs
@@ -44,10 +44,18 @@ class PetDisplay(
location.y += NumberUtils.fastSin(tick / (2 * PI) * 0.5) * 0.15
try {
stand.teleport(location)
} catch (_: Exception) {
if (location.world != null) {
try {
stand.teleport(location)
} catch (_: Throwable) {
/*
For anyone reading - I KNOW TO NEVER CATCH THROWABLE
but NMS is really stupid and does this sometimes:
java.lang.Throwable: null
at net.minecraft.world.entity.Entity.teleportTo(Entity.java:3336) ~[paper-1.19.2.jar:git-Paper-186]
so I guess that's what has to be done. Not sure what the actual cause is.
*/
}
}
if (!pet.entityTexture.contains(":")) {

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

@@ -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%)"
@@ -268,5 +274,3 @@ potions:
particles:
permanent: false
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,17 @@ 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!"
must-specify-lrcdb-id: "&cYou must specify the ID of the config to download! Not sure what this means? Go to &alrcdb.auxilor.io"
lrcdb-import-error: "&cError importing config: &f%message%"
lrcdb-import-success: "&fImported &a%name%&f! Reload the plugin to install it"
must-specify-config-name: "&cYou must specify the config name!"
invalid-config-name: "&cInvalid config name!"
lrcdb-export-error: "&cError exporting config: &f%message%"
lrcdb-export-success: "&fExported &a%name%&f! View it on &alrcdb.auxilor.io&f, or share your config ID: &f%id%"
menu:
title: "Pets"

View File

@@ -0,0 +1,19 @@
# Options for lrcdb (https://lrcdb.auxilor.io), a website to share configs
# with other server owners, so you can get more configs without making them
# yourself!
author: "Unknown Author" # The name attached to configs you export
# Options about automatically sharing configs you create
share-configs:
# If you want all your configs to automatically be publicly available,
# set this to true. This really helps out other users!
publicly: false
# If you don't want your configs to be usable to gather information about
# plugin usage or to improve the plugins in the future, disable this.
# Nothing identifying is shared.
enabled: true
# If you disable share-configs, you can still share select configs publicly
# with /ecopets export <config>.

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,10 @@ permissions:
ecopets.command.giveegg: true
ecopets.command.givexp: true
ecopets.command.reset: true
ecopets.command.activate: true
ecopets.command.deactivate: true
ecopets.command.import: true
ecopets.command.export: true
ecopets.command.reload:
description: Allows reloading the config
@@ -74,6 +78,18 @@ permissions:
ecopets.command.reset:
description: Allows the use of /ecopets reset.
default: op
ecopets.command.import:
description: Allows the use of /ecopets import.
default: op
ecopets.command.export:
description: Allows the use of /ecopets export.
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
#Thu Sep 15 12:10:13 BST 2022
version=1.37.0
#Tue Oct 18 14:15:28 BST 2022
version=1.52.0
plugin-name=EcoPets