fix: send callback command to >= 1.21.6 clients (#1627)
This commit is contained in:
@@ -359,8 +359,13 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
// Inject commands from the proxy.
|
// Inject commands from the proxy.
|
||||||
final CommandGraphInjector<CommandSource> injector = server.getCommandManager().getInjector();
|
final CommandGraphInjector<CommandSource> injector = server.getCommandManager().getInjector();
|
||||||
injector.inject(rootNode, serverConn.getPlayer());
|
injector.inject(rootNode, serverConn.getPlayer());
|
||||||
|
|
||||||
|
// In 1.21.6 a confirmation prompt was added when executing a command via `run_command` click
|
||||||
|
// action if the command is unknown. To prevent this prompt we have to send the command.
|
||||||
|
if (this.playerConnection.getProtocolVersion().lessThan(ProtocolVersion.MINECRAFT_1_21_6)) {
|
||||||
rootNode.removeChildByName("velocity:callback");
|
rootNode.removeChildByName("velocity:callback");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
server.getEventManager().fire(
|
server.getEventManager().fire(
|
||||||
new PlayerAvailableCommandsEvent(serverConn.getPlayer(), rootNode))
|
new PlayerAvailableCommandsEvent(serverConn.getPlayer(), rootNode))
|
||||||
|
|||||||
Reference in New Issue
Block a user