diff --git a/Core/src/main/java/com/plotsquared/core/command/Clear.java b/Core/src/main/java/com/plotsquared/core/command/Clear.java index 68d97e380..d9ae0a3bb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Clear.java +++ b/Core/src/main/java/com/plotsquared/core/command/Clear.java @@ -135,6 +135,7 @@ public class Clear extends Command { .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")); diff --git a/Core/src/main/java/com/plotsquared/core/events/post/PostPlotClearEvent.java b/Core/src/main/java/com/plotsquared/core/events/post/PostPlotClearEvent.java new file mode 100644 index 000000000..c1c461e25 --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/events/post/PostPlotClearEvent.java @@ -0,0 +1,43 @@ +/* + * PlotSquared, a land and world management plugin for Minecraft. + * Copyright (C) IntellectualSites + * 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 . + */ +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); + } + +} diff --git a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java index a01e72564..b80029aad 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java +++ b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java @@ -52,6 +52,7 @@ import com.plotsquared.core.events.TeleportCause; 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; @@ -182,6 +183,12 @@ public class EventDispatcher { 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);