WolfyScript / CustomCrafting

Spigot based plugin to create your own custom Recipes & Items. Designed to be easy to use with in-game GUI and tons of configuration possibilities.
https://modrinth.com/plugin/customcrafting
GNU General Public License v3.0
114 stars 36 forks source link

During mass crafting, the command is executed only once. #313

Closed mc-yuu2132 closed 1 year ago

mc-yuu2132 commented 1 year ago

What happened?

I have tried to use the extensions command feature of this plugin, but when I craft it all at once, e.g. shift+click, the command is only executed once.

I am trying to use this feature to create a function that consumes experience for each item created, but even if I craft a large number of items, the player will only reduce one amount of experience.

To solve this problem, either set the command to run for the number of items created when performing mass crafting, or add to the result options an option to increase or decrease the amount of experience specified in addition to comparing the current amount of experience.

How can the bug be reproduced?

It can be reproduced by creating a recipe with the following settings for EXTENSION and mass crafting at once using Shift+click.

[extensions is here]

extensions : [ { "key" : "customcrafting:command", "outer_radius" : [ 0.0, 0.0, 0.0 ], "inner_radius" : [ 0.0, 0.0, 0.0 ], "consoleCommands" : [ "experience add @p -1000 points" ], "playerCommands" : [ ], "nearPlayer" : true, "nearWorkstation" : true } ]

Expected Behaviour?

For example, if 10 items were created using shift+click, the command would be executed 10 times and exp would be reduced by 10000 points.

However, in reality, exp is only reduced by 1000 points.

Plugin version

CustomCrafting v4.16.8.0 / WolfyUtilities v4.16.12.0

Server software

paper 1.19.2 (git-paper-307)

Relevant log output

No response

Submit issue

WolfyScript commented 1 year ago

Looks like the option for that is missing in the wiki. Set the property executionType to BULK inside the extension. By default it is set to ONCE.

mc-yuu2132 commented 1 year ago

Thanks for providing the solution. I tried it and it worked fine! Can you please include it in the wiki so that similar questions don't come up in the future? Thank you in advance :D