diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java b/Plugin/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java index 43192677..eceeb887 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java +++ b/Plugin/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java @@ -15,8 +15,12 @@ package com.gmail.filoghost.holograms.api; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -39,17 +43,28 @@ import com.gmail.filoghost.holographicdisplays.util.Validator; @Deprecated public class HolographicDisplaysAPI { + private static Set notifiedPlugins = new HashSet(); + + private static void notifyOldAPI(Plugin plugin) { + if (notifiedPlugins.add(plugin.getName())) { + Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[Holographic Displays] The plugin \"" + plugin.getName() + "\" is still using the old API of Holographic Displays. " + + "Please notify the author and ask them to update it, the old API will be removed soon."); + } + } + @Deprecated - public static Hologram createHologram(Plugin plugin, Location source, String... lines) { + public static Hologram createHologram(Plugin plugin, Location source, String... lines) { + notifyOldAPI(plugin); CraftHologram hologram = (CraftHologram) BackendAPI.getImplementation().createHologram(plugin, source); for (String line : lines) { hologram.appendTextLine(line); } return hologram; } - + @Deprecated public static FloatingItem createFloatingItem(Plugin plugin, Location source, ItemStack itemstack) { + notifyOldAPI(plugin); Validator.notNull(itemstack, "itemstack"); Validator.isTrue(itemstack.getType() != Material.AIR, "itemstack cannot be AIR"); @@ -60,6 +75,7 @@ public class HolographicDisplaysAPI { @Deprecated public static Hologram createIndividualHologram(Plugin plugin, Location source, Player whoCanSee, String... lines) { + notifyOldAPI(plugin); List whoCanSeeList = new ArrayList(); whoCanSeeList.add(whoCanSee); return createIndividualHologram(plugin, source, whoCanSeeList, lines); @@ -67,7 +83,7 @@ public class HolographicDisplaysAPI { @Deprecated public static Hologram createIndividualHologram(Plugin plugin, Location source, List whoCanSee, String... lines) { - + notifyOldAPI(plugin); Validator.notNull(plugin, "plugin"); Validator.notNull(source, "source"); Validator.notNull(source.getWorld(), "source's world"); @@ -90,6 +106,7 @@ public class HolographicDisplaysAPI { @Deprecated public static FloatingItem createIndividualFloatingItem(Plugin plugin, Location source, Player whoCanSee, ItemStack itemstack) { + notifyOldAPI(plugin); List whoCanSeeList = new ArrayList(); whoCanSeeList.add(whoCanSee); return createIndividualFloatingItem(plugin, source, whoCanSeeList, itemstack); @@ -97,7 +114,7 @@ public class HolographicDisplaysAPI { @Deprecated public static FloatingItem createIndividualFloatingItem(Plugin plugin, Location source, List whoCanSee, ItemStack itemstack) { - + notifyOldAPI(plugin); Validator.notNull(plugin, "plugin cannot be null"); Validator.notNull(source, "source cannot be null"); Validator.notNull(source.getWorld(), "source's world cannot be null"); @@ -119,6 +136,7 @@ public class HolographicDisplaysAPI { @Deprecated public static Hologram[] getHolograms(Plugin plugin) { + notifyOldAPI(plugin); Validator.notNull(plugin, "plugin cannot be null"); List pluginHolograms = Utils.newList(); @@ -133,6 +151,7 @@ public class HolographicDisplaysAPI { @Deprecated public static FloatingItem[] getFloatingItems(Plugin plugin) { + notifyOldAPI(plugin); Validator.notNull(plugin, "plugin cannot be null"); return new FloatingItem[0]; }