示例#1
0
 /**
  * Are popops enabled
  *
  * @return if popupmanager is loaded
  */
 public boolean popupsAreEnabled(MsgCategory category) {
   if (messages.getBoolean(MessageNode.SB_MSG_ENABLE))
     switch (category.getSubcategory() != null
         ? category.getSubcategory()
         : category) // Some messages might inherit from another MsgCategory
     {
       case TUTORIAL:
         return messages.getBoolean(MessageNode.SB_MSG_TUTORIAL);
       case NOTIFICATION:
         return messages.getBoolean(MessageNode.SB_MSG_NOTIFICATION);
       case BROADCAST:
         return messages.getBoolean(MessageNode.SB_MSG_BROADCAST);
       default:
         return false;
     }
   return false;
 }
示例#2
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 to display
   */
  public void sendPopup(Player player, MsgCategory category, String message) {
    if (popupsAreEnabled(category)) {
      int length;
      ChatColor titleColor;
      ChatColor textColor;
      String titleText = messages.getString(MessageNode.SB_MSG_TITLE);

      if (messages.getBoolean(MessageNode.SB_MSG_REMOVE_COLOR))
        message = ChatColor.stripColor(message);

      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);
    }
  }
示例#3
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
  */
 public void sendPopup(Player player, MsgCategory category, List<String> message) {
   sendPopup(player, category, message, messages.getBoolean(MessageNode.SB_MSG_REMOVE_COLOR));
 }