fix weird bug where the viewer list is empty sometime apparently
This commit is contained in:
alexcrea 2025-02-17 15:16:00 +01:00
parent c5c32ce386
commit 482d5eb66d
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
2 changed files with 4 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package xyz.alexcrea.cuanvil.listener
import com.github.stefvanschie.inventoryframework.util.InventoryViewUtil
import io.delilaheve.CustomAnvil
import io.delilaheve.util.ConfigOptions
import io.delilaheve.util.EnchantmentUtil.combineWith
@ -42,7 +43,7 @@ class PrepareAnvilListener : Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
fun anvilCombineCheck(event: PrepareAnvilEvent) {
// Should find player
val player: HumanEntity = event.viewers.first()
val player: HumanEntity = InventoryViewUtil.getInstance().getPlayer(event.view)
// Test if the event should bypass custom anvil.
if (DependencyManager.tryEventPreAnvilBypass(event, player)) return