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

Addition of BlockFertilizeEvent #151

Open
KaiWelsing opened this issue Oct 9, 2023 · 0 comments
Open

Addition of BlockFertilizeEvent #151

KaiWelsing opened this issue Oct 9, 2023 · 0 comments

Comments

@KaiWelsing
Copy link

Hello Alex,

for a server that uses your plugin I made a small change to the source code, that I believe would benefit most use cases.
I am adding blocks that generate because of the use of bonemeal to the list of blocks placed by the player. This is helpful if players want to farm on a hotel region.
Because I made my changes inside of a gitlab repo I cant issue a pull request, therefor I will just mention the code changes I made.

In the file "BlockModifyListener" I added following lines:


 @EventHandler(priority = EventPriority.HIGHEST)
    public void addGeneratedBlock(BlockFertilizeEvent event) {
        if (event.isCancelled()) {
            return;
        }
        if (AdvancedRegionMarket.getInstance().getRegionManager() == null) {
            return;
        }

        List<Region> locRegions = AdvancedRegionMarket.getInstance().getRegionManager().getRegionsByLocation(event.getBlock().getLocation());

        for (Region region : locRegions) {
            if (region.isHotel()) {
                if (region.isSold()) {
                    for (BlockState block : event.getBlocks()){
                        region.addBuiltBlock(block.getLocation());
                    }
                }
            }
        }
    }

Because I believe this feature would benefit a lot of Players I hope you consider adding it to your code.

Thank you for your amazing work.

Best regards,
Kai

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

No branches or pull requests

1 participant