PikaMug / Quests

Easy-to-use, open-source plugin for the creation and execution of quests on Minecraft servers.
https://modrinth.com/plugin/quests.classic
MIT License
147 stars 109 forks source link

Item Duplications #2280

Closed EurusTheGreat closed 3 weeks ago

EurusTheGreat commented 3 weeks ago

What is your Quests version / build number (do not say "latest")?

5.1.2-b501

Describe the problem and how to replicate it.

The process is quite the same as #2278, but mine requires a player to craft the item first and then deliver it to the NPC. Yes, it deducts the same amount of item as it should be, however, if you kept giving the NPC the same item, it increases the way it should not.

Here's a video showing the duplication bug: https://www.youtube.com/watch?v=8eq85oklgek

Any console errors to share?

I'm unsure if this might help, but it came from CMILib every time the duplication was performed.

[13:12:00 WARN]: java.lang.reflect.InvocationTargetException
[13:12:00 WARN]:        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
[13:12:00 WARN]:        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[13:12:00 WARN]:        at CMILib1.5.1.1.jar//net.Zrips.CMILib.NBT.CMINBT.getNbt(CMINBT.java:1519)
[13:12:00 WARN]:        at CMILib1.5.1.1.jar//net.Zrips.CMILib.NBT.CMINBT.<init>(CMINBT.java:348)
[13:12:00 WARN]:        at CMILib1.5.1.1.jar//net.Zrips.CMILib.GUI.GUIListener.onItemDrop(GUIListener.java:121)
[13:12:00 WARN]:        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor90.execute(Unknown Source)
[13:12:00 WARN]:        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77)
[13:12:00 WARN]:        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80)
[13:12:00 WARN]:        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
[13:12:00 WARN]:        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54)
[13:12:00 WARN]:        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131)
[13:12:00 WARN]:        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:630)
[13:12:00 WARN]:        at net.minecraft.world.entity.player.Player.drop(Player.java:832)
[13:12:00 WARN]:        at net.minecraft.server.level.ServerPlayer.drop(ServerPlayer.java:2697)
[13:12:00 WARN]:        at net.minecraft.server.level.ServerPlayer.drop(ServerPlayer.java:2692)
[13:12:00 WARN]:        at net.minecraft.server.level.ServerPlayer.drop(ServerPlayer.java:2789)
[13:12:00 WARN]:        at net.minecraft.server.network.ServerGamePacketListenerImpl.handlePlayerAction(ServerGamePacketListenerImpl.java:1910)
[13:12:00 WARN]:        at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.handle(ServerboundPlayerActionPacket.java:51)
[13:12:00 WARN]:        at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.handle(ServerboundPlayerActionPacket.java:20)
[13:12:00 WARN]:        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:56)
[13:12:00 WARN]:        at net.minecraft.server.TickTask.run(TickTask.java:18)
[13:12:00 WARN]:        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151)
[13:12:00 WARN]:        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1574)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:201)
[13:12:00 WARN]:        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1551)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1544)
[13:12:00 WARN]:        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1503)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1510)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1355)
[13:12:00 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:334)
[13:12:00 WARN]:        at java.base/java.lang.Thread.run(Thread.java:1583)
[13:12:00 WARN]: Caused by: java.lang.IllegalStateException: Value must be within range [1;99]: 288
[13:12:00 WARN]:        at com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287)
[13:12:00 WARN]:        at com.mojang.serialization.DataResult.getOrThrow(DataResult.java:81)
[13:12:00 WARN]:        at net.minecraft.world.item.ItemStack.save(ItemStack.java:624)
[13:12:00 WARN]:        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[13:12:00 WARN]:        ... 33 more

If applicable, can you provide an example quest from quests.yml?

'000018':
    name: Sally-1
    ask-message: Challenge objectives!
    finish-message: Well done!
    requirements:
      money: 100
    stages:
      ordered:
        '1':
          items-to-craft:
          - ==: org.bukkit.inventory.ItemStack
            v: 3955
            type: BLUE_DYE
            amount: 16
          - ==: org.bukkit.inventory.ItemStack
            v: 3955
            type: LIME_DYE
            amount: 16
          - ==: org.bukkit.inventory.ItemStack
            v: 3955
            type: BROWN_DYE
            amount: 16
        '2':
          items-to-deliver:
          - ==: org.bukkit.inventory.ItemStack
            v: 3955
            type: BLUE_DYE
            amount: 16
          - ==: org.bukkit.inventory.ItemStack
            v: 3955
            type: LIME_DYE
            amount: 16
          - ==: org.bukkit.inventory.ItemStack
            v: 3955
            type: BROWN_DYE
            amount: 16
          npc-delivery-uuids:
          - aa75be94-2ba4-4a8b-9ad3-cac51ebf4c3a
          - aa75be94-2ba4-4a8b-9ad3-cac51ebf4c3a
          - aa75be94-2ba4-4a8b-9ad3-cac51ebf4c3a
          delivery-messages:
          - Thank you. Only §5<amount> §rmore to go!
    rewards:
      exp: 500
PikaMug commented 3 weeks ago

@EurusTheGreat Thanks for reporting this. As you discovered, this bug requires a particular objective setup to replicate. Please give the following development build a try:

https://ci.codemc.io/job/PikaMug/job/Quests/502/