/** Initializes MCCom base classes. (Required for SQL) */ public static void initialize() { if (Settings.dbtype.equalsIgnoreCase("mysql")) { IOH.log("MySQL is enabled for Accounts.", IOH.INFO); accounting = new MySqlAccounting(); } else { IOH.log("YML is enabled for Accounts.", IOH.INFO); accounting = new Accounting(); } }
/** Loads accounts file */ public void load() { accounts = YamlConfiguration.loadConfiguration(accountsFile); accounts.options().header("=== MineConomy Accounts ===\n\n Do not edit!\n"); accountlist = new ArrayList<String>(); accountbalance = new Hashtable<String, Double>(); accountcurrency = new Hashtable<String, String>(); accountstatus = new Hashtable<String, String>(); if (!accountsFile.exists()) { IOH.log("Accounts file not found...", IOH.INFO); accounts.set("Accounts", ""); IOH.log("Accounts file created!", IOH.INFO); save(); } IOH.log("Loading Accounts file...", IOH.INFO); reload(); IOH.log("Accounts file loaded!", IOH.INFO); }
/** Saves bank file */ public void save() { accounts.set("Accounts", ""); for (int i = 0; accountlist.size() > i; i++) { String account = accountlist.get(i); accounts.set("Accounts." + account + ".Balance", accountbalance.get(account)); accounts.set("Accounts." + account + ".Currency", accountcurrency.get(account)); accounts.set("Accounts." + account + ".Status", accountstatus.get(account)); } try { accounts.save(accountsFile); } catch (IOException e) { IOH.error("IOException", e); } reload(); }
public static void load() { lang = YamlConfiguration.loadConfiguration(langFile); lang.options().header("=== MineConomy Language ===\n\n \n"); if (!langFile.exists()) { IOH.log("Language file not found...", IOH.INFO); lang.set("Lang", ""); lang.set("Lang.Tag", langtag); lang.set("Lang.Message.Welcome Message", welcomeMessage); lang.set("Lang.Message.Welcome Account Created", messageWelcomeAccountCreated); lang.set("Lang.Message.Account Balance", messageAccountBalance); lang.set("Lang.Message.Bank Balance", messageBankBalance); lang.set("Lang.Op.Update", warnOp); lang.set("Lang.Error.Permission.Have Account", errorPermissionHaveAccount); lang.set("Lang.Error.Permission.Generic", errorPermissionGeneric); lang.set("Lang.Error.Int", errorInt); lang.set("Lang.Error.Invalid Args", errorInvalidArgs); lang.set("Lang.Error.Command.Recognition", errorCommandRecognition); lang.set("Lang.Error.Currency Not Found", errorCurrencyNotFound); lang.set("Lang.Message.Currency Set", messageCurrencySet); lang.set("Lang.Message.Exp Check", messageExpCheck); lang.set("Lang.Message.Get Balance", messageGetBalance); lang.set("Lang.Message.Set Balance", messageSetBalance); lang.set("Lang.Error.Max Debt", errorMaxDebt); lang.set("Lang.Message.Give", messageGive); lang.set("Lang.Error.They Enough", errorTheyEnough); lang.set("Lang.Error.You Enough", errorYouEnough); lang.set("Lang.Message.Payed To", messagePayedTo); lang.set("Lang.Message.Payed From", messagePayedFrom); lang.set("Lang.Message.Took", messageTook); lang.set("Lang.Message.Empty", messageEmpty); lang.set("Lang.Message.Account Created", messageCreated); lang.set("Lang.Error.Account Exists", errorAccountExists); lang.set("Lang.Message.Account Deleted", messageDeleted); lang.set("Lang.Error.No Account", errorNoAccount); lang.set("Lang.Error.No Bank", errorNoBank); lang.set("Lang.Error.No Bank Account", errorNoBankAccount); lang.set("Lang.Message.Bank Created", messageBankCreated); lang.set("Lang.Error.Bank Exists", errorBankExists); lang.set("Lang.Message.Bank Deleted", messageBankDeleted); lang.set("Lang.Error.Money Format", errorMoneyFormat); lang.set("Lang.Error.Bank Account Exists", errorBankAccountExists); lang.set("Lang.Message.Bank Account Created", messageBankAccountCreated); lang.set("Lang.Message.Bank Account Deleted", messageBankAccountDeleted); lang.set("Lang.Message.Empty Bank Account", messageEmptyBankAccount); lang.set("Lang.Message.Bank Renamed", messageBankRenamed); lang.set("Lang.Message.Get Bank Account", messageGetBankAccount); lang.set("Lang.Message.Set Bank Account", messageSetBankAccount); lang.set("Lang.Message.Bank Account Renamed", messageBankAccountRenamed); lang.set("Lang.Message.Bank Account Deposit", messageBankAccountDeposit); lang.set("Lang.Message.Bank Account Withdraw", messageBankAccountWithdraw); lang.set("Lang.Message.Transaction Complete", messageTransactionComplete); lang.set("Lang.Error.No Physical Currency", errorNoPhysicalCurrency); lang.set("Lang.Error.Exp Enough", errorExpEnough); lang.set("Lang.Message.Help.Page 1", messageHelp1); lang.set("Lang.Message.Help.Page 2", messageHelp2); lang.set("Lang.Message.Help.Page 3", messageHelp3); IOH.log("Language file created!", IOH.INFO); save(); } IOH.log("Loading Language file...", IOH.INFO); reload(); IOH.log("Language file loaded!", IOH.INFO); }
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(); }