From 896609d046472b08876950a9b1f0cd3248c01392 Mon Sep 17 00:00:00 2001 From: filoghost Date: Tue, 30 Dec 2014 10:40:14 +0100 Subject: [PATCH] Give a name to the startup task (for timings). --- .../holographicdisplays/HolographicDisplays.java | 13 +++---------- .../task/StartupLoadHologramsTask.java | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/StartupLoadHologramsTask.java diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java index 0769f7a8..45bac637 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java @@ -4,7 +4,6 @@ import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitRunnable; import com.gmail.filoghost.holographicdisplays.SimpleUpdater.ResponseHandler; import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.BungeeServerTracker; @@ -24,6 +23,7 @@ import com.gmail.filoghost.holographicdisplays.object.NamedHologramManager; import com.gmail.filoghost.holographicdisplays.placeholder.AnimationsRegister; import com.gmail.filoghost.holographicdisplays.placeholder.PlaceholdersManager; import com.gmail.filoghost.holographicdisplays.task.BungeeCleanupTask; +import com.gmail.filoghost.holographicdisplays.task.StartupLoadHologramsTask; import com.gmail.filoghost.holographicdisplays.task.WorldPlayerCounterTask; import com.gmail.filoghost.holographicdisplays.util.VersionUtils; @@ -70,7 +70,7 @@ public class HolographicDisplays extends JavaPlugin { HolographicDisplays.newVersion = newVersion; getLogger().info("Found a new version available: " + newVersion); getLogger().info("Download it on Bukkit Dev:"); - getLogger().info("dev.bukkit.org/bukkit-plugins/holographic-displays"); + getLogger().info("dev.bukkit.org/bukkit-plugins/holographic-displays"); } }); } @@ -203,14 +203,7 @@ public class HolographicDisplays extends JavaPlugin { } catch (Exception ignore) { } // The entities are loaded when the server is ready. - new BukkitRunnable() { - @Override - public void run() { - for (NamedHologram hologram : NamedHologramManager.getHolograms()) { - hologram.refreshAll(); - } - } - }.runTaskLater(this, 10L); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new StartupLoadHologramsTask(), 10L); } diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/StartupLoadHologramsTask.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/StartupLoadHologramsTask.java new file mode 100644 index 00000000..bde84a5b --- /dev/null +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/StartupLoadHologramsTask.java @@ -0,0 +1,15 @@ +package com.gmail.filoghost.holographicdisplays.task; + +import com.gmail.filoghost.holographicdisplays.object.NamedHologram; +import com.gmail.filoghost.holographicdisplays.object.NamedHologramManager; + +public class StartupLoadHologramsTask implements Runnable { + + @Override + public void run() { + for (NamedHologram hologram : NamedHologramManager.getHolograms()) { + hologram.refreshAll(); + } + } + +}