Search in sources :

Example 1 with TextLine

use of com.gmail.filoghost.holographicdisplays.api.line.TextLine 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 2 with TextLine

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

the class HolographicDisplaysWrapper method createHologram.

@Override
public de.erethon.holographicmenus.hologram.Hologram createHologram(Location location, String label, Collection<Player> viewers) {
    Hologram hdHolo = createHologram(viewers, location);
    de.erethon.holographicmenus.hologram.Hologram hmHolo = new de.erethon.holographicmenus.hologram.Hologram(plugin, location, hdHolo);
    TextLine line = hdHolo.appendTextLine(label);
    line.setTouchHandler(p -> hmHolo.click(plugin.getHPlayerCache().getByPlayer(p)));
    return hmHolo;
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) TextLine(com.gmail.filoghost.holographicdisplays.api.line.TextLine)

Example 3 with TextLine

use of com.gmail.filoghost.holographicdisplays.api.line.TextLine in project HubParkour by Block2Block.

the class Parkour method generateHolograms.

@SuppressWarnings("unused")
public void generateHolograms() {
    for (PressurePlate p : getAllPoints()) {
        List<String> defaultValues = new ArrayList<>();
        String configKey = "";
        switch(p.getType()) {
            case 0:
                if (!ConfigUtil.getBoolean("Settings.Holograms.Start", true)) {
                    continue;
                }
                configKey = "Start";
                defaultValues.add("&9&l&n{parkour-name}");
                defaultValues.add("&9&lParkour Start");
                break;
            case 1:
                if (!ConfigUtil.getBoolean("Settings.Holograms.End", true)) {
                    continue;
                }
                configKey = "End";
                defaultValues.add("&9&l&n{parkour-name}");
                defaultValues.add("&9&lParkour End");
                break;
            case 2:
                continue;
            case 3:
                if (!ConfigUtil.getBoolean("Settings.Holograms.Checkpoint", true)) {
                    continue;
                }
                configKey = "Checkpoint";
                defaultValues.add("&9&l&n{parkour-name}");
                defaultValues.add("&9&lCheckpoint #{checkpoint}");
                break;
            default:
        }
        Location l = p.getLocation().clone();
        l.setX(l.getX() + 0.5);
        l.setZ(l.getZ() + 0.5);
        l.setY(l.getY() + 2);
        if (l.getWorld() == null) {
            continue;
        }
        Hologram hologram = HologramsAPI.createHologram(HubParkour.getInstance(), l);
        int counter = 0;
        for (String s : ConfigUtil.getStringList("Messages.Holograms." + configKey, defaultValues)) {
            s = ChatColor.translateAlternateColorCodes('&', s.replace("{parkour-name}", name).replace("{checkpoint}", ((p instanceof Checkpoint) ? ((Checkpoint) p).getCheckpointNo() + "" : "")));
            if (HubParkour.isPlaceholders()) {
                s = PlaceholderAPI.setPlaceholders(null, s);
            }
            TextLine textLine = hologram.appendTextLine(s);
            counter++;
        }
        holograms.put(p, hologram);
    }
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) ILeaderboardHologram(me.block2block.hubparkour.api.ILeaderboardHologram) TextLine(com.gmail.filoghost.holographicdisplays.api.line.TextLine) ArrayList(java.util.ArrayList) Location(org.bukkit.Location)

Aggregations

Hologram (com.gmail.filoghost.holographicdisplays.api.Hologram)3 TextLine (com.gmail.filoghost.holographicdisplays.api.line.TextLine)3 ArrayList (java.util.ArrayList)1 ILeaderboardHologram (me.block2block.hubparkour.api.ILeaderboardHologram)1 Location (org.bukkit.Location)1