Skip to content

Commit

Permalink
Update to 1.19.1 (PaperMC#772)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored and ValeraShimchuck committed Aug 2, 2022
1 parent 0715d04 commit c8bdb9b
Show file tree
Hide file tree
Showing 60 changed files with 883 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public String toString() {
*/
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;

import java.util.List;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -57,7 +57,7 @@ public static Tristate fromBoolean(boolean val) {
*
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package com.velocitypowered.api.proxy;

import com.velocitypowered.api.network.ProtocolVersion;

import java.net.InetSocketAddress;
import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -56,6 +54,7 @@ default boolean hasExpired() {
* 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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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,
Expand All @@ -85,13 +85,13 @@ TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, in
/**
* 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public Builder profile(GameProfile profile) {
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;

import org.checkerframework.checker.nullness.qual.Nullable;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public String toString() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void toBuilderConsistency() {
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());
}
}
}
Loading

0 comments on commit c8bdb9b

Please sign in to comment.