本帖最后由 tycmc.top 于 2022-2-19 08:55 编辑
看不懂这个报错的描述意思,是因为这句代码错了吗:
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Objects.requireNonNull(config.getString("hoverButton")).replaceAll("&", "§")).create()));

看不懂这个报错的描述意思,是因为这句代码错了吗:
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Objects.requireNonNull(config.getString("hoverButton")).replaceAll("&", "§")).create()));
Deprecated. HoverEvent(Action, Content[])
Legacy constructor to create hover event.遗留的构造函数,用于创建悬停事件。
也就是说这个构建方法已经过时了
Legacy constructor to create hover event.遗留的构造函数,用于创建悬停事件。
也就是说这个构建方法已经过时了
方法过时,去官方文档看一下新的构造函数就好。
美味的曲奇 发表于 2022-2-19 11:50
Deprecated. HoverEvent(Action, Content[])
Legacy constructor to create hover event.遗留的构造函数, ...
那么应该换用什么方法来实现把鼠标移到文字上方显示悬浮文本呢
tycmc.top 发表于 2022-2-19 13:09
那么应该换用什么方法来实现把鼠标移到文字上方显示悬浮文本呢
过时的不是HoverEvent,而是你用的那个构造函数,1.15以后用:
new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(text))