@Override public void setLocationNMS(double x, double y, double z) { super.setPosition(x, y, z); if (Configuration.preciseHologramMovement) { // Send a packet near to update the position. PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this); for (Object obj : super.world.players) { if (obj instanceof EntityPlayer) { EntityPlayer nmsPlayer = (EntityPlayer) obj; double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ); if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) { nmsPlayer.playerConnection.sendPacket(teleportPacket); } } } } }
public static String join(String[] elements, String separator) { return join(elements, separator, 0, elements.length); }
List<String> help = Utils.newList(); help.add(Colors.PRIMARY + usage); for (String tutLine : subCommand.getTutorial()) { .color(ChatColor.AQUA) .event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, usage)) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Utils.join(help, "\n")))) .create());
normalPlaceholders = Utils.newSet(); worldsOnlinePlayersReplacers = Utils.newMap(); bungeeReplacers = Utils.newMap(); bungeeReplacers = Utils.newMap(); bungeeReplacers = Utils.newMap(); bungeeReplacers = Utils.newMap(); bungeeReplacers = Utils.newMap(); animationsPlaceholders = Utils.newMap(); if (Utils.isThereNonNull(normalPlaceholders, bungeeReplacers, worldsOnlinePlayersReplacers, animationsPlaceholders)) {
List<String> help = Utils.newList(); help.add(Colors.PRIMARY + usage); for (String tutLine : subCommand.getTutorial()) { .color(ChatColor.AQUA) .event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, usage)) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Utils.join(help, "\n")))) .create());
@Override public void setLocationNMS(double x, double y, double z) { super.setPosition(x, y, z); if (Configuration.preciseHologramMovement) { // Send a packet near to update the position. PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this); for (Object obj : super.world.players) { if (obj instanceof EntityPlayer) { EntityPlayer nmsPlayer = (EntityPlayer) obj; double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ); if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) { nmsPlayer.playerConnection.sendPacket(teleportPacket); } } } } }
public static String join(List<String> elements, String separator) { return join(elements, separator, 0, elements.size()); }
@Override public void setLocationNMS(double x, double y, double z) { super.setPosition(x, y, z); if (Configuration.preciseHologramMovement) { // Send a packet near to update the position. PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this); for (Object obj : super.world.players) { if (obj instanceof EntityPlayer) { EntityPlayer nmsPlayer = (EntityPlayer) obj; double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ); if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) { nmsPlayer.playerConnection.sendPacket(teleportPacket); } } } } }
public static String join(List<String> elements, String separator, int startIndex, int size) { return join(elements.toArray(new String[elements.size()]), separator, startIndex, size); }
@Override public void setLocationNMS(double x, double y, double z) { super.setPosition(x, y, z); if (Configuration.preciseHologramMovement) { // Send a packet near to update the position. PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this); for (Object obj : super.world.players) { if (obj instanceof EntityPlayer) { EntityPlayer nmsPlayer = (EntityPlayer) obj; double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ); if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) { nmsPlayer.playerConnection.sendPacket(teleportPacket); } } } } }
@Override public void execute(CommandSender sender, String label, String[] args) throws CommandException { NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase()); CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase())); String line = Utils.join(args, " ", 1, args.length); // Check material validity if (line.toLowerCase().startsWith("icon:")) { String iconMaterial = ItemUtils.stripSpacingChars(line.substring("icon:".length(), line.length())); if (iconMaterial.contains(":")) { iconMaterial = iconMaterial.split(":")[0]; } Material mat = ItemUtils.matchMaterial(iconMaterial); CommandValidator.notNull(mat, "Invalid icon material."); } hologram.getLinesUnsafe().add(HologramDatabase.readLineFromString(line, hologram)); hologram.refreshAll(); HologramDatabase.saveHologram(hologram); HologramDatabase.trySaveToDisk(); sender.sendMessage(Colors.PRIMARY + "Line added!"); Bukkit.getPluginManager().callEvent(new NamedHologramEditedEvent(hologram)); }
@Override public void setLocationNMS(double x, double y, double z) { super.setPosition(x, y, z); if (Configuration.preciseHologramMovement) { // Send a packet near to update the position. PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this); for (Object obj : super.world.players) { if (obj instanceof EntityPlayer) { EntityPlayer nmsPlayer = (EntityPlayer) obj; double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ); if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) { nmsPlayer.playerConnection.sendPacket(teleportPacket); } } } } }
NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase()); CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase())); String line = Utils.join(args, " ", 2, args.length);
@Override public void setLocationNMS(double x, double y, double z) { super.setPosition(x, y, z); if (Configuration.preciseHologramMovement) { // Send a packet near to update the position. PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this); for (Object obj : super.world.players) { if (obj instanceof EntityPlayer) { EntityPlayer nmsPlayer = (EntityPlayer) obj; double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ); if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) { nmsPlayer.playerConnection.sendPacket(teleportPacket); } } } } }
@Override public void execute(CommandSender sender, String label, String[] args) throws CommandException { NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase()); CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase())); int insertAfter = CommandValidator.getInteger(args[1]); int oldLinesAmount = hologram.size(); CommandValidator.isTrue(insertAfter >= 0 && insertAfter <= oldLinesAmount, "The number must be between 0 and " + hologram.size() + "(amount of lines of the hologram)."); hologram.getLinesUnsafe().add(insertAfter, HologramDatabase.readLineFromString(Utils.join(args, " ", 2, args.length), hologram)); hologram.refreshAll(); HologramDatabase.saveHologram(hologram); HologramDatabase.trySaveToDisk(); if (insertAfter == 0) { sender.sendMessage(Colors.PRIMARY + "Line inserted before line n.1!"); } else if (insertAfter == oldLinesAmount) { sender.sendMessage(Colors.PRIMARY + "Line appended at the end!"); sender.sendMessage(Strings.TIP_PREFIX + "Next time use /" + label + " addline to add a line at the end."); } else { sender.sendMessage(Colors.PRIMARY + "Line inserted between lines " + insertAfter + " and " + (insertAfter + 1) + "!"); } Bukkit.getPluginManager().callEvent(new NamedHologramEditedEvent(hologram)); }
@Override public void setLocationNMS(double x, double y, double z) { super.setPosition(x, y, z); if (Configuration.preciseHologramMovement) { // Send a packet near to update the position. PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this); for (Object obj : super.world.players) { if (obj instanceof EntityPlayer) { EntityPlayer nmsPlayer = (EntityPlayer) obj; double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ); if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) { nmsPlayer.playerConnection.sendPacket(teleportPacket); } } } } }
String text = Utils.join(args, " ", 1, args.length); CommandValidator.isTrue(!text.equalsIgnoreCase("{empty}"), "The first line should not be empty.");