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;
}
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);
});
});
}