001/*
002 * PlotSquared, a land and world management plugin for Minecraft.
003 * Copyright (C) IntellectualSites <https://intellectualsites.com>
004 * Copyright (C) IntellectualSites team and contributors
005 *
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
018 */
019package com.plotsquared.core.events;
020
021import com.plotsquared.core.command.Claim;
022import com.plotsquared.core.player.PlotPlayer;
023import com.plotsquared.core.plot.Plot;
024import org.checkerframework.checker.nullness.qual.Nullable;
025
026public class PlayerClaimPlotEvent extends PlotPlayerEvent implements CancellablePlotEvent {
027
028    private Result eventResult;
029    private String schematic;
030
031    /**
032     * PlayerClaimPlotEvent: Called when a plot is claimed.
033     *
034     * @param player    Player that claimed the plot
035     * @param plot      Plot that was claimed
036     * @param schematic The schematic defined or null
037     */
038    public PlayerClaimPlotEvent(PlotPlayer<?> player, Plot plot, @Nullable String schematic) {
039        super(player, plot);
040        this.schematic = schematic;
041    }
042
043    /**
044     * Obtain the schematic string as used by the {@link Claim} command or null.
045     *
046     * @return schematic string
047     */
048    public @Nullable String getSchematic() {
049        return this.schematic;
050    }
051
052    /**
053     * Set the schematic string used in the claim.
054     *
055     * @param schematic the schematic name
056     */
057    public void setSchematic(String schematic) {
058        this.schematic = schematic;
059    }
060
061    @Override
062    public Result getEventResult() {
063        return eventResult;
064    }
065
066    @Override
067    public void setEventResult(Result e) {
068        this.eventResult = e;
069    }
070
071}