diff --git a/src/main/java/com/songoda/skyblock/command/commands/admin/SetHologramCommand.java b/src/main/java/com/songoda/skyblock/command/commands/admin/SetHologramCommand.java index 6d066755..25739d7a 100644 --- a/src/main/java/com/songoda/skyblock/command/commands/admin/SetHologramCommand.java +++ b/src/main/java/com/songoda/skyblock/command/commands/admin/SetHologramCommand.java @@ -5,10 +5,10 @@ import com.songoda.skyblock.command.SubCommand; import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.hologram.Hologram; -import com.songoda.skyblock.tasks.HologramTask; import com.songoda.skyblock.hologram.HologramType; import com.songoda.skyblock.message.MessageManager; import com.songoda.skyblock.sound.SoundManager; +import com.songoda.skyblock.tasks.HologramTask; import org.apache.commons.lang.WordUtils; import org.bukkit.Bukkit; import org.bukkit.command.ConsoleCommandSender; @@ -49,16 +49,15 @@ public class SetHologramCommand extends SubCommand { fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), "Location.Hologram.Leaderboard." + hologramType.name(), player.getLocation(), true); - Bukkit.getServer().getScheduler().runTask(skyblock, () -> { - HologramType hologramType1 = HologramType - .valueOf(WordUtils.capitalize(args[0].toLowerCase())); - Hologram hologram = hologramManager.getHologram(hologramType1); + HologramType hologramType1 = HologramType + .valueOf(WordUtils.capitalize(args[0].toLowerCase())); + Hologram hologram = hologramManager.getHologram(hologramType1); - if (hologram != null) - hologram.remove(); + if (hologram != null) + hologram.remove(); - hologramManager.spawnHologram(hologramType1); - }); + Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> + hologramManager.spawnHologram(hologramType1)); messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.SetHologram.Set.Message").replace("%type", diff --git a/src/main/java/com/songoda/skyblock/hologram/Hologram.java b/src/main/java/com/songoda/skyblock/hologram/Hologram.java index 051b6ff7..090c060e 100644 --- a/src/main/java/com/songoda/skyblock/hologram/Hologram.java +++ b/src/main/java/com/songoda/skyblock/hologram/Hologram.java @@ -1,13 +1,10 @@ package com.songoda.skyblock.hologram; import com.songoda.core.hooks.HologramManager; -import com.songoda.skyblock.utils.version.NMSUtil; -import org.bukkit.ChatColor; +import com.songoda.skyblock.SkyBlock; +import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.EntityType; -import java.util.ArrayList; import java.util.List; public class Hologram { @@ -18,7 +15,9 @@ public class Hologram { public Hologram(HologramType type, Location location, List lines) { this.type = type; this.location = location; - HologramManager.createHologram(location, lines); + + Bukkit.getScheduler().runTask(SkyBlock.getInstance(), + () -> HologramManager.createHologram(location, lines)); } public HologramType getType() { @@ -32,10 +31,13 @@ public class Hologram { public void remove() { HologramManager.removeHologram(location); + Bukkit.getScheduler().runTask(SkyBlock.getInstance(), + () -> HologramManager.removeHologram(location)); } public void update(List lines) { - HologramManager.updateHologram(location, lines); + Bukkit.getScheduler().runTask(SkyBlock.getInstance(), + () -> HologramManager.updateHologram(location, lines)); } } diff --git a/src/main/java/com/songoda/skyblock/tasks/HologramTask.java b/src/main/java/com/songoda/skyblock/tasks/HologramTask.java index 9f0b85c8..d6472e18 100644 --- a/src/main/java/com/songoda/skyblock/tasks/HologramTask.java +++ b/src/main/java/com/songoda/skyblock/tasks/HologramTask.java @@ -38,7 +38,7 @@ public class HologramTask extends BukkitRunnable { plugin = plug; if (instance == null) { instance = new HologramTask(plugin); - instance.runTaskTimerAsynchronously(plugin, 0, 20 * 15); + instance.runTaskTimerAsynchronously(plugin, 0, 20 * 60); } return instance;