Cuboid / trencher tool issue
Minecraft's Version
1.20.4
Plugin's Version
2024.2-b49
Describe the bug
I have this in my config so the plugin picks up on ALL the blocks broken by cuboid tools:
other-plugins:
- InsanityFactions
However, when you break a block with a cuboid tool, it sends out MULTIPLE events per block. For example, if I break 1 coal ore with a cuboid tool, it sends out 15 block break events for it for some reason
To Reproduce
Mine a block with a cuboid tool and listen for it in an "other-plugins" plugin
Additional Information
No response
WildTools will simulate the BlockBreakEvent for every block that it breaks. It doesn't use the PluginManager#callEvent method tho, so only plugins that you configured to listen to the events, will listen to the events.
What exactly fires the BlockBreakEvent?
@OmerBenGera The issue is that it fires TOO MANY times per block. I mine a 5x5x5 area and listen for every COAL_ORE break (assuming the entire 9x9x9 is coal ore), it fires like 150 times
It is called two times - one time for claiming plugins, one time for other-plugins. Is InsanityFactions your plugin?
InsanityFactions is my plugin. I have attached a video so you can see. In this video at the start I show the "ore mining" leaderboard where it shows me on 24. It basically just adds 1 for every ore broken. I break it with a trencher and it's the ONLY block broken, yet it added 24 to the amount of ores
https://github.com/user-attachments/assets/c75d32d5-1b89-4ac1-a7d3-c65ec0902e01
The code to add ores is simply just on the BlockBreakEvent add 1. The BlockBreakEvent is sent 24 times here for this 1 break
My config is this:
# A list of all the plugins that handle claims here on your server.
# If one of the plugins here cancel the events, then WT will know that the player doesn't have access.
claiming-plugins:
- FactionsX
- BlockLocker
- InsanityFactions
# A list of all the other plugins that needs to know about breaking of blocks.
# You can add your custom shops plugins, spawners plugin and more.
# WildTools will not care if events are cancelled from this list. Therefore, if WildTools needs to know
# if the events are cancelled from a plugin, add it to the 'claiming-plugins' section.
other-plugins:
- FactionsX
- BlockLocker
- CoreProtect
- InsanityCore
- InsanityFactions```
My config is this:
# A list of all the plugins that handle claims here on your server. # If one of the plugins here cancel the events, then WT will know that the player doesn't have access. claiming-plugins: - FactionsX - BlockLocker - InsanityFactions # A list of all the other plugins that needs to know about breaking of blocks. # You can add your custom shops plugins, spawners plugin and more. # WildTools will not care if events are cancelled from this list. Therefore, if WildTools needs to know # if the events are cancelled from a plugin, add it to the 'claiming-plugins' section. other-plugins: - FactionsX - BlockLocker - CoreProtect - InsanityCore - InsanityFactions```
Remove InsanityFactions from the claiming plugins
Doing that reduces the amount of times it's given off but doesn't make it 1
In your listener, print the stacktrace and send me it here. This way I can better understand what causes this. Make sure when you use a trench pickaxe, you only break one block, so we are not spammed.
There is no stack trace. No error. All it does is print each block MANY times if I were to output all the block breaks
There is no stack trace. No error. All it does is print each block MANY times if I were to output all the block breaks
Listen to the BlockBreakEVent and print the stack trace yourself, so we can understand what called the events.
In this video I simply hit 1 coal ore with a 5x5 cuboid tool. It only breaks 1 block (the coal ore). However, when I output the block.getType() in the BlockBreakEvent, I get this:
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
[14:19:52 INFO]: COAL_ORE
https://github.com/user-attachments/assets/064676a4-989e-4d31-9a51-5910d443b702
Instead of printing the coal ore to console, print the stack trace.
You can do so by calling new Exception().printStackTrace()
Then, send it to me here via pastebin
https://paste.md-5.net/jehefixawe.md
Can you send me a copy of your plugin? I want to debug it myself.
I cant give you the plugin unfortunately but you should be able to replicate by making a plugin that listens to block break event and then put that plugin in the widl tools config
I cannot replicate it with a random plugin, it is probably something with how you developed your plugin that WildTools breaks. Can't you send me a copy of this plugin in private?
Any news regarding this?
I am closing this due to lack of response If the issue still occurs, let me know
Hey @OmerBenGera can we reopen this as the issue still persists. With my config and just 1 listener for block break event, it is fired like 40 times
My listener is very simply just this
// Normal priority events @EventHandler(ignoreCancelled = true) public void onBreakNormal(BlockBreakEvent e) { System.out.println(1);
It also sends a block break event for air blocks. It shouldnt really send for air blocks and it also sends a different amount of times per hit
I made a random plugin that only has 1 block break listener and added it to the WildTools config and it still sends too many times
I am also not 100% sure how you can't replicate it as I have just put a completely fresh config in and used a newly made plugin and it still sends too many times. I am on v1.21.1 and the latest stable plugin ver 2024.4
Check out latest dev build, it should be fixed
Hi @OmerBenGera this still isn't fixed
Show me your config file
https://hastebin.com/share/dufahaxobe.bash
I only see two times the event is called - one time is the original event, which is cancelled by WildTools. The second time is WildTools' calling the event, which is the time your listener should be triggered.
Can you print the stack trace in your listener and send me the stack traces?
Any news regarding this?