From 83935aaa5ce4c72fd0d17625ff8ddf943dd87d14 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 22 Aug 2016 20:08:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0cmd=5Ftip=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../java/pw/yumc/YumCore/tellraw/Tellraw.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java b/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java index 5143e05..f2d2680 100644 --- a/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java +++ b/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java @@ -46,6 +46,19 @@ public class Tellraw { System.out.println(Tellraw.create("命令").command("yum list").tip("点击查看插件列表").toJsonString()); } + /** + * 命令与提示 + * + * @param command + * 命令 + * @param tip + * 提示 + * @return {@link Tellraw} + */ + public Tellraw cmd_tip(final String command, final String... tip) { + return command(command).tip(tip); + } + /** * 执行命令 * @@ -111,7 +124,7 @@ public class Tellraw { /** * 修改当前串文本 - * + * * @param text * 文本 * @return {@link Tellraw} @@ -140,6 +153,9 @@ public class Tellraw { * @return {@link Tellraw} */ public Tellraw tip(final List texts) { + if (texts.size() == 0) { + return this; + } final StringBuffer text = new StringBuffer(); for (final String t : texts) { text.append(t).append("\n");