Now calling the respective events when a user is removed from a plot.

And switched the event calling of adding Helpers and Trusted players. (Correct me if that was wrong)
This commit is contained in:
Alex 2016-08-08 22:45:08 +02:00
parent d22f7b8781
commit 37e4a652dd
3 changed files with 18 additions and 28 deletions

View File

@ -1,30 +1,9 @@
package com.plotsquared.bukkit.util;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.Rating;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.EventUtil;
import com.plotsquared.bukkit.events.ClusterFlagRemoveEvent;
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.events.*;
import com.plotsquared.bukkit.object.BukkitPlayer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -110,12 +89,12 @@ public class BukkitEventUtil extends EventUtil {
@Override
public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added));
}
@Override
public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added));
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
}
@Override

View File

@ -5,6 +5,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.UUIDHandler;
@ -71,20 +72,30 @@ public class Remove extends SubCommand {
if (!uuids.isEmpty()) {
for (UUID uuid : uuids) {
if (uuid == DBFunc.everyone) {
if (plot.removeTrusted(uuid) | plot.removeMember(uuid) | plot.removeDenied(uuid)) {
if (plot.removeTrusted(uuid)){
EventUtil.manager.callTrusted(player, plot, uuid, false);
count++;
}else if (plot.removeMember(uuid)) {
EventUtil.manager.callMember(player, plot, uuid, false);
count++;
}else if (plot.removeDenied(uuid)) {
EventUtil.manager.callDenied(player, plot, uuid, false);
count++;
}
}
else if (plot.getTrusted().contains(uuid)) {
if (plot.removeTrusted(uuid)) {
EventUtil.manager.callTrusted(player, plot, uuid, false);
count++;
}
} else if (plot.getMembers().contains(uuid)) {
if (plot.removeMember(uuid)) {
EventUtil.manager.callMember(player, plot, uuid, false);
count++;
}
} else if (plot.getDenied().contains(uuid)) {
if (plot.removeDenied(uuid)) {
EventUtil.manager.callDenied(player, plot, uuid, false);
count++;
}
}

View File

@ -106,12 +106,12 @@ public class SpongeEventUtil extends EventUtil {
@Override
public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotHelperEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
callEvent(new PlayerPlotTrustedEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
}
@Override
public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotTrustedEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
callEvent(new PlayerPlotHelperEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
}
@Override