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

Change method signature of allowBreak method in main class #1406

Merged
merged 1 commit into from Jun 17, 2021
Merged

Change method signature of allowBreak method in main class #1406

merged 1 commit into from Jun 17, 2021

Conversation

solarrabbit99
Copy link

@solarrabbit99 solarrabbit99 commented Jun 14, 2021

I'm working on a plugin, intending it to support GriefPrevention's land protection. There is this public method in the main class that caught my attention allowBreak(Player player, Block block, Location location, BlockBreakEvent breakEvent). This class takes in a Block type parameter but never utilises its properties - only calling block.getType() at some point to test if that block can be broken in a claimed area.

It is a suggestion to change the method signature to/add a method with signature allowBreak(Player player, Material material, Location location, BlockBreakEvent breakEvent) instead. This will allow plugin authors who want to know if a player can break STONE at a given location without having an actual stone there. Right now the best way to do this is to copy and paste the entire method down.

@RoboMWM
Copy link

RoboMWM commented Jun 17, 2021

You can also datastore#getClaimAt? But I assume you're checking for permissions too and whatnot.

@solarrabbit99
Copy link
Author

solarrabbit99 commented Jun 17, 2021

You can also datastore#getClaimAt? But I assume you're checking for permissions too and whatnot.

Yes im checking for permissions and it seems like allowBreak() checks for wilderness too. The way I see it Material does suite more for the method, and increase the extensiveness of where the method can be applied.

Copy link

@RoboMWM RoboMWM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can generate a block from a material but fair enough, seems like this is the only call in the plugin. Interesting.

@RoboMWM RoboMWM merged commit f4680c4 into GriefPrevention:master Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants