From 6d4b4718dbc799ebdaa0f49341d278c28b2ab914 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Thu, 15 Dec 2011 11:49:44 +0100 Subject: [PATCH] Added ServerInterface.getWorlds. --- .../com/sk89q/worldedit/ServerInterface.java | 7 +++++++ .../worldedit/bukkit/BukkitServerInterface.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/ServerInterface.java b/src/main/java/com/sk89q/worldedit/ServerInterface.java index a497f676c..a0dfade76 100644 --- a/src/main/java/com/sk89q/worldedit/ServerInterface.java +++ b/src/main/java/com/sk89q/worldedit/ServerInterface.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit; +import java.util.Collections; +import java.util.List; + /** * * @author sk89q @@ -57,4 +60,8 @@ public abstract class ServerInterface { public int schedule(long delay, long period, Runnable task) { return -1; } + + public List getWorlds() { + return Collections.emptyList(); + } } diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java index 78664c682..ff1edf86f 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java @@ -19,8 +19,12 @@ package com.sk89q.worldedit.bukkit; +import java.util.ArrayList; +import java.util.List; + import org.bukkit.*; import org.bukkit.entity.CreatureType; +import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.ServerInterface; public class BukkitServerInterface extends ServerInterface { @@ -52,4 +56,16 @@ public class BukkitServerInterface extends ServerInterface { public int schedule(long delay, long period, Runnable task) { return Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, task, delay, period); } + + @Override + public List getWorlds() { + List worlds = server.getWorlds(); + List ret = new ArrayList(worlds.size()); + + for (World world : worlds) { + ret.add(BukkitUtil.getLocalWorld(world)); + } + + return ret; + } }