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