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.post; 020 021import com.plotsquared.core.events.PlotPlayerEvent; 022import com.plotsquared.core.player.OfflinePlotPlayer; 023import com.plotsquared.core.player.PlotPlayer; 024import com.plotsquared.core.plot.Plot; 025import org.checkerframework.checker.index.qual.NonNegative; 026 027/** 028 * Called after a player has successfully bought a plot. 029 * 030 * @since 7.3.2 031 */ 032public class PostPlayerBuyPlotEvent extends PlotPlayerEvent { 033 034 private final OfflinePlotPlayer previousOwner; 035 private final double price; 036 037 public PostPlayerBuyPlotEvent( 038 final PlotPlayer<?> plotPlayer, final OfflinePlotPlayer previousOwner, final Plot plot, 039 @NonNegative final double price 040 ) { 041 super(plotPlayer, plot); 042 this.previousOwner = previousOwner; 043 this.price = price; 044 } 045 046 /** 047 * The previous owner of the bought plot. 048 * 049 * @return the previous owner. 050 */ 051 public OfflinePlotPlayer previousOwner() { 052 return previousOwner; 053 } 054 055 /** 056 * Returns the price after potential modifications by {@link com.plotsquared.core.events.PlayerBuyPlotEvent}. 057 * 058 * @return the price the player had to pay to buy the plot. 059 */ 060 public double price() { 061 return price; 062 } 063 064}