public CraftVisibilityManager(CraftHologram hologram) { Validator.notNull(hologram, "hologram"); this.hologram = hologram; this.visibleByDefault = true; }
public PluginHologram(Location source, Plugin plugin) { super(source); Validator.notNull(plugin, "plugin"); this.plugin = plugin; }
protected CraftHologramLine(double height, CraftHologram parent) { Validator.notNull(parent, "parent hologram"); this.height = height; this.parent = parent; }
@Deprecated public static FloatingItem[] getFloatingItems(Plugin plugin) { Validator.notNull(plugin, "plugin cannot be null"); return new FloatingItem[0]; }
public Collection<Hologram> getHolograms(Plugin plugin) { Validator.notNull(plugin, "plugin"); return PluginHologramManager.getHolograms(plugin); }
public void spawn(World world, double x, double y, double z) { Validator.notNull(world, "world"); // Remove the old entities when spawning the new ones. despawn(); isSpawned = true; // Do nothing, there are no entities in this class. }
public Collection<String> getRegisteredPlaceholders(Plugin plugin) { Validator.notNull(plugin, "plugin"); return PlaceholdersRegister.getTextPlaceholdersByPlugin(plugin); }
@Override public boolean isVisibleTo(Player player) { Validator.notNull(player, "player"); if (playersVisibilityMap != null) { Boolean value = playersVisibilityMap.get(player.getName().toLowerCase()); if (value != null) { return value; } } return visibleByDefault; }
public boolean registerPlaceholder(Plugin plugin, String textPlaceholder, double refreshRate, PlaceholderReplacer replacer) { Validator.notNull(textPlaceholder, "textPlaceholder"); Validator.isTrue(refreshRate >= 0, "refreshRate should be positive"); Validator.notNull(replacer, "replacer"); return PlaceholdersRegister.register(new Placeholder(plugin, textPlaceholder, refreshRate, replacer)); }
public Hologram createHologram(Plugin plugin, Location source) { Validator.notNull(plugin, "plugin"); Validator.notNull(source, "source"); Validator.notNull(source.getWorld(), "source's world"); Validator.isTrue(Bukkit.isPrimaryThread(), "Async hologram creation"); PluginHologram hologram = new PluginHologram(source, plugin); PluginHologramManager.addHologram(hologram); return hologram; }
@Deprecated public static Hologram[] getHolograms(Plugin plugin) { Validator.notNull(plugin, "plugin cannot be null"); List<Hologram> pluginHolograms = Utils.newList(); for (PluginHologram pluginHologram : PluginHologramManager.getHolograms()) { if (pluginHologram.getOwner().equals(plugin)) { pluginHolograms.add(pluginHologram); } } return pluginHolograms.toArray(new Hologram[0]); }
private void updateLocation(World world, double x, double y, double z) { Validator.notNull(world, "world"); this.world = world; this.x = x; this.y = y; this.z = z; chunkX = Utils.floor(x) >> 4; chunkZ = Utils.floor(z) >> 4; }
public void unregisterPlaceholders(Plugin plugin) { Validator.notNull(plugin, "plugin"); for (String placeholder : getRegisteredPlaceholders(plugin)) { unregisterPlaceholder(plugin, placeholder); } }
@Override public CraftItemLine appendItemLine(ItemStack itemStack) { Validator.isTrue(!deleted, "hologram already deleted"); Validator.notNull(itemStack, "itemStack"); CraftItemLine line = new CraftItemLine(this, itemStack); lines.add(line); refreshSingleLines(); return line; }
@Override public CraftItemLine insertItemLine(int index, ItemStack itemStack) { Validator.isTrue(!deleted, "hologram already deleted"); Validator.notNull(itemStack, "itemStack"); CraftItemLine line = new CraftItemLine(this, itemStack); lines.add(index, line); refreshSingleLines(); return line; }
public DynamicLineData(NMSNameable entity, String originalName) { Validator.notNull(entity, "entity"); this.entity = entity; this.originalName = originalName; placeholders = Utils.newSet(); animations = Utils.newMap(); replacers = Utils.newMap(); }
@Deprecated public static FloatingItem createFloatingItem(Plugin plugin, Location source, ItemStack itemstack) { Validator.notNull(itemstack, "itemstack"); Validator.isTrue(itemstack.getType() != Material.AIR, "itemstack cannot be AIR"); CraftHologram hologram = (CraftHologram) BackendAPI.getImplementation().createHologram(plugin, source); hologram.appendItemLine(itemstack); return new FakeFloatingItem(hologram, itemstack); }
@Override public void teleport(Location location) { Validator.notNull(location, "location"); teleport(location.getWorld(), location.getX(), location.getY(), location.getZ()); }
public CraftHologram(Location location) { Validator.notNull(location, "location"); updateLocation(location.getWorld(), location.getX(), location.getY(), location.getZ()); lines = Utils.newList(); allowPlaceholders = false; creationTimestamp = System.currentTimeMillis(); visibilityManager = new CraftVisibilityManager(this); }