aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Kohls <mattkohls13@gmail.com>2018-11-12 23:02:03 -0500
committerMatt Kohls <mattkohls13@gmail.com>2018-11-12 23:02:03 -0500
commit9596f2ab16de02e46415dde479a19973b8d43ac8 (patch)
tree4933d66b1e89ab4890d47d41476bb19f2a1061c7
parent3d2ded8af9e6306f0a3bea331f6354743c8c7a28 (diff)
downloadSoundChan-9596f2ab16de02e46415dde479a19973b8d43ac8.tar.gz
SoundChan-9596f2ab16de02e46415dde479a19973b8d43ac8.tar.bz2
SoundChan-9596f2ab16de02e46415dde479a19973b8d43ac8.zip
Renaming function and adding comment
-rw-r--r--src/main/java/soundchan/BotListener/BotListener.java4
-rw-r--r--src/main/java/soundchan/BotListener/MediaWatcher.java4
-rw-r--r--src/main/java/soundchan/BotListener/MediaWatcherListener.java6
3 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/soundchan/BotListener/BotListener.java b/src/main/java/soundchan/BotListener/BotListener.java
index 77ed890..e3ac382 100644
--- a/src/main/java/soundchan/BotListener/BotListener.java
+++ b/src/main/java/soundchan/BotListener/BotListener.java
@@ -70,7 +70,7 @@ public class BotListener extends ListenerAdapter{
if(settingEnableCheck(properties.getProperty("watchUserSoundFile"))) {
addWatcherTask(new MediaWatcherListener() {
@Override
- public void runTask(WatchEvent event) {
+ public void onWatchEvent(WatchEvent event) {
localManager.UpdateUserAudio();
}
}, userAudioPath, "watchUserSoundFile");
@@ -82,7 +82,7 @@ public class BotListener extends ListenerAdapter{
if(settingEnableCheck(properties.getProperty("watchLocalFilePath"))) {
addWatcherTask(new MediaWatcherListener() {
@Override
- public void runTask(WatchEvent event) {
+ public void onWatchEvent(WatchEvent event) {
localManager.UpdateFiles();
}
}, localFilePath, "watchLocalFilePath");
diff --git a/src/main/java/soundchan/BotListener/MediaWatcher.java b/src/main/java/soundchan/BotListener/MediaWatcher.java
index 684be94..f9c7598 100644
--- a/src/main/java/soundchan/BotListener/MediaWatcher.java
+++ b/src/main/java/soundchan/BotListener/MediaWatcher.java
@@ -88,10 +88,10 @@ public class MediaWatcher implements Runnable {
for(WatchEvent<?> event : key.pollEvents()) {
WatchEvent<Path> pathEvent = cast(event);
if(isDirectory) {
- listener.runTask(event);
+ listener.onWatchEvent(event);
} else {
if(pathEvent.context().endsWith(mediaFilename)) {
- listener.runTask(event);
+ listener.onWatchEvent(event);
}
}
}
diff --git a/src/main/java/soundchan/BotListener/MediaWatcherListener.java b/src/main/java/soundchan/BotListener/MediaWatcherListener.java
index 8997a49..8c146f6 100644
--- a/src/main/java/soundchan/BotListener/MediaWatcherListener.java
+++ b/src/main/java/soundchan/BotListener/MediaWatcherListener.java
@@ -4,5 +4,9 @@ import java.nio.file.WatchEvent;
public interface MediaWatcherListener {
- void runTask(WatchEvent event);
+ /**
+ * Called by MediaWatcher when there is a file event. Any created, deleted, or modified events will be passed for use.
+ * @param event The type of event that triggered the update.
+ */
+ void onWatchEvent(WatchEvent event);
}