diff --git a/pom.xml b/pom.xml index 7db558e..003c15d 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ http://ci.citycraft.cn:8080 - §a添加操作提示... + §d更新命令以及参数... Debug UTF-8 diff --git a/src/main/java/cn/citycraft/DataStorage/DataStorage.java b/src/main/java/cn/citycraft/DataStorage/DataStorage.java index bebd8e2..87d55e9 100644 --- a/src/main/java/cn/citycraft/DataStorage/DataStorage.java +++ b/src/main/java/cn/citycraft/DataStorage/DataStorage.java @@ -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));