From 2a23535239d7cda5781b1ee23e616b5afb4b24e2 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 24 Dec 2015 22:59:37 -0200 Subject: [PATCH] Sorry, no future block expression for the event (wait 1 tick inside... ...your script) --- src/me/TheBukor/SkStuff/SkStuff.java | 14 -------------- .../SkStuff/events/EvtWorldEditChange.java | 8 +------- .../TheBukor/SkStuff/events/WorldEditExtent.java | 10 +--------- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/me/TheBukor/SkStuff/SkStuff.java b/src/me/TheBukor/SkStuff/SkStuff.java index a8a4863..327c0a7 100644 --- a/src/me/TheBukor/SkStuff/SkStuff.java +++ b/src/me/TheBukor/SkStuff/SkStuff.java @@ -437,13 +437,6 @@ public class SkStuff extends JavaPlugin { return EvtWorldEditChange.getPlayer(); } }, 0); - EventValues.registerEventValue(EvtWorldEditChange.class, Block.class, new Getter() { - @Override - @Nullable - public Block get(EvtWorldEditChange e) { - return EvtWorldEditChange.getBlock(); - } - }, -1); EventValues.registerEventValue(EvtWorldEditChange.class, Block.class, new Getter() { @Override @Nullable @@ -451,13 +444,6 @@ public class SkStuff extends JavaPlugin { return EvtWorldEditChange.getBlock(); } }, 0); - EventValues.registerEventValue(EvtWorldEditChange.class, Block.class, new Getter() { - @Override - @Nullable - public Block get(EvtWorldEditChange e) { - return EvtWorldEditChange.getFutureBlock(); - } - }, 1); evtWE = true; } catch (ClassNotFoundException ex) { Skript.error("Unable to register \"On WorldEdit block change\" event! You will need to upgrade to WorldEdit 6.0"); diff --git a/src/me/TheBukor/SkStuff/events/EvtWorldEditChange.java b/src/me/TheBukor/SkStuff/events/EvtWorldEditChange.java index 75d21cc..02f04e7 100644 --- a/src/me/TheBukor/SkStuff/events/EvtWorldEditChange.java +++ b/src/me/TheBukor/SkStuff/events/EvtWorldEditChange.java @@ -8,12 +8,10 @@ import org.bukkit.event.HandlerList; public class EvtWorldEditChange extends Event { static Player player; static Block block; - static Block futureBlock; - public EvtWorldEditChange(Player player, Block block, Block futureBlock) { + public EvtWorldEditChange(Player player, Block block) { EvtWorldEditChange.player = player; EvtWorldEditChange.block = block; - EvtWorldEditChange.futureBlock = futureBlock; } public static Player getPlayer() { @@ -23,10 +21,6 @@ public class EvtWorldEditChange extends Event { public static Block getBlock() { return block; } - - public static Block getFutureBlock() { - return futureBlock; - } private static final HandlerList handlers = new HandlerList(); diff --git a/src/me/TheBukor/SkStuff/events/WorldEditExtent.java b/src/me/TheBukor/SkStuff/events/WorldEditExtent.java index 5f6208d..78bee02 100644 --- a/src/me/TheBukor/SkStuff/events/WorldEditExtent.java +++ b/src/me/TheBukor/SkStuff/events/WorldEditExtent.java @@ -13,8 +13,6 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent; -import me.TheBukor.SkStuff.SkStuff; - public class WorldEditExtent extends AbstractLoggingExtent { private final Actor actor; @@ -30,12 +28,6 @@ public class WorldEditExtent extends AbstractLoggingExtent { protected void onBlockChange(final Vector vec, BaseBlock baseBlock) { final Block b = BukkitUtil.toLocation(world, vec).getBlock(); final Player p = Bukkit.getPlayerExact(actor.getName()); - Bukkit.getScheduler().scheduleSyncDelayedTask(new SkStuff(), new Runnable() { //Wait 1 tick to get the future block - @Override - public void run() { - Block futureB = BukkitUtil.toLocation(world, vec).getBlock(); - Bukkit.getPluginManager().callEvent(new EvtWorldEditChange(p, b, futureB)); - } - }, 1L); + Bukkit.getPluginManager().callEvent(new EvtWorldEditChange(p, b)); } } \ No newline at end of file