cui新增指令提示

This commit is contained in:
zhangyuheng 2024-06-09 23:31:56 +08:00
parent 9f7fce1ed5
commit e6ea79437c

View File

@ -29,6 +29,7 @@ public class CuiTextInput implements CuiView {
private final Map<Integer, ItemStackButton> buttons = new HashMap<>();
private InputCallback callback_handle_input;
private AnvilInventory inv;
private String suggest_command = null;
public static CuiTextInput create(InputCallback callback_handle_input) {
CuiTextInput cuiTextInput = new CuiTextInput();
@ -40,6 +41,9 @@ public class CuiTextInput implements CuiView {
public void open(Player audience) {
if (!isPaper()) {
Notification.error(audience, "CUI TextInput 功能在非 Paper 系的服务端上不可用,请使用指令执行对应操作。");
if (suggest_command != null) {
Notification.info(audience, "参考指令: " + suggest_command);
}
return;
}
// open anvil inventory
@ -138,4 +142,9 @@ public class CuiTextInput implements CuiView {
}
public CuiTextInput setSuggestCommand(String command) {
this.suggest_command = command;
return this;
}
}