mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-08-26 23:19:47 +02:00
Fix SpongeEventUtil
This commit is contained in:
parent
660cd1b870
commit
302fe0c2c8
|
@ -1,5 +1,6 @@
|
||||||
package com.plotsquared.sponge.events;
|
package com.plotsquared.sponge.events;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import org.spongepowered.api.event.Cancellable;
|
import org.spongepowered.api.event.Cancellable;
|
||||||
import org.spongepowered.api.event.cause.Cause;
|
import org.spongepowered.api.event.cause.Cause;
|
||||||
import org.spongepowered.api.event.impl.AbstractEvent;
|
import org.spongepowered.api.event.impl.AbstractEvent;
|
||||||
|
@ -7,28 +8,27 @@ import org.spongepowered.api.event.impl.AbstractEvent;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
|
||||||
public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
||||||
private final PlotId id;
|
|
||||||
private final String world;
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
private Plot plot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotDeleteEvent: Called when a plot is cleared
|
* PlotDeleteEvent: Called when a plot is cleared
|
||||||
*
|
*
|
||||||
* @param world The world in which the plot was cleared
|
* @param plot The plot that was cleared
|
||||||
* @param id The plot that was cleared
|
|
||||||
*/
|
*/
|
||||||
public PlotClearEvent(final String world, final PlotId id) {
|
|
||||||
this.id = id;
|
public PlotClearEvent(Plot plot) {
|
||||||
this.world = world;
|
this.plot = plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PlotId
|
* Get the PlotId
|
||||||
*
|
*
|
||||||
* @return PlotId
|
* @return PlotId
|
||||||
*/
|
*/
|
||||||
public PlotId getPlotId() {
|
public PlotId getPlotId() {
|
||||||
return id;
|
return plot.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
return world;
|
return plot.getArea().worldname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
package com.plotsquared.sponge.events;
|
package com.plotsquared.sponge.events;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import org.spongepowered.api.event.cause.Cause;
|
import org.spongepowered.api.event.cause.Cause;
|
||||||
import org.spongepowered.api.event.impl.AbstractEvent;
|
import org.spongepowered.api.event.impl.AbstractEvent;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
|
||||||
public class PlotDeleteEvent extends AbstractEvent {
|
public class PlotDeleteEvent extends AbstractEvent {
|
||||||
private final PlotId id;
|
private final Plot plot;
|
||||||
private final String world;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotDeleteEvent: Called when a plot is deleted
|
* PlotDeleteEvent: Called when a plot is deleted
|
||||||
*
|
*
|
||||||
* @param world The world in which the plot was deleted
|
* @param plot The plot that was deleted
|
||||||
* @param id The ID of the plot that was deleted
|
|
||||||
*/
|
*/
|
||||||
public PlotDeleteEvent(final String world, final PlotId id) {
|
public PlotDeleteEvent(Plot plot) {
|
||||||
this.id = id;
|
this.plot = plot;
|
||||||
this.world = world;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +24,7 @@ public class PlotDeleteEvent extends AbstractEvent {
|
||||||
* @return PlotId
|
* @return PlotId
|
||||||
*/
|
*/
|
||||||
public PlotId getPlotId() {
|
public PlotId getPlotId() {
|
||||||
return id;
|
return plot.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +33,7 @@ public class PlotDeleteEvent extends AbstractEvent {
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
return world;
|
return plot.getArea().worldname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
package com.plotsquared.sponge.util;
|
package com.plotsquared.sponge.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.spongepowered.api.event.Event;
|
|
||||||
import org.spongepowered.api.event.EventManager;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
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.PlotArea;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
@ -30,6 +25,11 @@ import com.plotsquared.sponge.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.sponge.events.PlotMergeEvent;
|
import com.plotsquared.sponge.events.PlotMergeEvent;
|
||||||
import com.plotsquared.sponge.events.PlotRateEvent;
|
import com.plotsquared.sponge.events.PlotRateEvent;
|
||||||
import com.plotsquared.sponge.events.PlotUnlinkEvent;
|
import com.plotsquared.sponge.events.PlotUnlinkEvent;
|
||||||
|
import org.spongepowered.api.event.Event;
|
||||||
|
import org.spongepowered.api.event.EventManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SpongeEventUtil extends EventUtil {
|
public class SpongeEventUtil extends EventUtil {
|
||||||
|
|
||||||
|
@ -54,13 +54,13 @@ public class SpongeEventUtil extends EventUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callClear(final String world, final PlotId id) {
|
public boolean callClear(final Plot plot) {
|
||||||
return callEvent(new PlotClearEvent(world, id));
|
return callEvent(new PlotClearEvent(plot));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callDelete(final String world, final PlotId id) {
|
public void callDelete(Plot plot) {
|
||||||
callEvent(new PlotDeleteEvent(world, id));
|
callEvent(new PlotDeleteEvent(plot));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -74,13 +74,13 @@ public class SpongeEventUtil extends EventUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callMerge(final String world, final Plot plot, final ArrayList<PlotId> plots) {
|
public boolean callMerge(final Plot plot, final ArrayList<PlotId> plots) {
|
||||||
return callEvent(new PlotMergeEvent(SpongeUtil.getWorld(world), plot, plots));
|
return callEvent(new PlotMergeEvent(SpongeUtil.getWorld(plot.getArea().worldname), plot, plots));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callUnlink(final String world, final ArrayList<PlotId> plots) {
|
public boolean callUnlink(final PlotArea area, final ArrayList<PlotId> plots) {
|
||||||
return callEvent(new PlotUnlinkEvent(SpongeUtil.getWorld(world), plots));
|
return callEvent(new PlotUnlinkEvent(SpongeUtil.getWorld(area.worldname), plots));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user