diff options
author | Matt Kohls <mattkohls13@gmail.com> | 2018-10-16 17:58:38 -0400 |
---|---|---|
committer | Matt Kohls <mattkohls13@gmail.com> | 2018-10-16 17:58:38 -0400 |
commit | 266c900d573cc4b70683e290404af663eb3f66d0 (patch) | |
tree | 08317c3d50b4c4a1cabca37b35d5fa23b307ed39 | |
parent | 155bdfdffbae68f85cc971eb96ea432a6f4a736d (diff) | |
download | SoundChan-266c900d573cc4b70683e290404af663eb3f66d0.tar.gz SoundChan-266c900d573cc4b70683e290404af663eb3f66d0.tar.bz2 SoundChan-266c900d573cc4b70683e290404af663eb3f66d0.zip |
Adding property setting for watching local sounds
-rw-r--r-- | soundchan.properties.example | 16 | ||||
-rw-r--r-- | src/main/java/soundchan/BotListener/BotListener.java | 14 |
2 files changed, 18 insertions, 12 deletions
diff --git a/soundchan.properties.example b/soundchan.properties.example index 0655076..8780021 100644 --- a/soundchan.properties.example +++ b/soundchan.properties.example @@ -1,19 +1,25 @@ +// Example properties file for SoundChan +// +// Flag conditions are enabled with any of the following values: +// true, on, enable, yes, 1 +// any other string (or empty) will leave the condition disabled + + //The Bot Token you will have received from the discord developers page botToken=BOT_TOKEN_FROM_DISCORD //The local file path to the directory of your sounds. Don't forget to escape your slashes localFilePath=C:\\PATH\\TO\\SOUNDS\\DIRECTORY +//Flag for watching the sound directory for changes +watchLocalFilePath=FLAG_CONDITION + //The user for the followingUser=USERNAME -//Flag conditions are enabled with any of the following values: -// true, on, enable, yes, 1 -//any other string (or empty) will leave the condition disabled - //If you want SoundChan to play an audio file whit their name when a user joins the channel or have that information come from below file //This is a flag condition -audioOnUserJoin=on/off +audioOnUserJoin=FLAG_CONDITION //The file where users and sound clips are related, see usersound.properties.example for more info //If this is not set, it will default to usersounds.properties diff --git a/src/main/java/soundchan/BotListener/BotListener.java b/src/main/java/soundchan/BotListener/BotListener.java index 9177385..0dad6c0 100644 --- a/src/main/java/soundchan/BotListener/BotListener.java +++ b/src/main/java/soundchan/BotListener/BotListener.java @@ -36,7 +36,6 @@ public class BotListener extends ListenerAdapter{ private final AudioPlayerManager playerManager; private final Map<Long, GuildMusicManager> musicManagers; private BotListenerHelpers helper = new BotListenerHelpers(); - private ExecutorService executorService; private Future<?> future; // From configuration file @@ -51,8 +50,6 @@ public class BotListener extends ListenerAdapter{ AudioSourceManagers.registerRemoteSources(playerManager); AudioSourceManagers.registerLocalSource(playerManager); - executorService = Executors.newSingleThreadExecutor(); - loadProperties(properties); } @@ -75,10 +72,13 @@ public class BotListener extends ListenerAdapter{ } else localManager = new LocalAudioManager(localFilePath); - - DirectoryWatcher directoryWatcher = new DirectoryWatcher(localManager, localFilePath); - future = executorService.submit(directoryWatcher); - executorService.shutdown(); + + if(settingEnableCheck(properties.getProperty("watchLocalFilePath"))) { + ExecutorService executorService = Executors.newSingleThreadExecutor(); + DirectoryWatcher directoryWatcher = new DirectoryWatcher(localManager, localFilePath); + future = executorService.submit(directoryWatcher); + executorService.shutdown(); + } } |