EssentialsX

EssentialsX

2M Downloads

Duplication glitch when using /recipe

keehl254 opened this issue ยท 41 comments

commented

If you do /recipe diamond_block, then open your recipe book and click anything in it, it will send all the items from the workbench to your inventory.

commented

I honestly think the /recipe command should just map to the recipe book anyway, and open up the recipe for you via the book, because the recipe book only shows recipes in which you have at least one material to make them with. Some players might still want to use the traditional /recipe command. In fact, if it's possible, maybe Essentials could simply unlock every single recipe for you as well?

commented

Oh no... i just tried this and it does indeed give all the items.

commented

confirmed, it's anything you type in with the /recipe xxx command that shows a recipe, clicking on any item on the left side of the recipe book will give you all the blocks to make that recipe! This is very bad. Nice catch @keehl254 1254 / @LogGits

commented

So I'm guessing this is only on 1.12 servers?

commented

After much investigation and debugging I've come to find there is no way to properly handle this. The code in charge of the recipe book does not notify us via the API when the player clicks a new recipe.

I ask that you please revoke the essentials.recipe permission from all players and remain patient until this is fixed. Thank you.

commented

For the sake of those who manage to update EssentialsX and are not aware of this bug, I have disabled /recipe for Minecraft 1.12 (See e572788) until we can fix this.

commented

Cannot reproduce this on latest Spigot.
Perhaps it was a spigot bug.

commented

Just rebuilt spigot server - was only 1 release behind and could reproduce. I can still reproduce the behavior. Here is what the steps are.

  1. Open Inventory (E)
  2. Click on green book (Recipe Book)
  3. Click on one of the blocks on the Recipe - say Diamond for example
    image
  4. Note the diamond block changing (add then removes) each time you click on the diamond.
    image
  5. Now once the diamond block goes away after repeated clicks.
  6. Click on another recipe block. The diamond blocks returns. So it's calling the /give command (appears to anyway) every time you click a recipe block.
  7. Not only does the blocks reappear in your inventory, notice the blocks also increment in the Crafting pane each time you click on the block in the Recipe pane.
    image
    Mechanics does seem to be messed up a bit.
commented

Just dawned on me, I think the problem here is that players can and should be clicking on the Recipe blocks and the recipe should be shown in the Crafting table. However, It should not (IMO) increment the Crafting table for multiple clicks and clicking on the Crafting Table should be disabled. So the only active click should be on the Recipe blocks and the "display" updated to show how to create it.

commented

@smmmadden Your instructions don't seem to include /recipe at all. The issue at hand comes from when you type /recipe then proceed to click a recipe item in your recipe book (all within the /recipe Crafting Table view).

@andrewkm Could you try these simple instructions I've written above and confirm that the item in the Crafting Table matrix does not immediately get sent to your inventory? If you're absolutely certain, could you please provide me with Spigot and Essentials version. Thank you. :)

commented

It's the same interface @SupaHam :-) One is done by typing /recipe the other is done simply by press E to show your inventory. So I'm pretty confident the same code is used underneath both as the behavior is identical and UI is too.

commented

I maintain the official essentials (privately) with our development team and assistance from one of the original authors. I don't use essentialsX, I do however follow this issue fracker and github to see what you guys are up to :p

Just thought I'd comment on this as it's a "dupe bug" and considered serious. After trying initially I am unable to reproduce. Even tried it on your esssentialsX builds and still couldn't do it. I'm just about to go to bed, however when I'm up I'll try again with the instructions above and get back to you :)

commented

sounds good - it can be reproduce with both /recipe diamond_block or clicking E for Inventory, then click the Green Recipe book to get the same UI. From there, just click on any block one/many times and watch it change the Craft block display and Inventory. Yes, this is a serious bug and prevents moving it into a production environment. One of the main features for 1.12 is achievements and advancements and it enables the Recipe GUI - so disabling it would disable a major part of 1.12. :-)

Also saw that when clicking on the same diamond the recipe is shown and I am "able" to take the completed/crafted block into my inventory. I've reported the bug to Spigot as my understanding is that this part of the code doesn't have an API available for it, so it might just fall on them to fix it. Will keep you posted.

commented

K, sorry was tired and didn't fully test yesterday.
Reproduced it. I'll look for a solution shortly (that's if we even want one to be honest).

