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 com.sk89q.worldedit.function.pattern.Pattern; 024 025/** 026 * Called when a plot component is set 027 */ 028public class PlotComponentSetEvent extends PlotEvent { 029 030 private String component; 031 private Pattern pattern; 032 033 /** 034 * PlotComponentSetEvent: Called when a player attempts to set the component of a plot (e.g. walls) 035 * 036 * @param plot The plot having its component set 037 * @param component The component being set 038 * @param pattern The pattern the component is being set to 039 */ 040 public PlotComponentSetEvent(Plot plot, String component, Pattern pattern) { 041 super(plot); 042 this.component = component; 043 this.pattern = pattern; 044 } 045 046 /** 047 * Get the PlotId 048 * 049 * @return PlotId 050 */ 051 public PlotId getPlotId() { 052 return getPlot().getId(); 053 } 054 055 /** 056 * Get the world name 057 * 058 * @return String 059 */ 060 public String getWorld() { 061 return getPlot().getWorldName(); 062 } 063 064 /** 065 * Get the component which was set 066 * 067 * @return Component name 068 */ 069 public String getComponent() { 070 return this.component; 071 } 072 073 /** 074 * Change the component being set 075 * 076 * @param component the component to set 077 */ 078 public void setComponent(String component) { 079 this.component = component; 080 } 081 082 /** 083 * Get the pattern being set 084 * 085 * @return Pattern 086 */ 087 public Pattern getPattern() { 088 return this.pattern; 089 } 090 091 /** 092 * Change the pattern being set 093 * 094 * @param pattern the pattern to set 095 */ 096 public void setPattern(Pattern pattern) { 097 this.pattern = pattern; 098 } 099 100}