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.player.PlotPlayer;
022import com.plotsquared.core.plot.Plot;
023
024import java.util.UUID;
025
026public class PlayerPlotTrustedEvent extends PlotEvent {
027
028    private final PlotPlayer<?> initiator;
029    private final boolean added;
030    private final UUID player;
031
032    /**
033     * PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
034     *
035     * @param initiator Player that initiated the event
036     * @param plot      Plot in which the event occurred
037     * @param player    Player that was added/removed from the trusted list
038     * @param added     {@code true} if the player was added, {@code false} if the player was removed
039     */
040    public PlayerPlotTrustedEvent(PlotPlayer<?> initiator, Plot plot, UUID player, boolean added) {
041        super(plot);
042        this.initiator = initiator;
043        this.added = added;
044        this.player = player;
045    }
046
047    /**
048     * If a player was added
049     *
050     * @return boolean
051     */
052    public boolean wasAdded() {
053        return this.added;
054    }
055
056    /**
057     * The UUID added/removed
058     *
059     * @return UUID
060     */
061    public UUID getPlayer() {
062        return this.player;
063    }
064
065    /**
066     * The player initiating the action
067     *
068     * @return PlotPlayer
069     */
070    public PlotPlayer<?> getInitiator() {
071        return this.initiator;
072    }
073
074}