Esempio n. 1
0
  public static void save() {
    lang.set("Lang", "");
    lang.set("Lang.Tag", MCFormat.decolor(langtag));
    lang.set("Lang.Message.Welcome Message", MCFormat.decolor(welcomeMessage));
    lang.set(
        "Lang.Message.Welcome Account Created", MCFormat.decolor(messageWelcomeAccountCreated));
    lang.set("Lang.Message.Account Balance", MCFormat.decolor(messageAccountBalance));
    lang.set("Lang.Message.Bank Balance", MCFormat.decolor(messageBankBalance));
    lang.set("Lang.Op.Update", MCFormat.decolor(warnOp));
    lang.set("Lang.Error.Permission.Have Account", MCFormat.decolor(errorPermissionHaveAccount));
    lang.set("Lang.Error.Permission.Generic", MCFormat.decolor(errorPermissionGeneric));
    lang.set("Lang.Error.Int", MCFormat.decolor(errorInt));
    lang.set("Lang.Error.Invalid Args", MCFormat.decolor(errorInvalidArgs));
    lang.set("Lang.Error.Command.Recognition", MCFormat.decolor(errorCommandRecognition));
    lang.set("Lang.Error.Currency Not Found", MCFormat.decolor(errorCurrencyNotFound));
    lang.set("Lang.Message.Currency Set", MCFormat.decolor(messageCurrencySet));
    lang.set("Lang.Message.Exp Check", MCFormat.decolor(messageExpCheck));
    lang.set("Lang.Message.Get Balance", MCFormat.decolor(messageGetBalance));
    lang.set("Lang.Message.Set Balance", MCFormat.decolor(messageSetBalance));
    lang.set("Lang.Error.Max Debt", MCFormat.decolor(errorMaxDebt));
    lang.set("Lang.Message.Give", MCFormat.decolor(messageGive));
    lang.set("Lang.Error.They Enough", MCFormat.decolor(errorTheyEnough));
    lang.set("Lang.Error.You Enough", MCFormat.decolor(errorYouEnough));
    lang.set("Lang.Message.Payed To", MCFormat.decolor(messagePayedTo));
    lang.set("Lang.Message.Payed From", MCFormat.decolor(messagePayedFrom));
    lang.set("Lang.Message.Took", MCFormat.decolor(messageTook));
    lang.set("Lang.Message.Empty", MCFormat.decolor(messageEmpty));
    lang.set("Lang.Message.Account Created", MCFormat.decolor(messageCreated));
    lang.set("Lang.Error.Account Exists", MCFormat.decolor(errorAccountExists));
    lang.set("Lang.Message.Account Deleted", MCFormat.decolor(messageDeleted));
    lang.set("Lang.Error.No Account", MCFormat.decolor(errorNoAccount));
    lang.set("Lang.Error.No Bank", MCFormat.decolor(errorNoBank));
    lang.set("Lang.Error.No Bank Account", MCFormat.decolor(errorNoBankAccount));
    lang.set("Lang.Message.Bank Created", MCFormat.decolor(messageBankCreated));
    lang.set("Lang.Error.Bank Exists", MCFormat.decolor(errorBankExists));
    lang.set("Lang.Message.Bank Deleted", MCFormat.decolor(messageBankDeleted));
    lang.set("Lang.Error.Money Format", MCFormat.decolor(errorMoneyFormat));
    lang.set("Lang.Error.Bank Account Exists", MCFormat.decolor(errorBankAccountExists));
    lang.set("Lang.Message.Bank Account Created", MCFormat.decolor(messageBankAccountCreated));
    lang.set("Lang.Message.Bank Account Deleted", MCFormat.decolor(messageBankAccountDeleted));
    lang.set("Lang.Message.Empty Bank Account", MCFormat.decolor(messageEmptyBankAccount));
    lang.set("Lang.Message.Bank Renamed", MCFormat.decolor(messageBankRenamed));
    lang.set("Lang.Message.Get Bank Account", MCFormat.decolor(messageGetBankAccount));
    lang.set("Lang.Message.Set Bank Account", MCFormat.decolor(messageSetBankAccount));
    lang.set("Lang.Message.Bank Account Renamed", MCFormat.decolor(messageBankAccountRenamed));
    lang.set("Lang.Message.Bank Account Deposit", MCFormat.decolor(messageBankAccountDeposit));
    lang.set("Lang.Message.Bank Account Withdraw", MCFormat.decolor(messageBankAccountWithdraw));
    lang.set("Lang.Message.Transaction Complete", MCFormat.decolor(messageTransactionComplete));
    lang.set("Lang.Error.No Physical Currency", MCFormat.decolor(errorNoPhysicalCurrency));
    lang.set("Lang.Error.Exp Enough", MCFormat.decolor(errorExpEnough));
    lang.set("Lang.Message.Help.Page 1", MCFormat.decolor(messageHelp1));
    lang.set("Lang.Message.Help.Page 2", MCFormat.decolor(messageHelp2));
    lang.set("Lang.Message.Help.Page 3", MCFormat.decolor(messageHelp3));

    try {
      lang.save(langFile);
    } catch (IOException e) {
      IOH.error("IOException", e);
    }

    reload();
  }
