PostPlotClearEvent added (#4268)

* PostPlotClearEvent added

* Made requested changes

* Clear.java changed

* Changed to PlotPlayer Event

* Removed methods

* Removed methods

* Removed useless import
This commit is contained in:
David 2024-01-21 15:22:38 +01:00 committed by GitHub
parent 951f08bc8b
commit 76ea9e0d3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 0 deletions

View File

@ -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"));

View File

@ -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);
}
}

View File

@ -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);