Move event calling to Plot class

This commit is contained in:
manuelgu 2016-05-28 01:09:13 +02:00
parent ceb8fb9fa3
commit ec4839ec3f
3 changed files with 6 additions and 12 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

@ -7,7 +7,6 @@ import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetQueue;
import java.util.ArrayList;
@ -22,35 +21,27 @@ public class ClassicPlotManager extends SquarePlotManager {
switch (component) {
case "floor":
setFloor(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
case "wall":
setWallFilling(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
case "all":
setAll(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
case "air":
setAir(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
case "main":
setMain(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
case "middle":
setMiddle(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
case "outline":
setOutline(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
case "border":
setWall(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true;
}
return false;

View File

@ -18,12 +18,12 @@ 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.*;
import java.awt.geom.Area;
import java.awt.geom.PathIterator;
import java.io.File;
@ -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);
}