--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/EternalDayCommand.java 2011/03/23 21:29:52 1242 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/EternalDayCommand.java 2011/09/20 06:24:39 1598 @@ -1,5 +1,7 @@ package dk.thoerup.bukkit.hoeruputils; +import java.util.List; + import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.World; @@ -8,6 +10,8 @@ import org.bukkit.command.CommandSender; import org.bukkit.plugin.Plugin; +import dk.thoerup.bukkit.hoeruputils.utils.MessageBroadcaster; + public class EternalDayCommand implements CommandExecutor { @@ -21,13 +25,12 @@ this.plugin = plugin; server = plugin.getServer(); - world = server.getWorlds().get(0); + world = server.getWorld("world"); } @Override public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { - - + if (taskId == -1) { taskId = server.getScheduler().scheduleSyncRepeatingTask(plugin, new EternalDayRunner(), 2*20, 60*20); server.broadcastMessage(ChatColor.YELLOW + "Eternal day is enabled - have a nice long day"); @@ -37,7 +40,6 @@ server.broadcastMessage(ChatColor.YELLOW + "Eternal day is disabled - watch out for zombies"); } - return true; } @@ -46,9 +48,12 @@ // 1000=1 hour, 0 is 06:00 so 12000 is 18:00 @Override public void run() { - if (world.getTime() > 12000) { + if (world.getTime() > 12000) { world.setTime(0); - } + String msg = ChatColor.YELLOW + "Eternalday has extended the period of light once again!"; + //server.getScheduler().scheduleSyncDelayedTask(plugin, new MessageBroadcaster(server, msg)); + Util.broadcastWorld(world, msg); + } } }