Esempio n. 2
0
  public static String parse(String message, String[] args) {
    if (message.equals(welcomeMessage)) {
      message = message.replace("%player%", args[0]);
      message = message.replace("%currency%", args[1]);

      double balance = Double.parseDouble(args[2]);

      if (balance >= 0) {
        message = message.replace("%pos-balance%", MCFormat.format(balance));
        message = message.replace("%neg-balance%", "");
      } else {
        message = message.replace("%pos-balance%", "");
        message = message.replace("%neg-balance%", MCFormat.format(balance));
      }
    } else if (message.equals(messageAccountBalance)) {
      message = message.replace("%currency%", args[0]);

      double balance = Double.parseDouble(args[1]);

      if (balance >= 0) {
        message = message.replace("%pos-balance%", MCFormat.format(balance));
        message = message.replace("%neg-balance%", "");
      } else {
        message = message.replace("%pos-balance%", "");
        message = message.replace("%neg-balance%", MCFormat.format(balance));
      }
    } else if (message.equals(messageBankBalance)) {
      message = message.replace("%bank%", args[0]);

      double balance = Double.parseDouble(args[1]);

      if (balance >= 0) {
        message = message.replace("%pos-balance%", MCFormat.format(balance));
        message = message.replace("%neg-balance%", "");
      } else {
        message = message.replace("%pos-balance%", "");
        message = message.replace("%neg-balance%", MCFormat.format(balance));
      }
    } else if (message.equals(messageCurrencySet)) {
      message = message.replace("%player%", args[0]);
      message = message.replace("%currency%", args[1]);
    } else if (message.equals(messageExpCheck)) {
      message = message.replace("%exp%", args[0]);
    } else if (message.equals(messageGetBalance) || message.equals(messageSetBalance)) {
      message = message.replace("%player%", args[0]);
      message = message.replace("%balance%", MCFormat.format(Double.parseDouble(args[1])));
      message = message.replace("%currency%", args[2]);
    } else if (message.equals(messageGive)) {
      message = message.replace("%player%", args[0]);
      message = message.replace("%amount%", MCFormat.format(Double.parseDouble(args[1])));
      message = message.replace("%currency%", args[2]);
    } else if (message.equals(errorTheyEnough)) {
      message = message.replace("%player%", args[0]);
    } else if (message.equals(messagePayedTo)) {
      message = message.replace("%amount%", MCFormat.format(Double.parseDouble(args[0])));
      message = message.replace("%currency%", args[1]);
      message = message.replace("%player%", args[2]);
    } else if (message.equals(messagePayedFrom)) {
      message = message.replace("%player%", args[0]);
      message = message.replace("%amount%", MCFormat.format(Double.parseDouble(args[1])));
      message = message.replace("%currency%", args[2]);
    } else if (message.equals(messageTook)) {
      message = message.replace("%amount%", MCFormat.format(Double.parseDouble(args[0])));
      message = message.replace("%currency%", args[1]);
      message = message.replace("%account%", args[2]);
    } else if (message.equals(messageCreated)
        || message.equals(messageDeleted)
        || message.equals(messageEmpty)
        || message.equals(errorAccountExists)) {
      message = message.replace("%account%", args[0]);
    } else if (message.equals(errorNoBank)
        || message.equals(errorNoBankAccount)
        || message.equals(messageBankCreated)
        || message.equals(errorBankExists)
        || message.equals(messageBankDeleted)) {
      message = message.replace("%bank%", args[0]);
    } else if (message.equals(errorBankAccountExists)
        || message.equals(messageBankAccountDeleted)
        || message.equals(messageBankAccountCreated)
        || message.equals(messageEmptyBankAccount)) {
      message = message.replace("%account%", args[0]);
      message = message.replace("%bank%", args[1]);
    } else if (message.equals(messageBankRenamed)) {
      message = message.replace("%bank%", args[0]);
      message = message.replace("%oldbank%", args[1]);
    } else if (message.equals(messageGetBankAccount) || message.equals(messageSetBankAccount)) {
      message = message.replace("%account%", args[0]);
      message = message.replace("%bank%", args[1]);
      message = message.replace("%balance%", args[2]);
    } else if (message.equals(messageBankAccountRenamed)) {
      message = message.replace("%account%", args[0]);
      message = message.replace("%bank%", args[1]);
      message = message.replace("%oldaccount%", args[2]);
      message = message.replace("%oldbank%", args[3]);
    } else if (message.equals(messageBankAccountDeposit)
        || message.equals(messageBankAccountWithdraw)) {
      message = message.replace("%bank%", args[0]);
      message = message.replace("%account%", args[1]);
      message = message.replace("%amount%", MCFormat.format(Double.parseDouble(args[2])));
    }

    return MCFormat.color(message);
  }
