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.location.Location; 022import com.plotsquared.core.player.PlotPlayer; 023import com.plotsquared.core.plot.Plot; 024 025/** 026 * Called when a player teleports to a plot 027 */ 028public class PlayerTeleportToPlotEvent extends PlotPlayerEvent implements CancellablePlotEvent { 029 030 private final Location from; 031 private final TeleportCause cause; 032 private Result eventResult; 033 034 /** 035 * PlayerTeleportToPlotEvent: Called when a player teleports to a plot 036 * 037 * @param player That was teleported 038 * @param from Start location 039 * @param plot Plot to which the player was teleported 040 * @param cause Why the teleport is being completed 041 * @since 6.1.0 042 */ 043 public PlayerTeleportToPlotEvent(PlotPlayer<?> player, Location from, Plot plot, TeleportCause cause) { 044 super(player, plot); 045 this.from = from; 046 this.cause = cause; 047 } 048 049 /** 050 * Get the teleport cause 051 * 052 * @return TeleportCause 053 * @since 6.1.0 054 */ 055 public TeleportCause getCause() { 056 return cause; 057 } 058 059 /** 060 * Get the from location 061 * 062 * @return Location 063 */ 064 public Location getFrom() { 065 return this.from; 066 } 067 068 @Override 069 public Result getEventResult() { 070 return eventResult; 071 } 072 073 @Override 074 public void setEventResult(Result e) { 075 this.eventResult = e; 076 } 077 078}