= Monitored file updating post-accept now to properly keep tabs on changes
This commit is contained in:
+1
-1
@@ -166,7 +166,7 @@
|
||||
"Localized Strings","InviteInfo","Provides a direct invite link for KittyBot"
|
||||
"Localized Strings","DBFlushInfo","Takes all objects queued for the database and writes them to the database, then says how many were written."
|
||||
"Localized Commands","indicator",""
|
||||
"Localized Commands","yeet","yeet, yeety"
|
||||
"Localized Commands","yeet",""
|
||||
"Localized Commands","guildroleremove",""
|
||||
"Localized Commands","bethistory",""
|
||||
"Localized Commands","benchmark, bench",""
|
||||
|
||||
|
@@ -19,7 +19,7 @@ public class CommandEnabler implements IConfigSection
|
||||
public static final String enabled = "1";
|
||||
public static final String disabled = "0";
|
||||
public static final boolean defaultEnabledState = true;
|
||||
public static final String HeaderName = "Command Management";
|
||||
public static final String HeaderName = "Command Enabler";
|
||||
|
||||
// Local variables
|
||||
private HashMap<String, Boolean> enabledMap; // Quick lookup
|
||||
|
||||
+11
-8
@@ -15,6 +15,8 @@ import com.opencsv.CSVReader;
|
||||
import com.opencsv.CSVReaderBuilder;
|
||||
import com.opencsv.CSVWriter;
|
||||
|
||||
import utils.GlobalLog;
|
||||
|
||||
public class ConfigCSV
|
||||
{
|
||||
// Variables
|
||||
@@ -67,12 +69,11 @@ public class ConfigCSV
|
||||
{
|
||||
if(record.length < ConfigItem.items)
|
||||
{
|
||||
System.out.println("Incorrect number of items on line " + line + " in " + path);
|
||||
GlobalLog.warn("Incorrect number of items on line " + line + " in " + path);
|
||||
continue;
|
||||
}
|
||||
|
||||
ConfigItem parsedLine = new ConfigItem(record[0], record[1], record[2]);
|
||||
System.out.println(parsedLine);
|
||||
fileContents.add(parsedLine);
|
||||
++line;
|
||||
}
|
||||
@@ -111,17 +112,19 @@ public class ConfigCSV
|
||||
{
|
||||
try
|
||||
{
|
||||
Writer writer = Files.newBufferedWriter(Paths.get(path));
|
||||
CSVWriter csvWriter = makeWriter(writer);
|
||||
|
||||
csvWriter.writeNext(ConfigItem.header);
|
||||
List<String[]> toWrite = new Vector<String[]>();
|
||||
toWrite.add(ConfigItem.header);
|
||||
|
||||
for(ConfigItem item : fileContents)
|
||||
{
|
||||
csvWriter.writeNext(item.getAll());
|
||||
toWrite.add(item.getAll());
|
||||
}
|
||||
|
||||
Writer writer = Files.newBufferedWriter(Paths.get(path));
|
||||
CSVWriter csvWriter = makeWriter(writer);
|
||||
csvWriter.writeAll(toWrite);
|
||||
csvWriter.flush();
|
||||
csvWriter.close();
|
||||
writer.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
@@ -44,8 +44,11 @@ public class FileMonitor
|
||||
if(last.longValue() != file.lastModified.longValue())
|
||||
{
|
||||
IOLog.log("Most recently modified at " + last + ", stored version at " + file.lastModified);
|
||||
|
||||
file = new MonitoredFile(file.path, last);
|
||||
fileChanged.accept(file);
|
||||
|
||||
file = new MonitoredFile(file.path, FileUtils.lastModified(file.path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user