|
25 | 25 | import net.minecraft.text.Text; |
26 | 26 | import org.apache.commons.text.TextStringBuilder; |
27 | 27 |
|
| 28 | +import java.net.URI; |
28 | 29 | import java.util.Collection; |
29 | 30 |
|
30 | 31 | public class FabricMessageBuilder implements MessageBuilder { |
@@ -58,31 +59,31 @@ public MessageBuilder newLine() { |
58 | 59 |
|
59 | 60 | @Override |
60 | 61 | public MessageBuilder link(String url) { |
61 | | - builder.styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url))); |
| 62 | + builder.styled(style -> style.withClickEvent(new ClickEvent.OpenUrl(URI.create(url)))); |
62 | 63 | return this; |
63 | 64 | } |
64 | 65 |
|
65 | 66 | @Override |
66 | 67 | public MessageBuilder command(String command) { |
67 | | - builder.styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command.charAt(0) == '/' ? command : '/' + command))); |
| 68 | + builder.styled(style -> style.withClickEvent(new ClickEvent.RunCommand(command.charAt(0) == '/' ? command : '/' + command))); |
68 | 69 | return this; |
69 | 70 | } |
70 | 71 |
|
71 | 72 | @Override |
72 | 73 | public MessageBuilder hover(String message) { |
73 | | - builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(message)))); |
| 74 | + builder.styled(style -> style.withHoverEvent(new HoverEvent.ShowText(Text.literal(message)))); |
74 | 75 | return this; |
75 | 76 | } |
76 | 77 |
|
77 | 78 | @Override |
78 | 79 | public MessageBuilder hover(String... lines) { |
79 | | - builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); |
| 80 | + builder.styled(style -> style.withHoverEvent(new HoverEvent.ShowText(Text.literal(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); |
80 | 81 | return this; |
81 | 82 | } |
82 | 83 |
|
83 | 84 | @Override |
84 | 85 | public MessageBuilder hover(Collection<String> lines) { |
85 | | - builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); |
| 86 | + builder.styled(style -> style.withHoverEvent(new HoverEvent.ShowText(Text.literal(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); |
86 | 87 | return this; |
87 | 88 | } |
88 | 89 |
|
|
0 commit comments