From 379189f2249e304a4b3f7a776572f8d9f89bf25c Mon Sep 17 00:00:00 2001 From: zml2008 Date: Sat, 26 May 2012 11:34:26 -0700 Subject: [PATCH] Update for SpoutAPI scheduler and lighting changes --- .../java/com/sk89q/worldedit/spout/SpoutServerInterface.java | 3 ++- src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java | 2 +- src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java | 3 ++- src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java b/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java index d5233ab2d..b865ada52 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java @@ -31,6 +31,7 @@ import org.spout.api.Engine; import org.spout.api.geo.World; import org.spout.api.material.Material; import org.spout.api.material.MaterialRegistry; +import org.spout.api.scheduler.TaskPriority; import java.lang.reflect.Method; import java.util.ArrayList; @@ -74,7 +75,7 @@ public class SpoutServerInterface extends ServerInterface { @Override public int schedule(long delay, long period, Runnable task) { - return game.getScheduler().scheduleSyncRepeatingTask(plugin, task, delay, period); + return game.getScheduler().scheduleSyncRepeatingTask(plugin, task, delay * 50, period * 50, TaskPriority.NORMAL); } @Override diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java index 26dc842fc..9b81d9bab 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java @@ -192,7 +192,7 @@ public class SpoutWorld extends LocalWorld { */ @Override public int getBlockLightLevel(Vector pt) { - return world.getBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel(); + return world.getBlockLight(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); } /** diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java b/src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java index 8b0134392..ce78441eb 100644 --- a/src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java +++ b/src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java @@ -39,6 +39,7 @@ import org.spout.api.event.server.PreCommandEvent; import org.spout.api.event.world.WorldLoadEvent; import org.spout.api.generator.biome.BiomeGenerator; import org.spout.api.geo.discrete.Point; +import org.spout.api.scheduler.TaskPriority; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -140,7 +141,7 @@ public class WorldEditListener implements Listener { public void run() { ignoreLeftClickAir = false; } - }, 2); + }, 100, TaskPriority.NORMAL); if (taskId != -1) { ignoreLeftClickAir = true; diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java b/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java index 24fa2b755..64d8a1894 100644 --- a/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java +++ b/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java @@ -36,6 +36,7 @@ import org.spout.api.command.CommandSource; import org.spout.api.geo.World; import org.spout.api.player.Player; import org.spout.api.plugin.CommonPlugin; +import org.spout.api.scheduler.TaskPriority; import org.spout.api.util.Named; import java.io.*; @@ -100,7 +101,7 @@ public class WorldEditPlugin extends CommonPlugin implements Named { registerEvents(); getGame().getScheduler().scheduleAsyncRepeatingTask(this, - new SessionTimer(controller, getGame()), 120, 120); + new SessionTimer(controller, getGame()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST); } /**