3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

Fix "pointers" for players never being used lol & Type pointers (#674)

* Fix "pointers" for players never being used lol

* Added Platform Facet API to add Type pointers

* Remove duplicate
Dieser Commit ist enthalten in:
OOP-778 2022-04-01 05:09:10 +03:00 committet von GitHub
Ursprung 05d1938476
Commit 9f77431f36
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 14 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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'

Datei anzeigen

@ -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();

Datei anzeigen

@ -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;