From ec4839ec3fe598afb1f3c74e14d3c34ef512ea07 Mon Sep 17 00:00:00 2001 From: manuelgu Date: Sat, 28 May 2016 01:09:13 +0200 Subject: [PATCH] Move event calling to Plot class --- .../java/com/intellectualcrafters/plot/commands/Set.java | 2 +- .../plot/generator/ClassicPlotManager.java | 9 --------- .../java/com/intellectualcrafters/plot/object/Plot.java | 7 +++++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java index bed827fd0..a2d558f76 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -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() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java index 4fe810e5d..b98df658e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java @@ -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; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 50a2c8283..162333cea 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -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); }