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(); plot.addRunning();
for (Plot current : plot.getConnectedPlots()) { for (Plot current : plot.getConnectedPlots()) {
manager.setComponent(plotworld, current.getId(), component, blocks); current.setComponent(component, blocks);
} }
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT); MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
SetQueue.IMP.addTask(new Runnable() { 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.PlotId;
import com.intellectualcrafters.plot.object.PseudoRandom; import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetQueue; import com.intellectualcrafters.plot.util.SetQueue;
import java.util.ArrayList; import java.util.ArrayList;
@ -22,35 +21,27 @@ public class ClassicPlotManager extends SquarePlotManager {
switch (component) { switch (component) {
case "floor": case "floor":
setFloor(plotworld, plotid, blocks); setFloor(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
case "wall": case "wall":
setWallFilling(plotworld, plotid, blocks); setWallFilling(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
case "all": case "all":
setAll(plotworld, plotid, blocks); setAll(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
case "air": case "air":
setAir(plotworld, plotid, blocks); setAir(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
case "main": case "main":
setMain(plotworld, plotid, blocks); setMain(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
case "middle": case "middle":
setMiddle(plotworld, plotid, blocks); setMiddle(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
case "outline": case "outline":
setOutline(plotworld, plotid, blocks); setOutline(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
case "border": case "border":
setWall(plotworld, plotid, blocks); setWall(plotworld, plotid, blocks);
EventUtil.manager.callComponentSet(plotworld.getPlot(plotid), component);
return true; return true;
} }
return false; 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.Permissions;
import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SetQueue; import com.intellectualcrafters.plot.util.SetQueue;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.awt.*;
import java.awt.Rectangle;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.PathIterator; import java.awt.geom.PathIterator;
import java.io.File; import java.io.File;
@ -2600,6 +2600,9 @@ public class Plot {
* @return * @return
*/ */
public boolean setComponent(String component, PlotBlock[] blocks) { 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); return this.getManager().setComponent(this.area, this.getId(), component, blocks);
} }