Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void loadConfig(String name){
- File file = new File(getDataFolder(), "config.yml");
- if (!file.exists()){
- InputStream defaultFile = ShankAFK.class.getResourceAsStream("/config/" + name);
- try {
- FileOutputStream writer = new FileOutputStream(file);
- byte[] buf = new byte[8192];
- int length = 0;
- try {
- while ((length = defaultFile.read(buf)) > 0){
- writer.write(buf, 0, length);
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- writer.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } finally {
- try {
- defaultFile.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- Configuration config = new Configuration(file);
- config.load();
- playerThreshold = config.getInt("player-threshold", 15);
- playerIdleTime = config.getInt("player-idletime", 900);
- kickMsg = config.getString("kick-message");
- announceKick = config.getBoolean("announce", true);
- }
Advertisement
Add Comment
Please, Sign In to add comment