本文整理汇总了Java中com.gmail.filoghost.holographicdisplays.api.Hologram类的典型用法代码示例。如果您正苦于以下问题:Java Hologram类的具体用法?Java Hologram怎么用?Java Hologram使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hologram类属于com.gmail.filoghost.holographicdisplays.api包,在下文中一共展示了Hologram类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setHologramLines
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
private static void setHologramLines(Hologram hologram, RetPlayerPoints rpp) {
if (rpp != null) {
hologram.appendTextLine(ConstantHolder.RAGEMODE_PREFIX);
hologram.appendTextLine(PluginLoader.getMessages().RANK + Integer.toString(rpp.getRank()));
hologram.appendTextLine(PluginLoader.getMessages().SCORE + rpp.getPoints());
hologram.appendTextLine(PluginLoader.getMessages().WINS + rpp.getWins());
hologram.appendTextLine(PluginLoader.getMessages().GAMES + rpp.getGames());
hologram.appendTextLine(PluginLoader.getMessages().KD + rpp.getKD());
hologram.appendTextLine(PluginLoader.getMessages().KILLS + rpp.getKills());
hologram.appendTextLine(PluginLoader.getMessages().DEATHS + rpp.getDeaths());
} else {
hologram.appendTextLine(ConstantHolder.RAGEMODE_PREFIX);
hologram.appendTextLine(PluginLoader.getMessages().RANK + "---------------");
hologram.appendTextLine(PluginLoader.getMessages().SCORE + "---------------");
hologram.appendTextLine(PluginLoader.getMessages().WINS + "---------------");
hologram.appendTextLine(PluginLoader.getMessages().GAMES + "---------------");
hologram.appendTextLine(PluginLoader.getMessages().KD + "---------------");
hologram.appendTextLine(PluginLoader.getMessages().KILLS + "---------------");
hologram.appendTextLine(PluginLoader.getMessages().DEATHS + "---------------");
}
}
示例2: deleteHologram
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public static void deleteHologram(Hologram holo) {
if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays"))
return;
if (holo == null) {
return;
}
List<Location> locList = (List<Location>) holosConfiguration.getList("data.holos");
if (locList.contains(holo.getLocation()))
locList.remove(holo.getLocation());
holosConfiguration.set("data.holos", locList);
try {
holosConfiguration.save(yamlHolosFile);
} catch (IOException e) {
e.printStackTrace();
}
holo.delete();
loadHolos();
}
示例3: getClosest
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public static Hologram getClosest(Player player) {
if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays"))
return null;
Collection<Hologram> holos = HologramsAPI.getHolograms(PluginLoader.getInstance());
Hologram closest = null;
double lowestDist = Double.MAX_VALUE;
for (Hologram holo : holos) {
double dist = holo.getLocation().distance(player.getLocation());
if (dist < lowestDist) {
lowestDist = dist;
closest = holo;
}
}
return closest;
}
示例4: updatePlayerHologram
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
private void updatePlayerHologram(Player player, Location holoLocation) {
List<Hologram> holograms = null;
if (!this.holograms.containsKey(player)) {
this.holograms.put(player, new ArrayList<Hologram>());
}
holograms = this.holograms.get(player);
Hologram holo = this.getHologramByLocation(holograms, holoLocation);
if (holo == null && player.getWorld() == holoLocation.getWorld()) {
holograms.add(this.createPlayerStatisticHologram(player, holoLocation));
} else if (holo != null) {
if (holo.getLocation().getWorld() == player.getWorld()) {
this.updatePlayerStatisticHologram(player, holo);
} else {
holograms.remove(holo);
holo.delete();
}
}
}
示例5: followEntity
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
/**
* Make a hologram follow an entity from the HoloManager by ID.
*
* @param ent The entity to be followed.
* @param id The ID text for the hologram.
* @param xoffset The x offset of the hologram from the entity.
* @param yoffset The y offset of the hologram from the entity.
* @param zoffset The z offset of the hologram from the entity.
*/
public static void followEntity(final Entity ent, final String id, final double xoffset,
final double yoffset, final double zoffset) {
new BukkitRunnable() {
@Override
public void run() {
Hologram hologram = getFromHoloMap(id);
if (isInHoloMap(id) == true) {
hologram.teleport(ent.getLocation().add(xoffset, yoffset, zoffset));
} else {
cancel();
}
}
}.runTaskTimer(Core.plugin, 1L, 1L);
}
示例6: get
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
@Override
@Nullable
protected String[] get(Event evt) {
if (HoloManager.getFromHoloMap(id.getSingle(evt).replace("\"", "")) != null) {
Hologram hologram = HoloManager.getFromHoloMap(id.getSingle(evt).replace("\"", ""));
String finalLine = hologram.getLine(line.getSingle(evt).intValue()).toString();
if (finalLine.indexOf("text=") != -1) {
finalLine = finalLine.substring(finalLine.indexOf("text=") + 5, finalLine.indexOf("]"));
return new String[] {finalLine};
} else if (finalLine.indexOf("itemStack=") != -1) {
finalLine =
finalLine.substring(finalLine.indexOf("itemStack=") + 10, finalLine.indexOf(","));
return new String[] {finalLine};
} else {
return new String[] {null};
}
} else {
return new String[] {null};
}
}
示例7: loadHolos
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public static void loadHolos() {
if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays"))
return;
Collection<Hologram> holos = HologramsAPI.getHolograms(PluginLoader.getInstance());
for (Hologram holo : holos) {
holo.delete();
}
Collection<? extends Player> onlines = Bukkit.getOnlinePlayers();
for (Player player : onlines) {
showAllHolosToPlayer(player);
}
}
示例8: deleteHoloObjectsOfPlayer
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public static void deleteHoloObjectsOfPlayer(Player player) {
if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays"))
return;
Collection<Hologram> holos = HologramsAPI.getHolograms(PluginLoader.getInstance());
for (Hologram holo : holos) {
if (holo.getVisibilityManager().isVisibleTo(player))
holo.delete();
}
}
示例9: createPlayerStatisticHologram
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
private Hologram createPlayerStatisticHologram(Player player, Location holoLocation) {
final Hologram holo = HologramsAPI.createHologram(BedwarsRel.getInstance(), holoLocation);
holo.getVisibilityManager().setVisibleByDefault(false);
holo.getVisibilityManager().showTo(player);
this.updatePlayerStatisticHologram(player, holo);
return holo;
}
示例10: getHologramByLocation
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
private Hologram getHologramByLocation(List<Hologram> holograms, Location holoLocation) {
for (Hologram holo : holograms) {
if (holo.getLocation().getX() == holoLocation.getX()
&& holo.getLocation().getY() == holoLocation.getY()
&& holo.getLocation().getZ() == holoLocation.getZ()) {
return holo;
}
}
return null;
}
示例11: loadHolograms
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void loadHolograms() {
if (!BedwarsRel.getInstance().isHologramsEnabled()) {
return;
}
if (this.holograms != null && this.hologramLocations != null) {
// first unload all holograms
this.unloadHolograms();
}
this.holograms = new HashMap<Player, List<Hologram>>();
this.hologramLocations = new ArrayList<Location>();
File file = new File(BedwarsRel.getInstance().getDataFolder(), "holodb.yml");
if (file.exists()) {
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
List<Object> locations = (List<Object>) config.get("locations");
for (Object location : locations) {
Location loc = Utils.locationDeserialize(location);
if (loc == null) {
continue;
}
this.hologramLocations.add(loc);
}
}
if (this.hologramLocations.size() == 0) {
return;
}
this.updateHolograms();
}
示例12: onHologramTouch
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public void onHologramTouch(final Player player, final Hologram holo) {
if (!player.hasMetadata("bw-remove-holo")
|| (!player.isOp() && !player.hasPermission("bw.setup"))) {
return;
}
player.removeMetadata("bw-remove-holo", BedwarsRel.getInstance());
BedwarsRel.getInstance().getServer().getScheduler()
.runTask(BedwarsRel.getInstance(), new Runnable() {
@Override
public void run() {
// remove all player holograms on this location
for (Entry<Player, List<Hologram>> entry : HolographicDisplaysInteraction.this
.getHolograms().entrySet()) {
Iterator<Hologram> iterator = entry.getValue().iterator();
while (iterator.hasNext()) {
Hologram hologram = iterator.next();
if (hologram.getX() == holo.getX() && hologram.getY() == holo.getY()
&& hologram.getZ() == holo.getZ()) {
hologram.delete();
iterator.remove();
}
}
}
Location holoLocation =
HolographicDisplaysInteraction.this
.getHologramLocationByLocation(holo.getLocation());
if (holoLocation != null) {
HolographicDisplaysInteraction.this.hologramLocations.remove(holoLocation);
HolographicDisplaysInteraction.this.updateHologramDatabase();
}
player.sendMessage(
ChatWriter.pluginMessage(ChatColor.GREEN + BedwarsRel._l("success.holoremoved")));
}
});
}
示例13: unloadAllHolograms
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public void unloadAllHolograms(Player player) {
if (!this.holograms.containsKey(player)) {
return;
}
for (Hologram holo : this.holograms.get(player)) {
holo.delete();
}
this.holograms.remove(player);
}
示例14: unloadHolograms
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public void unloadHolograms() {
if (BedwarsRel.getInstance().isHologramsEnabled()) {
Iterator<Hologram> iterator = HologramsAPI.getHolograms(BedwarsRel.getInstance()).iterator();
while (iterator.hasNext()) {
iterator.next().delete();
}
}
}
示例15: spawnNPCs
import com.gmail.filoghost.holographicdisplays.api.Hologram; //导入依赖的package包/类
public static void spawnNPCs(){
Entity pet = Bukkit.getWorld(world).spawnEntity(new Location(Bukkit.getWorld(world), -1249, 55, 242, -120, 0).add(0.5, 0, 0.5), EntityType.VILLAGER);
EntityUtils.noAI(pet);
entitys.add(pet);
Hologram petHolo = HologramsAPI.createHologram(Main.getPlugin(), pet.getLocation().add(0, 2.6, 0));
petHolo.appendTextLine(MiscUtils.color("&bPet Shop"));
petHolo.appendTextLine(MiscUtils.color("&7&lSoonTM"));
holograms.add(petHolo);
Entity merchant = Bukkit.getWorld(world).spawnEntity(new Location(Bukkit.getWorld(world), -1197, 54, 59, -15, 0).add(0.5, 0, 0.5), EntityType.VILLAGER);
EntityUtils.noAI(merchant);
entitys.add(merchant);
Hologram merchantHolo = HologramsAPI.createHologram(Main.getPlugin(), merchant.getLocation().add(0, 2.6, 0));
merchantHolo.appendTextLine(MiscUtils.color("&bKleding Shop"));
merchantHolo.appendTextLine(MiscUtils.color("&7&lSoonTM"));
holograms.add(merchantHolo);
Entity gadget = Bukkit.getWorld(world).spawnEntity(new Location(Bukkit.getWorld(world), -1249, 55, 238, -50, 0).add(0.5,0,0.5), EntityType.VILLAGER);
gadgetEntity = gadget;
EntityUtils.noAI(gadget);
entitys.add(gadget);
Hologram gadgetHolo = HologramsAPI.createHologram(Main.getPlugin(), gadget.getLocation().add(0, 2.6, 0));
gadgetHolo.appendTextLine(MiscUtils.color("&bGadget Shop"));
gadgetHolo.appendTextLine(MiscUtils.color("&a&lRIGHT CLICK"));
holograms.add(gadgetHolo);
Entity food = Bukkit.getWorld(world).spawnEntity(new Location(Bukkit.getWorld(world), -1184, 54, 60, -180, 0).add(0.5,0,0.5), EntityType.VILLAGER);
EntityUtils.noAI(food);
entitys.add(food);
Hologram foodHolo = HologramsAPI.createHologram(Main.getPlugin(), food.getLocation().add(0, 2.6, 0));
foodHolo.appendTextLine(MiscUtils.color("&bCocktail Bar"));
foodHolo.appendTextLine(MiscUtils.color("&7&lSoonTM"));
holograms.add(foodHolo);
}