Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +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:
Ursprung
05d1938476
Commit
9f77431f36
@ -68,6 +68,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation(platform("net.kyori:adventure-bom:${adventureVersion}"))
|
implementation(platform("net.kyori:adventure-bom:${adventureVersion}"))
|
||||||
implementation("net.kyori:adventure-nbt")
|
implementation("net.kyori:adventure-nbt")
|
||||||
|
implementation("net.kyori:adventure-platform-facet:4.0.0")
|
||||||
|
|
||||||
implementation 'org.asynchttpclient:async-http-client:2.12.3'
|
implementation 'org.asynchttpclient:async-http-client:2.12.3'
|
||||||
|
|
||||||
|
@ -88,6 +88,8 @@ import net.kyori.adventure.audience.MessageType;
|
|||||||
import net.kyori.adventure.bossbar.BossBar;
|
import net.kyori.adventure.bossbar.BossBar;
|
||||||
import net.kyori.adventure.identity.Identity;
|
import net.kyori.adventure.identity.Identity;
|
||||||
import net.kyori.adventure.permission.PermissionChecker;
|
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.pointer.Pointers;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TranslatableComponent;
|
import net.kyori.adventure.text.TranslatableComponent;
|
||||||
@ -145,6 +147,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
.withDynamic(Identity.UUID, this::getUniqueId)
|
.withDynamic(Identity.UUID, this::getUniqueId)
|
||||||
.withDynamic(Identity.NAME, this::getUsername)
|
.withDynamic(Identity.NAME, this::getUsername)
|
||||||
.withStatic(PermissionChecker.POINTER, getPermissionChecker())
|
.withStatic(PermissionChecker.POINTER, getPermissionChecker())
|
||||||
|
.withStatic(FacetPointers.TYPE, Type.PLAYER)
|
||||||
.build();
|
.build();
|
||||||
private @Nullable String clientBrand;
|
private @Nullable String clientBrand;
|
||||||
private @Nullable Locale effectiveLocale;
|
private @Nullable Locale effectiveLocale;
|
||||||
@ -256,6 +259,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
server.getEventManager().fireAndForget(new PlayerModInfoEvent(this, modInfo));
|
server.getEventManager().fireAndForget(new PlayerModInfoEvent(this, modInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Pointers pointers() {
|
||||||
|
return this.pointers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InetSocketAddress getRemoteAddress() {
|
public InetSocketAddress getRemoteAddress() {
|
||||||
return (InetSocketAddress) connection.getRemoteAddress();
|
return (InetSocketAddress) connection.getRemoteAddress();
|
||||||
|
@ -29,6 +29,8 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import net.kyori.adventure.identity.Identity;
|
import net.kyori.adventure.identity.Identity;
|
||||||
import net.kyori.adventure.permission.PermissionChecker;
|
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.pointer.Pointers;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
@ -52,7 +54,9 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons
|
|||||||
private final VelocityServer server;
|
private final VelocityServer server;
|
||||||
private PermissionFunction permissionFunction = ALWAYS_TRUE;
|
private PermissionFunction permissionFunction = ALWAYS_TRUE;
|
||||||
private final @NotNull Pointers pointers = ConsoleCommandSource.super.pointers().toBuilder()
|
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) {
|
public VelocityConsole(VelocityServer server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren