@Override
  public void forceSave() {
    // config.load -- Configurations are loaded on Construction.
    config.addCustomCategoryComment("Chat", "Chatconfigs");

    Property prop =
        config.get(
            "Chat",
            "chatformat",
            "%groupPrefix%playerPrefix<%username>%playerSuffix%groupSuffix %reset%message");
    prop.comment = "This String formats the Chat.";
    prop.comment +=
        "\nIf you want both a color and special formatcodes, the color needs to be first before the special code";
    prop.comment +=
        "\nExamples: '%red%username' '%red%bold%username'\nNot OK:'%bold%gold%underline%username' In this example you would get the username in gold and underline but without bold";
    prop.comment += "\nList of possible variables:";
    prop.comment +=
        "\nFor the username: %username The health of the player can be used with %health. The variable, you need for the message:%message ";
    prop.comment += "\nFor the players prefix and suffix use %playerPrefix and %playerSuffix";
    prop.comment +=
        "\nColors:%black,%darkblue,%darkgreen,%darkaqua,%darkred,%purple,%gold,%grey,%darkgrey,%indigo,\n       %green,%aqua,%red,%pink,%yellow,%white";
    prop.comment += "\nSpecial formatcodes: %random,%bold,%strike,%underline,%italics";
    prop.comment += "\nTo reset all formatcodes, you can use %reset";
    prop.comment +=
        "\nUse %rank to display a users rank as defined in the config below., %zone to specify there current zone";
    prop.comment +=
        "\nUse %groupPrefix and groupSuffix to display the prefix and suffix of groups as defined in the config";
    prop.value = chatFormat;

    config.get("BannedWords", "censor", true, "censor the words in the censorList").value =
        "" + Chat.censor;
    config.get("BannedWords", "censorList", new String[] {}, "List of words to be censored")
            .valueList =
        Chat.bannedWords.toArray(new String[Chat.bannedWords.size()]);

    config.addCustomCategoryComment(
        "Chat.groups",
        "You may put enything here that you want displaed as part of the group prefixes, suffixes, or ranks."
            + "\n {ladderName<:>Zone} will display the data for the highest priority group that the player is in that is part of the specified ladder and specified zone."
            + "\n {...} will display the data of each group the player is in in order of priority"
            + "\n you may put contsraints with ladders or zones with {...<:>zoneName} or {ladderName<:>...}"
            + "\n you may also use the color and MCFormat codes above.");

    config.get("Chat.groups", "groupPrefix", "").value = groupPrefixFormat;
    config.get("Chat.groups", "groupSuffix", "").value = groupSuffixFormat;
    config.get("Chat.groups", "rank", "").value = groupRankFormat;

    config.save();
  }
Esempio n. 2
0
  @Override
  public void registerConfig(Configuration config, String category) {
    String[] potionEffects = {"9:5:0"};

    config.addCustomCategoryComment(
        category,
        "For more information, go to http://www.minecraftwiki.net/wiki/Potion_effects#Parameters");
    potionEffects =
        config
            .get(
                category,
                "potionEffects",
                potionEffects,
                "Format like this: 'ID:duration:amplifier'")
            .getStringList();

    for (String poisonEffect : potionEffects) {
      String[] split = poisonEffect.split(":");
      potionEffectsList.add(
          new PotionEffect(
              Integer.parseInt(split[0]),
              Integer.parseInt(split[1]) * 20,
              Integer.parseInt(split[2])));
    }
  }
  @Override
  public void init() {
    config = new Configuration(file, true);

    config.addCustomCategoryComment("general", "General Commands configuration.");
    config.save();
  }
  @Override
  public void forceSave() {
    // TODO: may have problems..
    String path = CommandRules.rulesFile.getPath();
    path = path.replace(ModuleCommands.cmddir.getPath(), "");

    config.addCustomCategoryComment("general", "General Commands configuration.");
    config.save();
  }
Esempio n. 5
0
  private void loadPerms() {
    config.addCustomCategoryComment(
        "Permissions",
        "Configure ForgeEssentials Permissions. Only implemented if Permissions module is enabled.");

    Property prop = config.get("Permissions", "verbose", false);
    prop.comment =
        "Specify if Verbose mode for Permissions module is enabled. If enabled, every permission registered is printed to the console. Only useful in debugging.";
    ModulePermissions.permsVerbose = prop.getBoolean(false);
  }
Esempio n. 6
0
  private void loadCore() {
    config.addCustomCategoryComment("Core", "Configure ForgeEssentials Core.");

    Property prop = config.get("Core", "versionCheck", true);
    prop.comment = "Check for newer versions of ForgeEssentials on load?";
    ForgeEssentials.verCheck = prop.getBoolean(true);

    prop = config.get("Core", "modlistLocation", "modlist.txt");
    prop.comment =
        "Specify the file where the modlist will be written to. This path is relative to the ForgeEssentials folder.";
    ForgeEssentials.modlistLocation = prop.value;
  }
Esempio n. 7
0
  @Subscribe
  public void preInit(FMLPreInitializationEvent ev) {
    bukkitLogger = ev.getModLog();
    bukkitLogger.setParent(FMLCommonHandler.instance().getFMLLogger());

    // ServerGUI.logger = bukkitLogger;
    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {

      FMLCommonHandler.instance()
          .getFMLLogger()
          .warning("Bukkit For Vanilla is currently only a server-side mod.");
      return;
    } else if (FMLCommonHandler.instance().getEffectiveSide() == Side.BUKKIT) {
      FMLCommonHandler.instance()
          .getFMLLogger()
          .severe("The bukkit API as a forge mod on bukkit? *mind blown*");
      return;
    }
    this.bukkitLogger.info("Initializing configuration...");
    myConfigurationFile = ev.getSuggestedConfigurationFile();

    Configuration config = new Configuration(myConfigurationFile);
    config.addCustomCategoryComment("consoleConfig", "Configuration for the server console");
    config.addCustomCategoryComment("dontTouchThis", "Things which are best left untouched");

    Property colour =
        config.get(
            "consoleConfig",
            "enablecolour",
            DedicatedServer.getServer().getGuiEnabled() ? false : true);
    colour.comment = "Enable coloured ANSI console output";
    this.allowAnsi = colour.getBoolean(false);

    Property plugins = config.get(Configuration.CATEGORY_GENERAL, "pluginDir", "plugins");
    plugins.comment = "The folder to look for plugins in.";
    this.pluginFolder = plugins.value;

    Property suuid = config.get("dontTouchThis", "serverUUID", this.genUUID());
    bukkitLogger.info("Set UUID to " + suuid.value);
    suuid.comment = "The UUID of the server. Don't touch this or it might break your plugins.";
    this.serverUUID = suuid.value;

    /*Property showAllLogs = config.get(Configuration.CATEGORY_GENERAL, "printForgeLogToGui", false);
    showAllLogs.comment = "Print stuff that's outputted to the logs to the GUI as it happens.";
    this.showAllLogs = showAllLogs.getBoolean(false);*/

    config.save();
  }
Esempio n. 8
0
  private void loadCmd() {
    config.addCustomCategoryComment(
        "Commands",
        "Configure ForgeEssentials Commands. Only implemented if Commands module is on.");

    Property prop = config.get("Commands", "motd", "Welcome to a server running ForgeEssentials");
    prop.comment = "Specify the message that greets players when they log in to your server.";
    CommandMotd.motd = prop.value;

    prop = config.get("Commands", "RulesFile", "rules.txt");
    prop.comment =
        "Specify the file where the rules will read from and written to. This path is relative to the ForgeEssentials folder.";
    CommandRules.rulesFile = new File(ForgeEssentials.FEDIR, prop.value);

    prop = config.get("Commands", "backupName", "%world_%month-%day_%hourh%min");
    prop.comment =
        "The name config for the backup zip. You can use the following variables: %day, %month, %year, %hour, %min, %world";
    CommandBackup.backupName = prop.value;
  }
