Search in sources :

Example 1 with Hologram

use of com.gmail.filoghost.holographicdisplays.api.Hologram in project HolographicMenus by DRE2N.

the class HolographicDisplaysWrapper method createHologram.

public Hologram createHologram(Collection<Player> viewers, Location location) {
    Hologram hologram = HologramsAPI.createHologram(plugin, location);
    if (viewers != null) {
        hologram.getVisibilityManager().setVisibleByDefault(false);
        viewers.forEach(hologram.getVisibilityManager()::showTo);
    }
    return hologram;
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram)

Example 2 with Hologram

use of com.gmail.filoghost.holographicdisplays.api.Hologram in project Crazy-Crates by Crazy-Crew.

the class HolographicSupport method removeHologram.

public void removeHologram(Block block) {
    if (!holograms.containsKey(block))
        return;
    Hologram hologram = holograms.get(block);
    holograms.remove(block);
    hologram.delete();
}
Also used : CrateHologram(com.badbones69.crazycrates.api.objects.CrateHologram) Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram)

Example 3 with Hologram

use of com.gmail.filoghost.holographicdisplays.api.Hologram in project BetonQuest by BetonQuest.

the class HologramLoop method cancel.

/**
 * Cancels hologram updating loop and removes all BetonQuest-registered holograms.
 */
public void cancel() {
    if (runnable != null) {
        runnable.cancel();
        for (final Hologram hologram : holograms.keySet()) {
            hologram.getVisibilityManager().resetVisibilityAll();
            hologram.delete();
        }
    }
    for (final Entry<Hologram, BukkitRunnable> h : runnables.entrySet()) {
        h.getValue().cancel();
        h.getKey().delete();
    }
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable)

Example 4 with Hologram

use of com.gmail.filoghost.holographicdisplays.api.Hologram in project RoseStacker by Rosewood-Development.

the class HolographicDisplaysHologramHandler method createOrUpdateHologram.

@Override
public void createOrUpdateHologram(Location location, String text) {
    Hologram hologram = this.holograms.get(location);
    if (hologram == null) {
        hologram = HologramsAPI.createHologram(RoseStacker.getInstance(), location.clone().add(0, 1, 0));
        hologram.appendTextLine(text);
        this.holograms.put(location, hologram);
    } else {
        ((TextLine) hologram.getLine(0)).setText(text);
    }
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) TextLine(com.gmail.filoghost.holographicdisplays.api.line.TextLine)

Example 5 with Hologram

use of com.gmail.filoghost.holographicdisplays.api.Hologram in project NextEconomy by NextPlugins.

the class NextEconomyCommand method onRankingDebug.

@Command(name = "nexteconomy.rankingdebug", permission = "nexteconomy.admin", async = true)
public void onRankingDebug(Context<CommandSender> context) {
    val pluginManager = Bukkit.getPluginManager();
    if (!pluginManager.isPluginEnabled("HolographicDisplays")) {
        context.sendMessage(ColorUtil.colored("&cO plugin HolographicDisplays precisa estar ativo para usar esta função."));
        return;
    }
    val citizensEnabled = pluginManager.isPluginEnabled("Citizens");
    for (val world : Bukkit.getWorlds()) {
        for (val entity : world.getEntities()) {
            if (!entity.hasMetadata("nexteconomy"))
                continue;
            if (citizensEnabled) {
                val npc = CitizensAPI.getNPCRegistry().getNPC(entity);
                if (npc != null) {
                    CitizensAPI.getNPCRegistry().deregister(npc);
                    continue;
                }
            }
            entity.remove();
        }
    }
    HologramsAPI.getHolograms(NextEconomy.getInstance()).forEach(Hologram::delete);
    if (citizensEnabled) {
        try {
            for (val npc : CitizensAPI.getNPCRegistry()) {
                if (!npc.data().has("nexteconomy"))
                    continue;
                npc.despawn();
                npc.destroy();
            }
        } catch (Exception exception) {
            for (val id : NPCRunnable.NPCS) {
                val npc = CitizensAPI.getNPCRegistry().getById(id);
                if (npc == null)
                    continue;
                CitizensAPI.getNPCRegistry().deregister(npc);
            }
        }
        NPCRunnable.NPCS.clear();
    }
    context.sendMessage(ColorUtil.colored("&aTodos os NPCs, ArmorStands e Hologramas foram limpos com sucesso."));
}
Also used : lombok.val(lombok.val) Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) Command(me.saiintbrisson.minecraft.command.annotation.Command)

Aggregations

Hologram (com.gmail.filoghost.holographicdisplays.api.Hologram)29 ArrayList (java.util.ArrayList)8 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)7 Player (org.bukkit.entity.Player)6 List (java.util.List)4 PracticeHologram (net.frozenorb.potpvp.hologram.PracticeHologram)4 TextLine (com.gmail.filoghost.holographicdisplays.api.line.TextLine)3 Location (org.bukkit.Location)3 CrateHologram (com.badbones69.crazycrates.api.objects.CrateHologram)2 ItemLine (com.gmail.filoghost.holographicdisplays.api.line.ItemLine)2 Map (java.util.Map)2 lombok.val (lombok.val)2 DialogHologram (me.iatog.characterdialogue.api.dialog.DialogHologram)2 NPC (net.citizensnpcs.api.npc.NPC)2 BasicConfigurationFile (net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile)2 CMIHologram (com.Zrips.CMI.Modules.Holograms.CMIHologram)1 VisibilityManager (com.gmail.filoghost.holographicdisplays.api.VisibilityManager)1 HologramLine (com.gmail.filoghost.holographicdisplays.api.line.HologramLine)1 NMSEntityBase (com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase)1 MPlayer (com.massivecraft.factions.entity.MPlayer)1