From da2e9ff6a4d68b7464eadb6634945db223ee4618 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 5 Jan 2022 21:50:03 +0100 Subject: [PATCH] Add BConfig --- .../{T2CodeLib_9_0.xml => T2CodeLib_10_0.xml} | 4 +- pom.xml | 2 +- .../Bungee/Lib/yamlConfiguration/BConfig.java | 85 ++++++++++++++++++ target/classes/bungee.yml | 2 +- .../Lib/yamlConfiguration/BConfig.class | Bin 0 -> 4692 bytes target/classes/plugin.yml | 2 +- 6 files changed, 90 insertions(+), 5 deletions(-) rename .idea/artifacts/{T2CodeLib_9_0.xml => T2CodeLib_10_0.xml} (63%) create mode 100644 src/main/java/net/t2code/lib/Bungee/Lib/yamlConfiguration/BConfig.java create mode 100644 target/classes/net/t2code/lib/Bungee/Lib/yamlConfiguration/BConfig.class diff --git a/.idea/artifacts/T2CodeLib_9_0.xml b/.idea/artifacts/T2CodeLib_10_0.xml similarity index 63% rename from .idea/artifacts/T2CodeLib_9_0.xml rename to .idea/artifacts/T2CodeLib_10_0.xml index d86a691..eebabbb 100644 --- a/.idea/artifacts/T2CodeLib_9_0.xml +++ b/.idea/artifacts/T2CodeLib_10_0.xml @@ -1,7 +1,7 @@ - + $PROJECT_DIR$/../../Plugins/T2CodeLib/.jar - + diff --git a/pom.xml b/pom.xml index d89e68b..97a1bb2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code T2CodeLib - 9.0 + 10.0 jar T2CodeLib diff --git a/src/main/java/net/t2code/lib/Bungee/Lib/yamlConfiguration/BConfig.java b/src/main/java/net/t2code/lib/Bungee/Lib/yamlConfiguration/BConfig.java new file mode 100644 index 0000000..1dbbdec --- /dev/null +++ b/src/main/java/net/t2code/lib/Bungee/Lib/yamlConfiguration/BConfig.java @@ -0,0 +1,85 @@ +package net.t2code.lib.Bungee.Lib.yamlConfiguration; + +import net.md_5.bungee.config.Configuration; +import net.t2code.lib.Spigot.Lib.replace.Replace; + +import java.util.ArrayList; +import java.util.List; + +public class BConfig { + public static void set(String path, String value, Configuration configuration) { + if (!configuration.contains(path)) { + configuration.set(path, value); + } + } + + public static void set(String path, Configuration configuration) { + configuration.set(path, null); + } + + public static void set(String path, Integer value, Configuration configuration) { + if (!configuration.contains(path)) { + configuration.set(path, value); + } + } + + public static void set(String path, Double value, Configuration configuration) { + if (!configuration.contains(path)) { + configuration.set(path, value); + } + } + + public static void set(String path, Boolean value, Configuration configuration) { + if (!configuration.contains(path)) { + configuration.set(path, value); + } + } + + public static void set(String path, List value, Configuration configuration) { + if (!configuration.contains(path)) { + configuration.set(path, value); + } + } + + + public static String select(String prefix, String path, Configuration configuration) { + return Replace.replace(prefix, configuration.getString(path)); + } + + + public static Integer selectInt(String path, Configuration configuration) { + return (configuration.getInt(path)); + } + + public static Boolean selectBoolean(String path, Configuration configuration) { + return (configuration.getBoolean(path)); + } + + public static Double selectDouble(String path, Configuration configuration) { + return (configuration.getDouble(path)); + } + + public static List selectList(String path, Configuration configuration) { + return (configuration.getStringList(path)); + } + + + + public static List selectList(String prefix, String path, Configuration configuration) { + List output = new ArrayList<>(); + List input = configuration.getStringList(path); + for (String st : input) { + output.add(Replace.replace(prefix, st)); + } + return output; + } + + public static void select(String prefix, List value, String path, Configuration configuration) { + List output = new ArrayList<>(); + List input = configuration.getStringList(path); + for (String st : input) { + output.add(Replace.replace(prefix, st)); + } + value = output; + } +} diff --git a/target/classes/bungee.yml b/target/classes/bungee.yml index 742d3ec..6fb495f 100644 --- a/target/classes/bungee.yml +++ b/target/classes/bungee.yml @@ -1,5 +1,5 @@ name: T2CodeLib -version: 9.0 +version: 10.0 main: net.t2code.lib.Bungee.BMain author: JaTiTV, Jkobs description: Libarie from T2Code Plugins \ No newline at end of file diff --git a/target/classes/net/t2code/lib/Bungee/Lib/yamlConfiguration/BConfig.class b/target/classes/net/t2code/lib/Bungee/Lib/yamlConfiguration/BConfig.class new file mode 100644 index 0000000000000000000000000000000000000000..bbe251407d2d786da2fb478963eafb8bd732c493 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H3QE0VXL;p`00#;If|7J80z49RdT z{2Y@E-{SxuO)>nA>11Ri9*a=Qp5tl&w|;#2*9f;ns%IY+G%!W#xlDz7h4hm_3e)tH zXGT~zM(d;0p+2L8@}1+g)Q;CuJFZgOMn4)qhfOwi;wZkLQ3zaTJb!X+rM9+0YxA_W z6M+}lt6@z1Pyd6%kdA*T^!Jr={3RW1qwQ(scrr9H%sm$lbI&8Oi1NIbkCf+HEEJDv z9@qbjg)+QvO6T7e!MsLHv(!1SQ34 zs5* literal 0 HcmV?d00001 diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml index a3db8b0..1e0bc41 100644 --- a/target/classes/plugin.yml +++ b/target/classes/plugin.yml @@ -1,5 +1,5 @@ name: T2CodeLib -version: 9.0 +version: 10.0 main: net.t2code.lib.Spigot.system.Main api-version: 1.13 prefix: T2CodeLib