- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Connection c =
DataSource dataSource;dataSource.getConnection()
String url;DriverManager.getConnection(url)
IdentityDatabaseUtil.getDBConnection()
- Smart code suggestions by Codota
}
@EventHandler public void onPlayerDeath(PlayerDeathEvent event) { Hologram hologram = HologramsAPI.createHologram(this, event.getEntity().getEyeLocation()); hologram.appendTextLine(ChatColor.RED + "Player " + ChatColor.GOLD + event.getEntity().getName() + ChatColor.RED + " died here!"); hologram.appendTextLine(ChatColor.GRAY + "Time of death: " + new SimpleDateFormat("H:m").format(new Date())); } }
@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"))); }
@Override public void run() { if (npcHologram.hologram != null) { npcHologram.hologram.getVisibilityManager().showTo(player); } } },2);
@Override public void onPickup(Player player) { // Play an effect. player.playEffect(hologram.getLocation(), Effect.MOBSPAWNER_FLAMES, null); // 30 seconds of speed II. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30 * 20, 1), true); // Delete the hologram. hologram.delete(); } });
if (npcHologram.hologram == null) { Hologram hologram = HologramsAPI.createHologram(BetonQuest.getInstance(), npc.getStoredLocation().add(npcHologram.config.vector)); hologram.getVisibilityManager().setVisibleByDefault(false); for (String line : npcHologram.config.settings.getStringList("lines")) { if (line.startsWith("item:")) { hologram.appendItemLine(new ItemStack(Material.matchMaterial(line.substring(5)))); } else { hologram.appendTextLine(line.replace('&', '§')); npcHologram.hologram.delete(); npcHologram.hologram = null;
public DGroupTag(DungeonsXL plugin, DGamePlayer player) { this.player = player; DGroup group = player.getDGroup(); if (group != null) { hologram = HologramsAPI.createHologram(plugin, player.getPlayer().getLocation().clone().add(0, 3.5, 0)); hologram.appendItemLine(group.getDColor().getWoolMaterial().toItemStack()); hologram.appendTextLine(group.getName()); } }
hologram.getVisibilityManager().setVisibleByDefault(false); for (String line : lines) { hologram.appendItemLine(new ItemStack(Material.matchMaterial(line.substring(5)))); } else { hologram.appendTextLine(line.replace('&', '§'));
private void updatePlayerStatisticHologram(Player player, final Hologram holo) { PlayerStatistic statistic = BedwarsRel.getInstance().getPlayerStatisticManager() .getStatistic(player); holo.clearLines(); TextLine textLine = holo.appendTextLine(line); textLine.setTouchHandler(new TouchHandler() {
public void unloadAllHolograms(Player player) { if (!this.holograms.containsKey(player)) { return; } for (Hologram holo : this.holograms.get(player)) { holo.delete(); } this.holograms.remove(player); }
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; }
@Override public void run() { for (NPC npc : npcs.keySet()) { for (NPCHologram npcHologram : npcs.get(npc)) { if (npcHologram.hologram != null) { npcHologram.hologram.teleport(npc.getStoredLocation().add(npcHologram.config.vector)); } } } } };
hologram.appendTextLine(ChatColor.AQUA + "" + ChatColor.BOLD + "Speed PowerUp"); ItemLine icon = hologram.appendItemLine(new ItemStack(Material.SUGAR));
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(); } } }
private void updatePlayerStatisticHologram(Player player, final Hologram holo) { PlayerStatistic statistic = BedwarsRel.getInstance().getPlayerStatisticManager() .getStatistic(player); holo.clearLines(); TextLine textLine = holo.appendTextLine(line); textLine.setTouchHandler(new TouchHandler() {
public void unloadAllHolograms(Player player) { if (!this.holograms.containsKey(player)) { return; } for (Hologram holo : this.holograms.get(player)) { holo.delete(); } this.holograms.remove(player); }
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; }
public void update() { hologram.teleport(player.getPlayer().getLocation().clone().add(0, 3.5, 0)); }
@Override public void onInit() { if (Bukkit.getPluginManager().getPlugin("HolographicDisplays") == null) { markAsErroneous("HolographicDisplays not enabled"); return; } getSign().getBlock().setType(VanillaItem.AIR.getMaterial()); String[] holoLines = lines[1].split("/"); Location location = getSign().getLocation(); location = location.add(0.5, NumberUtil.parseDouble(lines[2]), 0.5); hologram = HologramsAPI.createHologram(plugin, location); for (String line : holoLines) { if (line.startsWith("Item:")) { String id = line.replace("Item:", ""); ItemStack item = null; ExItem exItem = plugin.getCaliburn().getExItem(id); if (exItem != null) { item = exItem.toItemStack(); } hologram.appendItemLine(item); } else { hologram.appendTextLine(ChatColor.translateAlternateColorCodes('&', line)); } } }
@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"))); }
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(); } } }