Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instabreak drops items when disabled in BlockBreakEvent. #4508

Open
2 tasks done
nicolube opened this issue Sep 30, 2024 · 8 comments
Open
2 tasks done

Instabreak drops items when disabled in BlockBreakEvent. #4508

nicolube opened this issue Sep 30, 2024 · 8 comments
Labels
Enhancement New feature or request

Comments

@nicolube
Copy link
Contributor

Server Implementation

Paper

Server Version

1.20

Describe the bug

Instabreak dropes items when disabled in BlockBreakEvent.

To Reproduce

  1. Write a Plugin with an BlockBreakListener that disables drops.
  2. Enable instabreak on a plot
  3. Break Blocks
  4. Items still drop

Expected behaviour

Items only stopping when blockbreak event says it should

Screenshots / Videos

No response

Error log (if applicable)

No response

Plot Debugpaste

https://athion.net/ISPaster/paste/view/14b8c2d536ca470293e0f3a37ec0bbab

PlotSquared Version

7.3.12-SNAPSHOT

Checklist

Anything else?

Compiled form latest src

@nicolube nicolube added the Requires Testing This is a new issue which needs to be approved before labeled with "bug" label Sep 30, 2024
@nicolube nicolube changed the title Instabreak dropes items when disabled in BlockBreakEvent. Instabreak drops items when disabled in BlockBreakEvent. Sep 30, 2024
@TheMeinerLP
Copy link
Member

Can you please attach code for reproduction ?

@nicolube
Copy link
Contributor Author

@EventHandler
public void onBlockBreakEvent(BlockBreakEvent event) {
    event.setDropItems(false);
}

@TheMeinerLP
Copy link
Member

I would consider setting the event priority.
The events are sorted and called by Bukkit in the following order:
LOWEST -> LOWEST -> NORMAL -> HIGH -> HIGHEST -> MONITOR
See: https://jd.papermc.io/paper/1.21.1/org/bukkit/event/EventHandler.html

@nicolube
Copy link
Contributor Author

nicolube commented Sep 30, 2024

I would consider setting the event priority. The events are sorted and called by Bukkit in the following order: LOWEST -> LOWEST -> NORMAL -> HIGH -> HIGHEST -> MONITOR See: https://jd.papermc.io/paper/1.21.1/org/bukkit/event/EventHandler.html

BlockBreakEvent with instabreak falg is called by PlotSquared...
And is executes breakNaturally when not cancled... Does not check if dropItems is disabled...

I would suggest u check before proposing a solution that will not work.
https://github.com/IntellectualSites/PlotSquared/blob/main/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java#L523

@dordsor21
Copy link
Member

For instabreak P2 uses Block#breakNaturally and I do not know what event(s) that would send, and what it would be determined as have being "done" by

@nicolube
Copy link
Contributor Author

Would u guys just look 2 mins at ur own code before replying?
The this is a very simple issue and easy to fix.

@SirYwell SirYwell added Enhancement New feature or request and removed Requires Testing This is a new issue which needs to be approved before labeled with "bug" labels Sep 30, 2024
@SirYwell
Copy link
Member

We don't make any guarantees about what information is used from the BlockBreakEvent. I guess this is a feature request then. Feel free to open a PR.

@nicolube
Copy link
Contributor Author

nicolube commented Sep 30, 2024

Well, is this a feature request or a bug?

Well, I would say it is most definitely a bug, when calling Bukkit-evnets, the behavior of the event should mimic Bukkit as closely as possible.

If're not doing that, u break other plugins.

Which events are being called at an block break by a player?
As far as I know...

  1. BlockBreakEvent
  2. BlockDropItemEvent (if it has drops)

Well to be super correct, the BlockDropItems event should also be called when makeing a fake block break by an player

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants