mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2026-06-04 10:38:19 +08:00
docs(logo): Add project banner & logo
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 109 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
@@ -1,10 +1,7 @@
|
|||||||
```text
|
<div align=center>
|
||||||
____ _____ ____ __ _
|
<img src=".doc/images/banner.png" alt="Banner"/>
|
||||||
/ __/__ ____ __ __ / ___/__ ___ / _(_)__ ___ _________ _/ /_(_)__ ___
|
</div>
|
||||||
/ _// _ `(_-</ // / / /__/ _ \/ _ \/ _/ / _ `/ // / __/ _ `/ __/ / _ \/ _ \
|
|
||||||
/___/\_,_/___/\_, / \___/\___/_//_/_//_/\_, /\_,_/_/ \_,_/\__/_/\___/_//_/
|
|
||||||
/___/ /___/
|
|
||||||
```
|
|
||||||
|
|
||||||
README LANGUAGES [ [**English**](README.md) | [中文](README_CN.md) ]
|
README LANGUAGES [ [**English**](README.md) | [中文](README_CN.md) ]
|
||||||
|
|
||||||
@@ -42,6 +39,7 @@ For a detailed development guide, [CLICK HERE](.doc/README.md).
|
|||||||
### Code Samples
|
### Code Samples
|
||||||
|
|
||||||
To quickly demonstrate the applicability of the project, here are a few practical demonstrations:
|
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)
|
- [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)
|
- [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).
|
For more examples, see the [Development Guide](.doc/README.md).
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|
||||||
@ConfigPath(root = true)
|
@ConfigPath(root = true)
|
||||||
@HeaderComments("Configurations for sample")
|
@HeaderComments("Configurations for sample")
|
||||||
public interface SampleConfig extends Configuration {
|
public interface SampleConfig extends Configuration {
|
||||||
|
|
||||||
@InlineComment("Enabled?") // Inline comment
|
@InlineComment("Enabled?") // Inline comment
|
||||||
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
||||||
|
|
||||||
@HeaderComments("Server configurations") // Header comment
|
@HeaderComments("Server configurations") // Header comment
|
||||||
ConfiguredValue<Integer> PORT = ConfiguredValue.of(Integer.class);
|
ConfiguredValue<Integer> PORT = ConfiguredValue.of(Integer.class);
|
||||||
|
|
||||||
@HeaderComments({"[ UUID >-----------------------------------", "A lot of UUIDs"})
|
@HeaderComments({"[ UUID >-----------------------------------", "A lot of UUIDs"})
|
||||||
@FooterComments("[ UUID >-----------------------------------")
|
@FooterComments("[ UUID >-----------------------------------")
|
||||||
ConfiguredList<UUID> UUIDS = ConfiguredList.builderOf(UUID.class).fromString()
|
ConfiguredList<UUID> UUIDS = ConfiguredList.builderOf(UUID.class).fromString()
|
||||||
.parse(UUID::fromString).serialize(UUID::toString)
|
.parse(UUID::fromString).serialize(UUID::toString)
|
||||||
.defaults(
|
.defaults(
|
||||||
UUID.fromString("00000000-0000-0000-0000-000000000000"),
|
UUID.fromString("00000000-0000-0000-0000-000000000000"),
|
||||||
UUID.fromString("00000000-0000-0000-0000-000000000001")
|
UUID.fromString("00000000-0000-0000-0000-000000000001")
|
||||||
).build();
|
).build();
|
||||||
|
|
||||||
@ConfigPath("info") // Custom path
|
@ConfigPath("info") // Custom path
|
||||||
interface INFO extends Configuration {
|
interface INFO extends Configuration {
|
||||||
|
|
||||||
@HeaderComments("Configure your name!") // Header comment
|
@HeaderComments("Configure your name!") // Header comment
|
||||||
ConfiguredValue<String> NAME = ConfiguredValue.of("Joker");
|
ConfiguredValue<String> NAME = ConfiguredValue.of("Joker");
|
||||||
|
|
||||||
@ConfigPath("how-old-are-you") // Custom path
|
@ConfigPath("how-old-are-you") // Custom path
|
||||||
ConfiguredValue<Integer> AGE = ConfiguredValue.of(24);
|
ConfiguredValue<Integer> AGE = ConfiguredValue.of(24);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,23 +84,23 @@ public interface SampleConfig extends Configuration {
|
|||||||
|
|
||||||
```java
|
```java
|
||||||
public class Sample {
|
public class Sample {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// 1. Make a configuration provider from a file.
|
// 1. Make a configuration provider from a file.
|
||||||
ConfigurationHolder<?> holder = YAMLConfigFactory.from("target/config.yml")
|
ConfigurationHolder<?> holder = YAMLConfigFactory.from("target/config.yml")
|
||||||
.resourcePath("configs/sample.yml")
|
.resourcePath("configs/sample.yml")
|
||||||
.indent(4) // Optional: Set the indentation of the configuration file.
|
.indent(4) // Optional: Set the indentation of the configuration file.
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 2. Initialize the configuration classes or instances.
|
// 2. Initialize the configuration classes or instances.
|
||||||
holder.initialize(SampleConfig.class);
|
holder.initialize(SampleConfig.class);
|
||||||
// 3. Enjoy using the configuration!
|
// 3. Enjoy using the configuration!
|
||||||
System.out.println("Enabled? -> " + SampleConfig.ENABLED.resolve()); // true
|
System.out.println("Enabled? -> " + SampleConfig.ENABLED.resolve()); // true
|
||||||
SampleConfig.ENABLED.set(false);
|
SampleConfig.ENABLED.set(false);
|
||||||
System.out.println("And now? -> " + SampleConfig.ENABLED.resolve()); // 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.
|
// 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!
|
configured for MineCraft!
|
||||||
Easily manage configurations on MineCraft-related server platforms.
|
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.
|
with more platforms to be supported soon.
|
||||||
|
|
||||||
## Support and Donation
|
## Support and Donation
|
||||||
@@ -256,7 +255,7 @@ Many thanks to Jetbrains for kindly providing a license for us to work on this a
|
|||||||
|
|
||||||
[](https://www.jetbrains.com/?from=https://github.com/CarmJos/configured)
|
[](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!
|
strong support and active contribution to this project!
|
||||||
|
|
||||||
<img src="https://raw.githubusercontent.com/ArtformGames/.github/master/logo/logo_full.svg" width="317px" height="117px" alt="ArtformGames">
|
<img src="https://raw.githubusercontent.com/ArtformGames/.github/master/logo/logo_full.svg" width="317px" height="117px" alt="ArtformGames">
|
||||||
|
|||||||
+3
-7
@@ -1,10 +1,6 @@
|
|||||||
```text
|
<div align=center>
|
||||||
_____ ____ __ _
|
<img src=".doc/images/banner.png" alt="Banner"/>
|
||||||
/ ___/__ ___ / _(_)__ ___ _________ _/ /_(_)__ ___
|
</div>
|
||||||
/ /__/ _ \/ _ \/ _/ / _ `/ // / __/ _ `/ __/ / _ \/ _ \
|
|
||||||
\___/\___/_//_/_//_/\_, /\_,_/_/ \_,_/\__/_/\___/_//_/
|
|
||||||
/___/
|
|
||||||
```
|
|
||||||
|
|
||||||
README LANGUAGES [ [English](README.md) | [**中文**](README_CN.md) ]
|
README LANGUAGES [ [English](README.md) | [**中文**](README_CN.md) ]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user