mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Implement PlotComponentSetEvent
This commit is contained in:
@ -0,0 +1,56 @@
|
||||
package com.plotsquared.bukkit.events;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a plot component is set
|
||||
*
|
||||
*/
|
||||
public class PlotComponentSetEvent extends PlotEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final String component;
|
||||
|
||||
public PlotComponentSetEvent(Plot plot, String component) {
|
||||
super(plot);
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotId
|
||||
*
|
||||
* @return PlotId
|
||||
*/
|
||||
public PlotId getPlotId() {
|
||||
return getPlot().getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the world name
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String getWorld() {
|
||||
return getPlot().getArea().worldname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the component which was set
|
||||
*
|
||||
* @return Component name
|
||||
*/
|
||||
public String getComponent() {
|
||||
return this.component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -109,7 +109,6 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.projectiles.BlockProjectileSource;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -18,6 +18,7 @@ import com.plotsquared.bukkit.events.PlayerPlotHelperEvent;
|
||||
import com.plotsquared.bukkit.events.PlayerPlotTrustedEvent;
|
||||
import com.plotsquared.bukkit.events.PlayerTeleportToPlotEvent;
|
||||
import com.plotsquared.bukkit.events.PlotClearEvent;
|
||||
import com.plotsquared.bukkit.events.PlotComponentSetEvent;
|
||||
import com.plotsquared.bukkit.events.PlotDeleteEvent;
|
||||
import com.plotsquared.bukkit.events.PlotFlagAddEvent;
|
||||
import com.plotsquared.bukkit.events.PlotFlagRemoveEvent;
|
||||
@ -57,6 +58,11 @@ public class BukkitEventUtil extends EventUtil {
|
||||
return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callComponentSet(Plot plot, String component) {
|
||||
return callEvent(new PlotComponentSetEvent(plot, component));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callClear(Plot plot) {
|
||||
return callEvent(new PlotClearEvent(plot));
|
||||
|
Reference in New Issue
Block a user