Slimefun / Slimefun4

Slimefun 4 - A unique Spigot/Paper plugin that looks and feels like a modpack. We've been giving you backpacks, jetpacks, reactors and much more since 2013.
GNU General Public License v3.0
967 stars 545 forks source link

Duplication Sf + Itemsadders #3100

Closed istarengwa closed 1 year ago

istarengwa commented 3 years ago

Description (Required)

Hello hello, I am explaining the current bug, which is really annoying at the time, and I do not know if the error came from you or from slimefun.

In fact, if a player puts a slimefun object in his left hand and nothing in his right hand, that he types with the right hand empty an itemsadders block, this duplicates the slimefun object held in his left hand ad infinitum, with all his content if it is a backpack.

I created a ticket on the lonedev discord which told me:

"LoneDev — 31/05/2021 did you try contacting slimefun devs about that? i don't drop items on blocks interact they probably are not checking if the block break event is cancelled or their blockbreak event priority is not set to MONITOR"

Video: https://cdn.discordapp.com/attachments/849633185003733023/849633251550691369/2021-05-31_01-40-41_Scene_Trim.mp4

Steps to reproduce the Issue (Required)

i can send you the video i send to the itemsadders developer on discord if you don't mind.

Environment (Required)

WalshyDev commented 3 years ago

I don't understand the issue, could you please record it and show /sf versions in the recording.

WalshyDev commented 3 years ago

https://cdn.discordapp.com/attachments/849633185003733023/849633251550691369/2021-05-31_01-40-41_Scene_Trim.mp4

Video from user

istarengwa commented 3 years ago

https://www.casimages.com/i/21060203195761697.png.html

I updated the plugin in the meantime but it still does the same thing

100petr commented 3 years ago

I can't imitate it. Does it work for all blocks? I chose random three. righ-click (open) https://user-images.githubusercontent.com/29830635/120889822-492dc200-c5ff-11eb-80fa-b4ade174805d.mp4 left-click (destroy) It didn't even work with cancel-break-wrong-tool.enabled: true https://user-images.githubusercontent.com/29830635/120889615-47afca00-c5fe-11eb-9a4a-e05a1a57b9a8.mp4 image IA 2.3.9 (Sometimes I could update addons :D but it's just a test server, so I don't deal with it much)

Rushia140 commented 3 years ago

i also got the same problem https://youtu.be/VLi1WgwzS2w

istarengwa commented 3 years ago

Hello, my problem is still there, I have slimefun dev 962 and the latest version of item adders, but now no longer need to hold in the left hand, a right click with an item slimefun on an itemadders block is enough to duplicate the item

istarengwa commented 3 years ago

I can't imitate it. Does it work for all blocks? I chose random three. righ-click (open) https://user-images.githubusercontent.com/29830635/120889822-492dc200-c5ff-11eb-80fa-b4ade174805d.mp4 left-click (destroy) It didn't even work with cancel-break-wrong-tool.enabled: true https://user-images.githubusercontent.com/29830635/120889615-47afca00-c5fe-11eb-9a4a-e05a1a57b9a8.mp4 image IA 2.3.9 (Sometimes I could update addons :D but it's just a test server, so I don't deal with it much)

Hello, I'm responding a little late but there are no itemadders in your plugin list, and the duplication bug is specifically related to this plugin

100petr commented 3 years ago

what? however, you can see in the video that it is an itemsadder (ESC, blocks, thirst bar) and IA does not show in sf versions, but I'll try it again tomorrow where I'll even write about itemsadder. to the topic: have you only tried it with IA (and the necessary plugins) and sf?

Boomer-1 commented 3 years ago

do /pl to provide the complete plugin list

istarengwa commented 3 years ago

do /pl to provide the complete plugin list

I did the test only with ia + sf plugins and it always does the same duplication, here is my /pl

https://zupimages.net/viewer.php?id=21/36/vv1h.png

I use purpur for fork (purpurclip-1378) https://ci.pl3x.net/job/Purpur/1378/

another example video with left click on block :

https://cdn.discordapp.com/attachments/638870738002247681/885870276791894026/2021-09-10_14-47-42_Scene.mp4

I just tried with the fork paper and the problem is still there

this only happens on "real-note" blocks so blocks that use note blocks but not on real note blocks

the ticket on the itemadders github is here: https://github.com/PluginBugs/Issues-ItemsAdder/issues/1162

100petr commented 3 years ago

Thanks for the reply that this is happening on real_note. I could not duplicate the backpack, it was "destroyed", but the ingots could be duplicated.

https://user-images.githubusercontent.com/29830635/132944979-56fc2dcb-0c81-4f0d-abf8-04493799f2a9.mp4

https://user-images.githubusercontent.com/29830635/132944985-2d7ede8e-d667-441e-b1e7-4b90f64fd654.mp4

Purpur 1.17.1 1382, SF DEV - 968, IA 2.4.15

LoneDev6 commented 3 years ago

Let me know if I can do anything to directly help Slimefun devs. (I'm ItemsAdder developer)

LoneDev6 commented 3 years ago

Does the problem occurs also using vanilla items? https://user-images.githubusercontent.com/29830635/132944985-2d7ede8e-d667-441e-b1e7-4b90f64fd654.mp4

I can't find any reason why itemsadder would make this behaviour only with slimefun items, i don't even implement their api to handle their items in any way

100petr commented 3 years ago

I tried goldingot and nothing happens

https://user-images.githubusercontent.com/29830635/134370493-96a5ce89-e5cb-444f-a0ae-02aaa99ce3ac.mp4

100petr commented 3 years ago

so i found that it does even with normal noteblocks if IA is installed

Sfiguz7 commented 3 years ago

@LoneDev6 looks like you might've been right about your NMS code

LoneDev6 commented 3 years ago

@LoneDev6 looks like you might've been right about your NMS code

Very good, I hope it's the issue so it's "easier" for me to fix since I've already identified the possible cause. I'll fix this in the next days

LoneDev6 commented 3 years ago

@Sfiguz7 Added a check for slimefun item, now it's working fine! No duplication bug anymore.

if(Main.hasSlimefun)
{
    NBTItem tmp = new NBTItem(itemStack);
    if(tmp.hasNBTData() && tmp.hasKey("PublicBukkitValues") 
            && tmp.getCompound("PublicBukkitValues").hasKey("slimefun:slimefun_item"))
    {
        return;
    }
}

I'll release an update in the next hours.

Anyway I think this issue happens because Slimefun is not cancelling the PlayerInteractEvent, so ItemsAdder will process it anyway even if: @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR).

For now I'll keep this workaround

Sfiguz7 commented 3 years ago

I'll release an update in the next hours.

Is it fixed then? Shall we close this issue?

Anyway I think this issue happens because Slimefun is not cancelling the PlayerInteractEvent, so ItemsAdder will process it anyway even if: @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR).

For now I'll keep this workaround

If you ignoreCancelled it should not matter whether we cancel or not, unless you check for isCancelled() and do nothing if it's true at which point you could simply remove the ignoreCancelled flag

100petr commented 3 years ago

I tried it and it's fixed, thanks to both of you! 

J3fftw1 commented 1 year ago

Apparently this has been fixed since oct 4th 2021 https://github.com/Slimefun/Slimefun4/issues/3100#issuecomment-933576103