Attempted to fix Metrics IO error

This commit is contained in:
alisolarflare 2016-11-26 19:45:10 -05:00
parent 7e5b244585
commit 0e9df75f17
2 changed files with 5 additions and 5 deletions

View file

@ -11,7 +11,7 @@ import alisolarflare.components.metrics.files.MetricsFile;
import alisolarflare.components.metrics.output.GetLoginMetrics;
public class MetricsComponent extends Component{
String defaultPath = "metrics";
String defaultPath = "AliPresents/metrics";
String defaultFilePath = (defaultPath + "/metrics.txt");
String playerLoginsFilePath = (defaultPath + "/playerLogins.txt");

View file

@ -13,17 +13,17 @@ import java.util.List;
import buttondevteam.lib.TBMCCoreAPI;
public class MetricsFile {
private String fileName = "metrics/playerLogins.txt";
private String fileName = "AliPresents/metrics/playerLogins.txt";
public MetricsFile(String directory){
this.fileName = directory;
}
public void AddLine(String string){
BufferedWriter inputStream = null;
try {
File file = new File("metrics/playerLogins.txt");
TBMCCoreAPI.sendDebugMessage("Metrics File Exists: " + file.exists());
File file = new File(fileName);
TBMCCoreAPI.SendException("Metrics File Exists: " + file.exists(), new IOException());
inputStream = new BufferedWriter(new FileWriter(fileName, true));
TBMCCoreAPI.sendDebugMessage("Input Stream Created!");
TBMCCoreAPI.SendException("Input Stream Created!", new IOException());
inputStream.write(string);
inputStream.newLine();
inputStream.close();