Esempio n. 1
0
  public void sendPlayer(Player p) {
    if (p == null) {
      return;
    }
    TextComponent formattedtitle = (TextComponent) this.title.duplicate();
    formattedtitle.setText(StringUtils.center(this.title.getText(), CHAT_SIZE, '-'));
    p.spigot().sendMessage(formattedtitle);

    if (!subTitle.equals("")) {
      p.spigot().sendMessage(subTitle);
    }

    TextComponent message = new TextComponent("");
    int counter = CHAT_SIZE;
    for (int i = 0; i < parts.size(); i++) {
      message.addExtra("[");
      message.addExtra(parts.get(i));
      message.addExtra("] ");
      counter -= (parts.get(i).getText().length() + 2);
      if (i + 1 != parts.size()) {
        if (counter < parts.get(i + 1).getText().length() + 2) {
          p.spigot().sendMessage(message);
          message = new TextComponent("");
          counter = CHAT_SIZE;
        }
      } else {
        p.spigot().sendMessage(message);
      }
    }

    p.spigot().sendMessage(formattedtitle);
  }
 public void addTranslatedExtra(String text) {
   super.addExtra(I18n.getTranslation(text));
 }