Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev/3.0.0' into dev/3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Nov 27, 2024
2 parents 7a8da11 + 9cfcfcf commit 08fcb8e
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ body:
```
[17:44:10 INFO]: Velocity 3.3.0-SNAPSHOT (git-9d25d309-b400)
[17:44:10 INFO]: Copyright 2018-2023 Velocity Contributors. Velocity is licensed under the terms of the GNU General Public License v3.
[17:44:10 INFO]: velocitypowered.com - GitHub
[17:44:10 INFO]: PaperMC - GitHub
```
</details>
validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,25 @@ default TabListEntry buildEntry(GameProfile profile, @Nullable Component display
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
*/
@Deprecated
default TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
int gameMode, @Nullable ChatSession chatSession, boolean listed) {
return buildEntry(profile, displayName, latency, gameMode, chatSession, listed, 0);
}

/**
* Represents an entry in a {@link Player}'s tab list.
*
* @param profile the profile
* @param displayName the display name
* @param latency the latency
* @param gameMode the game mode
* @param chatSession the chat session
* @param listed the visible status of entry
* @param listOrder the order/priority of entry in the tab list
* @return the entry
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
*/
@Deprecated
TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
int gameMode, @Nullable ChatSession chatSession, boolean listed);
int gameMode, @Nullable ChatSession chatSession, boolean listed, int listOrder);
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,27 @@ default TabListEntry setListed(boolean listed) {
return this;
}

/**
* Returns the order/priority of this entry in the tab list.
*
* @return order of this entry
* @sinceMinecraft 1.21.2
*/
default int getListOrder() {
return 0;
}

/**
* Sets the order/priority of this entry in the tab list.
*
* @param order order of this entry
* @return {@code this}, for chaining
* @sinceMinecraft 1.21.2
*/
default TabListEntry setListOrder(int order) {
return this;
}

/**
* Returns a {@link Builder} to create a {@link TabListEntry}.
*
Expand All @@ -161,6 +182,7 @@ class Builder {
private int latency = 0;
private int gameMode = 0;
private boolean listed = true;
private int listOrder = 0;

private @Nullable ChatSession chatSession;

Expand Down Expand Up @@ -243,7 +265,7 @@ public Builder gameMode(int gameMode) {
}

/**
* Sets wether this entry should be visible.
* Sets whether this entry should be visible.
*
* @param listed to set
* @return ${code this}, for chaining
Expand All @@ -254,6 +276,19 @@ public Builder listed(boolean listed) {
return this;
}

/**
* Sets the order/priority of this entry in the tab list.
*
* @param order to set
* @return ${code this}, for chaining
* @sinceMinecraft 1.21.2
* @see TabListEntry#getListOrder()
*/
public Builder listOrder(int order) {
this.listOrder = order;
return this;
}

