diff --git a/gradle.properties b/gradle.properties index 9f39e4c..753ef0c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ group=com.mineinabyss version=0.10 -idofrontVersion=0.25.3 +idofrontVersion=0.25.6 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fc85abd..c79a212 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,9 @@ [versions] -gearyPaper = "0.30.14" -guiy="0.12.4-dev.1" +gearyPaper = "0.30.20" +guiy="0.12.4" [libraries] geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" } guiy = { module = "com.mineinabyss:guiy-compose", version.ref = "guiy" } -minecraft-plugin-protectionlib = "io.th0rgal:protectionlib:1.6.0" +minecraft-plugin-protectionlib = "io.th0rgal:protectionlib:1.6.1" diff --git a/src/main/kotlin/com/mineinabyss/blocky/listeners/BlockyFurnitureListener.kt b/src/main/kotlin/com/mineinabyss/blocky/listeners/BlockyFurnitureListener.kt index 5bd2fc3..bad3975 100644 --- a/src/main/kotlin/com/mineinabyss/blocky/listeners/BlockyFurnitureListener.kt +++ b/src/main/kotlin/com/mineinabyss/blocky/listeners/BlockyFurnitureListener.kt @@ -20,6 +20,8 @@ import com.mineinabyss.idofront.util.to import com.ticxo.modelengine.api.events.BaseEntityInteractEvent import io.papermc.paper.event.packet.PlayerChunkLoadEvent import io.papermc.paper.event.packet.PlayerChunkUnloadEvent +import io.papermc.paper.event.player.PlayerTrackEntityEvent +import io.papermc.paper.event.player.PlayerUntrackEntityEvent import io.th0rgal.protectionlib.ProtectionLib import org.bukkit.* import org.bukkit.block.BlockFace @@ -41,41 +43,20 @@ import org.bukkit.util.Vector class BlockyFurnitureListener : Listener { @EventHandler(priority = EventPriority.HIGH) - fun PlayerChunkLoadEvent.onLoadChunk() { - chunk.entities.filterIsInstance().forEach { - FurniturePacketHelpers.sendInteractionEntityPacket(it, player) - FurniturePacketHelpers.sendCollisionHitboxPacket(it, player) - FurniturePacketHelpers.sendLightPacket(it, player) - } + fun PlayerTrackEntityEvent.onTrackEntity() { + val baseEntity = entity as? ItemDisplay ?: return + FurniturePacketHelpers.sendInteractionEntityPacket(baseEntity, player) + FurniturePacketHelpers.sendCollisionHitboxPacket(baseEntity, player) + FurniturePacketHelpers.sendLightPacket(baseEntity, player) } @EventHandler - fun PlayerChunkUnloadEvent.onUnloadChunk() { - chunk.entities.filterIsInstance().forEach { - FurniturePacketHelpers.removeInteractionHitboxPacket(it, player) - FurniturePacketHelpers.removeHitboxOutlinePacket(it, player) - FurniturePacketHelpers.removeCollisionHitboxPacket(it, player) - FurniturePacketHelpers.removeLightPacket(it, player) - } - } - - @EventHandler(priority = EventPriority.LOWEST) - fun EntityRemoveFromWorldEvent.onRemoveFurniture() { - val entity = entity as? ItemDisplay ?: return - FurniturePacketHelpers.removeInteractionHitboxPacket(entity) - FurniturePacketHelpers.removeHitboxOutlinePacket(entity) - FurniturePacketHelpers.removeCollisionHitboxPacket(entity) - FurniturePacketHelpers.removeLightPacket(entity) - } - - @EventHandler - fun PlayerChangedWorldEvent.onChangeWorld() { - from.entities.filterIsInstance().forEach { - FurniturePacketHelpers.removeInteractionHitboxPacket(it, player) - FurniturePacketHelpers.removeHitboxOutlinePacket(it, player) - FurniturePacketHelpers.removeCollisionHitboxPacket(it, player) - FurniturePacketHelpers.removeLightPacket(it, player) - } + fun PlayerUntrackEntityEvent.onUntrackEntity() { + val baseEntity = entity as? ItemDisplay ?: return + FurniturePacketHelpers.removeInteractionHitboxPacket(baseEntity, player) + FurniturePacketHelpers.removeHitboxOutlinePacket(baseEntity, player) + FurniturePacketHelpers.removeCollisionHitboxPacket(baseEntity, player) + FurniturePacketHelpers.removeLightPacket(baseEntity, player) } @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)