From 3c26ecf0f434d52dc58687eec6166cddacac80e4 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 1 Dec 2015 21:41:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=91=BD=E4=BB=A4=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=8F=82=E6=95=B0...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- pom.xml | 2 +- .../cn/citycraft/DataStorage/DataStorage.java | 35 +++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) 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));