FastCraft

FastCraft

138k Downloads

bug with craftevent when using anything do to do from the crazyenchants/envoys/vouchers

YTCoolGunner opened this issue · 12 comments

commented

bug with craftevent when using anything do to do from the crazyenchants/envoys/vouchers
spams conolse not sure if its your end or their end

Stack Trace
23:36:48 ERROR]: Could not pass event CraftItemEvent to CrazyEnchantments v2.5.1
java.lang.AbstractMethodError: Method net/benwoodworth/fastcraft/bukkit/recipe/CraftingInventoryViewFactory_1_14$CustomCraftingInventory.getHolder(Z)Lorg/bukkit/inventory/InventoryHolder; is abstract
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.bukkit.recipe.CraftingInventoryViewFactory_1_14$CustomCraftingInventory.getHolder(CraftingInventoryViewFactory_1_14.kt) ~[FastCraft-3.2.13.jar:?]
        at CrazyEnchantments-2.5.1.jar/com.badbones69.crazyenchantments.paper.api.builders.types.gkitz.KitsMenu$KitsListener.onInventoryClick(KitsMenu.java:115) ~[CrazyEnchantments-2.5.1.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor727.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:1.21.1-123-aebbdc9]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.bukkit.recipe.FcCraftingRecipePrepared_Bukkit_1_7.craft(FcCraftingRecipePrepared_Bukkit_1_7.kt:51) ~[FastCraft-3.2.13.jar:?]
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.crafting.model.FastCraftGuiModel.craftRecipe(FastCraftGuiModel.kt:91) ~[FastCraft-3.2.13.jar:?]
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.crafting.presenter.FastCraftGuiPresenter$RecipeButtonListener.onCraft(FastCraftGuiPresenter.kt:190) ~[FastCraft-3.2.13.jar:?]
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.crafting.view.buttons.RecipeButtonView$ButtonListener$onClick$action$1.invoke(RecipeButtonView.kt:140) ~[FastCraft-3.2.13.jar:?]
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.crafting.view.buttons.RecipeButtonView$ButtonListener$onClick$action$1.invoke(RecipeButtonView.kt:140) ~[FastCraft-3.2.13.jar:?]
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.crafting.view.buttons.RecipeButtonView$ButtonListener.onClick(RecipeButtonView.kt:149) ~[FastCraft-3.2.13.jar:?]
        at FastCraft-3.2.13.jar/net.benwoodworth.fastcraft.bukkit.gui.FcGui_Bukkit_1_7$InventoryListener.onInventoryClick(FcGui_Bukkit_1_7.kt:113) ~[FastCraft-3.2.13.jar:?]
        at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:44) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:1.21.1-123-aebbdc9]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleContainerClick(ServerGamePacketListenerImpl.java:3224) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:69) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:33) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:56) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1535) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:201) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1512) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1505) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1464) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1471) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1316) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:329) ~[paper-1.21.1.jar:1.21.1-123-aebbdc9]
        at java.base/java.lang.Thread.run(Unknown Source) ~[?:?]
commented

alright but would it be yourside or there side?

commented

It's definitely not a problem with CrazyEnchantments. It's just using functions that are available.

It might be something I can support on my end by dynamically adding any other functions that might exist

Either that or PaperMC itself, but that feels like a big ask

commented

ok

commented

It'll be a couple days before I can look into it, but I'll see if I can find a solution when I get a chance :)

commented

alright thanks

commented

Hey! Thanks so much for the report :)

I don't have much time at the moment, but I looked into it quickly:

FastCraft: CraftingInventoryViewFactory_1_14$CustomCraftingInventory
CrazyEnchantments: KitsMenu$KitsListener.onInventoryClick

CrazyEnchantments is calling getHolder(false) (which gets the block/player/etc. that has that inventory), but in Spigot, there's only getHolder() without true/false:
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/Inventory.html#getHolder()

So FastCraft only has getHolder() in its code (since that's all Spigot asks FastCraft to implement)

But it looks like PaperMC adds an extra getHolder(useSnapshot) function, but since FastCraft doesn't know about that, and CrazyEnchantments tries to use it anyway, we get an "AbstractMethodError"

commented

any luck on this?

commented

I just tried a quick and dirty solution that seems to work. Let me know if it fixes it for you, and I'll continue playing around with it and put up a new release when I get a chance. I've been busy with building a resume and starting up a job hunt haha

And if this works for you, there's no problem if you use it on your server indefinitely.

Here's the change to CustomCraftingInventory, for my own reference:

@Suppress("unused")
@Deprecated("Delegates interface method added by PaperMC in 1.15.2", level = DeprecationLevel.HIDDEN)
fun getHolder(useSnapshot: Boolean): InventoryHolder? {
    return baseInventory::class.java
        .getMethod("getHolder", Boolean::class.java)
        .invoke(baseInventory, useSnapshot) as InventoryHolder?
}

Fixed plugin:
FastCraft-3.2.13-dirty.zip

commented

ok i will try it and let you know thanks

commented

@YTCoolGunner
as soon as i put it in my server it started crashing every other plugin and making it that they are running out of memory

(I got an email saying you replied with this, but I'm not seeing the reply on this issue...?)

image

If that was a problem, do you have any errors you can share?

And here's another change you can try: FastCraft-3.2.13-dirty-2.zip

@Suppress("unused", "UNUSED_PARAMETER")
@Deprecated("Delegates interface method added by PaperMC in 1.15.2", level = DeprecationLevel.HIDDEN)
fun getHolder(useSnapshot: Boolean): InventoryHolder? {
    return baseInventory.holder
}
commented
commented

i just got a new pc fan in havnt been able to use pc much gonna try this and see if it happens still soon