use of com.plotsquared.core.events.PlotFlagRemoveEvent in project PlotSquared by IntellectualSites.
the class Continue method onCommand.
@Override
public boolean onCommand(PlotPlayer<?> player, String[] args) {
Plot plot = player.getCurrentPlot();
if ((plot == null) || !plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), Template.of("node", TranslatableCaption.of("permission.no_plot_perms").getComponent(player)));
return false;
}
if (!DoneFlag.isDone(plot)) {
player.sendMessage(TranslatableCaption.of("done.done_not_done"));
return false;
}
int size = plot.getConnectedPlots().size();
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) {
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"), Template.of("amount", String.valueOf(player.getAllowedPlots())));
return false;
}
if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
return false;
}
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class);
PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plotFlag, plot);
if (event.getEventResult() == Result.DENY) {
player.sendMessage(TranslatableCaption.of("events.event_denied"), Template.of("value", "Done flag removal"));
return true;
}
plot.removeFlag(event.getFlag());
player.sendMessage(TranslatableCaption.of("done.done_removed"));
return true;
}
use of com.plotsquared.core.events.PlotFlagRemoveEvent in project PlotSquared by IntellectualSites.
the class EventDispatcher method callFlagRemove.
public PlotFlagRemoveEvent callFlagRemove(PlotFlag<?, ?> flag, Plot plot) {
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot);
callEvent(event);
return event;
}
Aggregations