Esempio n. 3
0
  public static void reload() {
    lang = YamlConfiguration.loadConfiguration(langFile);

    welcomeMessage = MCFormat.color(lang.getString("Lang.Message.Welcome Message", welcomeMessage));
    if (welcomeMessage.equals("")) {
      displayWelcome = false;
    } else {
      displayWelcome = true;
    }

    langtag = MCFormat.color(lang.getString("Lang.Tag", langtag));
    messageWelcomeAccountCreated =
        MCFormat.color(
            lang.getString("Lang.Message.Welcome Account Created", messageWelcomeAccountCreated));
    messageAccountBalance =
        MCFormat.color(lang.getString("Lang.Message.Account Balance", messageAccountBalance));
    messageBankBalance =
        MCFormat.color(lang.getString("Lang.Message.Bank Balance", messageBankBalance));
    warnOp = MCFormat.color(lang.getString("Lang.Op.Update", warnOp));
    errorPermissionHaveAccount =
        MCFormat.color(
            lang.getString("Lang.Error.Permission.Have Account", errorPermissionHaveAccount));
    errorPermissionGeneric =
        MCFormat.color(lang.getString("Lang.Error.Permission.Generic", errorPermissionGeneric));
    errorInt = MCFormat.color(lang.getString("Lang.Error.Int", errorInt));
    errorInvalidArgs = MCFormat.color(lang.getString("Lang.Error.Invalid Args", errorInvalidArgs));
    errorCommandRecognition =
        MCFormat.color(lang.getString("Lang.Error.Command.Recognition", errorCommandRecognition));
    errorCurrencyNotFound =
        MCFormat.color(lang.getString("Lang.Error.Currency Not Found", errorCurrencyNotFound));
    messageCurrencySet =
        MCFormat.color(lang.getString("Lang.Message.Currency Set", messageCurrencySet));
    messageExpCheck = MCFormat.color(lang.getString("Lang.Message.Exp Check", messageExpCheck));
    messageGetBalance =
        MCFormat.color(lang.getString("Lang.Message.Get Balance", messageGetBalance));
    messageSetBalance =
        MCFormat.color(lang.getString("Lang.Message.Set Balance", messageSetBalance));
    errorMaxDebt = MCFormat.color(lang.getString("Lang.Error.Max Debt", errorMaxDebt));
    messageGive = MCFormat.color(lang.getString("Lang.Message.Give", messageGive));
    errorTheyEnough = MCFormat.color(lang.getString("Lang.Error.They Enough", errorTheyEnough));
    errorYouEnough = MCFormat.color(lang.getString("Lang.Error.You Enough", errorYouEnough));
    messagePayedTo = MCFormat.color(lang.getString("Lang.Message.Payed To", messagePayedTo));
    messagePayedFrom = MCFormat.color(lang.getString("Lang.Message.Payed From", messagePayedFrom));
    messageTook = MCFormat.color(lang.getString("Lang.Message.Took", messageTook));
    messageEmpty = MCFormat.color(lang.getString("Lang.Message.Empty", messageEmpty));
    messageCreated = MCFormat.color(lang.getString("Lang.Message.Account Created", messageCreated));
    errorAccountExists =
        MCFormat.color(lang.getString("Lang.Error.Account Exists", errorAccountExists));
    messageDeleted = MCFormat.color(lang.getString("Lang.Message.Account Deleted", messageDeleted));
    errorNoAccount = MCFormat.color(lang.getString("Lang.Error.No Account", errorNoAccount));
    errorNoBank = MCFormat.color(lang.getString("Lang.Error.No Bank", errorNoBank));
    errorNoBankAccount =
        MCFormat.color(lang.getString("Lang.Error.No Bank Account", errorNoBankAccount));
    messageBankCreated =
        MCFormat.color(lang.getString("Lang.Message.Bank Created", messageBankCreated));
    errorBankExists = MCFormat.color(lang.getString("Lang.Error.Bank Exists", errorBankExists));
    messageBankDeleted =
        MCFormat.color(lang.getString("Lang.Message.Bank Deleted", messageBankDeleted));
    errorMoneyFormat = MCFormat.color(lang.getString("Lang.Error.Money Format", errorMoneyFormat));
    errorBankAccountExists =
        MCFormat.color(lang.getString("Lang.Error.Bank Account Exists", errorBankAccountExists));
    messageBankAccountCreated =
        MCFormat.color(
            lang.getString("Lang.Message.Bank Account Created", messageBankAccountCreated));
    messageBankAccountDeleted =
        MCFormat.color(
            lang.getString("Lang.Message.Bank Account Deleted", messageBankAccountDeleted));
    messageEmptyBankAccount =
        MCFormat.color(lang.getString("Lang.Message.Empty Bank Account", messageEmptyBankAccount));
    messageBankRenamed =
        MCFormat.color(lang.getString("Lang.Message.Bank Renamed", messageBankRenamed));
    messageGetBankAccount =
        MCFormat.color(lang.getString("Lang.Message.Get Bank Account", messageGetBankAccount));
    messageSetBankAccount =
        MCFormat.color(lang.getString("Lang.Message.Set Bank Account", messageSetBankAccount));
    messageBankAccountRenamed =
        MCFormat.color(
            lang.getString("Lang.Message.Bank Account Renamed", messageBankAccountRenamed));
    messageBankAccountDeposit =
        MCFormat.color(
            lang.getString("Lang.Message.Bank Account Deposit", messageBankAccountDeposit));
    messageBankAccountWithdraw =
        MCFormat.color(
            lang.getString("Lang.Message.Bank Account Withdraw", messageBankAccountWithdraw));
    messageTransactionComplete =
        MCFormat.color(
            lang.getString("Lang.Message.Transaction Complete", messageTransactionComplete));
    errorNoPhysicalCurrency =
        MCFormat.color(lang.getString("Lang.Error.No Physical Currency", errorNoPhysicalCurrency));
    errorExpEnough = MCFormat.color(lang.getString("Lang.Error.Exp Enough", errorExpEnough));
    messageHelp1 = MCFormat.color(lang.getString("Lang.Message.Help.Page 1", messageHelp1));
    messageHelp2 = MCFormat.color(lang.getString("Lang.Message.Help.Page 2", messageHelp2));
    messageHelp3 = MCFormat.color(lang.getString("Lang.Message.Help.Page 3", messageHelp3));

    tag = ChatColor.GREEN + "[" + langtag + "] ";
  }