版本更新至:3.77
调整:Language2 工具变量算法优化 修复:Language2 工具修复 [book] 类型的变量无法识别问题
This commit is contained in:
parent
ad1a21196f
commit
bfb2015b20
@ -6,7 +6,7 @@ website: http://www.15imc.com/index.html
|
|||||||
|
|
||||||
main: me.skymc.taboolib.Main
|
main: me.skymc.taboolib.Main
|
||||||
|
|
||||||
version: 3.76
|
version: 3.77
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
taboolib:
|
taboolib:
|
||||||
|
@ -105,7 +105,9 @@ public class Language2Format implements Language2Line {
|
|||||||
private void parseValue(Player player, List<String> list, Language2Type type) {
|
private void parseValue(Player player, List<String> list, Language2Type type) {
|
||||||
if (list.size() == 0) {
|
if (list.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 变量转换
|
||||||
|
list = language2Value.setPlaceholder(list, player);
|
||||||
|
|
||||||
// 大标题
|
// 大标题
|
||||||
if (type == Language2Type.TITLE) {
|
if (type == Language2Type.TITLE) {
|
||||||
|
@ -80,7 +80,7 @@ public class Language2Action implements Language2Line {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ActionUtils.send(player, value.setPlaceholder(text, player));
|
ActionUtils.send(player, text);
|
||||||
if ((times += 1) >= repeat) {
|
if ((times += 1) >= repeat) {
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
|
@ -139,17 +139,17 @@ public class Language2Book implements Language2Line {
|
|||||||
// 遍历内容
|
// 遍历内容
|
||||||
for (String _option : entry.getValue()) {
|
for (String _option : entry.getValue()) {
|
||||||
if (_option.startsWith(KEY_TEXT)) {
|
if (_option.startsWith(KEY_TEXT)) {
|
||||||
builder.text(value.setPlaceholder(_option.substring(KEY_TEXT.length()), player));
|
builder.text(_option.substring(KEY_TEXT.length()));
|
||||||
}
|
}
|
||||||
else if (_option.startsWith(KEY_COMMAND)) {
|
else if (_option.startsWith(KEY_COMMAND)) {
|
||||||
builder.onClick(ClickAction.runCommand(value.setPlaceholder(_option.substring(KEY_COMMAND.length()), player)));
|
builder.onClick(ClickAction.runCommand(_option.substring(KEY_COMMAND.length())));
|
||||||
}
|
}
|
||||||
else if (_option.startsWith(KEY_SUGGEST)) {
|
else if (_option.startsWith(KEY_SUGGEST)) {
|
||||||
builder.onClick(ClickAction.suggestCommand(value.setPlaceholder(_option.substring(KEY_SUGGEST.length()), player)));
|
builder.onClick(ClickAction.suggestCommand(_option.substring(KEY_SUGGEST.length())));
|
||||||
}
|
}
|
||||||
else if (_option.startsWith(KEY_URL)) {
|
else if (_option.startsWith(KEY_URL)) {
|
||||||
try {
|
try {
|
||||||
builder.onClick(ClickAction.openUrl(value.setPlaceholder(_option.substring(KEY_URL.length()), player)));
|
builder.onClick(ClickAction.openUrl(_option.substring(KEY_URL.length())));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
builder.text("§4[<ERROR-52: " + value.getLanguageKey() + ">]");
|
builder.text("§4[<ERROR-52: " + value.getLanguageKey() + ">]");
|
||||||
@ -159,7 +159,7 @@ public class Language2Book implements Language2Line {
|
|||||||
builder.onClick(ClickAction.changePage(NumberUtils.getInteger(_option.substring(KEY_PAGE.length()))));
|
builder.onClick(ClickAction.changePage(NumberUtils.getInteger(_option.substring(KEY_PAGE.length()))));
|
||||||
}
|
}
|
||||||
else if (_option.startsWith(KEY_SHOWTEXT)) {
|
else if (_option.startsWith(KEY_SHOWTEXT)) {
|
||||||
builder.onHover(HoverAction.showText(value.setPlaceholder(_option.substring(KEY_SHOWTEXT.length()), player)));
|
builder.onHover(HoverAction.showText(_option.substring(KEY_SHOWTEXT.length())));
|
||||||
}
|
}
|
||||||
else if (_option.startsWith(KEY_SHOWITEM)) {
|
else if (_option.startsWith(KEY_SHOWITEM)) {
|
||||||
ItemStack item = ItemUtils.getCacheItem(_option.substring(KEY_SHOWITEM.length()));
|
ItemStack item = ItemUtils.getCacheItem(_option.substring(KEY_SHOWITEM.length()));
|
||||||
|
@ -68,7 +68,7 @@ public class Language2Json implements Language2Line {
|
|||||||
try {
|
try {
|
||||||
// 如果是显示文本
|
// 如果是显示文本
|
||||||
if (message.startsWith(KEY_TEXT)) {
|
if (message.startsWith(KEY_TEXT)) {
|
||||||
hoverEvent = new ShowTextEvent(value.setPlaceholder(message.replace("||", "\n").substring(KEY_TEXT.length()), player));
|
hoverEvent = new ShowTextEvent(message.replace("||", "\n").substring(KEY_TEXT.length()));
|
||||||
}
|
}
|
||||||
// 显示物品
|
// 显示物品
|
||||||
else if (message.startsWith(KEY_ITEM)) {
|
else if (message.startsWith(KEY_ITEM)) {
|
||||||
@ -80,15 +80,15 @@ public class Language2Json implements Language2Line {
|
|||||||
}
|
}
|
||||||
// 执行指令
|
// 执行指令
|
||||||
else if (message.startsWith(KEY_COMMAND)) {
|
else if (message.startsWith(KEY_COMMAND)) {
|
||||||
clickEvent = new RunCommandEvent(value.setPlaceholder(message.substring(KEY_COMMAND.length()), player));
|
clickEvent = new RunCommandEvent(message.substring(KEY_COMMAND.length()));
|
||||||
}
|
}
|
||||||
// 打印指令
|
// 打印指令
|
||||||
else if (message.startsWith(KEY_SUGGEST)) {
|
else if (message.startsWith(KEY_SUGGEST)) {
|
||||||
clickEvent = new SuggestCommandEvent(value.setPlaceholder(message.substring(KEY_SUGGEST.length()), player));
|
clickEvent = new SuggestCommandEvent(message.substring(KEY_SUGGEST.length()));
|
||||||
}
|
}
|
||||||
// 打开连接
|
// 打开连接
|
||||||
else if (message.startsWith(KEY_URL)) {
|
else if (message.startsWith(KEY_URL)) {
|
||||||
clickEvent = new OpenUrlEvent(value.setPlaceholder(message.substring(KEY_SUGGEST.length()), player));
|
clickEvent = new OpenUrlEvent(message.substring(KEY_SUGGEST.length()));
|
||||||
}
|
}
|
||||||
// 换行
|
// 换行
|
||||||
else if (message.equals("[break]")) {
|
else if (message.equals("[break]")) {
|
||||||
@ -149,16 +149,16 @@ public class Language2Json implements Language2Line {
|
|||||||
private void append(String current, ClickEvent clickEvent, HoverEvent hoverEvent) {
|
private void append(String current, ClickEvent clickEvent, HoverEvent hoverEvent) {
|
||||||
if (clickEvent == null && hoverEvent == null) {
|
if (clickEvent == null && hoverEvent == null) {
|
||||||
// 纯文本
|
// 纯文本
|
||||||
json.append(value.setPlaceholder(current, player));
|
json.append(current);
|
||||||
} else if (clickEvent != null && hoverEvent == null) {
|
} else if (clickEvent != null && hoverEvent == null) {
|
||||||
// 纯点击
|
// 纯点击
|
||||||
json.appendClick(value.setPlaceholder(current, player), clickEvent);
|
json.appendClick(current, clickEvent);
|
||||||
} else if (clickEvent == null && hoverEvent != null) {
|
} else if (clickEvent == null && hoverEvent != null) {
|
||||||
// 纯显示
|
// 纯显示
|
||||||
json.appendHover(value.setPlaceholder(current, player), hoverEvent);
|
json.appendHover(current, hoverEvent);
|
||||||
} else {
|
} else {
|
||||||
// 全部
|
// 全部
|
||||||
json.appendHoverClick(value.setPlaceholder(current, player), hoverEvent, clickEvent);
|
json.appendHoverClick(current, hoverEvent, clickEvent);
|
||||||
}
|
}
|
||||||
// 追加显示文本
|
// 追加显示文本
|
||||||
text.append(current);
|
text.append(current);
|
||||||
|
@ -36,14 +36,14 @@ public class Language2Text implements Language2Line {
|
|||||||
@Override
|
@Override
|
||||||
public void send(Player player) {
|
public void send(Player player) {
|
||||||
for (String line : text) {
|
for (String line : text) {
|
||||||
player.sendMessage(value.setPlaceholder(line, player));
|
player.sendMessage(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void console() {
|
public void console() {
|
||||||
for (String line : text) {
|
for (String line : text) {
|
||||||
Bukkit.getConsoleSender().sendMessage(value.setPlaceholder(line, null));
|
Bukkit.getConsoleSender().sendMessage(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class Language2Title implements Language2Line {
|
|||||||
player.sendMessage(ChatColor.DARK_RED + "[<ERROR-31: " + value.getLanguageKey() + ">]");
|
player.sendMessage(ChatColor.DARK_RED + "[<ERROR-31: " + value.getLanguageKey() + ">]");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TitleUtils.sendTitle(player, value.setPlaceholder(title, player), value.setPlaceholder(subtitle, player), fade1, stay, fade2);
|
TitleUtils.sendTitle(player, title, subtitle, fade1, stay, fade2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user