mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 06:18:46 +00:00
feat: 添加数据库保存
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
829351e576
commit
2b3313579c
@ -38,7 +38,7 @@ public class YumPluginLoader implements PluginLoader {
|
|||||||
internal_loader = new JavaPluginLoader(instance);
|
internal_loader = new JavaPluginLoader(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cleanJavaPluginLoaders() {
|
public static void replaceJavaPluginLoaders() {
|
||||||
final YumPluginLoader yumPluginLoader = new YumPluginLoader(Bukkit.getServer());
|
final YumPluginLoader yumPluginLoader = new YumPluginLoader(Bukkit.getServer());
|
||||||
final PluginManager spm = Bukkit.getPluginManager();
|
final PluginManager spm = Bukkit.getPluginManager();
|
||||||
try {
|
try {
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import cn.citycraft.PluginHelper.bukkit.P;
|
import cn.citycraft.PluginHelper.bukkit.P;
|
||||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||||
|
import cn.citycraft.PluginHelper.sql.DataBase;
|
||||||
|
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
public final static String ENABLE = "Enable";
|
public final static String ENABLE = "Enable";
|
||||||
@ -36,6 +37,10 @@ public class ConfigManager {
|
|||||||
return config.getStringList("blacklist");
|
return config.getStringList("blacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataBase getDataBase() {
|
||||||
|
return DataBase.create(P.instance, config.getConfigurationSection(""));
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getIgnoreList() {
|
public List<String> getIgnoreList() {
|
||||||
return config.getStringList("ignorelist");
|
return config.getStringList("ignorelist");
|
||||||
}
|
}
|
||||||
|
20
src/main/java/pw/yumc/Yum/managers/DataManager.java
Normal file
20
src/main/java/pw/yumc/Yum/managers/DataManager.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package pw.yumc.Yum.managers;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.sql.DataBase;
|
||||||
|
import cn.citycraft.PluginHelper.sql.KeyValue;
|
||||||
|
import cn.citycraft.PluginHelper.sql.Type;
|
||||||
|
|
||||||
|
public class DataManager {
|
||||||
|
private static DataBase db = ConfigManager.i().getDataBase();
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
db.createTables(TableName.cmd, new KeyValue("name", Type.VARCHAR.get()), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class TableName {
|
||||||
|
public static String prefix = "monitor_";
|
||||||
|
public static String cmd = prefix + "cmd";
|
||||||
|
public static String event = prefix + "event";
|
||||||
|
public static String task = prefix + "task";
|
||||||
|
}
|
||||||
|
}
|
@ -42,13 +42,17 @@ public class MonitorManager {
|
|||||||
private final static Map<String, Long> event = new ConcurrentHashMap<>();
|
private final static Map<String, Long> event = new ConcurrentHashMap<>();
|
||||||
private final static Map<String, Long> cmd = new ConcurrentHashMap<>();
|
private final static Map<String, Long> cmd = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final static DataBase db = null;
|
private static DataBase db;
|
||||||
|
|
||||||
private final static double um = 1000000.00;
|
private final static double um = 1000000.00;
|
||||||
|
|
||||||
private final static LogKit mlog = new LogKit("monitor.log");
|
private final static LogKit mlog = new LogKit("monitor.log");
|
||||||
private final static LogKit elog = new LogKit("error.log");
|
private final static LogKit elog = new LogKit("error.log");
|
||||||
|
|
||||||
|
public MonitorManager() {
|
||||||
|
db = ConfigManager.i().getDataBase();
|
||||||
|
}
|
||||||
|
|
||||||
public static void addCmd(final String pname, final long time) {
|
public static void addCmd(final String pname, final long time) {
|
||||||
add(pname, time, monitor, cmd);
|
add(pname, time, monitor, cmd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user