Skip to content

Commit

Permalink
PostPlotClearEvent added (#4268)
Browse files Browse the repository at this point in the history
* PostPlotClearEvent added

* Made requested changes

* Clear.java changed

* Changed to PlotPlayer Event

* Removed methods

* Removed methods

* Removed useless import
  • Loading branch information
David-M-GitHub authored Jan 21, 2024
1 parent 951f08b commit 76ea9e0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions Core/src/main/java/com/plotsquared/core/command/Clear.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public CompletableFuture<Boolean> execute(
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
.build()
);
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
@@ -0,0 +1,43 @@
/*
* PlotSquared, a land and world management plugin for Minecraft.
* Copyright (C) IntellectualSites <https://intellectualsites.com>
* Copyright (C) IntellectualSites team and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.events.post;

import com.plotsquared.core.events.PlotPlayerEvent;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;

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


/**
* 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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.plotsquared.core.events.post.PostPlayerAutoPlotEvent;
import com.plotsquared.core.events.post.PostPlayerBuyPlotEvent;
import com.plotsquared.core.events.post.PostPlotChangeOwnerEvent;
import com.plotsquared.core.events.post.PostPlotClearEvent;
import com.plotsquared.core.events.post.PostPlotDeleteEvent;
import com.plotsquared.core.events.post.PostPlotMergeEvent;
import com.plotsquared.core.events.post.PostPlotUnlinkEvent;
Expand Down Expand Up @@ -182,6 +183,12 @@ public PlotClearEvent callClear(Plot plot) {
return event;
}

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

public PlotDeleteEvent callDelete(Plot plot) {
PlotDeleteEvent event = new PlotDeleteEvent(plot);
callEvent(event);
Expand Down

0 comments on commit 76ea9e0

Please sign in to comment.