Skip to content

Commit

Permalink
fix: hotfix all old broken bonfires missing hitboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Feb 2, 2024
1 parent f14db9e commit d117c0d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.mineinabyss.bonfire.listeners

import com.mineinabyss.blocky.api.BlockyFurnitures
import com.mineinabyss.blocky.components.core.BlockyFurniture
import com.mineinabyss.bonfire.bonfire
import com.mineinabyss.bonfire.components.Bonfire
import com.mineinabyss.geary.modules.geary
import com.mineinabyss.geary.papermc.datastore.decodePrefabs
import com.mineinabyss.geary.papermc.datastore.hasComponentsEncoded
import com.mineinabyss.geary.papermc.tracking.entities.events.GearyEntityAddToWorldEvent
import com.mineinabyss.geary.prefabs.PrefabKey
import org.bukkit.Bukkit
import org.bukkit.entity.ItemDisplay
Expand Down Expand Up @@ -31,4 +35,14 @@ class FixUntrackedBonfiresListener : Listener {
}
}
}

@EventHandler
fun GearyEntityAddToWorldEvent.onOldBonfireLoad() {
if (entity !is ItemDisplay || gearyEntity.has<BlockyFurniture>() || !gearyEntity.has<Bonfire>()) return

Bukkit.getScheduler().scheduleSyncDelayedTask(bonfire.plugin, {
BlockyFurnitures.placeFurniture(bonfireItemKey, entity.location, entity.yaw)
entity.remove()
}, 1)
}
}

0 comments on commit d117c0d

Please sign in to comment.