Search in sources :

Example 1 with ItemLine

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

the class HolographicDisplaysWrapper method createHologram.

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

Example 2 with ItemLine

use of com.gmail.filoghost.holographicdisplays.api.line.ItemLine in project Nexus by ProjectEdenGG.

the class PowerUpUtils method spawn.

public void spawn(Location location, boolean recurring) {
    PowerUp powerUp = getRandomPowerUp();
    Hologram hologram = HologramsAPI.createHologram(Nexus.getInstance(), location.clone().add(0, 2, 0));
    match.getHolograms().add(hologram);
    hologram.appendTextLine(StringUtils.colorize("&3&lPower Up"));
    hologram.insertTextLine(1, powerUp.getName());
    ItemLine itemLine = hologram.appendItemLine(powerUp.getItemStack());
    itemLine.setPickupHandler(player -> {
        Minigamer minigamer = PlayerManager.get(player);
        if (!minigamer.isPlaying(match))
            return;
        minigamer.tell("You picked up a power up!");
        powerUp.onPickup(PlayerManager.get(player));
        match.getHolograms().remove(hologram);
        hologram.delete();
        if (recurring)
            match.getTasks().wait(10 * 20, () -> {
                if (!match.isEnded())
                    spawn(location, true);
            });
    });
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) ItemLine(com.gmail.filoghost.holographicdisplays.api.line.ItemLine) Minigamer(gg.projecteden.nexus.features.minigames.models.Minigamer)

Aggregations

Hologram (com.gmail.filoghost.holographicdisplays.api.Hologram)2 ItemLine (com.gmail.filoghost.holographicdisplays.api.line.ItemLine)2 Minigamer (gg.projecteden.nexus.features.minigames.models.Minigamer)1