Skip to content

Commit

Permalink
Changed to PlotPlayer Event
Browse files Browse the repository at this point in the history
  • Loading branch information
David-M-GitHub committed Dec 19, 2023
1 parent 289561f commit 1c168c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Core/src/main/java/com/plotsquared/core/command/Clear.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public CompletableFuture<Boolean> execute(
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
.build()
);
this.eventDispatcher.callPostPlotClear(plot);
this.eventDispatcher.callPostPlotClear(player, plot);
}));
if (!result) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,27 @@
*/
package com.plotsquared.core.events.post;

import com.plotsquared.core.events.CancellablePlotEvent;
import com.plotsquared.core.events.PlotEvent;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.events.PlotPlayerEvent;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotId;

/**
* Called after a {@link Plot} was cleared.
*
* @since 7.2.1
* @since TODO
*/
public class PostPlotClearEvent extends PlotEvent {
public class PostPlotClearEvent extends PlotPlayerEvent {

public PostPlotClearEvent(Plot plot) {
super(plot);

/**
* Instantiate a new PostPlotClearEvent.
*
* @param plotPlayer The {@link PlotPlayer} that initiated the clear.
* @param plot The clearing plot.
*/
public PostPlotClearEvent(final PlotPlayer<?> plotPlayer, final Plot plot) {
super(plotPlayer, plot);
}

/**
Expand All @@ -53,4 +59,13 @@ public String getWorld() {
return getPlot().getWorldName();
}

/**
* Get the PlotPlayer.
*
* @return PlotPlayer
*/
public PlotPlayer<?> getPlotPlayer() {

This comment has been minimized.

Copy link
@dordsor21

dordsor21 Dec 19, 2023

Member

There's no need to override the super method here

return super.getPlotPlayer();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ public PlotClearEvent callClear(Plot plot) {
return event;
}

public PostPlotClearEvent callPostPlotClear(Plot plot) {
PostPlotClearEvent event = new PostPlotClearEvent(plot);
public PostPlotClearEvent callPostPlotClear(PlotPlayer<?> player, Plot plot) {
PostPlotClearEvent event = new PostPlotClearEvent(player, plot);
callEvent(event);
return event;
}
Expand Down

0 comments on commit 1c168c4

Please sign in to comment.