Skip to content

Commit 6a440aa

Browse files
Handle signed chat commands as well for custom click events (#1103)
1 parent 075ca70 commit 6a440aa

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_6to1_21_5/Protocol1_21_6To1_21_5.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,8 @@ public void handleArgument(final PacketWrapper wrapper, final String argumentTyp
178178
registerClientbound(ClientboundPackets1_21_6.SERVER_LINKS, this::storeServerLinks);
179179
registerClientbound(ClientboundConfigurationPackets1_21_6.SERVER_LINKS, this::storeServerLinks);
180180

181-
registerServerbound(ServerboundPackets1_21_5.CHAT_COMMAND, wrapper -> {
182-
final String command = wrapper.passthrough(Types.STRING);
183-
184-
final ClickEvents clickEvents = wrapper.user().get(ClickEvents.class);
185-
if (clickEvents.handleChatCommand(wrapper.user(), command)) {
186-
wrapper.cancel();
187-
}
188-
});
181+
registerServerbound(ServerboundPackets1_21_5.CHAT_COMMAND, this::handleClickEvents);
182+
registerServerbound(ServerboundPackets1_21_5.CHAT_COMMAND_SIGNED, this::handleClickEvents);
189183

190184
// The ones below are specific to the chest dialog view provider
191185
registerServerbound(ServerboundPackets1_21_5.CONTAINER_CLOSE, wrapper -> {
@@ -312,6 +306,15 @@ private void storeServerLinks(final PacketWrapper wrapper) {
312306
wrapper.user().put(serverLinks);
313307
}
314308

309+
private void handleClickEvents(final PacketWrapper wrapper) {
310+
final String command = wrapper.passthrough(Types.STRING);
311+
312+
final ClickEvents clickEvents = wrapper.user().get(ClickEvents.class);
313+
if (clickEvents.handleChatCommand(wrapper.user(), command)) {
314+
wrapper.cancel();
315+
}
316+
}
317+
315318
@Override
316319
public void init(final UserConnection user) {
317320
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_21_6.PLAYER));

0 commit comments

Comments
 (0)