コード例 #1
0
 /** Class constructor. */
 public SetValueArgument() {
   super(
       new String[] {Language.COMMAND_SETVALUE.toString()},
       -1,
       "spleef.setvalue",
       null,
       Language.COMMAND_SETVALUE_DESCRIPTION.toString());
 }
コード例 #2
0
  /*
   * (non-Javadoc)
   * @see de.oppermann.bastian.spleef.util.command.AbstractArgument#onTabComplete(org.bukkit.entity.Player, java.lang.String[])
   */
  @Override
  public List<String> onTabComplete(Player sender, String[] args) {
    ArrayList<String> list = new ArrayList<>();
    if (args.length == 1) {
      list.add(Language.COMMAND_SETVALUE.toString());
    }
    if (args.length == 2) {
      list.addAll(Sets.newHashSet(SpleefArena.getArenaNames()));
    }
    if (args.length == 3) {
      list.add(Language.FLAG_ENABLED.toString());
      list.add(Language.FLAG_SNOWBALLS_ENABLED.toString());
      list.add(Language.FLAG_MAX_SNOWBALLS.toString());
      list.add(Language.FLAG_MODE.toString());
      list.add(Language.FLAG_CUSTOMINVENTORY.toString());
      list.add(Language.FLAG_CUSTOMINVENTORY_ENABLED.toString());
      list.add(Language.FLAG_VEHICLE.toString());
      list.add(Language.FLAG_INSTANT_BLOCK_DESTORY.toString());
      list.add(Language.FLAG_REWARD_MONEY_PARTICIPATION.toString());
      list.add(Language.FLAG_REWARD_MONEY_WINNING.toString());
      list.add(Language.FLAG_REWARD_POINTS_PARTICIPATION.toString());
      list.add(Language.FLAG_REWARD_POINTS_WINNING.toString());
      list.add(Language.FLAG_FREEZE_PLAYERS.toString());
      list.add(Language.FLAG_MODIFY_GRAVITY.toString());
      list.add(Language.FLAG_GRAVITY.toString());
      list.add(Language.FLAG_MIN_PLAYERS.toString());
      list.add(Language.FLAG_REQUIRED_PLAYERS_TO_START_COUNTDOWN.toString());
      list.add(Language.FLAG_SPECTATE_TYPE.toString());
      list.add(Language.FLAG_SPECTATE_LOCATION.toString());
      list.add(Language.FLAG_ARENA_COUNTDOWN.toString());
      list.add(Language.FLAG_LOBBY_COUNTDOWN.toString());
    }
    if (args.length == 4) {
      if (args[2].equalsIgnoreCase(Language.FLAG_ENABLED.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_SNOWBALLS_ENABLED.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_CUSTOMINVENTORY_ENABLED.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_INSTANT_BLOCK_DESTORY.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_FREEZE_PLAYERS.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_MODIFY_GRAVITY.toString())) {
        list.add(Language.VALUE_TRUE.toString());
        list.add(Language.VALUE_FALSE.toString());
      }
      if (args[2].equalsIgnoreCase(Language.FLAG_MAX_SNOWBALLS.toString())) {
        list.add("0");
        list.add("1");
        list.add("5");
        list.add("16");
        list.add("32");
        list.add("64");
      }
      if (args[2].equalsIgnoreCase(Language.FLAG_MODE.toString())) {
        list.add(Language.VALUE_MODE_NORMAL.toString());
        list.add(Language.VALUE_MODE_BOWSPLEEF.toString());
        list.add(Language.VALUE_MODE_SPLEGG.toString());
        list.add(Language.VALUE_MODE_SPLEEF_RUN.toString());
        // list.add(Language.VALUE_MODE_SUPER_SPLEEF.toString()); // TODO enable super gamemodes
        // list.add(Language.VALUE_MODE_SUPER_SPLEGG.toString()); // TODO enable super gamemodes
      }
      if (args[2].equalsIgnoreCase(Language.FLAG_VEHICLE.toString())) {
        try {
          list.add(EntityType.RABBIT.name().toLowerCase());
        } catch (Exception e) {
          // older versions of minecraft don't have rabbits :(
          // A life without rabbits is not livable!
        }
        list.add(EntityType.VILLAGER.name().toLowerCase());
        list.add(EntityType.PIG.name().toLowerCase());
        list.add(EntityType.OCELOT.name().toLowerCase());
        list.add(EntityType.SHEEP.name().toLowerCase());
        list.add("none");
      }
      if (args[2].equalsIgnoreCase(Language.FLAG_REWARD_MONEY_PARTICIPATION.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_REWARD_MONEY_WINNING.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_REWARD_POINTS_PARTICIPATION.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_REWARD_POINTS_WINNING.toString())) {
        list.add("0");
        list.add("10");
        list.add("25");
        list.add("50");
        list.add("100");
        list.add("150");
        list.add("200");
        list.add("500");
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_ARENA_COUNTDOWN.toString())
          || args[2].equalsIgnoreCase(Language.FLAG_LOBBY_COUNTDOWN.toString())) {
        list.add("10");
        list.add("15");
        list.add("20");
        list.add("30");
        list.add("45");
        list.add("60");
        list.add("100");
        list.add("120");
        list.add("250");
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_GRAVITY.toString())) {
        list.add("0.25");
        list.add("0.5");
        list.add("0.75");
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_MIN_PLAYERS.toString())
          || args[2].equalsIgnoreCase(
              Language.FLAG_REQUIRED_PLAYERS_TO_START_COUNTDOWN.toString())) {
        list.add("2");
        list.add("4");
        list.add("8");
        list.add("12");
        list.add("16");
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_SPECTATE_TYPE.toString())) {
        list.add(Language.SPECTATE_TYPE_NONE.toString());
        list.add(Language.SPECTATE_TYPE_NORMAL.toString());
        list.add(Language.SPECTATE_TYPE_NORMAL_FLYING.toString());
        list.add(Language.SPECTATE_TYPE_GAMEMODE_3.toString());
      }
    }
    return list;
  }