Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
YTCoolGunner opened this issue Oct 27, 2024 · 12 comments

Comments

@YTCoolGunner
Copy link

YTCoolGunner commented Oct 27, 2024

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) ~[?:?]
@BenWoodworth
Copy link
Owner

BenWoodworth commented Oct 28, 2024

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"

@YTCoolGunner
Copy link
Author

alright but would it be yourside or there side?

@BenWoodworth
Copy link
Owner

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

@YTCoolGunner
Copy link
Author

ok

@BenWoodworth
Copy link
Owner

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 :)

@YTCoolGunner
Copy link
Author

alright thanks

@YTCoolGunner
Copy link
Author

any luck on this?

@BenWoodworth
Copy link
Owner

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

@YTCoolGunner
Copy link
Author

ok i will try it and let you know thanks

@BenWoodworth
Copy link
Owner

@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
}

@YTCoolGunner
Copy link
Author

YTCoolGunner commented Nov 3, 2024 via email

@YTCoolGunner
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants