Package org.kingdoms.config.managers
Class ConfigWatcher
java.lang.Object
org.kingdoms.config.managers.ConfigWatcher
This is generally unreliable for Linux.
Vim triggering file modifies twice is normal: https://stackoverflow.com/a/23309948
Default Windows Notepad only calls it once.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Map<String,FileWatcher> protected static final WatchService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidbeforeWrite(YamlContainer adapter) static BiConsumer<Path,WatchEvent.Kind<?>> generateGUIHandlerForLang(SupportedLanguage language) static voidhandleNormalConfigs(Path path, WatchEvent.Kind<?> kind) static WatchKeyregister(Path dir, BiConsumer<Path, WatchEvent.Kind<?>> handler) If you ever wanted toWatchKey.cancel(), don't do that, useunregister(WatchKey)instead.static voidregisterGUIWatchers(SupportedLanguage language) static voidreload(YamlResource config, String file) static voidsetAccepting(boolean accepting) protected static voidstatic voidunregister(WatchKey key) Also callsWatchKey.cancel()
-
Field Details
-
WATCH_SERVICE
-
NORMAL_WATCHERS
-
-
Constructor Details
-
ConfigWatcher
public ConfigWatcher()
-
-
Method Details
-
setAccepting
public static void setAccepting(boolean accepting) -
reload
-
register
If you ever wanted toWatchKey.cancel(), don't do that, useunregister(WatchKey)instead.- Parameters:
dir- The folder to register.handler- the file change handler.
-
unregister
Also callsWatchKey.cancel() -
registerGUIWatchers
-
setupWatchService
protected static void setupWatchService() -
beforeWrite
-
generateGUIHandlerForLang
public static BiConsumer<Path,WatchEvent.Kind<?>> generateGUIHandlerForLang(SupportedLanguage language) -
handleNormalConfigs
-