Example #1
0
    @Override
    public String getPromptText(ConversationContext context) {
      Warp warp = (Warp) context.getSessionData(Warp.class);
      String welcomeMessage = (String) context.getSessionData(String.class);
      warp.setWelcomeMessage(welcomeMessage);

      Locale locale = (Locale) context.getSessionData(Locale.class);

      Message message;

      if (welcomeMessage.isEmpty()) {
        message =
            Message.builder()
                .append(msg.getString("welcome-message.removed-successful", locale, warp.getName()))
                .build();
      } else {
        message =
            Message.builder()
                .append(msg.getString("welcome-message.changed-successful", locale, warp.getName()))
                .appendNewLine()
                .append(Message.Style.INFO)
                .append(welcomeMessage)
                .build();
      }

      return BukkitMessageInterpreter.interpret(message);
    }
Example #2
0
    @Override
    public String getPromptText(ConversationContext context) {
      Warp warp = (Warp) context.getSessionData(Warp.class);
      Locale locale = (Locale) context.getSessionData(Locale.class);

      Message message =
          Message.builder()
              .append(
                  msg.getString(
                      "welcome-message.enter-message",
                      locale,
                      warp.getName(),
                      REMOVE_SEQUENCE,
                      ESCAPE_SEQUENCE,
                      MyWarpPlugin.CONVERSATION_TIMEOUT))
              .build();

      return BukkitMessageInterpreter.interpret(message);
    }