geforkt von Mirrors/Velocity
Merge branch 'dev/1.1.0' into decode-multiple
Dieser Commit ist enthalten in:
Commit
9f6d8e1840
@ -26,6 +26,7 @@ dependencies {
|
||||
compile "org.slf4j:slf4j-api:${slf4jVersion}"
|
||||
compile 'com.google.inject:guice:4.2.2'
|
||||
compile "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
|
||||
compile 'com.mojang:brigadier:1.0.17'
|
||||
|
||||
compile "org.spongepowered:configurate-hocon:${configurateVersion}"
|
||||
compile "org.spongepowered:configurate-yaml:${configurateVersion}"
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.velocitypowered.api.event.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
/**
|
||||
* Allows plugins to modify the packet indicating commands available on the server to a
|
||||
* Minecraft 1.13+ client.
|
||||
*/
|
||||
@Beta
|
||||
public class PlayerAvailableCommandsEvent {
|
||||
|
||||
private final Player player;
|
||||
private final RootCommandNode<?> rootNode;
|
||||
|
||||
/**
|
||||
* Constructs an available commands event.
|
||||
* @param player the targeted player
|
||||
* @param rootNode the Brigadier root node
|
||||
*/
|
||||
public PlayerAvailableCommandsEvent(Player player,
|
||||
RootCommandNode<?> rootNode) {
|
||||
this.player = checkNotNull(player, "player");
|
||||
this.rootNode = checkNotNull(rootNode, "rootNode");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public RootCommandNode<?> getRootNode() {
|
||||
return rootNode;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.velocitypowered.api.event.command.PlayerAvailableCommandsEvent;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
@ -175,7 +176,11 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
||||
.build();
|
||||
commands.getRootNode().addChild(root);
|
||||
}
|
||||
return false;
|
||||
|
||||
server.getEventManager().fire(
|
||||
new PlayerAvailableCommandsEvent(serverConn.getPlayer(), commands.getRootNode()))
|
||||
.thenAcceptAsync(event -> playerConnection.write(commands), playerConnection.eventLoop());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren