diff options
author | Keuin <[email protected]> | 2021-12-17 23:55:44 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-12-17 23:55:44 +0800 |
commit | 12ddbba66e6f2585e59d05d1782c0e8ce9fe6146 (patch) | |
tree | 0d98ee95c01c8509160658080523e351357d4a9b /src/main/java/com/keuin/crosslink/config/GlobalConfigManager.java | |
parent | 7fc64f506ea7ebc68fcb0a9e98351deed7c1d212 (diff) |
Use the latest Velocity API.
Implement API server for online players and server status.
Implement core message routing abstraction and concrete BungeeCross, Velocity, Telegram endpoint impl.
Load config from config file "crosslink/config.json".
Test core components. Proxy API related stuff are not tested.
Add README in English and Chinese.
TODO: Add config hot reloading. More configurable system. PSMB endpoint impl.
Diffstat (limited to 'src/main/java/com/keuin/crosslink/config/GlobalConfigManager.java')
-rw-r--r-- | src/main/java/com/keuin/crosslink/config/GlobalConfigManager.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/crosslink/config/GlobalConfigManager.java b/src/main/java/com/keuin/crosslink/config/GlobalConfigManager.java new file mode 100644 index 0000000..26996c2 --- /dev/null +++ b/src/main/java/com/keuin/crosslink/config/GlobalConfigManager.java @@ -0,0 +1,50 @@ +package com.keuin.crosslink.config; + +import org.jetbrains.annotations.NotNull; + +import java.io.File; + +public class GlobalConfigManager { + /** + * Load config from disk. + * If loaded successfully, the global 'loaded' status will be set to true. + * @throws ConfigLoadException failed to load. The 'loaded' status will be set to false. + */ + public static void initializeGlobalManager(File configFile) throws ConfigLoadException { + // TODO read config from disk, create the singleton object +// throw new RuntimeException(); + } + + public static @NotNull GlobalConfigManager getInstance() { + // TODO get the singleton object +// throw new RuntimeException(); + throw new RuntimeException("GlobalConfigManager is not initialized"); + } + + /** + * Get an immutable view of the global config. + * A view is a consistent, but not up-to-date snapshot. + * + * @return the config view. + */ + public IConfigView getConfig() { + // TODO + throw new RuntimeException("Global config is not loaded"); + } + + public boolean isLoaded() { + throw new RuntimeException(); + } + + /** + * Reload the config file from disk. + * If loaded successfully, the global 'loaded' status will be set to true. + * @throws ConfigLoadException failed to reload. + * If previously loaded, the global config won't be modified. + * Otherwise, the 'loaded' status will be set to false. + */ + public void reload() throws ConfigLoadException { + // TODO +// throw new RuntimeException(); + } +} |