mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
[trunk] GroupManager: Support utf-8 for saving files.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1170 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
27a3d0a9a1
commit
471e20473b
1 changed files with 17 additions and 5 deletions
|
@ -7,8 +7,11 @@ package org.anjocaido.groupmanager.dataholder;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -756,8 +759,13 @@ public class WorldDataHolder {
|
||||||
DumperOptions opt = new DumperOptions();
|
DumperOptions opt = new DumperOptions();
|
||||||
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||||
final Yaml yaml = new Yaml(opt);
|
final Yaml yaml = new Yaml(opt);
|
||||||
|
try {
|
||||||
|
yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
|
||||||
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
}
|
||||||
|
|
||||||
FileWriter tx = null;
|
/*FileWriter tx = null;
|
||||||
try {
|
try {
|
||||||
tx = new FileWriter(groupsFile, false);
|
tx = new FileWriter(groupsFile, false);
|
||||||
tx.write(yaml.dump(root));
|
tx.write(yaml.dump(root));
|
||||||
|
@ -768,7 +776,7 @@ public class WorldDataHolder {
|
||||||
tx.close();
|
tx.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -813,8 +821,12 @@ public class WorldDataHolder {
|
||||||
DumperOptions opt = new DumperOptions();
|
DumperOptions opt = new DumperOptions();
|
||||||
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||||
final Yaml yaml = new Yaml(opt);
|
final Yaml yaml = new Yaml(opt);
|
||||||
|
try {
|
||||||
FileWriter tx = null;
|
yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"));
|
||||||
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
}
|
||||||
|
/*FileWriter tx = null;
|
||||||
try {
|
try {
|
||||||
tx = new FileWriter(usersFile, false);
|
tx = new FileWriter(usersFile, false);
|
||||||
tx.write(yaml.dump(root));
|
tx.write(yaml.dump(root));
|
||||||
|
@ -825,7 +837,7 @@ public class WorldDataHolder {
|
||||||
tx.close();
|
tx.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue