Exemple #1
0
  /**
   * Send a short message using SbPopupAPI
   *
   * @param player player to send the message to
   * @param category type defines the length color for consistency
   * @param message text already seperated into lines
   * @param stripColors if colors should be removed from the message
   */
  public void sendPopup(
      Player player, MsgCategory category, List<String> message, boolean stripColors) {
    if (popupsAreEnabled(category)) {
      int length;
      ChatColor titleColor;
      ChatColor textColor;
      String titleText = messages.getString(MessageNode.SB_MSG_TITLE);

      if (stripColors)
        for (int i = 0; i < message.size(); i++)
          message.set(i, ChatColor.stripColor(message.get(i)));

      switch (category) {
        case BROADCAST:
          length = messages.getInt(MessageNode.SB_MSG_BROADCAST_LEN);
          titleColor = null;
          textColor = messages.getColor(MessageNode.SB_MSG_BROADCAST_TEXT_CLR);
          break;
        case ONE_TIME:
        case NOTIFICATION:
          length = messages.getInt(MessageNode.SB_MSG_NOTIFICATION_LEN);
          titleColor = null;
          textColor = messages.getColor(MessageNode.SB_MSG_NOTIFICATION_TEXT_CLR);
          break;
        case TUTORIAL:
          length = messages.getInt(MessageNode.SB_MSG_TUTORIAL_LEN);
          titleColor = null;
          textColor = messages.getColor(MessageNode.SB_MSG_TUTORIAL_TEXT_CLR);
          break;
        case DISABLED:
        default:
          length = 0;
          titleColor = null;
          textColor = null;
      }
      manager.showPopup(
          player.getName(),
          category.getUniqueIdentifier(),
          length,
          titleColor,
          textColor,
          titleText,
          message);
    }
  }
Exemple #2
0
 /**
  * Hides/Removes the message with the given unqiue identifier
  *
  * @param player player for which to hide message
  * @param identifier uique identifier of this message
  */
 public void hidePopup(Player player, String identifier) {
   if (manager != null && player != null) manager.removePopup(player.getName(), identifier);
 }