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.plot.Plot; 022import com.plotsquared.core.plot.PlotId; 023import org.checkerframework.checker.nullness.qual.NonNull; 024 025import java.util.Collections; 026import java.util.List; 027 028/** 029 * Event called when plots are automatically merged with /plot auto 030 * {@inheritDoc} 031 */ 032public final class PlotAutoMergeEvent extends PlotEvent implements CancellablePlotEvent { 033 034 private final List<PlotId> plots; 035 private final String world; 036 private Result eventResult; 037 038 /** 039 * PlotAutoMergeEvent: Called when plots are automatically merged with /plot auto 040 * 041 * @param world World in which the event occurred 042 * @param plot Plot that was merged 043 * @param plots A list of plots involved in the event 044 */ 045 public PlotAutoMergeEvent( 046 final @NonNull String world, final @NonNull Plot plot, 047 final @NonNull List<PlotId> plots 048 ) { 049 super(plot); 050 this.world = world; 051 this.plots = plots; 052 } 053 054 /** 055 * Get the plots being added. 056 * 057 * @return Unmodifiable list containing the merging plots 058 */ 059 public List<PlotId> getPlots() { 060 return Collections.unmodifiableList(this.plots); 061 } 062 063 @Override 064 public Result getEventResult() { 065 return eventResult; 066 } 067 068 @Override 069 public void setEventResult(Result e) { 070 this.eventResult = e; 071 } 072 073 public String getWorld() { 074 return this.world; 075 } 076 077}