From a4812267a1b1fb450484ebfbccb45dd1f0433088 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 1 Dec 2015 20:16:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=93=8D=E4=BD=9C=E6=8F=90?= =?UTF-8?q?=E7=A4=BA...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- pom.xml | 4 +-- .../cn/citycraft/DataStorage/DataStorage.java | 30 +++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 03814bb..7db558e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.citycraft DataStorage - 1.0 + 1.0.1 DataStorage ${project.name} @@ -54,7 +54,7 @@ http://ci.citycraft.cn:8080 - + §a添加操作提示... Debug UTF-8 diff --git a/src/main/java/cn/citycraft/DataStorage/DataStorage.java b/src/main/java/cn/citycraft/DataStorage/DataStorage.java index 5da3f5b..bebd8e2 100644 --- a/src/main/java/cn/citycraft/DataStorage/DataStorage.java +++ b/src/main/java/cn/citycraft/DataStorage/DataStorage.java @@ -36,22 +36,42 @@ public class DataStorage extends JavaPlugin { if (args.length > 2 && value != 0) { switch (subcmd) { case "add": - db.dbUpdate(tableName, new KeyValue(vfields, value + dbValue), kv); + if (db.dbUpdate(tableName, new KeyValue(vfields, value + dbValue), kv) != 0) { + sender.sendMessage("§a成功给了 " + key + " 添加了 " + value + " 目前的值为 " + (value + dbValue)); + } else { + sender.sendMessage("§c操作失败 请查看后台错误!"); + } return true; case "del": - db.dbUpdate(tableName, new KeyValue(vfields, dbValue - value), kv); + if (db.dbUpdate(tableName, new KeyValue(vfields, dbValue - value), kv) != 0) { + sender.sendMessage("§a成功给了 " + key + " 减少了 " + value + " 目前的值为 " + (dbValue - value)); + } else { + sender.sendMessage("§c操作失败 请查看后台错误!"); + } return true; case "create": - db.dbInsert(tableName, kv.add(vfields, value)); + if (db.dbInsert(tableName, kv.add(vfields, value)) != 0) { + sender.sendMessage("§a成功创建了 " + key + "初始值为 " + value); + } else { + sender.sendMessage("§c操作失败 请查看后台错误!"); + } return true; } } if (args.length > 1) { - db.dbDelete(tableName, kv); + if (db.dbDelete(tableName, kv) != 0) { + sender.sendMessage("§a成功移除了 " + key); + } else { + sender.sendMessage("§c操作失败 请查看后台错误!"); + } return true; } } - final String[] help = new String[] { "§6dd add key value 键key的值添加value!", "§6dd del key value 键key的值减少value!", "§6dd add key value 创建键key设置值为value!", "§6dd remove key 移除key!" }; + final String[] help = new String[] { "§6========= [§b" + this.getName() + "§6] 插件帮助列表=========", + "§6/dd §acreate key value §6- §b创建键key设置值为value!", + "§6/dd §aadd key value §6- §b键key的值添加value!", + "§6/dd §adel key value §6- §b键key的值减少value!", + "§6/dd §aremove key §6- §b移除key!" }; sender.sendMessage(help); return true; }