/**
* Constructs the {@link TabListEntry} specified by {@code this} {@link Builder}.
*
Expand All @@ -266,7 +301,7 @@ public TabListEntry build() {
if (profile == null) {
throw new IllegalStateException("The GameProfile must be set when building a TabListEntry");
}
return tabList.buildEntry(profile, displayName, latency, gameMode, chatSession, listed);
return tabList.buildEntry(profile, displayName, latency, gameMode, chatSession, listed, listOrder);
}
}
}
17 changes: 9 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
configurate3 = "3.7.3"
configurate4 = "4.1.2"
flare = "2.0.1"
log4j = "2.22.1"
netty = "4.1.106.Final"
log4j = "2.24.1"
netty = "4.1.114.Final"

[plugins]
indra-publishing = "net.kyori.indra.publishing:2.0.6"
Expand All @@ -12,13 +12,14 @@ spotless = "com.diffplug.spotless:6.25.0"

[libraries]
adventure-bom = "net.kyori:adventure-bom:4.17.0"
adventure-facet = "net.kyori:adventure-platform-facet:4.3.2"
adventure-text-serializer-json-legacy-impl = "net.kyori:adventure-text-serializer-json-legacy-impl:4.17.0"
adventure-facet = "net.kyori:adventure-platform-facet:4.3.4"
asm = "org.ow2.asm:asm:9.6"
auto-service = "com.google.auto.service:auto-service:1.0.1"
auto-service-annotations = "com.google.auto.service:auto-service-annotations:1.0.1"
brigadier = "com.velocitypowered:velocity-brigadier:1.0.0-SNAPSHOT"
bstats = "org.bstats:bstats-base:3.0.2"
caffeine = "com.github.ben-manes.caffeine:caffeine:3.1.5"
caffeine = "com.github.ben-manes.caffeine:caffeine:3.1.8"
checker-qual = "org.checkerframework:checker-qual:3.42.0"
checkstyle = "com.puppycrawl.tools:checkstyle:10.9.3"
completablefutures = "com.spotify:completable-futures:0.3.6"
Expand All @@ -28,15 +29,15 @@ configurate3-gson = { module = "org.spongepowered:configurate-gson", version.ref
configurate4-hocon = { module = "org.spongepowered:configurate-hocon", version.ref = "configurate4" }
configurate4-yaml = { module = "org.spongepowered:configurate-yaml", version.ref = "configurate4" }
configurate4-gson = { module = "org.spongepowered:configurate-gson", version.ref = "configurate4" }
disruptor = "com.lmax:disruptor:3.4.4"
fastutil = "it.unimi.dsi:fastutil:8.5.12"
disruptor = "com.lmax:disruptor:4.0.0"
fastutil = "it.unimi.dsi:fastutil:8.5.15"
flare-core = { module = "space.vectrix.flare:flare", version.ref = "flare" }
flare-fastutil = { module = "space.vectrix.flare:flare-fastutil", version.ref = "flare" }
jline = "org.jline:jline-terminal-jansi:3.23.0"
jline = "org.jline:jline-terminal-jansi:3.27.1"
jopt = "net.sf.jopt-simple:jopt-simple:5.0.4"
junit = "org.junit.jupiter:junit-jupiter:5.10.2"
jspecify = "org.jspecify:jspecify:0.3.0"
kyori-ansi = "net.kyori:ansi:1.0.3"
kyori-ansi = "net.kyori:ansi:1.1.0"
guava = "com.google.guava:guava:25.1-jre"
gson = "com.google.code.gson:gson:2.10.1"
guice = "com.google.inject:guice:6.0.0"
Expand Down
2 changes: 1 addition & 1 deletion proxy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ dependencies {
runtimeOnly(libs.disruptor)
implementation(libs.fastutil)
implementation(platform(libs.adventure.bom))
implementation("net.kyori:adventure-nbt")
implementation(libs.adventure.text.serializer.json.legacy.impl)
implementation(libs.adventure.facet)
implementation(libs.completablefutures)
implementation(libs.nightconfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ public int run(final CommandContext<CommandSource> context) {
if (version.getName().equals("Velocity")) {
final TextComponent embellishment = Component.text()
.append(Component.text()
.content("velocitypowered.com")
.content("PaperMC")
.color(NamedTextColor.GREEN)
.clickEvent(
ClickEvent.openUrl("https://velocitypowered.com"))
ClickEvent.openUrl("https://papermc.io/software/velocity"))
.build())
.append(Component.text(" - "))
.append(Component.text()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.util.VelocityLegacyHoverEventSerializer;
import com.velocitypowered.proxy.util.except.QuietDecoderException;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
Expand All @@ -47,6 +46,7 @@
import net.kyori.adventure.nbt.CompoundBinaryTag;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.json.JSONOptions;
import net.kyori.adventure.text.serializer.json.legacyimpl.NBTLegacyHoverEventSerializer;
import net.kyori.option.OptionState;

/**
Expand All @@ -58,8 +58,7 @@ public enum ProtocolUtils {
private static final GsonComponentSerializer PRE_1_16_SERIALIZER =
GsonComponentSerializer.builder()
.downsampleColors()
.emitLegacyHoverEvent()
.legacyHoverEventSerializer(VelocityLegacyHoverEventSerializer.INSTANCE)
.legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get())
.options(
OptionState.optionState()
// before 1.16
Expand All @@ -74,7 +73,7 @@ public enum ProtocolUtils {
.build();
private static final GsonComponentSerializer PRE_1_20_3_SERIALIZER =
GsonComponentSerializer.builder()
.legacyHoverEventSerializer(VelocityLegacyHoverEventSerializer.INSTANCE)
.legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get())
.options(
OptionState.optionState()
// after 1.16
Expand All @@ -89,7 +88,7 @@ public enum ProtocolUtils {
.build();
private static final GsonComponentSerializer MODERN_SERIALIZER =
GsonComponentSerializer.builder()
.legacyHoverEventSerializer(VelocityLegacyHoverEventSerializer.INSTANCE)
.legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get())
.options(
OptionState.optionState()
// after 1.16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
// skip any runs of 0x00 we might find
int packetStart = in.forEachByte(FIND_NON_NUL);
if (packetStart == -1) {
in.clear();
return;
}
in.readerIndex(packetStart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ public ComponentHolder getComponent() {
@Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
component = ComponentHolder.read(buf, version);
// System chat is never decoded so this doesn't matter for now
type = ChatType.values()[ProtocolUtils.readVarInt(buf)];
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_19_1)){
type = buf.readBoolean() ? ChatType.GAME_INFO : ChatType.SYSTEM;
} else {
type = ChatType.values()[ProtocolUtils.readVarInt(buf)];
}
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,17 @@ public TabListEntry buildEntry(GameProfile profile,

@Override
public TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
int gameMode,
@Nullable ChatSession chatSession, boolean listed) {
int gameMode, @Nullable ChatSession chatSession, boolean listed) {
return new KeyedVelocityTabListEntry(this, profile, displayName, latency, gameMode,
chatSession == null ? null : chatSession.getIdentifiedKey());
}

@Override
public TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
int gameMode, @Nullable ChatSession chatSession, boolean listed, int listOrder) {
return buildEntry(profile, displayName, latency, gameMode, chatSession, listed);
}

@Override
public void processLegacy(LegacyPlayerListItemPacket packet) {
// Packets are already forwarded on, so no need to do that here
Expand Down
Loading

0 comments on commit 08fcb8e

Please sign in to comment.