commented

With 1.12, /recipe is pretty much obsolete. My team and I decided to remove the command from our Essentials completely and won't be going for a fix.

commented

so if it is removed from essentials, doesn't this revert back to base minecraft code or spigot in my case? I think that users are used to using /recipe (I know I use it all the time) - Mojang only just now built the UI for it and saying it is accessible either way E for Inventory or /recipe.

commented

I don't know whether or not EssentialsX will remove it. I'm just saying I've decided to remove it from my Essentials and won't be working towards a fix as I find it useless.

commented

Custom recipes from plugins are not visible in that Recipe Book in 1.12 which was possible with /recipe . Guessing now those plugins which I use need to provide the craft from the new Recipe Book, which one I own since 1.6.2 still works in 1.12. I don't code java sadly xD

commented

there is an option to force players to earn achievements to get crafted recipes and that's the only way you can get them, or alternatively if you know the recipe then you don't need to wait until you earn it first. That in itself is a great feature. You guys may have been playing longer than I and have memorized all the blocks that can be crafted, but being able to do a /recipe ladder or /recipe stairs is a nice option so you know how to do it. Previous versions, there was NO UI Recipe space, it just opened the crafting table and showed how to make it. Even with that in 1.11.2, you don't get anything for free.

I should also add that there are some Resource Packs which make the Recipe Book not visible and the only way to get to the display is by using /recipe so removing it wouldn't be my first choice.

commented

@smmmadden As a workaround, doing a webpage to list custom recipes or a building with a warp to show server's custom recipes. That's i'll do when my server passes on 1.12 building a "Custom Crafting Museum" showing our custom recipes. Love you guys xD

commented

I just confirmed that md_5 on Spigot was correct, my apologies to @md_5 - I just wished that Mojang would have documented the feature more clearly. Not a bug but a short cut to crafting items you already have.

Testing:
I created a private single player world from Minecraft Client 1.12
Logged into world
Checked E Inventory and no recipe book present
Broke some grass blocks, dirt and a couple trees
Earned achievements and Recipe Book option from Inventory
Saw that I earned some "Plank" Recipes which confirms the use of the Logs I just received
Clicked on the Recipe book for Planks and then clicked on the completed recipe
Received the Planks by clicking on the completed recipe box
Tried to click on Planks again (which I now have none)
No changes to left side, crafting table did show recipe for planks, but unable to put into my inventory.

Repeated the same for my Testing world without any plugins and the same as above is true.

This is not a bug and should be closed. I've added the above steps in case someone else thinks this is a bug. Thank you very much for confirming the actual behavior versus assumed behavior. {#emotions_dlg.smile}

The only question now is, can we get the /recipe command to be put back into the next build?

Regards,
Steve

commented

We could always turn the existing command into an itemdb-friendly wrapper around the vanilla command.

@smmmadden This issue directly concerns EssentialsX's /recipe command, but your method doesn't mention it at all?

commented

I don't believe removing /recipe is a valid course of action for us. Users like @TNTUP rely on it for their modded servers.

@smmmadden Again, the bug we're discussing is with /recipe, what creates this "dupe" bug is the fact that /recipe essentially gives the player the items used to create the resulting item.

So when I go to type /recipe diamond it'll show a diamond block in the crafting table, with the client presuming it was placed by the player, and knowing no better. It does inform the server that it will take those items and place it in the player's inventory, but when the server does this, it does not notify plugins via the API.

The only possible solution at the moment is packet hacking. That is, we listen to packets and process & modify their data before they reach Minecraft's server code.

commented

@md678685 - I think these are both one and the same, but we need @keehl254 to confirm the new findings and what he saw for behavior. The understanding is that this behavior of moving items from Inventory to the Recipe Panel is "expected" behavior and not a bug.

I think that having an option to disable/enable this in the config.yml would be great. This is just making the game easier to craft which is nice, but new players shouldn't be given everything on a platter. :-) Some players would get annoyed by the recipe option to automatically pull items out of their inventory to craft something when they may have all they need and don't want this "auto-craft-recipe" being performed.

EDIT: you are right the duplicate portion of it when using /recipe diamond_block will put it into the recipe panel even if you don't have it. Sorry, been looking at this too long and it does appear like two separate issues going on.

