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

Add events for plot buying #4291

Merged
merged 3 commits into from
Jan 21, 2024
Merged

Add events for plot buying #4291

merged 3 commits into from
Jan 21, 2024

Conversation

PierreSchwang
Copy link
Member

Overview

Required for IntellectualSites/HoloPlots#171

Usage (and my tests):

@Subscribe
    public void onPlayerBuyPlot(PlayerBuyPlotEvent event) {
        // Cancel / Disallow plot buy
        event.setEventResult(Result.DENY);
        
        // Modify price
        event.setPrice(event.price() * 1.337);
        
        // Ignore player balance and set price basically to 0
        event.setEventResult(Result.FORCE);
    }

    @Subscribe
    public void onPlayerBoughtPlot(PostPlayerBuyPlotEvent event) {
        event.getPlotPlayer().sendMessage(StaticCaption.of("Have fun with your plot by " + event.previousOwner().getName() + " " +
                "for which you paid " + event.price()));
    }

Submitter Checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter Checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
    Options
  2. Ensure that the pull request title represents the desired changelog entry.
    Options
  3. New public fields and methods are annotated with @since TODO.
    Options
  4. I read and followed the contribution guidelines.
    Options

@PierreSchwang PierreSchwang requested a review from a team as a code owner January 14, 2024 13:41
@github-actions github-actions bot added the Feature This PR proposes a new feature label Jan 14, 2024
@NotMyFault NotMyFault requested a review from a team January 15, 2024 03:49
@NotMyFault
Copy link
Member

Optionally, would you mind adding todo annotations to the interface methods added?

@PierreSchwang
Copy link
Member Author

Optionally, would you mind adding todo annotations to the interface methods added?

The interface itself shouldn't have any method changes, just the one deprecation and annotations

@NotMyFault NotMyFault merged commit 951f08b into main Jan 21, 2024
10 checks passed
@NotMyFault NotMyFault deleted the feat/plotBuyEvents branch January 21, 2024 14:21
@NotMyFault
Copy link
Member

Do you want to file the HoloPlots PR? @PierreSchwang

@PierreSchwang
Copy link
Member Author

Do you want to file the HoloPlots PR? @PierreSchwang

Possibly adding that to the existing PR if not merged until then. But that's the plan, yeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature This PR proposes a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants