Update to 1.19.1 (#772)

* 1.19.1-rc1

* More signature changes

* Further 1.19.1 changes

I also started on the checkstyle update, see the developers notes
for the rest I haven't gotten around to fixing yet.

* Fix checkstyle

* Checkstyle imports

* Fix logic error

* Changes 1.19.1-pre2

* 1.19-pre3

* Progress, some parts still WIP

* Overlooked changes

* Fix ServerData

* Fix ServerLogin send check

* Workaround the broken behavior of "No Chat Reports"

Note that if we ever choose to enforce chat signatures, then the mod will just break again... not our fault if we do that, you get what you pay for.

* more

Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Andrew Steinborn <git@steinborn.me>
This commit is contained in:
FivePB (Xer)
2022-07-30 23:30:03 +00:00
committed by GitHub
parent 6be344d919
commit 1a3fba4250
60 changed files with 883 additions and 192 deletions

View File

@@ -11,7 +11,6 @@ import com.google.common.base.Preconditions;
import java.util.Optional;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.checkerframework.checker.nullness.qual.Nullable;
/**

View File

@@ -74,8 +74,8 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
*/
public static final class CommandResult implements ResultedEvent.Result {
private static final CommandResult ALLOWED = new CommandResult(true, false,null);
private static final CommandResult DENIED = new CommandResult(false, false,null);
private static final CommandResult ALLOWED = new CommandResult(true, false, null);
private static final CommandResult DENIED = new CommandResult(false, false, null);
private static final CommandResult FORWARD_TO_SERVER = new CommandResult(false, true, null);
private @Nullable String command;

View File

@@ -10,7 +10,6 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import java.util.List;
/**

View File

@@ -58,7 +58,8 @@ public enum ProtocolVersion {
MINECRAFT_1_17_1(756, "1.17.1"),
MINECRAFT_1_18(757, "1.18", "1.18.1"),
MINECRAFT_1_18_2(758, "1.18.2"),
MINECRAFT_1_19(759, "1.19");
MINECRAFT_1_19(759, "1.19"),
MINECRAFT_1_19_1(760, "1.19.1");
private static final int SNAPSHOT_BIT = 30;

View File

@@ -43,7 +43,7 @@ public enum Tristate {
*
* @param val the boolean value
* @return {@link #TRUE} or {@link #FALSE}, if the value is <code>true</code> or
* <code>false</code>, respectively.
* <code>false</code>, respectively.
*/
public static Tristate fromBoolean(boolean val) {
return val ? TRUE : FALSE;
@@ -57,7 +57,7 @@ public enum Tristate {
*
* @param val the boolean value
* @return {@link #UNDEFINED}, {@link #TRUE} or {@link #FALSE}, if the value is <code>null</code>,
* <code>true</code> or <code>false</code>, respectively.
* <code>true</code> or <code>false</code>, respectively.
*/
public static Tristate fromNullableBoolean(@Nullable Boolean val) {
if (val == null) {

View File

@@ -8,7 +8,6 @@
package com.velocitypowered.api.proxy;
import com.velocitypowered.api.network.ProtocolVersion;
import java.net.InetSocketAddress;
import java.util.Optional;

View File

@@ -7,7 +7,12 @@
package com.velocitypowered.api.proxy.crypto;
import com.google.common.collect.ImmutableSet;
import com.velocitypowered.api.network.ProtocolVersion;
import java.security.PublicKey;
import java.util.Set;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Represents session-server cross-signed dated RSA public key.
@@ -32,4 +37,41 @@ public interface IdentifiedKey extends KeySigned {
*/
boolean verifyDataSignature(byte[] signature, byte[]... toVerify);
/**
* Retrieves the signature holders UUID.
* Returns null before the {@link com.velocitypowered.api.event.connection.LoginEvent}.
*
* @return the holder UUID or null if not present
*/
@Nullable
UUID getSignatureHolder();
/**
* Retrieves the key revision.
*
* @return the key revision
*/
Revision getKeyRevision();
enum Revision {
GENERIC_V1(ImmutableSet.of(), ImmutableSet.of(ProtocolVersion.MINECRAFT_1_19)),
LINKED_V2(ImmutableSet.of(), ImmutableSet.of(ProtocolVersion.MINECRAFT_1_19_1));
final Set<Revision> backwardsCompatibleTo;
final Set<ProtocolVersion> applicableTo;
Revision(Set<Revision> backwardsCompatibleTo, Set<ProtocolVersion> applicableTo) {
this.backwardsCompatibleTo = backwardsCompatibleTo;
this.applicableTo = applicableTo;
}
public Set<Revision> getBackwardsCompatibleTo() {
return backwardsCompatibleTo;
}
public Set<ProtocolVersion> getApplicableTo() {
return applicableTo;
}
}
}

View File

@@ -8,10 +8,8 @@
package com.velocitypowered.api.proxy.crypto;
import com.google.common.annotations.Beta;
import java.security.PublicKey;
import java.time.Instant;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface KeySigned {
@@ -56,6 +54,7 @@ public interface KeySigned {
* signer public key. Note: This will **not** check for
* expiry. You can check for expiry with {@link KeySigned#hasExpired()}.
* <p>DOES NOT WORK YET FOR MESSAGES AND COMMANDS!</p>
* Addendum: Does not work for 1.19.1 until the user has authenticated.
*
* @return validity of the signature
*/

View File

@@ -49,7 +49,7 @@ public interface TabList {
*
* @param uuid of the entry
* @return {@link Optional} containing the removed {@link TabListEntry} if present, otherwise
* {@link Optional#empty()}
* {@link Optional#empty()}
*/
Optional<TabListEntry> removeEntry(UUID uuid);
@@ -71,12 +71,12 @@ public interface TabList {
/**
* Builds a tab list entry.
*
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
* @param profile profile
* @param displayName display name
* @param latency latency
* @param gameMode game mode
* @return entry
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
*/
@Deprecated
TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
@@ -85,13 +85,13 @@ public interface TabList {
/**
* Builds a tab list entry.
*
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
* @param profile profile
* @param displayName display name
* @param latency latency
* @param gameMode game mode
* @param key the player key
* @return entry
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
*/
@Deprecated
TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,

View File

@@ -160,6 +160,7 @@ public interface TabListEntry extends KeyIdentifiable {
* Sets the {@link IdentifiedKey} of the {@link TabListEntry}.
* <p>This is only intended and only works for players currently <b>not</b> connected to this proxy.</p>
* <p>For any player currently connected to this proxy this will be filled automatically.</p>
* <p>Will ignore mismatching key revisions data.</p>
*
* @param playerKey key to set
* @return {@code this}, for chaining

View File

@@ -18,7 +18,6 @@ import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
/**

View File

@@ -11,7 +11,6 @@ import java.time.Duration;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import org.checkerframework.common.value.qual.IntRange;
import org.jetbrains.annotations.NotNull;

View File

@@ -80,7 +80,7 @@ public final class Favicon {
public static Favicon create(BufferedImage image) {
Preconditions.checkNotNull(image, "image");
Preconditions.checkArgument(image.getWidth() == 64 && image.getHeight() == 64,
"Image is not 64x64 (found %sx%s)", image.getWidth(),image.getHeight());
"Image is not 64x64 (found %sx%s)", image.getWidth(), image.getHeight());
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ImageIO.write(image, "PNG", os);

View File

@@ -20,7 +20,7 @@ class QueryResponseTest {
QueryResponse response = new QueryResponse("test", "test", "test",
1, 2, "test", 1234, ImmutableList.of("tuxed"),
"0.0.1", ImmutableList.of(new PluginInformation("test", "1.0.0"),
new PluginInformation("test2", null)));
new PluginInformation("test2", null)));
assertEquals(response, response.toBuilder().build());
}
}
}