commented

When I had created the report, I had simply found that /recipe xxx, if showing in a workbench UI, can have all its items transferred to the inventory whenever you click on a recipe that needs items to craft. Minecraft's Recipe book moves the items currently in the workbench to the players inventory when it wants to load a new recipe...This is obviously so that players don't lose items when trying to view a recipe.Essentials required the PlayerClickEvent;however, it does not throw any event that Essentials cancels. It is essentially (See what I did there?) a feature that we do not have a way of stopping yet....

The recipe book/UI has to be Client side, but the moving of items would have to be sent to the server. Wonder if we are blind to an event that is called, or if it's missing in Spigot currently.

I agree with @andrewkm that the feature is obsolete thanks to the recipe book in the first place. If you are worried about Custom Recipies, then I believe that 1.12 has a way of creating custom advancements and recipes in JSON that you could send to the player. Haven't looked into it myself.

Sorry if I had restated anything that was already said, but I had just posted what I had noticed in a server directly after it had happened. I hadn't been skimming the posts here much. I just came when my username was brought up.

commented

@SupaHam What about making a menu like this?

image

commented

I found out about that new 1.12 dupe glitch a long time ago. The packet for AutoRecipe, if cancelled, will stop that glitch. Acompany it along with the data held by the packet, such as "c", and c's "a", with the variables "a" and "b" (...Real classy naming here, huh?), you can recreate the vanilla recipe book using workbench inventories, kindof like what /recipe used to do here.

Sorry for posting something unrelated to essentials here. Delete if wanted.

commented

No need to close the issue, as it isn't actually fixed yet?

commented

Was this ever patched?

commented

On 1.12 servers, /recipe is disabled in favour of the 1.12 vanilla recipe book.

commented

@SupaHam awesome, sorry to necro this Issue, its just I found a dupe glitch on 1.12 default crafting book today, this thread was brought up in conversation for "other ways to dupe" Just wanted to make sure im patched! https://hub.spigotmc.org/jira/browse/SPIGOT-3466

commented

Not sure if its related to EssentialsX but anyways the bug you've reported or found works on my Paper server (1162!) and Spigot builds in 1.12. The provided plugin in the bug report solves it :)

Wasn't aware of this issue so meaning players could abuse that bug in the past I don't know :/

commented

@TNTUP not related to EssentialsX that bug, thats Vanilla/Spigot/Paper/Bukkit server issue, its reported, Paper has a "kind'a" fix, but its not fully patched yet, that plugin solved it for me that I linked in the Issue tracker.

commented

@Kakifrucht The dupe glitch that I posted this issue about no longer exists because the EssentialsX team took out the recipe command.

commented

Well yes, but that was just a quick patch to prevent big damages due to updating. The issue in itself is not fixed yet, as it is waiting for server side functionality to prevent recipe book interaction in a recipe window.

commented

True. Well, then, I guess there are few courses of action, from their viewpoint. Use the removal of /recipe as the permanent fixture, or they could listen to the AutoRecipe packet, and if it's called, and the user's "RecipeSee" boolean is true, then clear the inv and unregister the listener/set RecipeSee to false. There could be other courses of action that I am not thinking of, though.

commented

This is fixed for the latest versions of Paper for 1.15.2 and 1.16.1 respectively, on EssentialsX 2.17.2.143 or higher.

commented

Now safe to give the permission back for my 1.12.2/1.15.2 (1.16.1/1.16.2)? Players will be happy to see the /recipe back !

commented

Please refer to this very cool chart for compatibility information:

image

Green tick: Fully compatible - /recipe is available for use
Red cross: Not compatible - Command is disabled due to dupe glitch

Be aware that only very recent versions of Paper 1.15.2 (Yellow tick) are compatible, so ensure that you are using the most recent Paper 1.15.2 build to take advantage of this feature.

commented

Well rip my 1.12.2 servers are still in use, I'll keep it disabled for those old servers while enabling them for 1.15.x/1.16.x. As soon 1.16.2 gets stable and ready to be used in a production state I'll upgrade my 1.15.x servers. Thanks for the nice chart!

commented

For future reference: EssentialsX still disables the command on any servers susceptible to dupe glitches, so if anyone happens to be using an affected server this will behave as before (sending an error message instead of showing the recipe).