WildTools icon indicating copy to clipboard operation
WildTools copied to clipboard

Cuboid / trencher tool issue

Open JHarris12345 opened this issue 1 year ago • 25 comments

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

JHarris12345 avatar Aug 18 '24 17:08 JHarris12345

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 avatar Aug 23 '24 09:08 OmerBenGera

@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

JHarris12345 avatar Aug 23 '24 23:08 JHarris12345

It is called two times - one time for claiming plugins, one time for other-plugins. Is InsanityFactions your plugin?

OmerBenGera avatar Aug 24 '24 09:08 OmerBenGera

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

JHarris12345 avatar Sep 02 '24 16:09 JHarris12345

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```

JHarris12345 avatar Sep 02 '24 16:09 JHarris12345

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

OmerBenGera avatar Sep 02 '24 20:09 OmerBenGera

Doing that reduces the amount of times it's given off but doesn't make it 1

JHarris12345 avatar Sep 04 '24 23:09 JHarris12345

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.

OmerBenGera avatar Sep 13 '24 12:09 OmerBenGera

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

JHarris12345 avatar Sep 13 '24 12:09 JHarris12345

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.

OmerBenGera avatar Sep 13 '24 13:09 OmerBenGera

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

JHarris12345 avatar Sep 13 '24 13:09 JHarris12345

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

OmerBenGera avatar Sep 13 '24 14:09 OmerBenGera

https://paste.md-5.net/jehefixawe.md

JHarris12345 avatar Sep 13 '24 15:09 JHarris12345

Can you send me a copy of your plugin? I want to debug it myself.

OmerBenGera avatar Sep 14 '24 08:09 OmerBenGera

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

JHarris12345 avatar Sep 15 '24 14:09 JHarris12345

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?

OmerBenGera avatar Sep 21 '24 09:09 OmerBenGera

Any news regarding this?

OmerBenGera avatar Dec 21 '24 13:12 OmerBenGera

I am closing this due to lack of response If the issue still occurs, let me know

OmerBenGera avatar Jan 11 '25 18:01 OmerBenGera

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

JHarris12345 avatar Mar 03 '25 01:03 JHarris12345

Check out latest dev build, it should be fixed

OmerBenGera avatar Mar 15 '25 13:03 OmerBenGera

Hi @OmerBenGera this still isn't fixed

JHarris12345 avatar Mar 21 '25 14:03 JHarris12345

Show me your config file

OmerBenGera avatar Mar 21 '25 18:03 OmerBenGera

https://hastebin.com/share/dufahaxobe.bash

JHarris12345 avatar Mar 22 '25 01:03 JHarris12345

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?

OmerBenGera avatar Mar 29 '25 12:03 OmerBenGera

Any news regarding this?

OmerBenGera avatar Nov 01 '25 15:11 OmerBenGera