mirror of
https://e.coding.net/circlecloud/DataStorage.git
synced 2024-12-04 04:08:53 +00:00
更新命令以及参数...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
a4812267a1
commit
3c26ecf0f4
2
pom.xml
2
pom.xml
@ -54,7 +54,7 @@
|
||||
</build>
|
||||
<properties>
|
||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||
<update.description>§a添加操作提示...</update.description>
|
||||
<update.description>§d更新命令以及参数...</update.description>
|
||||
<env.BUILD_NUMBER>Debug</env.BUILD_NUMBER>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
@ -12,6 +12,7 @@ import cn.citycraft.PluginHelper.sql.DataBase;
|
||||
import cn.citycraft.PluginHelper.sql.KeyValue;
|
||||
import cn.citycraft.PluginHelper.sql.MySQLCore;
|
||||
import cn.citycraft.PluginHelper.sql.SQLiteCore;
|
||||
import me.clip.placeholderapi.PlaceholderHook;
|
||||
|
||||
public class DataStorage extends JavaPlugin {
|
||||
FileConfig config;
|
||||
@ -37,21 +38,21 @@ public class DataStorage extends JavaPlugin {
|
||||
switch (subcmd) {
|
||||
case "add":
|
||||
if (db.dbUpdate(tableName, new KeyValue(vfields, value + dbValue), kv) != 0) {
|
||||
sender.sendMessage("§a成功给了 " + key + " 添加了 " + value + " 目前的值为 " + (value + dbValue));
|
||||
sender.sendMessage("§a成功给了 §3" + key + " §a添加了 §e" + value + " §a目前的值为 §d" + (value + dbValue));
|
||||
} else {
|
||||
sender.sendMessage("§c操作失败 请查看后台错误!");
|
||||
sender.sendMessage("§c操作失败 请查看后台错误 (添加删除需要初始化)!");
|
||||
}
|
||||
return true;
|
||||
case "del":
|
||||
if (db.dbUpdate(tableName, new KeyValue(vfields, dbValue - value), kv) != 0) {
|
||||
sender.sendMessage("§a成功给了 " + key + " 减少了 " + value + " 目前的值为 " + (dbValue - value));
|
||||
sender.sendMessage("§a成功给了 §3" + key + " §c减少了 §e" + value + " §a目前的值为 §d" + (dbValue - value));
|
||||
} else {
|
||||
sender.sendMessage("§c操作失败 请查看后台错误!");
|
||||
sender.sendMessage("§c操作失败 请查看后台错误 (添加删除需要初始化)!");
|
||||
}
|
||||
return true;
|
||||
case "create":
|
||||
if (db.dbInsert(tableName, kv.add(vfields, value)) != 0) {
|
||||
sender.sendMessage("§a成功创建了 " + key + "初始值为 " + value);
|
||||
sender.sendMessage("§a成功创建了 §3" + key + " §a初始值为 §d" + value);
|
||||
} else {
|
||||
sender.sendMessage("§c操作失败 请查看后台错误!");
|
||||
}
|
||||
@ -59,12 +60,24 @@ public class DataStorage extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
if (args.length > 1) {
|
||||
if (db.dbDelete(tableName, kv) != 0) {
|
||||
sender.sendMessage("§a成功移除了 " + key);
|
||||
} else {
|
||||
sender.sendMessage("§c操作失败 请查看后台错误!");
|
||||
switch (subcmd) {
|
||||
case "remove":
|
||||
if (db.dbDelete(tableName, kv) != 0) {
|
||||
sender.sendMessage("§a成功移除了 §3" + key);
|
||||
} else {
|
||||
sender.sendMessage("§c操作失败 请查看后台错误 (添加删除需要初始化)!");
|
||||
}
|
||||
return true;
|
||||
case "test":
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage("§6语句测试: §3" + PluginAPI.PlaceholderAPI((Player) sender, key));
|
||||
} else {
|
||||
sender.sendMessage("§c控制台无法测试语句!");
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
final String[] help = new String[] { "§6========= [§b" + this.getName() + "§6] 插件帮助列表=========",
|
||||
@ -104,7 +117,7 @@ public class DataStorage extends JavaPlugin {
|
||||
this.getLogger().warning("数据库连接失败!");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
final boolean result = PluginAPI.PlaceholderHook("dd", new me.clip.placeholderapi.PlaceholderHook() {
|
||||
final boolean result = PluginAPI.PlaceholderHook("dd", new PlaceholderHook() {
|
||||
@Override
|
||||
public String onPlaceholderRequest(final Player arg0, final String arg1) {
|
||||
return db.dbSelectFirst(tableName, vfields, new KeyValue(kfields, arg1));
|
||||
|
Loading…
Reference in New Issue
Block a user