diff --git a/api/src/main/java/com/velocitypowered/api/command/CommandSource.java b/api/src/main/java/com/velocitypowered/api/command/CommandSource.java index 380cb9217..31392f538 100644 --- a/api/src/main/java/com/velocitypowered/api/command/CommandSource.java +++ b/api/src/main/java/com/velocitypowered/api/command/CommandSource.java @@ -14,12 +14,10 @@ import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.identity.Identified; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.permission.PermissionChecker; -import net.kyori.adventure.pointer.Pointers; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.legacytext3.LegacyText3ComponentSerializer; import net.kyori.adventure.util.TriState; import org.checkerframework.checker.nullness.qual.NonNull; -import org.jetbrains.annotations.NotNull; /** * Represents something that can be used to run a {@link Command}. @@ -42,11 +40,6 @@ public interface CommandSource extends Audience, PermissionSubject { this.sendMessage(LegacyText3ComponentSerializer.get().serialize(message)); } - @Override - default @NotNull Pointers pointers() { - return Pointers.builder().withStatic(PermissionChecker.POINTER, getPermissionChecker()).build(); - } - /** * Gets the permission checker for the invoker. * 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 94b2fd1f5..7807c8518 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 @@ -94,6 +94,7 @@ import java.util.concurrent.ThreadLocalRandom; 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.pointer.Pointers; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TranslatableComponent; @@ -148,6 +149,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { .withDynamic(Identity.UUID, this::getUniqueId) .withDynamic(Identity.NAME, this::getUsername) .withDynamic(Identity.DISPLAY_NAME, this::getDisplayName) + .withStatic(PermissionChecker.POINTER, getPermissionChecker()) .build(); ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection, 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 6b465193f..28454816a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java @@ -26,6 +26,8 @@ import com.velocitypowered.api.proxy.ConsoleCommandSource; import com.velocitypowered.proxy.VelocityServer; import java.util.List; import net.kyori.adventure.identity.Identity; +import net.kyori.adventure.permission.PermissionChecker; +import net.kyori.adventure.pointer.Pointers; import net.kyori.adventure.text.Component; import net.kyori.text.TextComponent; import net.kyori.text.format.TextColor; @@ -35,6 +37,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.io.IoBuilder; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.NotNull; import org.jline.reader.Candidate; import org.jline.reader.LineReader; import org.jline.reader.LineReaderBuilder; @@ -45,6 +48,8 @@ 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(); public VelocityConsole(VelocityServer server) { this.server = server; @@ -131,4 +136,9 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons protected void shutdown() { this.server.shutdown(true); } + + @Override + public @NotNull Pointers pointers() { + return pointers; + } }