From 9596f2ab16de02e46415dde479a19973b8d43ac8 Mon Sep 17 00:00:00 2001 From: Matt Kohls Date: Mon, 12 Nov 2018 23:02:03 -0500 Subject: Renaming function and adding comment --- src/main/java/soundchan/BotListener/BotListener.java | 4 ++-- src/main/java/soundchan/BotListener/MediaWatcher.java | 4 ++-- src/main/java/soundchan/BotListener/MediaWatcherListener.java | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/main') 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 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); } -- cgit v1.2.3