Search in sources :

Example 26 with Hologram

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

the class ApiImplementation method loadHologram.

@Override
public void loadHologram(int npcId) {
    if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays")) {
        return;
    }
    NPC citizensNpc = CitizensAPI.getNPCRegistry().getById(npcId);
    if (citizensNpc == null) {
        return;
    }
    Dialogue dialogue = getNPCDialogue(npcId);
    if (dialogue == null) {
        return;
    }
    DialogHologram hologram = dialogue.getHologram();
    if (hologram != null && hologram.isEnabled()) {
        Location location = citizensNpc.getStoredLocation();
        location.add(0, 2 + hologram.getY(), 0);
        Hologram holo = HologramsAPI.createHologram(main, location);
        String npcName = dialogue.getDisplayName();
        List<String> lines = hologram.getLines();
        for (String line : lines) {
            holo.appendTextLine(ChatColor.translateAlternateColorCodes('&', line.replace("%npc_name%", npcName)));
        }
        citizensNpc.setAlwaysUseNameHologram(false);
    }
}
Also used : NPC(net.citizensnpcs.api.npc.NPC) Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) DialogHologram(me.iatog.characterdialogue.api.dialog.DialogHologram) Dialogue(me.iatog.characterdialogue.api.dialog.Dialogue) DialogHologram(me.iatog.characterdialogue.api.dialog.DialogHologram) Location(org.bukkit.Location)

Example 27 with Hologram

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

the class GlobalHologram method deSpawn.

/**
 * DeSpawn the hologram for all players on the server
 * This method will only deSpawn the hologram but not delete,
 * so after a restart it will be back to its original location
 */
public void deSpawn() {
    Hologram hologram = meta.getHologram();
    hologram.clearLines();
    hologram.delete();
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) PracticeHologram(net.frozenorb.potpvp.hologram.PracticeHologram)

Example 28 with Hologram

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

the class KitHologram method spawn.

/**
 * Spawn the hologram for all players on the server
 * at the given location in the constructor
 */
public void spawn() {
    Preconditions.checkNotNull(this.meta, "Hologram Meta can not be null!");
    BasicConfigurationFile config = plugin.getHologramsConfig();
    Hologram apiHologram = HologramsAPI.createHologram(plugin, meta.getLocation());
    apiHologram.clearLines();
    apiHologram.getVisibilityManager().setVisibleByDefault(true);
    if (!apiHologram.getLocation().getChunk().isLoaded()) {
        apiHologram.getLocation().getChunk().load();
    }
    for (String line : config.getStringList("SETTINGS.KIT.LINES")) {
        if (line.contains("<top>")) {
            int position = 1;
            for (Map.Entry<String, Integer> entry : plugin.getEloHandler().topElo(kit).entrySet()) {
                apiHologram.appendTextLine(config.getString("SETTINGS.KIT.FORMAT").replace("<number>", String.valueOf(position)).replace("<value>", String.valueOf(entry.getValue())).replace("<name>", entry.getKey()));
                position++;
            }
            continue;
        }
        String replace = line.replace("<kit>", kit.getDisplayName()).replace("<update>", String.valueOf(updateIn));
        apiHologram.appendTextLine(replace);
    }
    meta.setHologram(apiHologram);
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) PracticeHologram(net.frozenorb.potpvp.hologram.PracticeHologram) BasicConfigurationFile(net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile) Map(java.util.Map)

Example 29 with Hologram

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

the class KitHologram method deSpawn.

/**
 * DeSpawn the hologram for all players on the server
 * This method will only deSpawn the hologram but not delete,
 * so after a restart it will be back to its original location
 */
public void deSpawn() {
    Hologram hologram = meta.getHologram();
    hologram.clearLines();
    hologram.delete();
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) PracticeHologram(net.frozenorb.potpvp.hologram.PracticeHologram)

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