mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Merge pull request #2102 from dordsor21/master
Add PlotChangeOwner Event
This commit is contained in:
commit
b6d4872ca4
@ -0,0 +1,107 @@
|
|||||||
|
package com.plotsquared.bukkit.events;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class PlotChangeOwnerEvent extends PlotEvent implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private final Player initiator;
|
||||||
|
private final UUID newOwner;
|
||||||
|
private final UUID oldOwner;
|
||||||
|
private boolean hasOldOwner;
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlotChangeOwnerEvent: Called when a plot's owner is change.
|
||||||
|
*
|
||||||
|
* @param newOwner The new owner of the plot
|
||||||
|
* @param oldOwner The old owner of the plot
|
||||||
|
* @param plot The plot having its owner changed
|
||||||
|
*/
|
||||||
|
public PlotChangeOwnerEvent(Player initiator, Plot plot, UUID oldOwner, UUID newOwner, boolean hasOldOwner) {
|
||||||
|
super(plot);
|
||||||
|
this.initiator = initiator;
|
||||||
|
this.newOwner = newOwner;
|
||||||
|
this.oldOwner = oldOwner;
|
||||||
|
this.hasOldOwner = hasOldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
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().getWorldName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the change-owner initator
|
||||||
|
*
|
||||||
|
* @return Player
|
||||||
|
*/
|
||||||
|
public Player getInitiator() {
|
||||||
|
return this.initiator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the old owner of the plot. Null if not exists.
|
||||||
|
*
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
|
public UUID getOldOwner() {
|
||||||
|
return this.oldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the new owner of the plot
|
||||||
|
*
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
|
public UUID getNewOwner() {
|
||||||
|
return this.newOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if the plot had an old owner
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean hasOldOwner() {
|
||||||
|
return this.hasOldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return this.cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean b) {
|
||||||
|
this.cancelled = b;
|
||||||
|
}
|
||||||
|
}
|
@ -9,22 +9,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.Rating;
|
import com.intellectualcrafters.plot.object.Rating;
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.plotsquared.bukkit.events.ClusterFlagRemoveEvent;
|
import com.plotsquared.bukkit.events.*;
|
||||||
import com.plotsquared.bukkit.events.PlayerClaimPlotEvent;
|
|
||||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
|
||||||
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
|
|
||||||
import com.plotsquared.bukkit.events.PlayerPlotDeniedEvent;
|
|
||||||
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;
|
|
||||||
import com.plotsquared.bukkit.events.PlotMergeEvent;
|
|
||||||
import com.plotsquared.bukkit.events.PlotRateEvent;
|
|
||||||
import com.plotsquared.bukkit.events.PlotUnlinkEvent;
|
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -119,6 +104,11 @@ public class BukkitEventUtil extends EventUtil {
|
|||||||
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
|
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, boolean hasOldOwner) {
|
||||||
|
return callEvent(new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callFlagRemove(Flag flag, Object object, PlotCluster cluster) {
|
public boolean callFlagRemove(Flag flag, Object object, PlotCluster cluster) {
|
||||||
return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
|
return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
|
||||||
|
@ -4,11 +4,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
import com.intellectualcrafters.plot.util.*;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -34,7 +30,8 @@ public class Owner extends SetCommand {
|
|||||||
try {
|
try {
|
||||||
uuid = UUID.fromString(value);
|
uuid = UUID.fromString(value);
|
||||||
name = MainUtil.getName(uuid);
|
name = MainUtil.getName(uuid);
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uuid = UUIDHandler.getUUID(value, null);
|
uuid = UUIDHandler.getUUID(value, null);
|
||||||
name = UUIDHandler.getName(uuid);
|
name = UUIDHandler.getName(uuid);
|
||||||
@ -80,13 +77,15 @@ public class Owner extends SetCommand {
|
|||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (removeDenied) plot.removeDenied(finalUUID);
|
if (plot.setOwner(finalUUID, player)) {
|
||||||
plot.setOwner(finalUUID);
|
if (removeDenied) plot.removeDenied(finalUUID);
|
||||||
plot.setSign(finalName);
|
plot.setSign(finalName);
|
||||||
MainUtil.sendMessage(player, C.SET_OWNER);
|
MainUtil.sendMessage(player, C.SET_OWNER);
|
||||||
if (other != null) {
|
if (other != null) {
|
||||||
MainUtil.sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId());
|
MainUtil.sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId());
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
MainUtil.sendMessage(player, C.SET_OWNER_CANCELLED);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
|
@ -692,6 +692,7 @@ public enum C {
|
|||||||
* Set Owner
|
* Set Owner
|
||||||
*/
|
*/
|
||||||
SET_OWNER("$4You successfully set the plot owner", "Owner"),
|
SET_OWNER("$4You successfully set the plot owner", "Owner"),
|
||||||
|
SET_OWNER_CANCELLED("$2The setowner action was cancelled", "Owner"),
|
||||||
NOW_OWNER("$4You are now owner of plot %s", "Owner"),
|
NOW_OWNER("$4You are now owner of plot %s", "Owner"),
|
||||||
/*
|
/*
|
||||||
* Signs
|
* Signs
|
||||||
|
@ -746,6 +746,37 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the plot owner (and update the database)
|
||||||
|
* @param owner
|
||||||
|
* @param initiator
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean setOwner(UUID owner, PlotPlayer initiator) {
|
||||||
|
boolean result = EventUtil.manager.callOwnerChange(initiator, this, owner, hasOwner() ? this.owner : null, hasOwner());
|
||||||
|
if(!result)
|
||||||
|
return false;
|
||||||
|
if (!hasOwner()) {
|
||||||
|
this.owner = owner;
|
||||||
|
create();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!isMerged()) {
|
||||||
|
if (!this.owner.equals(owner)) {
|
||||||
|
this.owner = owner;
|
||||||
|
DBFunc.setOwner(this, owner);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (Plot current : getConnectedPlots()) {
|
||||||
|
if (!owner.equals(current.owner)) {
|
||||||
|
current.owner = owner;
|
||||||
|
DBFunc.setOwner(current, owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear a plot.
|
* Clear a plot.
|
||||||
* @see this#clear(boolean, boolean, Runnable)
|
* @see this#clear(boolean, boolean, Runnable)
|
||||||
|
@ -67,6 +67,8 @@ public abstract class EventUtil {
|
|||||||
|
|
||||||
public abstract void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added);
|
public abstract void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added);
|
||||||
|
|
||||||
|
public abstract boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID newOwner, UUID oldOwner, boolean hasOldOwner);
|
||||||
|
|
||||||
public void doJoinTask(final PlotPlayer player) {
|
public void doJoinTask(final PlotPlayer player) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return; //possible future warning message to figure out where we are retrieving null
|
return; //possible future warning message to figure out where we are retrieving null
|
||||||
|
@ -63,4 +63,6 @@ public class EventUtilTest extends EventUtil {
|
|||||||
@Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {}
|
@Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {}
|
||||||
|
|
||||||
@Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {}
|
@Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {}
|
||||||
|
|
||||||
|
@Override public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID newOwner, UUID oldOwner, boolean hasOldOwner) {return false;}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.plotsquared.nukkit.events;
|
||||||
|
|
||||||
|
import cn.nukkit.Player;
|
||||||
|
import cn.nukkit.event.Cancellable;
|
||||||
|
import cn.nukkit.event.HandlerList;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class PlotChangeOwnerEvent extends PlotEvent implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private final Plot plot;
|
||||||
|
private final Player initiator;
|
||||||
|
private final UUID newOwner;
|
||||||
|
private final UUID oldOwner;
|
||||||
|
private final boolean hasOldOwner;
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlotChangeOwnerEvent: Called when a plot's owner is change.
|
||||||
|
*
|
||||||
|
* @param newOwner The new owner of the plot
|
||||||
|
* @param oldOwner The old owner of the plot
|
||||||
|
* @param plot The plot having its owner changed
|
||||||
|
*/
|
||||||
|
public PlotChangeOwnerEvent(Player initiator, Plot plot, UUID oldOwner, UUID newOwner, boolean hasOldOwner) {
|
||||||
|
super(plot);
|
||||||
|
this.plot = plot;
|
||||||
|
this.initiator = initiator;
|
||||||
|
this.newOwner = newOwner;
|
||||||
|
this.hasOldOwner = hasOldOwner;
|
||||||
|
this.oldOwner = oldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
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().getWorldName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the change-owner initator
|
||||||
|
*
|
||||||
|
* @return Player
|
||||||
|
*/
|
||||||
|
public Player getInitiator() {
|
||||||
|
return this.initiator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the old owner of the plot
|
||||||
|
*
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
|
public UUID getOldOwner() {
|
||||||
|
return this.oldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the new owner of the plot
|
||||||
|
*
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
|
public UUID getNewOwner() {
|
||||||
|
return this.newOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if the plot had an old owner
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean hasOldOwner() {
|
||||||
|
return this.hasOldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return this.cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean b) {
|
||||||
|
this.cancelled = b;
|
||||||
|
}
|
||||||
|
}
|
@ -13,22 +13,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.Rating;
|
import com.intellectualcrafters.plot.object.Rating;
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.plotsquared.nukkit.NukkitMain;
|
import com.plotsquared.nukkit.NukkitMain;
|
||||||
import com.plotsquared.nukkit.events.ClusterFlagRemoveEvent;
|
import com.plotsquared.nukkit.events.*;
|
||||||
import com.plotsquared.nukkit.events.PlayerClaimPlotEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlayerEnterPlotEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlayerLeavePlotEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlayerPlotDeniedEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlayerPlotHelperEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlayerPlotTrustedEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlayerTeleportToPlotEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotClearEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotComponentSetEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotDeleteEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotFlagAddEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotFlagRemoveEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotMergeEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotRateEvent;
|
|
||||||
import com.plotsquared.nukkit.events.PlotUnlinkEvent;
|
|
||||||
import com.plotsquared.nukkit.object.NukkitPlayer;
|
import com.plotsquared.nukkit.object.NukkitPlayer;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -125,6 +110,11 @@ public class NukkitEventUtil extends EventUtil {
|
|||||||
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
|
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, boolean hasOldOwner) {
|
||||||
|
return callEvent(new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callFlagRemove(Flag flag, Object object, PlotCluster cluster) {
|
public boolean callFlagRemove(Flag flag, Object object, PlotCluster cluster) {
|
||||||
return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
|
return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
package com.plotsquared.sponge.events;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
|
import org.spongepowered.api.event.Cancellable;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class PlotChangeOwnerEvent extends PlotEvent implements Cancellable {
|
||||||
|
|
||||||
|
private final Player initiator;
|
||||||
|
private final UUID newOwner;
|
||||||
|
private final UUID oldOwner;
|
||||||
|
private final boolean hasOldOwner;
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlotChangeOwnerEvent: Called when a plot's owner is change.
|
||||||
|
*
|
||||||
|
* @param newOwner The new owner of the plot
|
||||||
|
* @param oldOwner The old owner of the plot
|
||||||
|
* @param plot The plot having its owner changed
|
||||||
|
*/
|
||||||
|
public PlotChangeOwnerEvent(Player initiator, Plot plot, UUID oldOwner, UUID newOwner, boolean hasOldOwner) {
|
||||||
|
super(plot);
|
||||||
|
this.initiator = initiator;
|
||||||
|
this.newOwner = newOwner;
|
||||||
|
this.oldOwner = oldOwner;
|
||||||
|
this.hasOldOwner = hasOldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PlotId.
|
||||||
|
*
|
||||||
|
* @return PlotId
|
||||||
|
*/
|
||||||
|
public PlotId getPlotId() {
|
||||||
|
return getPlot().getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the world name.
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public String getWorld() {
|
||||||
|
return getPlot().getWorldName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the change-owner initator
|
||||||
|
*
|
||||||
|
* @return Player
|
||||||
|
*/
|
||||||
|
public Player getInitiator() {
|
||||||
|
return this.initiator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the old owner of the plot. Null if not exists.
|
||||||
|
*
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
|
public UUID getOldOwner() {
|
||||||
|
return this.oldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the new owner of the plot
|
||||||
|
*
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
|
public UUID getNewOwner() {
|
||||||
|
return this.newOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if the plot had an old owner
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean hasOldOwner() {
|
||||||
|
return this.hasOldOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return this.cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean b) {
|
||||||
|
this.cancelled = b;
|
||||||
|
}
|
||||||
|
}
|
@ -10,22 +10,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.Rating;
|
import com.intellectualcrafters.plot.object.Rating;
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.plotsquared.sponge.SpongeMain;
|
import com.plotsquared.sponge.SpongeMain;
|
||||||
import com.plotsquared.sponge.events.ClusterFlagRemoveEvent;
|
import com.plotsquared.sponge.events.*;
|
||||||
import com.plotsquared.sponge.events.PlayerClaimPlotEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlayerEnterPlotEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlayerLeavePlotEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlayerPlotDeniedEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlayerPlotHelperEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlayerPlotTrustedEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlayerTeleportToPlotEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotClearEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotComponentSetEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotDeleteEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotFlagAddEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotFlagRemoveEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotMergeEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotRateEvent;
|
|
||||||
import com.plotsquared.sponge.events.PlotUnlinkEvent;
|
|
||||||
import org.spongepowered.api.event.Event;
|
import org.spongepowered.api.event.Event;
|
||||||
import org.spongepowered.api.event.EventManager;
|
import org.spongepowered.api.event.EventManager;
|
||||||
|
|
||||||
@ -115,6 +100,11 @@ public class SpongeEventUtil extends EventUtil {
|
|||||||
callEvent(new PlayerPlotHelperEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
|
callEvent(new PlayerPlotHelperEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, boolean hasOldOwner) {
|
||||||
|
return callEvent(new PlotChangeOwnerEvent(SpongeUtil.getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callFlagRemove(Flag flag, Object object, PlotCluster cluster) {
|
public boolean callFlagRemove(Flag flag, Object object, PlotCluster cluster) {
|
||||||
return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
|
return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
|
||||||
|
Loading…
Reference in New Issue
Block a user