public void createTimedHologram(final Location location, String text, Long timeout) { ArmorStand as = (ArmorStand) location.add(0.5, 1, 0.5).getWorld().spawnEntity(location, EntityType.ARMOR_STAND); //Spawn the ArmorStand as.setVisible(false); //Makes the ArmorStand invisible as.setGravity(false); //Make sure it doesn't fall as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it as.setCustomName(SavageFactions.plugin.color(text)); //Set this to the text you want as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not final ArmorStand armorStand = as; Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> { armorStand.remove(); getLogger().info("Removing Hologram."); } , timeout * 20); }
@SuppressWarnings("deprecation") @Override public void run() { if (arrow.isDead() || !arrow.isValid()) { cancel(); return; } if (arrow.isInBlock() || arrow.isOnGround()) { translocatorPlayerMap.invalidate(arrow.getUniqueId()); playerTranslocatorMap.invalidate(player.getUniqueId()); Location location = arrow.getLocation(); arrow.remove(); ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class); armorStand.setCanPickupItems(false); armorStand.setSmall(true); armorStand.setMarker(false); armorStand.setPersistent(false); armorStand.setCustomName(I18n.format("message.translocator", player.getName())); armorStand.setCustomNameVisible(true); playerTranslocatorMap.put(player.getUniqueId(), armorStand.getUniqueId()); translocatorPlayerMap.put(armorStand.getUniqueId(), player.getUniqueId()); cancel(); } } }.runTaskTimer(plugin, 0L, 5L);
asL.setCanPickupItems(false); asL.setMarker(true); asL.setPersistent(false); asR.setCanPickupItems(false); asR.setMarker(true); asR.setPersistent(false); asB.setCanPickupItems(false); asB.setMarker(true); asB.setPersistent(false);
as.setVisible(false); //Makes the ArmorStand invisible as.setGravity(false); //Make sure it doesn't fall as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it as.setCustomName(SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fbanners.BannerHolo").replace("{Faction}", fme.getTag()))); //Set this to the text you want as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not