Esempio n. 9
0
  private void loadModules() {
    config.addCustomCategoryComment(
        "Modules",
        "Toggles Forge Essentials modules on or off. Set to true to turn on, false to turn off.");

    Property prop = config.get("Modules", "Commands_Enabled", true);
    prop.comment =
        "Disabling this will remove non-essential commands. ie: /home, /motd, /rules, etc...";
    ModuleLauncher.cmdEnabled = prop.getBoolean(true);

    prop = config.get("Modules", "WorldControl_Enabled", true);
    prop.comment =
        "Disabling this will remove Selections and selection editing commands such as //set, //copy, etc... Note that this is force disabled if WEIntegration is loaded.";
    ModuleLauncher.wcEnabled = prop.getBoolean(true);

    prop = config.get("Modules", "Permissions_Enabled", true);
    prop.comment =
        "Disabling this will remove any and all permissions integration. Other mods that use this may be affected.";
    ModuleLauncher.permsEnabled = prop.getBoolean(true);
  }
  @Override
  public void init() {
    OutputHandler.finer("Loading chatconfigs");
    config = new Configuration(file, true);

    // config.load -- Configurations are loaded on Construction.
    config.addCustomCategoryComment("Chat", "Chat Configs");

    Property prop =
        config.get(
            "Chat",
            "chatformat",
            "%playerPrefix%groupPrefix<%username>%groupSuffix%playerSuffix %reset%message");
    prop.comment = "This String formats the Chat.";
    prop.comment +=
        "\nIf you want both a color and special formatcodes, the color needs to be first before the special code";
    prop.comment +=
        "\nExamples: '%red%username' '%red%bold%username'\nNot OK:'%bold%gold%underline%username' In this example you would get the username in gold and underline but without bold";
    prop.comment += "\nList of possible variables:";
    prop.comment +=
        "\nFor the username: %username The health of the player can be used with %health. The variable, you need for the message:%message ";
    prop.comment += "\nFor the player prefix and sufix use %playerPrefix and %playerSuffix";
    prop.comment +=
        "\nColors:%black,%darkblue,%darkgreen,%darkaqua,%darkred,%purple,%gold,%grey,%darkgrey,%indigo,\n       %green,%aqua,%red,%pink,%yellow,%white";
    prop.comment += "\nSpecial formatcodes: %random,%bold,%strike,%underline,%italics";
    prop.comment += "\nTo reset all formatcodes, you can use %reset";
    prop.comment +=
        "\nUse %rank to display a users rank as specified, %zone to specify there current zone";
    prop.comment +=
        "\nUse %groupPrefix and %groupSuffix to display the group prefixes and suffixes as specified";
    chatFormat = prop.value;

    Chat.censor =
        config
            .get("BannedWords", "censor", true, "censor the words in the censorList")
            .getBoolean(true);
    Chat.bannedWords =
        Arrays.asList(
            config.get(
                    "BannedWords",
                    "censorList",
                    new String[] {"f**k", "ass", "bitch", "shit"},
                    "List of words to be censored")
                .valueList);
    Chat.censorSymbol =
        config.get(
                "BannedWords",
                "censorSymbol",
                "#",
                "Character to replace censored words with (Use only one character in this config)")
            .value;

    config.addCustomCategoryComment(
        "Chat.groups",
        "You may put enything here that you want displaed as part of the group prefixes, suffixes, or ranks."
            + "\n {ladderName<:>Zone} will display the data for the highest priority group that the player is in that is part of the specified ladder and specified zone."
            + "\n {...<:>...} will display the data of each group the player is in in order of priority"
            + "\n you may put contsraints with ladders or zones with {...<:>zoneName} or {ladderName<:>...}"
            + "\n you may also use the color and MCFormat codes above.");
    groupPrefixFormat =
        config.get(
                "Chat.groups",
                "groupPrefix",
                "{...<:>" + ZoneManager.getGLOBAL().getZoneName() + "}")
            .value;
    groupSuffixFormat =
        config.get(
                "Chat.groups",
                "groupSuffix",
                "{...<:>" + ZoneManager.getGLOBAL().getZoneName() + "}")
            .value;
    groupRankFormat =
        config.get("Chat.groups", "rank", "[{...<:>" + ZoneManager.getGLOBAL().getZoneName() + "}]")
            .value;

    config.save();
  }