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

PlotClearEvent Result is always null #4288

Closed
2 tasks done
Ste3et opened this issue Jan 11, 2024 · 3 comments · Fixed by #4268
Closed
2 tasks done

PlotClearEvent Result is always null #4288

Ste3et opened this issue Jan 11, 2024 · 3 comments · Fixed by #4268
Labels
Enhancement New feature or request

Comments

@Ste3et
Copy link

Ste3et commented Jan 11, 2024

Server Implementation

Spigot

Server Version

1.20.4

Describe the bug

For my ProtectionLib plugin i listen to the PlotClearEvent and i have seen the event implements the interface CancellablePlotEvent.
The EventResult an enum is always null, i don't know how to handle if a non owner player try to usage /plot clear then the event is always triggerd by the player It doesn't matter whether he is the owner or whether he has the rights to do so.

To Reproduce

I have written an debug output inside my protectionlib plugin i know these is not the right way to reproduce it.
But here is it:

@Subscribe
public void onPlotClear(PlotClearEvent clearEvent) {
	Bukkit.broadcastMessage("PlotClearEvent: #getEventResult -> " + (Objects.isNull(clearEvent.getEventResult()) ? "null" : clearEvent.getEventResult().name()));
	if(Result.DENY == clearEvent.getEventResult()) return;
        //do something
}

Expected behaviour

The PlotClearEvent should not be triggered then the player have no permissions for it or use the Result enum as expacted

  • DENY(0) Player is not the owner of the Plot
  • ACCEPT(1) Player have confirmed the Clearing proccess or the toggle of the clear-confirmation
  • FORCE(2) Player have forced the deletion

The null resulot should be avoidet here to avoid confusing.

Screenshots / Videos

https://www.youtube.com/watch?v=4RxtKsnJUkg

Error log (if applicable)

No response

Plot Debugpaste

https://athion.net/ISPaster/paste/view/6c0efd6a58eb4c949553fe75fe1be21e

PlotSquared Version

PlotSquared v7 7.3.1-Premium

Checklist

Anything else?

No response

@Ste3et Ste3et added the Requires Testing This is a new issue which needs to be approved before labeled with "bug" label Jan 11, 2024
@Ste3et
Copy link
Author

Ste3et commented Jan 11, 2024

@PierreSchwang
Copy link
Member

The results are generally null by default. That just indicates, that no other addon listening on that event already set / modified the result.
The player check will only be ignored if the result is set to FORCE. Generally that event does not seem to be quite suitable for your needs - #4268 might be worthwhile waiting for.

@Ste3et
Copy link
Author

Ste3et commented Jan 11, 2024

Thank you @PierreSchwang that was exactly what i think how it works.
I have seen #4268 already thank you, i only asked here because maybe sometimes i need to double check if the behaviour is correct and maybe i do something wrong.

@PierreSchwang PierreSchwang 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 Jan 20, 2024
@PierreSchwang PierreSchwang linked a pull request Jan 20, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants