Package org.kingdoms.config.managers
Class ConfigWatcher
java.lang.Object
org.kingdoms.config.managers.ConfigWatcher
This is generally unreliable for Linux.
For the official wathcer API use
ConfigManager methods instead.-
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) protected static voidhandleMainConfigs(Path path, WatchEvent.Kind<?> kind) protected static voidregister(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 voidsetAccepting(boolean accepting) Whether any changes to the registered watchers should be handled.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) Whether any changes to the registered watchers should be handled. -
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
-
handleMainConfigs
-