Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Merge branch 'dev/1.1.0' into experiment/io_uring
# Conflicts: # proxy/build.gradle
Dieser Commit ist enthalten in:
Commit
08558b327e
@ -32,11 +32,12 @@ dependencies {
|
|||||||
// DEPRECATED: Will be removed in Velocity 2.0.0
|
// DEPRECATED: Will be removed in Velocity 2.0.0
|
||||||
api 'com.moandjiezana.toml:toml4j:0.7.2'
|
api 'com.moandjiezana.toml:toml4j:0.7.2'
|
||||||
|
|
||||||
api "net.kyori:adventure-api:${adventureVersion}"
|
api(platform("net.kyori:adventure-bom:${adventureVersion}"))
|
||||||
api "net.kyori:adventure-text-serializer-gson:${adventureVersion}"
|
api("net.kyori:adventure-api")
|
||||||
api "net.kyori:adventure-text-serializer-legacy:${adventureVersion}"
|
api("net.kyori:adventure-text-serializer-gson")
|
||||||
api "net.kyori:adventure-text-serializer-plain:${adventureVersion}"
|
api("net.kyori:adventure-text-serializer-legacy")
|
||||||
api "net.kyori:adventure-text-serializer-legacy-text3:${adventurePlatformVersion}"
|
api("net.kyori:adventure-text-serializer-plain")
|
||||||
|
api("net.kyori:adventure-text-serializer-legacy-text3:${adventurePlatformVersion}") // adventure-platform
|
||||||
|
|
||||||
api "org.slf4j:slf4j-api:${slf4jVersion}"
|
api "org.slf4j:slf4j-api:${slf4jVersion}"
|
||||||
api 'com.google.inject:guice:4.2.3'
|
api 'com.google.inject:guice:4.2.3'
|
||||||
|
@ -146,6 +146,20 @@ public interface Player extends CommandSource, Identified, InboundConnection,
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
void clearHeaderAndFooter();
|
void clearHeaderAndFooter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player's player list header.
|
||||||
|
*
|
||||||
|
* @return this player's player list header
|
||||||
|
*/
|
||||||
|
Component getPlayerListHeader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player's player list footer.
|
||||||
|
*
|
||||||
|
* @return this player's tab list
|
||||||
|
*/
|
||||||
|
Component getPlayerListFooter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the player's tab list.
|
* Returns the player's tab list.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +28,9 @@ public interface TabList {
|
|||||||
*
|
*
|
||||||
* @param header the header component
|
* @param header the header component
|
||||||
* @param footer the footer component
|
* @param footer the footer component
|
||||||
|
* @deprecated Use {@link Player#sendPlayerListHeaderAndFooter(Component, Component)} instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
void setHeaderAndFooter(Component header, Component footer);
|
void setHeaderAndFooter(Component header, Component footer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,12 +21,12 @@ allprojects {
|
|||||||
ext {
|
ext {
|
||||||
// dependency versions
|
// dependency versions
|
||||||
textVersion = '3.0.4'
|
textVersion = '3.0.4'
|
||||||
adventureVersion = '4.2.0'
|
adventureVersion = '4.3.0'
|
||||||
adventurePlatformVersion = '4.0.0-SNAPSHOT'
|
adventurePlatformVersion = '4.0.0-SNAPSHOT'
|
||||||
junitVersion = '5.7.0'
|
junitVersion = '5.7.0'
|
||||||
slf4jVersion = '1.7.30'
|
slf4jVersion = '1.7.30'
|
||||||
log4jVersion = '2.13.3'
|
log4jVersion = '2.13.3'
|
||||||
nettyVersion = '4.1.54.Final'
|
nettyVersion = '4.1.55.Final'
|
||||||
guavaVersion = '25.1-jre'
|
guavaVersion = '25.1-jre'
|
||||||
checkerFrameworkVersion = '3.6.1'
|
checkerFrameworkVersion = '3.6.1'
|
||||||
configurateVersion = '3.7.1'
|
configurateVersion = '3.7.1'
|
||||||
|
@ -51,7 +51,7 @@ dependencies {
|
|||||||
implementation "io.netty:netty-handler:${nettyVersion}"
|
implementation "io.netty:netty-handler:${nettyVersion}"
|
||||||
implementation "io.netty:netty-transport-native-epoll:${nettyVersion}"
|
implementation "io.netty:netty-transport-native-epoll:${nettyVersion}"
|
||||||
implementation "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
|
implementation "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
|
||||||
implementation "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-aarch64"
|
implementation "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-aarch_64"
|
||||||
implementation "io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.1.Final:linux-x86_64"
|
implementation "io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.1.Final:linux-x86_64"
|
||||||
implementation "io.netty:netty-resolver-dns:${nettyVersion}"
|
implementation "io.netty:netty-resolver-dns:${nettyVersion}"
|
||||||
|
|
||||||
@ -67,7 +67,9 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'it.unimi.dsi:fastutil:8.4.1'
|
implementation 'it.unimi.dsi:fastutil:8.4.1'
|
||||||
implementation 'net.kyori:event-method-asm:4.0.0-SNAPSHOT'
|
implementation 'net.kyori:event-method-asm:4.0.0-SNAPSHOT'
|
||||||
implementation 'net.kyori:adventure-nbt:4.0.0-SNAPSHOT'
|
|
||||||
|
implementation(platform("net.kyori:adventure-bom:${adventureVersion}"))
|
||||||
|
implementation("net.kyori:adventure-nbt")
|
||||||
|
|
||||||
implementation 'org.asynchttpclient:async-http-client:2.12.1'
|
implementation 'org.asynchttpclient:async-http-client:2.12.1'
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ import com.velocitypowered.proxy.protocol.StateRegistry;
|
|||||||
import com.velocitypowered.proxy.protocol.packet.Chat;
|
import com.velocitypowered.proxy.protocol.packet.Chat;
|
||||||
import com.velocitypowered.proxy.protocol.packet.ClientSettings;
|
import com.velocitypowered.proxy.protocol.packet.ClientSettings;
|
||||||
import com.velocitypowered.proxy.protocol.packet.Disconnect;
|
import com.velocitypowered.proxy.protocol.packet.Disconnect;
|
||||||
|
import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter;
|
||||||
import com.velocitypowered.proxy.protocol.packet.KeepAlive;
|
import com.velocitypowered.proxy.protocol.packet.KeepAlive;
|
||||||
import com.velocitypowered.proxy.protocol.packet.PluginMessage;
|
import com.velocitypowered.proxy.protocol.packet.PluginMessage;
|
||||||
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest;
|
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest;
|
||||||
@ -61,6 +62,7 @@ import java.net.InetSocketAddress;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -105,6 +107,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
private @Nullable VelocityServerConnection connectionInFlight;
|
private @Nullable VelocityServerConnection connectionInFlight;
|
||||||
private @Nullable PlayerSettings settings;
|
private @Nullable PlayerSettings settings;
|
||||||
private @Nullable ModInfo modInfo;
|
private @Nullable ModInfo modInfo;
|
||||||
|
private Component playerListHeader = Component.empty();
|
||||||
|
private Component playerListFooter = Component.empty();
|
||||||
private final VelocityTabList tabList;
|
private final VelocityTabList tabList;
|
||||||
private final VelocityServer server;
|
private final VelocityServer server;
|
||||||
private ClientConnectionPhase connectionPhase;
|
private ClientConnectionPhase connectionPhase;
|
||||||
@ -115,11 +119,6 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection,
|
ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection,
|
||||||
@Nullable InetSocketAddress virtualHost, boolean onlineMode) {
|
@Nullable InetSocketAddress virtualHost, boolean onlineMode) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
|
|
||||||
this.tabList = new VelocityTabList(connection);
|
|
||||||
} else {
|
|
||||||
this.tabList = new VelocityTabListLegacy(connection);
|
|
||||||
}
|
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.virtualHost = virtualHost;
|
this.virtualHost = virtualHost;
|
||||||
@ -127,6 +126,12 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
this.connectionPhase = connection.getType().getInitialClientPhase();
|
this.connectionPhase = connection.getType().getInitialClientPhase();
|
||||||
this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS);
|
this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS);
|
||||||
this.onlineMode = onlineMode;
|
this.onlineMode = onlineMode;
|
||||||
|
|
||||||
|
if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
|
||||||
|
this.tabList = new VelocityTabList(this);
|
||||||
|
} else {
|
||||||
|
this.tabList = new VelocityTabListLegacy(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -301,6 +306,33 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getPlayerListHeader() {
|
||||||
|
return this.playerListHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getPlayerListFooter() {
|
||||||
|
return this.playerListFooter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPlayerListHeader(@NonNull final Component header) {
|
||||||
|
this.sendPlayerListHeaderAndFooter(header, this.playerListFooter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPlayerListFooter(@NonNull final Component footer) {
|
||||||
|
this.sendPlayerListHeaderAndFooter(this.playerListHeader, footer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPlayerListHeaderAndFooter(final Component header, final Component footer) {
|
||||||
|
this.playerListHeader = Objects.requireNonNull(header, "header");
|
||||||
|
this.playerListFooter = Objects.requireNonNull(footer, "footer");
|
||||||
|
this.connection.write(HeaderAndFooter.create(header, footer, this.getProtocolVersion()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showTitle(net.kyori.adventure.title.@NonNull Title title) {
|
public void showTitle(net.kyori.adventure.title.@NonNull Title title) {
|
||||||
GsonComponentSerializer serializer = ProtocolUtils.getJsonChatSerializer(this
|
GsonComponentSerializer serializer = ProtocolUtils.getJsonChatSerializer(this
|
||||||
@ -363,6 +395,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
this.profile = profile.withProperties(Preconditions.checkNotNull(properties));
|
this.profile = profile.withProperties(Preconditions.checkNotNull(properties));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setHeaderAndFooter(net.kyori.text.Component header, net.kyori.text.Component footer) {
|
public void setHeaderAndFooter(net.kyori.text.Component header, net.kyori.text.Component footer) {
|
||||||
tabList.setHeaderAndFooter(header, footer);
|
tabList.setHeaderAndFooter(header, footer);
|
||||||
|
@ -8,6 +8,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
|||||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||||
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
|
|
||||||
public class HeaderAndFooter implements MinecraftPacket {
|
public class HeaderAndFooter implements MinecraftPacket {
|
||||||
@ -51,15 +52,8 @@ public class HeaderAndFooter implements MinecraftPacket {
|
|||||||
return handler.handle(this);
|
return handler.handle(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HeaderAndFooter create(net.kyori.text.Component header,
|
public static HeaderAndFooter create(Component header,
|
||||||
net.kyori.text.Component footer) {
|
Component footer, ProtocolVersion protocolVersion) {
|
||||||
return new HeaderAndFooter(
|
|
||||||
net.kyori.text.serializer.gson.GsonComponentSerializer.INSTANCE.serialize(header),
|
|
||||||
net.kyori.text.serializer.gson.GsonComponentSerializer.INSTANCE.serialize(footer));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HeaderAndFooter create(net.kyori.adventure.text.Component header,
|
|
||||||
net.kyori.adventure.text.Component footer, ProtocolVersion protocolVersion) {
|
|
||||||
GsonComponentSerializer serializer = ProtocolUtils.getJsonChatSerializer(protocolVersion);
|
GsonComponentSerializer serializer = ProtocolUtils.getJsonChatSerializer(protocolVersion);
|
||||||
return new HeaderAndFooter(serializer.serialize(header), serializer.serialize(footer));
|
return new HeaderAndFooter(serializer.serialize(header), serializer.serialize(footer));
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.velocitypowered.api.proxy.player.TabList;
|
|||||||
import com.velocitypowered.api.proxy.player.TabListEntry;
|
import com.velocitypowered.api.proxy.player.TabListEntry;
|
||||||
import com.velocitypowered.api.util.GameProfile;
|
import com.velocitypowered.api.util.GameProfile;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||||
|
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
||||||
import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter;
|
import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter;
|
||||||
import com.velocitypowered.proxy.protocol.packet.PlayerListItem;
|
import com.velocitypowered.proxy.protocol.packet.PlayerListItem;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -15,31 +16,39 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import net.kyori.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.serializer.legacytext3.LegacyText3ComponentSerializer;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
public class VelocityTabList implements TabList {
|
public class VelocityTabList implements TabList {
|
||||||
|
|
||||||
|
protected final ConnectedPlayer player;
|
||||||
protected final MinecraftConnection connection;
|
protected final MinecraftConnection connection;
|
||||||
protected final Map<UUID, VelocityTabListEntry> entries = new ConcurrentHashMap<>();
|
protected final Map<UUID, VelocityTabListEntry> entries = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public VelocityTabList(MinecraftConnection connection) {
|
public VelocityTabList(final ConnectedPlayer player) {
|
||||||
this.connection = connection;
|
this.player = player;
|
||||||
|
this.connection = player.getConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public void setHeaderAndFooter(net.kyori.text.Component header,
|
||||||
|
net.kyori.text.Component footer) {
|
||||||
|
Preconditions.checkNotNull(header, "header");
|
||||||
|
Preconditions.checkNotNull(footer, "footer");
|
||||||
|
this.player.sendPlayerListHeaderAndFooter(
|
||||||
|
LegacyText3ComponentSerializer.get().deserialize(header),
|
||||||
|
LegacyText3ComponentSerializer.get().deserialize(footer)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setHeaderAndFooter(Component header, Component footer) {
|
public void setHeaderAndFooter(Component header, Component footer) {
|
||||||
Preconditions.checkNotNull(header, "header");
|
Preconditions.checkNotNull(header, "header");
|
||||||
Preconditions.checkNotNull(footer, "footer");
|
Preconditions.checkNotNull(footer, "footer");
|
||||||
connection.write(HeaderAndFooter.create(header, footer));
|
this.player.sendPlayerListHeaderAndFooter(header, footer);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeaderAndFooter(net.kyori.adventure.text.Component header,
|
|
||||||
net.kyori.adventure.text.Component footer) {
|
|
||||||
Preconditions.checkNotNull(header, "header");
|
|
||||||
Preconditions.checkNotNull(footer, "footer");
|
|
||||||
connection.write(HeaderAndFooter.create(header, footer, connection.getProtocolVersion()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,7 +3,7 @@ package com.velocitypowered.proxy.tablist;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.velocitypowered.api.proxy.player.TabListEntry;
|
import com.velocitypowered.api.proxy.player.TabListEntry;
|
||||||
import com.velocitypowered.api.util.GameProfile;
|
import com.velocitypowered.api.util.GameProfile;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
||||||
import com.velocitypowered.proxy.protocol.packet.PlayerListItem;
|
import com.velocitypowered.proxy.protocol.packet.PlayerListItem;
|
||||||
import com.velocitypowered.proxy.protocol.packet.PlayerListItem.Item;
|
import com.velocitypowered.proxy.protocol.packet.PlayerListItem.Item;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -18,14 +18,16 @@ public class VelocityTabListLegacy extends VelocityTabList {
|
|||||||
|
|
||||||
private final Map<String, UUID> nameMapping = new ConcurrentHashMap<>();
|
private final Map<String, UUID> nameMapping = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public VelocityTabListLegacy(MinecraftConnection connection) {
|
public VelocityTabListLegacy(final ConnectedPlayer player) {
|
||||||
super(connection);
|
super(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setHeaderAndFooter(net.kyori.text.Component header, net.kyori.text.Component footer) {
|
public void setHeaderAndFooter(net.kyori.text.Component header, net.kyori.text.Component footer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setHeaderAndFooter(Component header, Component footer) {
|
public void setHeaderAndFooter(Component header, Component footer) {
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren