Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Change the Nation Economy
- public static void setNationEco(double value, double limit) {
- genNationFiles();
- ArrayList<String> fileName = new ArrayList<String>();
- try {
- FileInputStream fstream = new FileInputStream(Nations);
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- String strLine;
- // Load HIVE file regex2.hive
- while ((strLine = br.readLine()) != null) {
- fileName.add(strLine);
- }
- for (String s:fileName) {
- ArrayList<String> lines = new ArrayList<String>();
- File currentFile = new File(path + "/" + s);
- FileInputStream fstream2 = new FileInputStream(currentFile);
- DataInputStream in2 = new DataInputStream(fstream2);
- BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
- String strLine2;
- while ((strLine2 = br2.readLine()) != null) {
- lines.add(strLine2);
- }
- br2.close();
- for (String ss:lines) {
- if (ss.startsWith("money:")) {
- String strCheck = ss;
- strCheck.replace("money: ", "");
- double moneyVal = Double.parseDouble(strCheck);
- if (moneyVal >= moneyLimit) {
- ss = "money: " + changeAmountNation;
- }
- }
- }
- FileWriter f = null;
- // If regex0.hive exists, delete it
- if (currentFile.exists()) currentFile.delete();
- try {
- // Create the file
- currentFile.createNewFile();
- // Create the file writer
- f = new FileWriter(currentFile, true);
- // Write each file name to regex0.hive
- for (String ss:lines) {
- f.write(ss + "\r\n");
- }
- // Close the file writer
- f.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- br.close();
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement