use of com.gmail.filoghost.holographicdisplays.api.Hologram in project BetonQuest by BetonQuest.
the class CitizensHologram method updateHologramsForPlayers.
private boolean updateHologramsForPlayers(final NPCHologram npcHologram, final NPC npc) {
boolean hologramEnabled = false;
for (final Player player : Bukkit.getOnlinePlayers()) {
if (BetonQuest.conditions(PlayerConverter.getID(player), npcHologram.conditions)) {
hologramEnabled = true;
if (npcHologram.hologram == null) {
final Hologram hologram = HologramsAPI.createHologram(BetonQuest.getInstance(), npc.getStoredLocation().add(npcHologram.vector));
hologram.getVisibilityManager().setVisibleByDefault(false);
updateHologramForPlayersLines(npcHologram, hologram);
npcHologram.hologram = hologram;
}
if (!npcHologram.hologram.getVisibilityManager().isVisibleTo(player)) {
npcHologram.hologram.getVisibilityManager().showTo(player);
}
} else {
if (npcHologram.hologram != null && npcHologram.hologram.getVisibilityManager().isVisibleTo(player)) {
npcHologram.hologram.getVisibilityManager().hideTo(player);
}
}
}
return hologramEnabled;
}
use of com.gmail.filoghost.holographicdisplays.api.Hologram in project Crazy-Crates by Crazy-Crew.
the class HolographicSupport method createHologram.
public void createHologram(Block block, Crate crate) {
CrateHologram crateHologram = crate.getHologram();
if (!crateHologram.isEnabled())
return;
double height = crateHologram.getHeight();
Hologram hologram = HologramsAPI.createHologram(CrazyManager.getJavaPlugin(), block.getLocation().add(.5, height, .5));
crateHologram.getMessages().forEach(line -> hologram.appendTextLine(color(line)));
holograms.put(block, hologram);
}
use of com.gmail.filoghost.holographicdisplays.api.Hologram 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);
});
});
}
use of com.gmail.filoghost.holographicdisplays.api.Hologram 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);
}
}
use of com.gmail.filoghost.holographicdisplays.api.Hologram in project ChatBubbles by DrkMatr1984.
the class HandleThreeHD method handleThree.
public static void handleThree(ChatBubbles plugin, String message, Player p) {
boolean sendOriginal = plugin.getConfig().getBoolean("ChatBubble_Send_Original_Message");
boolean requirePerm = plugin.getConfig().getBoolean("ConfigOne_Require_Permissions");
String usePerm = plugin.getConfig().getString("ConfigOne_Use_Permission");
new BukkitRunnable() {
@Override
public void run() {
if (requirePerm && !p.hasPermission(usePerm))
return;
if (plugin.hdHandler.existingHolograms.containsKey(p.getUniqueId())) {
for (Hologram h : plugin.hdHandler.existingHolograms.get(p.getUniqueId())) {
if (!h.isDeleted())
h.delete();
}
}
MPlayer mPlayer = MPlayer.get(p);
String faction = mPlayer.getFactionName();
final Hologram hologram = HologramsAPI.createHologram(plugin, p.getLocation().add(0.0, plugin.getCBConfig().bubbleOffset, 0.0));
List<Hologram> hList = new ArrayList<Hologram>();
hList.add(hologram);
plugin.hdHandler.existingHolograms.put(p.getUniqueId(), hList);
hologram.getVisibilityManager().setVisibleByDefault(false);
for (Player oP : Bukkit.getOnlinePlayers()) {
if (((plugin.getCBConfig().seeOwnBubble) || (!plugin.getCBConfig().seeOwnBubble && oP.getName() != p.getName())) && (oP.getWorld().getName().equals(p.getWorld().getName()) && oP.getLocation().distance(p.getLocation()) <= plugin.getCBConfig().distance) && (MPlayer.get(oP).getFactionName().equals(faction)) && oP.canSee(p))
hologram.getVisibilityManager().showTo(oP);
}
int lines = plugin.hdHandler.formatHologramLines(p, hologram, message);
if (sendOriginal)
p.chat(message);
new BukkitRunnable() {
int ticksRun = 0;
@Override
public void run() {
ticksRun++;
if (!hologram.isDeleted())
hologram.teleport(p.getLocation().add(0.0, plugin.getCBConfig().bubbleOffset + .25 * lines, 0.0));
if (ticksRun > plugin.getCBConfig().life) {
hologram.delete();
cancel();
}
}
}.runTaskTimer(plugin, 1L, 1L);
if (plugin.getConfig().getBoolean("ChatBubble_Play_Sound")) {
String sound = plugin.getConfig().getString("ChatBubble_Sound_Name").toLowerCase();
float volume = (float) plugin.getConfig().getDouble("ChatBubble_Sound_Volume");
if (!sound.equals("")) {
try {
p.getWorld().playSound(p.getLocation(), sound, volume, 1.0f);
} catch (Exception e) {
plugin.getServer().getConsoleSender().sendMessage("Something is wrong in your ChatBubble config.yml sound settings!");
plugin.getServer().getConsoleSender().sendMessage("Please ensure that 'ChatBubble_Sound_Name' works in a '/playsound' command test.");
}
}
}
}
}.runTask(plugin);
}
Aggregations