コード例 #1
0
  private static void setDefaultFeature(String featurename, String... names) {
    if (names.length == 0) names = new String[] {"OP"};

    String list = "";
    for (int i = 0; i < names.length; i++) {
      if (i >= 1) list += ", ";
      list += names[i];
    }
    serverConfig.getTag("permissions." + featurename).setDefaultValue(list);
  }
コード例 #2
0
  private static void savePlayerList(String tag, Collection<String> list) {
    StringBuilder sb = new StringBuilder();
    int i = 0;
    for (Iterator<String> iterator = list.iterator(); iterator.hasNext(); i++) {
      if (i != 0) sb.append(", ");

      sb.append(iterator.next());
    }

    serverConfig.getTag(tag).setValue(sb.toString());
  }
コード例 #3
0
  private static void initDefaults() {
    serverConfig.setNewLineMode(1);
    serverConfig.getTag("permissions").useBraces();
    serverConfig
        .getTag("permissions")
        .setComment("List of players who can use these features. :Eg. time=CodeChicken, Friend1");
    serverConfig.getTag("BannedBlocks").useBraces();
    serverConfig
        .getTag("BannedBlocks")
        .setComment(
            "List of players who can use these blocks. :Anyone not listed here will not have these blocks appear in their item panel.:format is {itemID}::{itemDamage}:Eg. 12::5=CodeChicken, Friend1");

    setDefaultFeature("time");
    setDefaultFeature("rain");
    setDefaultFeature("heal");
    setDefaultFeature("magnet");
    setDefaultFeature("creative");
    setDefaultFeature("creative+");
    setDefaultFeature("adventure");
    setDefaultFeature("enchant");
    setDefaultFeature("potion");
    setDefaultFeature("save-state");
    setDefaultFeature("item");
    setDefaultFeature("delete");
    setDefaultFeature("notify-item", "CONSOLE, OP");

    serverConfig.getTag("BannedBlocks." + Block.bedrock.blockID + ":0").setDefaultValue("NONE");
  }
コード例 #4
0
  private static void loadBannedBlocks() {
    ConfigTag banTag = serverConfig.getTag("BannedBlocks");
    for (Entry<String, ConfigTag> entry : banTag.childTagMap().entrySet()) {
      String ident = entry.getKey();
      String num[] = ident.split(":");
      ItemKey hash =
          num.length == 1
              ? new ItemKey(Integer.parseInt(num[0]), -1)
              : new ItemKey(Integer.parseInt(num[0]), Integer.parseInt(num[1]));

      bannedblocks.put(hash, getPlayerList(entry.getValue().qualifiedname));
    }
  }
コード例 #5
0
 public static HashSet<String> getPlayerList(String tag) {
   String[] list = serverConfig.getTag(tag).getValue("").replace(" ", "").split(",");
   return new HashSet<String>(Arrays.asList(list));
 }