画饼
This commit is contained in:
35
src/main/java/com/ilummc/tlib/ExampleMain.java
Normal file
35
src/main/java/com/ilummc/tlib/ExampleMain.java
Normal file
@@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user