示例#1
0
文件: Msg.java 项目: Rojoss/HelpBot
 /**
  * Try to send a JSON formatted message to the specified array of {@link Player}s their action
  * bar. (above hotbar)
  *
  * <p>
  *
  * <p>If the JSON is invalid it will send the raw message {@link #sendRaw(CommandSender...)} as a
  * regular message. It will also send an error message to the console.
  *
  * <p>
  *
  * <p>Note that JSON actions won't really do anything on the actionbar except for colors and such.
  *
  * @param players Array with players to send the action bar message to.
  */
 public void sendBar(Player... players) {
   if (isValidJSON()) {
     NMS.get().getChat().sendBar(json, players);
   } else {
     sendRaw(players);
   }
 }
示例#2
0
文件: Msg.java 项目: Rojoss/HelpBot
 /**
  * Try to send a JSON formatted message to the specified collection of {@link Player}s their
  * action bar. (above hotbar)
  *
  * <p>
  *
  * <p>If the JSON is invalid it will send the raw message {@link #sendRaw(CommandSender...)} as a
  * regular message. It will also send an error message to the console.
  *
  * <p>
  *
  * <p>Note that JSON actions won't really do anything on the actionbar except for colors and such.
  *
  * @param players Collection with players to send the action bar message to.
  */
 public void sendBar(Collection<? extends Player> players) {
   if (isValidJSON()) {
     NMS.get().getChat().sendBar(json, players);
   } else {
     sendRaw(players);
   }
 }
示例#3
0
文件: Msg.java 项目: Rojoss/HelpBot
 /**
  * Send the message to the specified {@link CommandSender}.
  *
  * <p>
  *
  * <p>If the sender is a {@link Player} it will try to send the JSON formatted message. If not, it
  * will send the raw message. (also if there is no valid JSON) If the JSON is invalid it will also
  * send an error message to the console.
  *
  * <p>
  *
  * <p><b>Raw messages will still have params replaced, colors and other formatting but no
  * JSON.</b>
  *
  * @param sender The {@link CommandSender} to send the message to.
  */
 public void send(CommandSender sender) {
   if (sender instanceof Player && isValidJSON()) {
     NMS.get().getChat().send(json, (Player) sender);
   } else {
     sendRaw(sender);
   }
 }