An Easter basket bearing gifts! (#191)

* Delay switch to new server until after JoinGame is sent.

Unfortunately, in some cases (especially vanilla Minecraft) some login
disconnects are sent after ServerLoginSuccess but before JoinGame.
We've been using ServerLoginSuccess but it has caused too many problems.
Now Velocity will switch to a stripped-down version of the play session
handler until JoinGame is received. This handler does very little by
itself: it simply forwards plugin messages (for Forge) and waits for the
JoinGame packet from the server.

This is an initial version: only vanilla Minecraft 1.12.2 was tested.
However this is the way Waterfall without entity rewriting does server
switches (which, in turn, is inherited from BungeeCord).

* Move to Gradle 5 and Error Prone.
This commit is contained in:
Andrew Steinborn
2019-04-24 14:36:49 -04:00
committed by GitHub
parent c8e33eef60
commit 1661cece2d
35 changed files with 475 additions and 309 deletions

View File

@@ -38,7 +38,8 @@ public class PluginAnnotationProcessor extends AbstractProcessor {
}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
public synchronized boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
return false;
}

View File

@@ -12,7 +12,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.checkerframework.checker.nullness.qual.Nullable;
public class SerializedPluginDescription {
public final class SerializedPluginDescription {
public static final Pattern ID_PATTERN = Pattern.compile("[a-z][a-z0-9-_]{0,63}");
@@ -123,7 +123,7 @@ public class SerializedPluginDescription {
+ '}';
}
public static class Dependency {
public static final class Dependency {
private final String id;
private final boolean optional;

View File

@@ -70,6 +70,7 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage
*
* @param component the chat message to send
*/
@Override
default void sendMessage(Component component) {
sendMessage(component, MessagePosition.CHAT);
}

View File

@@ -3,6 +3,7 @@ package com.velocitypowered.api.proxy.server;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.proxy.config.ProxyConfig;
import java.util.ArrayList;
@@ -26,14 +27,14 @@ public final class QueryResponse {
private final int maxPlayers;
private final String proxyHost;
private final int proxyPort;
private final Collection<String> players;
private final ImmutableCollection<String> players;
private final String proxyVersion;
private final Collection<PluginInformation> plugins;
private final ImmutableCollection<PluginInformation> plugins;
@VisibleForTesting
QueryResponse(String hostname, String gameVersion, String map, int currentPlayers,
int maxPlayers, String proxyHost, int proxyPort, Collection<String> players,
String proxyVersion, Collection<PluginInformation> plugins) {
int maxPlayers, String proxyHost, int proxyPort, ImmutableCollection<String> players,
String proxyVersion, ImmutableCollection<PluginInformation> plugins) {
this.hostname = hostname;
this.gameVersion = gameVersion;
this.map = map;
@@ -403,7 +404,7 @@ public final class QueryResponse {
/**
* Represents a plugin in the query response.
*/
public static class PluginInformation {
public static final class PluginInformation {
private final String name;
private final @Nullable String version;