Merge pull request #1134 from manuelgu/feature/componentevent

[WIP] Implement PlotComponentSetEvent
This commit is contained in:
Jesse Boyd
2016-05-28 09:13:04 +10:00
10 changed files with 133 additions and 5 deletions

View File

@ -111,7 +111,7 @@ public class Set extends SubCommand {
}
plot.addRunning();
for (Plot current : plot.getConnectedPlots()) {
manager.setComponent(plotworld, current.getId(), component, blocks);
current.setComponent(component, blocks);
}
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
SetQueue.IMP.addTask(new Runnable() {

View File

@ -9,7 +9,6 @@ import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetQueue;
import java.util.ArrayList;
/**

View File

@ -18,11 +18,11 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SetQueue;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.listener.PlotListener;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.PathIterator;
@ -2600,6 +2600,9 @@ public class Plot {
* @return
*/
public boolean setComponent(String component, PlotBlock[] blocks) {
if (StringMan.isEqualToAny(component, getManager().getPlotComponents(this.area, this.getId()))) {
EventUtil.manager.callComponentSet(this, component);
}
return this.getManager().setComponent(this.area, this.getId(), component, blocks);
}

View File

@ -31,6 +31,8 @@ public abstract class EventUtil {
public abstract boolean callTeleport(PlotPlayer player, Location from, Plot plot);
public abstract boolean callComponentSet(Plot plot, String component);
public abstract boolean callClear(Plot plot);
public abstract void callDelete(Plot plot);

View File

@ -26,6 +26,8 @@ public class EventUtilTest extends EventUtil {
return false;
}
@Override public boolean callComponentSet(Plot plot, String component) { return false; }
@Override public boolean callClear(Plot plot) {
return false;
}
@ -61,4 +63,4 @@ public class EventUtilTest extends EventUtil {
@Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {}
@Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {}
}
}