コード例 #1
0
ファイル: PlayerCommands.java プロジェクト: Nekocraft/Saga
  // Info:
  @Command(
      aliases = {"stats"},
      usage = "[page]",
      flags = "",
      desc = "Shows player stats.",
      min = 0,
      max = 1)
  @CommandPermissions({"saga.user.player.stats"})
  public static void stats(CommandContext args, Saga plugin, SagaPlayer sagaPlayer) {

    Integer page = null;

    // Arguments:
    if (args.argsLength() == 1) {

      String argsPage = args.getString(0);

      try {
        page = Integer.parseInt(argsPage);
      } catch (NumberFormatException e) {
        sagaPlayer.message(GeneralMessages.notNumber(argsPage));
        return;
      }

    } else {
      page = 1;
    }

    // Inform:
    sagaPlayer.message(StatsMessages.stats(sagaPlayer, page - 1));
  }
コード例 #2
0
ファイル: PlayerCommands.java プロジェクト: Nekocraft/Saga
  // Info:
  @Command(
      aliases = {"phelp"},
      usage = "[page]",
      flags = "",
      desc = "Display player help.",
      min = 0,
      max = 1)
  @CommandPermissions({"saga.user.help.player"})
  public static void help(CommandContext args, Saga plugin, SagaPlayer sagaPlayer) {

    Integer page = null;

    // Arguments:
    if (args.argsLength() == 1) {
      try {
        page = Integer.parseInt(args.getString(0));
      } catch (NumberFormatException e) {
        sagaPlayer.message(GeneralMessages.notNumber(args.getString(0)));
        return;
      }
    } else {
      page = 0;
    }

    // Inform:
    sagaPlayer.message(HelpMessages.phelp(page - 1));
  }
コード例 #3
0
ファイル: BuySign.java プロジェクト: Nekocraft/Saga
  /*
   * (non-Javadoc)
   *
   * @see org.saga.buildings.signs.BuildingSign#getLine(int, org.saga.buildings.signs.BuildingSign.SignStatus)
   */
  @Override
  public String getLine(int index, SignStatus status) {

    switch (status) {
      case ENABLED:
        if (index == 1)
          return item.getAmount().intValue()
              + AMOUNT_DIV_DISPLAY
              + GeneralMessages.materialAbrev(item.getType());
        if (index == 2) return "price: " + EconomyMessages.coins(price);
        if (index == 3) return stored.intValue() + "/" + maxStored.intValue();

        break;

      case DISABLED:
        if (index == 1)
          return item.getAmount().intValue()
              + AMOUNT_DIV_DISPLAY
              + GeneralMessages.materialAbrev(item.getType());
        if (index == 2) return "price: " + EconomyMessages.coins(price);
        if (index == 3) return "come back later";
        break;

      case INVALIDATED:
        if (index == 1)
          return SettlementConfiguration.config().invalidSignColor
              + "amt"
              + AMOUNT_DIV_DISPLAY
              + "item/ID";
        if (index == 2) return SettlementConfiguration.config().invalidSignColor + "price";
        if (index == 3) return SettlementConfiguration.config().invalidSignColor + "max amount";

        break;

      default:
        return "-";
    }

    return "";
  }
コード例 #4
0
ファイル: PlayerCommands.java プロジェクト: Nekocraft/Saga
  @Command(
      aliases = {"ability", "pabilityinfo, abilityinfo"},
      usage = "<ability_name>",
      flags = "",
      desc = "Display ability information.",
      min = 1)
  @CommandPermissions({"saga.user.help.player.abilityinfo"})
  public static void abilityInfo(CommandContext args, Saga plugin, SagaPlayer sagaPlayer) {

    AbilityDefinition definition = null;

    String abilityName = null;

    // Arguments:
    abilityName = GeneralMessages.nameFromArg(args.getJoinedStrings(0));
    definition = AbilityConfiguration.config().getDefinition(abilityName);
    if (definition == null) {
      sagaPlayer.message(AbilityMessages.invalidAbility(abilityName));
      return;
    }

    // Inform:
    sagaPlayer.message(HelpMessages.ability(definition));
  }