Skip to content

Add PlayerAdvancementCriterionRevokeEvent and PlayerAdvancementRevokeEvent - #14445

Open
FlowerDevelops wants to merge 3 commits into
PaperMC:mainfrom
FlowerDevelops:advancement-revoke-events
Open

FlowerDevelops wants to merge 3 commits into
PaperMC:mainfrom
FlowerDevelops:advancement-revoke-events

Conversation

@FlowerDevelops

Copy link
Copy Markdown

No description provided.

@ImKarven ImKarven left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PlayerAdvancementRevokeEvent should also have changes similar to PlayerAdvancementRevokeCriterionEvent.

Javadoc should be added to getAdvancement() (for both events) and getCriterion().

Actually, the firing logic for PlayerAdvancementRevokeCriterionEvent should be moved to PlayerAdvancements#revoke so that the event is also fired when a plugin revoke an advancement through the API.

* An event fired when a {@link Player} has an advancement revoked
*/
@NullMarked
public final class PlayerAdvancementCriterionRevokeEvent extends Event implements Cancellable {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use PlayerEvent instead.

-public final class PlayerAdvancementCriterionRevokeEvent extends Event implements Cancellable {
+public final class PlayerAdvancementCriterionRevokeEvent extends PlayerEvent implements Cancellable {


@ApiStatus.Internal
public PlayerAdvancementCriterionRevokeEvent(final Player player, Advancement advancement, String criterion) {
this.player = player;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

-        this.player = player;
+        super(player);

this.criterion = criterion;
}

public Player getPlayer()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

-    public Player getPlayer()
-    {
-        return this.player;
-    }
-


private boolean cancelled;

private final Player player;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

-    private final Player player;

+ if (event.isCancelled()) {
+ return false;
+ }
+ // Paper end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suffix with commit description:
// Paper end - Add PlayerAdvancementRevokeEvent

+ if (!event.callEvent()) {
+ return false;
+ }
+ // Paper end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also suffix with commit description

@github-project-automation github-project-automation Bot moved this from Awaiting review to Changes required in Paper PR Queue Nov 1, 2026
@FlowerDevelops

Copy link
Copy Markdown
Author

I'll check all comment and change my code.

@FlowerDevelops

Copy link
Copy Markdown
Author

I made 2 commits that should fix this

@FlowerDevelops

Copy link
Copy Markdown
Author

If there are any changes you'd still want to see, tell me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

2 participants