版本更新至 4.13

+ TellrawJoin 新增 append 方法用于拼接其他 json 信息
o 修复 1.12 版本载入报错的问题
o 修复 json 信息发送方式错误的问题
This commit is contained in:
坏黑
2018-07-07 22:43:58 +08:00
parent a8c6aafbce
commit 655e3c2619
5 changed files with 33 additions and 22 deletions

View File

@@ -13,6 +13,7 @@ import me.skymc.taboolib.string.VariableFormatter;
import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
@@ -55,6 +56,14 @@ public class TellrawJson {
return this;
}
public TellrawJson append(TellrawJson json) {
BaseComponent[] newArray = new BaseComponent[components.length + json.components.length];
System.arraycopy(components, 0, newArray, 0, components.length);
System.arraycopy(json.components, 0, newArray, components.length, json.components.length);
components = newArray;
return this;
}
public TellrawJson hoverText(String text) {
getLatestComponent().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(text).create()));
return this;