Compare commits

..

8 Commits

Author SHA1 Message Date
Auxilor
5465a7412f libreforge-updater 2022-12-05 10:51:52 +00:00
Auxilor
4a8ea43b5b Merge remote-tracking branch 'origin/master' 2022-12-04 15:05:48 +00:00
Auxilor
a2d147e54c Updated to 1.64.2 2022-12-04 15:05:42 +00:00
Will FP
2ceb670999 Merge pull request #34
Fix bugs
2022-12-04 15:05:24 +00:00
TomTom
a4cef52d5c Merge branch 'Auxilor:master' into fixes 2022-11-30 18:54:38 +01:00
TomTom
f44ca8a7e3 Fix bald 2022-11-29 16:35:29 +01:00
TomTom
56ddfeca39 Add being able to disable pet entities 2022-11-29 16:11:04 +01:00
TomTom
332fd55f0b Fix stuff 2022-11-28 16:04:50 +01:00
7 changed files with 29 additions and 18 deletions

View File

@@ -49,7 +49,7 @@ allprojects {
dependencies { dependencies {
compileOnly 'com.willfp:eco:6.44.0' compileOnly 'com.willfp:eco:6.44.0'
implementation 'com.willfp:libreforge:3.124.1' implementation 'com.willfp:libreforge:3.125.0'
implementation 'com.willfp:ecomponent:1.0.0' implementation 'com.willfp:ecomponent:1.0.0'
implementation 'org.joml:joml:1.10.4' implementation 'org.joml:joml:1.10.4'

View File

@@ -7,7 +7,7 @@ dependencies {
compileOnly 'net.kyori:adventure-api:4.10.1' compileOnly 'net.kyori:adventure-api:4.10.1'
compileOnly 'net.essentialsx:EssentialsX:2.19.0' compileOnly 'net.essentialsx:EssentialsX:2.19.0'
compileOnly 'com.github.ben-manes.caffeine:caffeine:3.0.6' compileOnly 'com.github.ben-manes.caffeine:caffeine:3.0.6'
compileOnly 'com.ticxo.modelengine:api:R3.0.0' compileOnly 'com.ticxo.modelengine:api:R3.0.1'
} }
build.dependsOn publishToMavenLocal build.dependsOn publishToMavenLocal

View File

@@ -41,6 +41,10 @@ class EcoPetsPlugin : LibReforgePlugin() {
} }
override fun handleReloadAdditional() { override fun handleReloadAdditional() {
if (!this.configYml.getBool("pet-entity.enabled")) {
return
}
this.scheduler.runTimer(1, 1) { this.scheduler.runTimer(1, 1) {
petDisplay.tickAll() petDisplay.tickAll()
} }

View File

@@ -53,7 +53,7 @@ class CommandActivate(plugin: EcoPlugin) : Subcommand(plugin, "activate", "ecope
if (args.size == 1) { if (args.size == 1) {
StringUtil.copyPartialMatches( StringUtil.copyPartialMatches(
args[1], args[0],
Pets.values().filter { sender.hasPet(it) }.map { it.id }, Pets.values().filter { sender.hasPet(it) }.map { it.id },
completions completions
) )

View File

@@ -9,7 +9,9 @@ import org.bukkit.entity.ArmorStand
import org.bukkit.entity.Player import org.bukkit.entity.Player
import org.bukkit.event.EventHandler import org.bukkit.event.EventHandler
import org.bukkit.event.Listener import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerChangedWorldEvent
import org.bukkit.event.player.PlayerQuitEvent import org.bukkit.event.player.PlayerQuitEvent
import org.bukkit.event.player.PlayerTeleportEvent
import java.util.UUID import java.util.UUID
import kotlin.math.PI import kotlin.math.PI
import kotlin.math.abs import kotlin.math.abs
@@ -45,17 +47,7 @@ class PetDisplay(
location.y += NumberUtils.fastSin(tick / (2 * PI) * 0.5) * 0.15 location.y += NumberUtils.fastSin(tick / (2 * PI) * 0.5) * 0.15
if (location.world != null) { if (location.world != null) {
try {
stand.teleport(location) 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(":")) { if (!pet.entityTexture.contains(":")) {
@@ -117,10 +109,24 @@ class PetDisplay(
trackedEntities.clear() trackedEntities.clear()
} }
private fun remove(player: Player) {
trackedEntities[player.uniqueId]?.stand?.remove()
trackedEntities.remove(player.uniqueId)
}
@EventHandler @EventHandler
fun onLeave(event: PlayerQuitEvent) { fun onLeave(event: PlayerQuitEvent) {
trackedEntities[event.player.uniqueId]?.stand?.remove() remove(event.player)
trackedEntities.remove(event.player.uniqueId) }
@EventHandler
fun onTeleport(event: PlayerTeleportEvent) {
remove(event.player)
}
@EventHandler
fun onWorldChange(event: PlayerChangedWorldEvent) {
remove(event.player)
} }
private data class PetArmorStand( private data class PetArmorStand(

View File

@@ -217,6 +217,7 @@ level-gui:
custom-slots: [ ] custom-slots: [ ]
pet-entity: pet-entity:
enabled: true # If you disable this, there will be no floating pets
name: "%player%&f's %pet%&f (Lvl. %level%)" name: "%player%&f's %pet%&f (Lvl. %level%)"
level-up: level-up:

View File

@@ -1,4 +1,4 @@
#libreforge-updater #libreforge-updater
#Wed Nov 30 17:39:35 GMT 2022 #Mon Dec 05 10:51:52 GMT 2022
version=1.64.1 version=1.65.0
plugin-name=EcoPets plugin-name=EcoPets