diff --git a/.doc/images/banner.png b/.doc/images/banner.png new file mode 100644 index 0000000..bdeef09 Binary files /dev/null and b/.doc/images/banner.png differ diff --git a/.doc/images/logo.png b/.doc/images/logo.png new file mode 100644 index 0000000..b80df30 Binary files /dev/null and b/.doc/images/logo.png differ diff --git a/README.md b/README.md index 51667ed..e573b97 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ -```text - ____ _____ ____ __ _ - / __/__ ____ __ __ / ___/__ ___ / _(_)__ ___ _________ _/ /_(_)__ ___ - / _// _ `(_- +Banner + + README LANGUAGES [ [**English**](README.md) | [中文](README_CN.md) ] @@ -42,6 +39,7 @@ For a detailed development guide, [CLICK HERE](.doc/README.md). ### Code Samples To quickly demonstrate the applicability of the project, here are a few practical demonstrations: + - [Database configuration.](demo/src/main/java/cc/carm/lib/configuration/demo/DatabaseConfiguration.java) - [Demonstration of all types of configuration instance classes.](demo/src/main/java/cc/carm/lib/configuration/demo/tests/conf/DemoConfiguration.java) @@ -49,35 +47,36 @@ Check out all code demonstrations [HERE](demo/src/main/java/cc/carm/lib/configur For more examples, see the [Development Guide](.doc/README.md). ```java + @ConfigPath(root = true) @HeaderComments("Configurations for sample") public interface SampleConfig extends Configuration { - @InlineComment("Enabled?") // Inline comment - ConfiguredValue ENABLED = ConfiguredValue.of(true); + @InlineComment("Enabled?") // Inline comment + ConfiguredValue ENABLED = ConfiguredValue.of(true); - @HeaderComments("Server configurations") // Header comment - ConfiguredValue PORT = ConfiguredValue.of(Integer.class); + @HeaderComments("Server configurations") // Header comment + ConfiguredValue PORT = ConfiguredValue.of(Integer.class); - @HeaderComments({"[ UUID >-----------------------------------", "A lot of UUIDs"}) - @FooterComments("[ UUID >-----------------------------------") - ConfiguredList UUIDS = ConfiguredList.builderOf(UUID.class).fromString() - .parse(UUID::fromString).serialize(UUID::toString) - .defaults( - UUID.fromString("00000000-0000-0000-0000-000000000000"), - UUID.fromString("00000000-0000-0000-0000-000000000001") - ).build(); + @HeaderComments({"[ UUID >-----------------------------------", "A lot of UUIDs"}) + @FooterComments("[ UUID >-----------------------------------") + ConfiguredList UUIDS = ConfiguredList.builderOf(UUID.class).fromString() + .parse(UUID::fromString).serialize(UUID::toString) + .defaults( + UUID.fromString("00000000-0000-0000-0000-000000000000"), + UUID.fromString("00000000-0000-0000-0000-000000000001") + ).build(); - @ConfigPath("info") // Custom path - interface INFO extends Configuration { + @ConfigPath("info") // Custom path + interface INFO extends Configuration { - @HeaderComments("Configure your name!") // Header comment - ConfiguredValue NAME = ConfiguredValue.of("Joker"); + @HeaderComments("Configure your name!") // Header comment + ConfiguredValue NAME = ConfiguredValue.of("Joker"); - @ConfigPath("how-old-are-you") // Custom path - ConfiguredValue AGE = ConfiguredValue.of(24); + @ConfigPath("how-old-are-you") // Custom path + ConfiguredValue AGE = ConfiguredValue.of(24); - } + } } @@ -85,23 +84,23 @@ public interface SampleConfig extends Configuration { ```java public class Sample { - public static void main(String[] args) { - // 1. Make a configuration provider from a file. - ConfigurationHolder holder = YAMLConfigFactory.from("target/config.yml") - .resourcePath("configs/sample.yml") - .indent(4) // Optional: Set the indentation of the configuration file. - .build(); + public static void main(String[] args) { + // 1. Make a configuration provider from a file. + ConfigurationHolder holder = YAMLConfigFactory.from("target/config.yml") + .resourcePath("configs/sample.yml") + .indent(4) // Optional: Set the indentation of the configuration file. + .build(); - // 2. Initialize the configuration classes or instances. - holder.initialize(SampleConfig.class); - // 3. Enjoy using the configuration! - System.out.println("Enabled? -> " + SampleConfig.ENABLED.resolve()); // true - SampleConfig.ENABLED.set(false); - System.out.println("And now? -> " + SampleConfig.ENABLED.resolve()); // false - // p.s. Changes not save so enable value will still be true in the next run. + // 2. Initialize the configuration classes or instances. + holder.initialize(SampleConfig.class); + // 3. Enjoy using the configuration! + System.out.println("Enabled? -> " + SampleConfig.ENABLED.resolve()); // true + SampleConfig.ENABLED.set(false); + System.out.println("And now? -> " + SampleConfig.ENABLED.resolve()); // false + // p.s. Changes not save so enable value will still be true in the next run. - System.out.println("Your name is " + SampleConfig.INFO.NAME.resolve() + " (age=" + SampleConfig.INFO.AGE.resolve() + ")!"); - } + System.out.println("Your name is " + SampleConfig.INFO.NAME.resolve() + " (age=" + SampleConfig.INFO.AGE.resolve() + ")!"); + } } ``` @@ -243,7 +242,7 @@ dependencies { configured for MineCraft! Easily manage configurations on MineCraft-related server platforms. -Currently, it supports BungeeCord, Velocity, Bukkit (Spigot) servers, +Currently, it supports BungeeCord, Velocity, Bukkit (Spigot) servers, with more platforms to be supported soon. ## Support and Donation @@ -256,7 +255,7 @@ Many thanks to Jetbrains for kindly providing a license for us to work on this a [![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/CarmJos/configured) -Many thanks to [ArtformGames](https://github.com/ArtformGames) for their +Many thanks to [ArtformGames](https://github.com/ArtformGames) for their strong support and active contribution to this project! ArtformGames diff --git a/README_CN.md b/README_CN.md index 4bac278..11215d9 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,10 +1,6 @@ -```text - _____ ____ __ _ - / ___/__ ___ / _(_)__ ___ _________ _/ /_(_)__ ___ -/ /__/ _ \/ _ \/ _/ / _ `/ // / __/ _ `/ __/ / _ \/ _ \ -\___/\___/_//_/_//_/\_, /\_,_/_/ \_,_/\__/_/\___/_//_/ - /___/ -``` +
+Banner +
README LANGUAGES [ [English](README.md) | [**中文**](README_CN.md) ]