Merge pull request #1301 from MisterErwin/master

Calling events when players are removed from plots & correct calling of Member & Trusted events
This commit is contained in:
Jesse Boyd 2016-08-26 02:02:40 +10:00 committed by GitHub
commit a801127036
3 changed files with 16 additions and 5 deletions

View File

@ -110,12 +110,12 @@ public class BukkitEventUtil extends EventUtil {
@Override @Override
public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { 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 @Override
public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { 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 @Override

View File

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

View File

@ -106,12 +106,12 @@ public class SpongeEventUtil extends EventUtil {
@Override @Override
public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { 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 @Override
public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { 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 @Override