From 3cb10f6ad4f3f36941b5ae5e1fcc0987b4bcd0cb Mon Sep 17 00:00:00 2001 From: 4drian3d <68704415+4drian3d@users.noreply.github.com> Date: Fri, 15 Apr 2022 23:37:35 -0500 Subject: [PATCH] Implement missing Pointers (#694) - Implement Player's LOCALE and DISPLAY_NAME pointers - Implement VelocityConsole's LOCALE pointer --- .../proxy/connection/client/ConnectedPlayer.java | 2 ++ .../java/com/velocitypowered/proxy/console/VelocityConsole.java | 2 ++ 2 files changed, 4 insertions(+) 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 8a2ef58cd..d5f636299 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 @@ -152,6 +152,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { private final @NotNull Pointers pointers = Player.super.pointers().toBuilder() .withDynamic(Identity.UUID, this::getUniqueId) .withDynamic(Identity.NAME, this::getUsername) + .withDynamic(Identity.DISPLAY_NAME, () -> Component.text(this.getUsername())) + .withDynamic(Identity.LOCALE, this::getEffectiveLocale) .withStatic(PermissionChecker.POINTER, getPermissionChecker()) .withStatic(FacetPointers.TYPE, Type.PLAYER) .build(); 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 0b4f00390..6395dbe6d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java @@ -55,6 +55,8 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons private PermissionFunction permissionFunction = ALWAYS_TRUE; private final @NotNull Pointers pointers = ConsoleCommandSource.super.pointers().toBuilder() .withDynamic(PermissionChecker.POINTER, this::getPermissionChecker) + .withDynamic(Identity.LOCALE, () -> ClosestLocaleMatcher.INSTANCE + .lookupClosest(Locale.getDefault())) .withStatic(FacetPointers.TYPE, Type.CONSOLE) .build();