diff --git a/proxy/build.gradle b/proxy/build.gradle index fd38a2004..b486548ac 100644 --- a/proxy/build.gradle +++ b/proxy/build.gradle @@ -68,6 +68,7 @@ dependencies { implementation(platform("net.kyori:adventure-bom:${adventureVersion}")) implementation("net.kyori:adventure-nbt") + implementation("net.kyori:adventure-platform-facet:4.0.0") implementation 'org.asynchttpclient:async-http-client:2.12.3' diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 0851f1139..3fb828ef4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -88,6 +88,8 @@ import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.bossbar.BossBar; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.permission.PermissionChecker; +import net.kyori.adventure.platform.facet.FacetPointers; +import net.kyori.adventure.platform.facet.FacetPointers.Type; import net.kyori.adventure.pointer.Pointers; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TranslatableComponent; @@ -145,6 +147,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { .withDynamic(Identity.UUID, this::getUniqueId) .withDynamic(Identity.NAME, this::getUsername) .withStatic(PermissionChecker.POINTER, getPermissionChecker()) + .withStatic(FacetPointers.TYPE, Type.PLAYER) .build(); private @Nullable String clientBrand; private @Nullable Locale effectiveLocale; @@ -256,6 +259,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { server.getEventManager().fireAndForget(new PlayerModInfoEvent(this, modInfo)); } + @Override + public @NotNull Pointers pointers() { + return this.pointers; + } + @Override public InetSocketAddress getRemoteAddress() { return (InetSocketAddress) connection.getRemoteAddress(); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java index fe38209d3..0b4f00390 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java @@ -29,6 +29,8 @@ import java.util.List; import java.util.Locale; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.permission.PermissionChecker; +import net.kyori.adventure.platform.facet.FacetPointers; +import net.kyori.adventure.platform.facet.FacetPointers.Type; import net.kyori.adventure.pointer.Pointers; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -52,7 +54,9 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons private final VelocityServer server; private PermissionFunction permissionFunction = ALWAYS_TRUE; private final @NotNull Pointers pointers = ConsoleCommandSource.super.pointers().toBuilder() - .withDynamic(PermissionChecker.POINTER, this::getPermissionChecker).build(); + .withDynamic(PermissionChecker.POINTER, this::getPermissionChecker) + .withStatic(FacetPointers.TYPE, Type.CONSOLE) + .build(); public VelocityConsole(VelocityServer server) { this.server = server;