/** * Sends the message to a {@link Collection} of targets. * * @param targets The targets that should receive the message. * @param args An optional array of arguments. If this is used they will be passed together with * the message itself to the String.format() function, before the message gets send to the * client. This can be used to add variable data into the message. */ @Override public void send(@NotNull Collection<? extends ProxiedPlayer> targets, @Nullable Object... args) { Validate.notNull(targets, "The targets that should receive the message should not be null!"); if (getSendMethod() == SendMethod.DISABLED || targets.size() == 0) return; method .getSender() .doSend( targets, (args != null && args.length > 0) ? String.format(json, quoteArgs(args)) : json, optionalParameters); }
/** * Sends the message to all online players on the server, as well as the console. * * @param args An optional array of arguments. If this is used they will be passed together with * the message itself to the String.format() function, before the message gets send to the * client. This can be used to add variable data into the message. */ @SuppressWarnings("deprecation") @Override public void broadcast(@Nullable Object... args) { if (getSendMethod() == SendMethod.DISABLED) return; ProxyServer.getInstance() .getConsole() .sendMessage( (args != null && args.length > 0) ? String.format(fallback, args) : fallback); // Send the message to the console method .getSender() .doBroadcast( (args != null && args.length > 0) ? String.format(json, quoteArgs(args)) : json, optionalParameters); }
/** * Sends the message to a target. * * @param target The target that should receive the message. * @param args An optional array of arguments. If this is used they will be passed together with * the message itself to the String.format() function, before the message gets send to the * client. This can be used to add variable data into the message. */ @Override public void send(@NotNull CommandSender target, @Nullable Object... args) { Validate.notNull(target, "The target that should receive the message should not be null!"); if (getSendMethod() == SendMethod.DISABLED) return; if (target instanceof ProxiedPlayer) { method .getSender() .doSend( (ProxiedPlayer) target, (args != null && args.length > 0) ? String.format(json, quoteArgs(args)) : json, optionalParameters); } else { //noinspection deprecation target.sendMessage( (args != null && args.length > 0) ? String.format(fallback, args) : fallback); } }