Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("deprecation")
- private void loadConfig() throws IOException {
- File jarFile = new File(Configuration.class.getProtectionDomain().getCodeSource().getLocation().getPath());
- File configFile = new File(URLDecoder.decode(jarFile.getParent() + "//EventManager//config.yml"));
- BufferedReader inputStream = null;
- try {
- String line;
- inputStream = new BufferedReader(new FileReader(configFile));
- while ((line = inputStream.readLine()) != null) {
- if (line.startsWith("banTime: ")) {
- try {
- banTime = Integer.parseInt(line.replaceFirst("banTime: ", ""));
- } catch (Exception e) {
- banTime = 4320;
- }
- } else if (line.startsWith("premiumEventCost: ")) {
- try {
- premiumCost = Integer.parseInt(line.replaceFirst("premiumEventCost: ", ""));
- } catch (Exception e) {
- premiumCost = 10000;
- }
- } else if (line.startsWith("username: ")) {
- username = line.replaceFirst("username: ", "");
- } else if (line.startsWith("password: ")) {
- password = line.replaceFirst("password: ", "");
- } else if (line.startsWith("uri: ")) {
- url = "jdbc:" + line.replaceFirst("uri: ", "");
- }
- }
- } finally {
- if (inputStream != null) {
- inputStream.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement