diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/ilummc/tlib/ExampleMain.java b/src/main/java/com/ilummc/tlib/ExampleMain.java new file mode 100644 index 0000000..a22a8ad --- /dev/null +++ b/src/main/java/com/ilummc/tlib/ExampleMain.java @@ -0,0 +1,35 @@ +package com.ilummc.tlib; + +import com.ilummc.tlib.annotations.Config; +import com.ilummc.tlib.annotations.ConfigNode; +import com.ilummc.tlib.bean.BooleanProperty; +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +@Config(name = "cfg.yml", charset = "GBK") +public class ExampleMain extends JavaPlugin { + + @ConfigNode("enableUpdate") + private BooleanProperty update = new BooleanProperty(true); + + @Override + public void onEnable() { + update.addListener(((oldVal, newVal) -> { + Bukkit.getLogger().info("配置项 enableUpdate 的值由 " + oldVal + " 变为了 " + newVal); + if (newVal) + Updater.start(); + else + Updater.stop(); + })); + } + + private static class Updater { + public static void start() { + + } + + public static void stop() { + + } + } +} diff --git a/src/main/java/com/ilummc/tlib/annotations/Config.java b/src/main/java/com/ilummc/tlib/annotations/Config.java new file mode 100644 index 0000000..b702063 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/Config.java @@ -0,0 +1,19 @@ +package com.ilummc.tlib.annotations; + +public @interface Config { + + String name() default "config.yml"; + + boolean fromJar() default true; + + boolean saveOnExit() default false; + + boolean readOnly() default true; + + boolean fixUnicode() default true; + + String charset() default "UTF-8"; + + boolean listenChanges() default false; + +} diff --git a/src/main/java/com/ilummc/tlib/annotations/ConfigNode.java b/src/main/java/com/ilummc/tlib/annotations/ConfigNode.java new file mode 100644 index 0000000..810a26f --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/ConfigNode.java @@ -0,0 +1,6 @@ +package com.ilummc.tlib.annotations; + +public @interface ConfigNode { + + String value(); +} diff --git a/src/main/java/com/ilummc/tlib/annotations/Dependencies.java b/src/main/java/com/ilummc/tlib/annotations/Dependencies.java new file mode 100644 index 0000000..b17f877 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/Dependencies.java @@ -0,0 +1,7 @@ +package com.ilummc.tlib.annotations; + +public @interface Dependencies { + + String[] value(); + +} diff --git a/src/main/java/com/ilummc/tlib/annotations/PluginInstance.java b/src/main/java/com/ilummc/tlib/annotations/PluginInstance.java new file mode 100644 index 0000000..02c713e --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/PluginInstance.java @@ -0,0 +1,6 @@ +package com.ilummc.tlib.annotations; + +public @interface PluginInstance { + + String value(); +} diff --git a/src/main/java/com/ilummc/tlib/annotations/db/Database.java b/src/main/java/com/ilummc/tlib/annotations/db/Database.java new file mode 100644 index 0000000..cdf2b49 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/db/Database.java @@ -0,0 +1,11 @@ +package com.ilummc.tlib.annotations.db; + +public @interface Database { + + boolean sharedPool() default true; + + int poolSize() default 8; + + Class configClass(); + +} diff --git a/src/main/java/com/ilummc/tlib/annotations/db/DatabasePassword.java b/src/main/java/com/ilummc/tlib/annotations/db/DatabasePassword.java new file mode 100644 index 0000000..6f42c90 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/db/DatabasePassword.java @@ -0,0 +1,4 @@ +package com.ilummc.tlib.annotations.db; + +public @interface DatabasePassword { +} diff --git a/src/main/java/com/ilummc/tlib/annotations/db/DatabaseType.java b/src/main/java/com/ilummc/tlib/annotations/db/DatabaseType.java new file mode 100644 index 0000000..48070ca --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/db/DatabaseType.java @@ -0,0 +1,4 @@ +package com.ilummc.tlib.annotations.db; + +public @interface DatabaseType { +} diff --git a/src/main/java/com/ilummc/tlib/annotations/db/DatabaseUrl.java b/src/main/java/com/ilummc/tlib/annotations/db/DatabaseUrl.java new file mode 100644 index 0000000..056dd25 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/db/DatabaseUrl.java @@ -0,0 +1,4 @@ +package com.ilummc.tlib.annotations.db; + +public @interface DatabaseUrl { +} diff --git a/src/main/java/com/ilummc/tlib/annotations/db/DatabaseUser.java b/src/main/java/com/ilummc/tlib/annotations/db/DatabaseUser.java new file mode 100644 index 0000000..b8ab435 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/db/DatabaseUser.java @@ -0,0 +1,4 @@ +package com.ilummc.tlib.annotations.db; + +public @interface DatabaseUser { +} diff --git a/src/main/java/com/ilummc/tlib/annotations/db/SQLTable.java b/src/main/java/com/ilummc/tlib/annotations/db/SQLTable.java new file mode 100644 index 0000000..eb868f2 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/annotations/db/SQLTable.java @@ -0,0 +1,7 @@ +package com.ilummc.tlib.annotations.db; + +public @interface SQLTable { + + String value(); + +} diff --git a/src/main/java/com/ilummc/tlib/bean/BooleanProperty.java b/src/main/java/com/ilummc/tlib/bean/BooleanProperty.java new file mode 100644 index 0000000..2837d76 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/bean/BooleanProperty.java @@ -0,0 +1,17 @@ +package com.ilummc.tlib.bean; + +import java.util.function.BiConsumer; + +public class BooleanProperty { + + private boolean property; + + public BooleanProperty(boolean property) { + this.property = property; + } + + public void addListener(BiConsumer consumer) { + + } + +} diff --git a/src/main/java/com/ilummc/tlib/bean/Property.java b/src/main/java/com/ilummc/tlib/bean/Property.java new file mode 100644 index 0000000..12b16c7 --- /dev/null +++ b/src/main/java/com/ilummc/tlib/bean/Property.java @@ -0,0 +1,4 @@ +package com.ilummc.tlib.bean; + +public class Property { +}