Advertisement
Jnk1296

SEcReT (Server Economy Reset Tool)

Mar 30th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 21.34 KB | None | 0 0
  1. package net.jnk.SEcReT;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.DataInputStream;
  5. import java.io.File;
  6. import java.io.FileInputStream;
  7. import java.io.FileWriter;
  8. import java.io.FilenameFilter;
  9. import java.io.InputStreamReader;
  10. import java.util.ArrayList;
  11. import java.util.Scanner;
  12.  
  13. public final class SEcReT {
  14.    
  15.     /* Server Economy Reset Tool (SEcReT v1.0) By Jnk1296. Copyright © 2013 all rights reserved.
  16.      * This software is subject to the terms and conditions of the GNU GPL V3.0 License.
  17.      * GNU GPL V3.0: http://www.gnu.org/licenses/gpl.html
  18.      * */
  19.    
  20.     // Information Variables
  21.     public static final String verString = "v1.0_Release";
  22.     public static final String author = "Jnk1296 (Jacob Keep)";
  23.    
  24.     // Value Changing Variables
  25.     private static double changeAmountPlayer;
  26.     private static double changeAmountTown;
  27.     private static double changeAmountNation;
  28.    
  29.     private static double moneyLimit = -1;
  30.    
  31.     // Path Directories
  32.     public static File path = new File(System.getProperty("user.dir") + "/Data");
  33.    
  34.     public static File Users = new File(System.getProperty("user.dir") +"/regex0.hive");
  35.     public static File Towns = new File(System.getProperty("user.dir") +"/regex1.hive");
  36.     public static File Nations = new File(System.getProperty("user.dir") +"/regex2.hive");
  37.    
  38.     // Statistic Variables
  39.     public static int finalCount = 0;
  40.     public static double finalTime = 0;
  41.    
  42.     public static void main(String[] args) {
  43.         boolean hasParameters = false;
  44.        
  45.         // Check for parameters
  46.         try {
  47.             if (args[0] != null) hasParameters = true;
  48.         } catch (Exception e) {
  49.             hasParameters = false;
  50.         }
  51.        
  52.         if (hasParameters) {
  53.            
  54.             // Change Player Economy
  55.             if (args[0].equalsIgnoreCase("-player")) {
  56.                 try {
  57.                     if (args[1] != null) {
  58.                         try {
  59.                             changeAmountPlayer = Double.parseDouble(args[1]);
  60.                         } catch (NumberFormatException ee) {
  61.                             numFormErr(args[0]);
  62.                         }
  63.                        
  64.                         try {
  65.                             if (args[2] != null) {
  66.                                 try {
  67.                                     moneyLimit = Double.parseDouble(args[2]);
  68.                                 } catch (NumberFormatException ee) {
  69.                                     numFormErr(args[0]);
  70.                                 }
  71.                                
  72.                                 commandWarn();
  73.                             }
  74.                         } catch (Exception e) {
  75.                             noSetValWarn();
  76.                         }
  77.                        
  78.                         waitMsg();
  79.                         setPlayerEco(changeAmountPlayer, moneyLimit);
  80.                         report(finalCount, finalTime);
  81.                         opSuccess();
  82.                     }
  83.                 } catch (Exception e) {
  84.                     argNumErr(args[0]);
  85.                 }
  86.                
  87.             // Change Town Economy
  88.             } else if (args[0].equalsIgnoreCase("-town")) {
  89.                 try {
  90.                     if (args[1] != null) {
  91.                         try {
  92.                             changeAmountTown = Double.parseDouble(args[1]);
  93.                         } catch (NumberFormatException ee) {
  94.                             numFormErr(args[0]);
  95.                         }
  96.                        
  97.                         try {
  98.                             if (args[2] != null) {
  99.                                 try {
  100.                                     moneyLimit = Double.parseDouble(args[2]);
  101.                                 } catch (NumberFormatException ee) {
  102.                                     numFormErr(args[0]);
  103.                                 }
  104.                                
  105.                                 commandWarn();
  106.                             }
  107.                         } catch (Exception e) {
  108.                             noSetValWarn();
  109.                         }
  110.                        
  111.                         waitMsg();
  112.                         setTownEco(changeAmountTown, moneyLimit);
  113.                         report(finalCount, finalTime);
  114.                         opSuccess();
  115.                     }
  116.                 } catch (Exception e) {
  117.                     argNumErr(args[0]);
  118.                 }
  119.                
  120.             // Change Nation Economy
  121.             } else if (args[0].equalsIgnoreCase("-nation")) {
  122.                 try {
  123.                     if (args[1] != null) {
  124.                         try {
  125.                             changeAmountNation = Double.parseDouble(args[1]);
  126.                         } catch (NumberFormatException ee) {
  127.                             numFormErr(args[0]);
  128.                         }
  129.                        
  130.                         try {
  131.                             if (args[2] != null) {
  132.                                 try {
  133.                                     moneyLimit = Double.parseDouble(args[2]);
  134.                                 } catch (NumberFormatException ee) {
  135.                                     numFormErr(args[0]);
  136.                                 }
  137.                                
  138.                                 commandWarn();
  139.                             }
  140.                         } catch (Exception e) {
  141.                             noSetValWarn();
  142.                         }
  143.                        
  144.                         waitMsg();
  145.                         setNationEco(changeAmountNation, moneyLimit);
  146.                         report(finalCount, finalTime);
  147.                         opSuccess();
  148.                     }
  149.                 } catch (Exception e) {
  150.                     argNumErr(args[0]);
  151.                 }
  152.                
  153.             // Change Player and Town Economy
  154.             } else if (args[0].equalsIgnoreCase("-low")) {
  155.                 try {
  156.                     if (args[1] != null) {
  157.                         try {
  158.                             changeAmountPlayer = Double.parseDouble(args[1]);
  159.                             changeAmountTown = Double.parseDouble(args[1]);
  160.                         } catch (NumberFormatException ee) {
  161.                             numFormErr(args[0]);
  162.                         }
  163.                        
  164.                         try {
  165.                             if (args[2] != null) {
  166.                                 try {
  167.                                     moneyLimit = Double.parseDouble(args[2]);
  168.                                 } catch (NumberFormatException ee) {
  169.                                     numFormErr(args[0]);
  170.                                 }
  171.                                
  172.                                 commandWarn();
  173.                             }
  174.                         } catch (Exception e) {
  175.                             noSetValWarn();
  176.                         }
  177.                        
  178.                         waitMsg();
  179.                         setPlayerEco(changeAmountPlayer, moneyLimit);
  180.                         setTownEco(changeAmountTown, moneyLimit);
  181.                         report(finalCount, finalTime);
  182.                         opSuccess();
  183.                     }
  184.                 } catch (Exception e) {
  185.                     argNumErr(args[0]);
  186.                 }
  187.                
  188.             // Change Town and Nation Economy
  189.             } else if (args[0].equalsIgnoreCase("-high")) {
  190.                 try {
  191.                     if (args[1] != null) {
  192.                         try {
  193.                             changeAmountTown = Double.parseDouble(args[1]);
  194.                             changeAmountNation = Double.parseDouble(args[1]);
  195.                         } catch (NumberFormatException ee) {
  196.                             numFormErr(args[0]);
  197.                         }
  198.                        
  199.                         try {
  200.                             if (args[2] != null) {
  201.                                 try {
  202.                                     moneyLimit = Double.parseDouble(args[2]);
  203.                                 } catch (NumberFormatException ee) {
  204.                                     numFormErr(args[0]);
  205.                                 }
  206.                                
  207.                                 commandWarn();
  208.                             }
  209.                         } catch (Exception e) {
  210.                             noSetValWarn();
  211.                         }
  212.                        
  213.                         waitMsg();
  214.                         setTownEco(changeAmountTown, moneyLimit);
  215.                         setNationEco(changeAmountNation, moneyLimit);
  216.                         report(finalCount, finalTime);
  217.                         opSuccess();
  218.                     }
  219.                 } catch (Exception e) {
  220.                     argNumErr(args[0]);
  221.                 }
  222.                
  223.             // Change Entire Economy
  224.             } else if (args[0].equalsIgnoreCase("-all")) {
  225.                 try {
  226.                     if (args[1] != null) {
  227.                         try {
  228.                             changeAmountPlayer = Double.parseDouble(args[1]);
  229.                             changeAmountTown = Double.parseDouble(args[1]);
  230.                             changeAmountNation = Double.parseDouble(args[1]);
  231.                         } catch (NumberFormatException ee) {
  232.                             numFormErr(args[0]);
  233.                         }
  234.                        
  235.                         try {
  236.                             if (args[2] != null) {
  237.                                 try {
  238.                                     moneyLimit = Double.parseDouble(args[2]);
  239.                                 } catch (NumberFormatException ee) {
  240.                                     numFormErr(args[0]);
  241.                                 }
  242.                                
  243.                                 commandWarn();
  244.                             }
  245.                         } catch (Exception e) {
  246.                             noSetValWarn();
  247.                         }
  248.                        
  249.                         waitMsg();
  250.                         setPlayerEco(changeAmountPlayer, moneyLimit);
  251.                         setTownEco(changeAmountTown, moneyLimit);
  252.                         setNationEco(changeAmountNation, moneyLimit);
  253.                         report(finalCount, finalTime);
  254.                         opSuccess();
  255.                     }
  256.                 } catch (Exception e) {
  257.                     argNumErr(args[0]);
  258.                 }
  259.            
  260.             // Display Command Help
  261.             } else if (args[0].equalsIgnoreCase("-help")) {
  262.                 displayHelp();
  263.            
  264.             // Display Program Information
  265.             } else if (args[0].equalsIgnoreCase("-about")) {
  266.                 displayInfo();
  267.                
  268.             // All Else
  269.             } else {
  270.                 System.out.println("Improper syntax or invalid command.");
  271.                 System.exit(0);
  272.             }
  273.            
  274.         // If no parameters were specified, tell the user to look at the help command
  275.         } else if (!hasParameters) {
  276.             displayInfo();
  277.             sugHelp();
  278.         }
  279.     }
  280.    
  281.     public static void genPlayerFiles() {
  282.         // Create Regex0.hive (Hive storage of all player.yml files for program access)
  283.         FileWriter f = null;
  284.        
  285.         // If regex0.hive exists, delete it
  286.         if (Users.exists()) Users.delete();
  287.        
  288.         try {
  289.             // Create the file
  290.             Users.createNewFile();
  291.            
  292.             // Create the file writer
  293.             f = new FileWriter(Users, true);
  294.            
  295.             // Create a file array which holds all files found in the directory which have the extension *.yml
  296.             File[] files = path.listFiles(new FilenameFilter() {
  297.                 @Override
  298.                 public boolean accept(File pathUsers, String name) {
  299.                     if (name.toLowerCase().endsWith(".yml") && !name.toLowerCase().startsWith("nation_") && !name.toLowerCase().startsWith("town_")) {
  300.                         return true;
  301.                     } else {
  302.                         return false;
  303.                     }
  304.                 }
  305.             });
  306.            
  307.             // Write each file name to regex0.hive
  308.             for (int i = 0; i < files.length; i++) {
  309.                 f.write(files[i].getName() + "\r\n");
  310.             }
  311.            
  312.             // Close the file writer
  313.             f.close();
  314.         } catch (Exception e) {
  315.             e.printStackTrace();
  316.         }
  317.     }
  318.    
  319.     public static void genTownFiles() {
  320.         // Create Regex1.hive (Hive storage of all town.yml files for program access)
  321.         FileWriter f = null;
  322.        
  323.         // If regex1.hive exists, delete it
  324.         if (Towns.exists()) Towns.delete();
  325.        
  326.         try {
  327.             // Create the file
  328.             Towns.createNewFile();
  329.            
  330.             // Create the file writer
  331.             f = new FileWriter(Towns, true);
  332.            
  333.             // Create a file array which holds all files found in the directory which have the extension *.yml
  334.             File[] files = path.listFiles(new FilenameFilter() {
  335.                 @Override
  336.                 public boolean accept(File pathTowns, String name) {
  337.                     if (name.toLowerCase().endsWith(".yml") && name.toLowerCase().startsWith("town_")) {
  338.                         return true;
  339.                     } else {
  340.                         return false;
  341.                     }
  342.                 }
  343.             });
  344.            
  345.             // Write each file name to regex1.hive
  346.             for (int i = 0; i < files.length; i++) {
  347.                 f.write(files[i].getName() + "\r\n");
  348.             }
  349.            
  350.             // Close the file writer
  351.             f.close();
  352.         } catch (Exception e) {
  353.             e.printStackTrace();
  354.         }
  355.     }
  356.    
  357.     public static void genNationFiles() {
  358.         // Create Regex2.hive (Hive storage of all Nation.yml files for program access)
  359.         FileWriter f = null;
  360.        
  361.         // If regex2.hive exists, delete it
  362.         if (Nations.exists()) Nations.delete();
  363.        
  364.         try {
  365.             // Create the file
  366.             Nations.createNewFile();
  367.            
  368.             // Create the file writer
  369.             f = new FileWriter(Nations, true);
  370.            
  371.             // Create a file array which holds all files found in the directory which have the extension *.yml
  372.             File[] files = path.listFiles(new FilenameFilter() {
  373.                 @Override
  374.                 public boolean accept(File pathNations, String name) {
  375.                     if (name.toLowerCase().endsWith(".yml") && name.toLowerCase().startsWith("nation_")) {
  376.                         return true;
  377.                     } else {
  378.                         return false;
  379.                     }
  380.                 }
  381.             });
  382.            
  383.             // Write each file name to regex2.hive
  384.             for (int i = 0; i < files.length; i++) {
  385.                 f.write(files[i].getName() + "\r\n");
  386.             }
  387.            
  388.             // Close the file writer
  389.             f.close();
  390.         } catch (Exception e) {
  391.             e.printStackTrace();
  392.         }
  393.     }
  394.    
  395.     // Change the Player Economy
  396.     public static void setPlayerEco(double value, double limit) {
  397.         // Check starting time
  398.         double startTime = System.currentTimeMillis();
  399.        
  400.         // Generate regex0.hive
  401.         genPlayerFiles();
  402.         ArrayList<String> fileName = new ArrayList<String>();
  403.        
  404.         // Create File Reader
  405.         try {
  406.             FileInputStream fstream = new FileInputStream(Users);
  407.             DataInputStream in = new DataInputStream(fstream);
  408.             BufferedReader br = new BufferedReader(new InputStreamReader(in));
  409.             String strLine;
  410.            
  411.             // Load file names from regex0.hive
  412.             while ((strLine = br.readLine()) != null) {
  413.                 fileName.add(strLine);
  414.             }
  415.            
  416.             // Iterate through each file in the hive
  417.             for (String s:fileName) {
  418.                 ArrayList<String> lines = new ArrayList<String>();
  419.                 File currentFile = new File(path + "/" + s);
  420.                
  421.                 // Create File Reader
  422.                 FileInputStream fstream2 = new FileInputStream(currentFile);
  423.                 DataInputStream in2 = new DataInputStream(fstream2);
  424.                 BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
  425.                 String strLine2;
  426.                
  427.                 // Store contents of file to ArrayList
  428.                 while ((strLine2 = br2.readLine()) != null) {
  429.                     lines.add(strLine2);
  430.                 }
  431.                
  432.                 br2.close();
  433.                
  434.                 // Check for the "money: " line, change it to specified amount if higher than moneyLimit.
  435.                 int count = 0;
  436.                 for (String ss:lines) {
  437.                     if (ss.startsWith("money:")) {
  438.                         String strCheck = ss;
  439.                         strCheck = strCheck.replace("money: ", "");
  440.                         double moneyVal = Double.parseDouble(strCheck);
  441.                        
  442.                         if (moneyVal > moneyLimit) {
  443.                             lines.set(count, "money: " + changeAmountPlayer);
  444.                         }
  445.                        
  446.                         // Report to statistics
  447.                         finalCount++;
  448.                     }
  449.                    
  450.                     count++;
  451.                 }
  452.                
  453.                 // Create File Writer
  454.                 FileWriter f = null;
  455.                
  456.                 // If current file exists, delete it
  457.                 if (currentFile.exists()) currentFile.delete();
  458.                
  459.                 try {
  460.                     // Create the file
  461.                     currentFile.createNewFile();
  462.                    
  463.                     // Create the file writer
  464.                     f = new FileWriter(currentFile, true);
  465.                    
  466.                     // Write current file
  467.                     for (String ss:lines) {
  468.                         f.write(ss + "\r\n");
  469.                     }
  470.                    
  471.                     // Close the file writer
  472.                     f.close();
  473.                    
  474.                 } catch (Exception e) {
  475.                     e.printStackTrace();
  476.                 }
  477.                
  478.             }
  479.            
  480.             // Calculate and Report to Statistics
  481.             double endTime = System.currentTimeMillis();
  482.             finalTime += (endTime - startTime) / 1000;
  483.            
  484.             br.close();
  485.         } catch (Exception e) {
  486.             e.printStackTrace();
  487.             System.exit(0);
  488.         }
  489.     }
  490.    
  491.     // Change the Town Economy
  492.     public static void setTownEco(double value, double limit) {
  493.         // Check starting time
  494.         double startTime = System.currentTimeMillis();
  495.        
  496.         // Generate regex1.hive
  497.         genTownFiles();
  498.         ArrayList<String> fileName = new ArrayList<String>();
  499.        
  500.         // Create File Reader
  501.         try {
  502.             FileInputStream fstream = new FileInputStream(Towns);
  503.             DataInputStream in = new DataInputStream(fstream);
  504.             BufferedReader br = new BufferedReader(new InputStreamReader(in));
  505.             String strLine;
  506.            
  507.             // Load file names from regex1.hive
  508.             while ((strLine = br.readLine()) != null) {
  509.                 fileName.add(strLine);
  510.             }
  511.            
  512.             // Iterate through each file in the hive
  513.             for (String s:fileName) {
  514.                 ArrayList<String> lines = new ArrayList<String>();
  515.                 File currentFile = new File(path + "/" + s);
  516.                
  517.                 // Create File Reader
  518.                 FileInputStream fstream2 = new FileInputStream(currentFile);
  519.                 DataInputStream in2 = new DataInputStream(fstream2);
  520.                 BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
  521.                 String strLine2;
  522.                
  523.                 // Store contents of file to ArrayList
  524.                 while ((strLine2 = br2.readLine()) != null) {
  525.                     lines.add(strLine2);
  526.                 }
  527.                
  528.                 br2.close();
  529.                
  530.                 // Check for the "money: " line, change it to specified amount if higher than moneyLimit.
  531.                 int count = 0;
  532.                 for (String ss:lines) {
  533.                     if (ss.startsWith("money:")) {
  534.                         String strCheck = ss;
  535.                         strCheck = strCheck.replace("money: ", "");
  536.                         double moneyVal = Double.parseDouble(strCheck);
  537.                        
  538.                         if (moneyVal > moneyLimit) {
  539.                             lines.set(count, "money: " + changeAmountTown);
  540.                         }
  541.                        
  542.                         // Report to statistics
  543.                         finalCount++;
  544.                     }
  545.                    
  546.                     count++;
  547.                 }
  548.                
  549.                 // Create File Writer
  550.                 FileWriter f = null;
  551.                
  552.                 // If current file exists, delete it
  553.                 if (currentFile.exists()) currentFile.delete();
  554.                
  555.                 try {
  556.                     // Create the file
  557.                     currentFile.createNewFile();
  558.                    
  559.                     // Create the file writer
  560.                     f = new FileWriter(currentFile, true);
  561.                    
  562.                     // Write current file
  563.                     for (String ss:lines) {
  564.                         f.write(ss + "\r\n");
  565.                     }
  566.                    
  567.                     // Close the file writer
  568.                     f.close();
  569.                    
  570.                 } catch (Exception e) {
  571.                     e.printStackTrace();
  572.                 }
  573.                
  574.             }
  575.            
  576.             // Calculate and Report to Statistics
  577.             double endTime = System.currentTimeMillis();
  578.             finalTime += (endTime - startTime) / 1000;
  579.            
  580.             br.close();
  581.         } catch (Exception e) {
  582.             e.printStackTrace();
  583.             System.exit(0);
  584.         }
  585.     }
  586.  
  587.     // Change the Nation Economy
  588.     public static void setNationEco(double value, double limit) {
  589.         // Check starting time
  590.         double startTime = System.currentTimeMillis();
  591.        
  592.         // Generate regex2.hive
  593.         genNationFiles();
  594.         ArrayList<String> fileName = new ArrayList<String>();
  595.        
  596.         // Create File Reader
  597.         try {
  598.             FileInputStream fstream = new FileInputStream(Nations);
  599.             DataInputStream in = new DataInputStream(fstream);
  600.             BufferedReader br = new BufferedReader(new InputStreamReader(in));
  601.             String strLine;
  602.            
  603.             // Load file names from regex2.hive
  604.             while ((strLine = br.readLine()) != null) {
  605.                 fileName.add(strLine);
  606.             }
  607.            
  608.             // Iterate through each file in the hive
  609.             for (String s:fileName) {
  610.                 ArrayList<String> lines = new ArrayList<String>();
  611.                 File currentFile = new File(path + "/" + s);
  612.                
  613.                 // Create File Reader
  614.                 FileInputStream fstream2 = new FileInputStream(currentFile);
  615.                 DataInputStream in2 = new DataInputStream(fstream2);
  616.                 BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
  617.                 String strLine2;
  618.                
  619.                 // Store contents of file to ArrayList
  620.                 while ((strLine2 = br2.readLine()) != null) {
  621.                     lines.add(strLine2);
  622.                 }
  623.                
  624.                 br2.close();
  625.                
  626.                 // Check for the "money: " line, change it to specified amount if higher than moneyLimit.
  627.                 int count = 0;
  628.                 for (String ss:lines) {
  629.                     if (ss.startsWith("money:")) {
  630.                         String strCheck = ss;
  631.                         strCheck = strCheck.replace("money: ", "");
  632.                         double moneyVal = Double.parseDouble(strCheck);
  633.                        
  634.                         if (moneyVal > moneyLimit) {
  635.                             lines.set(count, "money: " + changeAmountNation);
  636.                         }
  637.                        
  638.                         // Report to statistics
  639.                         finalCount++;
  640.                     }
  641.                    
  642.                     count++;
  643.                 }
  644.                
  645.                 // Create File Writer
  646.                 FileWriter f = null;
  647.                
  648.                 // If current file exists, delete it
  649.                 if (currentFile.exists()) currentFile.delete();
  650.                
  651.                 try {
  652.                     // Create the file
  653.                     currentFile.createNewFile();
  654.                    
  655.                     // Create the file writer
  656.                     f = new FileWriter(currentFile, true);
  657.                    
  658.                     // Write current file
  659.                     for (String ss:lines) {
  660.                         f.write(ss + "\r\n");
  661.                     }
  662.                    
  663.                     // Close the file writer
  664.                     f.close();
  665.                    
  666.                 } catch (Exception e) {
  667.                     e.printStackTrace();
  668.                 }
  669.                
  670.             }
  671.            
  672.             // Calculate and Report to Statistics
  673.             double endTime = System.currentTimeMillis();
  674.             finalTime += (endTime - startTime) / 1000;
  675.            
  676.             br.close();
  677.         } catch (Exception e) {
  678.             e.printStackTrace();
  679.             System.exit(0);
  680.         }
  681.     }
  682.    
  683.     // Report Statistics
  684.     public static void report(int count, double time) {
  685.         System.out.println("\n\nTotal time taken for operation to complete: " + time + " seconds. " + count + " files modified.");
  686.     }
  687.    
  688.     // Report Invalid Number of Arguments for Command
  689.     public static void argNumErr(String command) {
  690.         System.out.println("Invalid Number of Arguments.\n");
  691.         displaySyntax(command);
  692.     }
  693.    
  694.     // Report Invalind Argument Format
  695.     public static void numFormErr(String command) {
  696.         System.out.println("Argument must be a valid number (with or without decimals)!\n");
  697.         displaySyntax(command);
  698.     }
  699.    
  700.     // Display the command for viewing help
  701.     public static void sugHelp() {
  702.         System.out.println("secret.jar -help");
  703.     }
  704.    
  705.     // Display the Command Syntax for the command entered
  706.     public static void displaySyntax(String command) {
  707.         System.out.println("Usage: secret.jar " + command + " <AMOUNT_TO_SET> <MONEY_LIMIT>(Optional)");
  708.         System.exit(0);
  709.     }
  710.    
  711.     // Report Operation Success
  712.     public static void opSuccess() {
  713.         System.out.println("\nOperation completed successfully!");
  714.         System.exit(0);
  715.     }
  716.    
  717.     // Report Working Status of Operation
  718.     public static void waitMsg() {
  719.         System.out.println("\nPlease wait while operation completes...");
  720.     }
  721.    
  722.     // Prompt for user approval (if Money_limit not set)
  723.     public static void noSetValWarn() {
  724.         System.out.println("\nWARNING. No value was given for <MONEY_LIMIT>. Proceeding with this action will affect ALL PLAYER FILES. There is NO UNDO. Do you wish to proceed? <Y/N>");
  725.         Scanner in = new Scanner(System.in);
  726.         String response = in.next();
  727.        
  728.         if (response.equalsIgnoreCase("y")) {
  729.             return;
  730.         } else if (response.equalsIgnoreCase("n")) {
  731.             System.out.println("\nOperation Aborted.");
  732.             System.exit(0);
  733.         } else {
  734.             System.out.println("\nOperation Aborted. Bad Input Received.");
  735.             System.exit(0);
  736.         }
  737.     }
  738.    
  739.     // Prompt for user approval
  740.     public static void commandWarn() {
  741.         System.out.println("\nWARNING. Proceeding with this action will affect player data files. There is NO UNDO. Do you wish to proceed? <Y/N>");
  742.         Scanner in = new Scanner(System.in);
  743.         String response = in.next();
  744.        
  745.         if (response.equalsIgnoreCase("y")) {
  746.             return;
  747.         } else if (response.equalsIgnoreCase("n")) {
  748.             System.out.println("\nOperation Aborted.");
  749.             System.exit(0);
  750.         } else {
  751.             System.out.println("\nOperation Aborted. Bad Input Received.");
  752.             System.exit(0);
  753.         }
  754.     }
  755.    
  756.     // Display Program Information
  757.     public static void displayInfo() {
  758.         System.out.println("\nSEcReT (Server Economy Reset Tool) " + verString + " by: " + author + "\n" +
  759.                             "Build date: 31/03/2013 | JVM Build Version: Java 1.7_17\n" +
  760.                             "Copyright (C) 2013. Released under GNU GPL v3.0.\n");
  761.     }
  762.    
  763.     // Display Help Information
  764.     public static void displayHelp() {
  765.         System.out.println( "\n<--()***________SEcReT v1.0 by Jnk1296________***()-->\n" +
  766.                             "======================================================\n" +
  767.                             "Command | Description\n" +
  768.                             "======================================================\n" +
  769.                             "-player  Resets the economy of players.\n" +
  770.                             "-town    Resets the economy of towns.\n" +
  771.                             "-nation  Resets the economy of nations.\n" +
  772.                             "-low     Resets the economy of both players and towns.\n" +
  773.                             "-high    Resets the economy of both towns and nations.\n" +
  774.                             "-all     Resets entire economy.\n\n" +
  775.                             "For additional help, type the command with no parameters."
  776.                 );
  777.     }
  778. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement