Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for snapshot 24w04a (1.20.5) #3602

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.net.InetSocketAddress;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import net.md_5.bungee.api.config.ListenerInfo;
import org.jetbrains.annotations.ApiStatus;

/**
* Represents a user attempting to log into the proxy.
Expand Down Expand Up @@ -89,4 +91,15 @@ public interface PendingConnection extends Connection
* @return Whether the client is using a legacy client.
*/
boolean isLegacy();

/**
* Retrieves a cookie from this pending connection.
*
* @param cookie the resource location of the cookie, for example "bungeecord:my_cookie"
* @return a {@link CompletableFuture} that will be completed when the Cookie response is received
* if the cookie is not set in the client, the {@link CompletableFuture} will complete with a null value
* @throws IllegalStateException if the players version is not at least 1.20.5
*/
@ApiStatus.Experimental
CompletableFuture<byte[]> retrieveCookie(String cookie);
Outfluencer marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender;
Expand All @@ -13,6 +14,7 @@
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.ServerConnectEvent;
import net.md_5.bungee.api.score.Scoreboard;
import org.jetbrains.annotations.ApiStatus;

/**
* Represents a player whose connection is being connected to somewhere else,
Expand Down Expand Up @@ -339,4 +341,36 @@ public enum MainHand
*/
@Deprecated
Scoreboard getScoreboard();

/**
* Retrieves a cookie from this player.
*
* @param cookie the resource location of the cookie, for example "bungeecord:my_cookie"
* @return a {@link CompletableFuture} that will be completed when the Cookie response is received
* if the cookie is not set in the client, the {@link CompletableFuture} will complete with a null value
* @throws IllegalStateException if the players version is not at least 1.20.5
*/
@ApiStatus.Experimental
CompletableFuture<byte[]> retrieveCookie(String cookie);

Outfluencer marked this conversation as resolved.
Show resolved Hide resolved
/**
* Stores a cookie in this player's client.
*
* @param cookie the resource location of the cookie, for example "bungeecord:my_cookie"
* @param data the data to store in the cookie
* @throws IllegalStateException if the players version is not at least 1.20.5
*/
@ApiStatus.Experimental
void storeCookie(String cookie, byte[] data);

/**
* Requests this player to connect to a different server specified by host and port.
* This is a client side transfer, host and port should not specify a BungeeCord Backend Server.
*
* @param host the host of the server to transfer to
* @param port the port of the server to transfer to
* @throws IllegalStateException if the players version is not at least 1.20.5
*/
@ApiStatus.Experimental
void transfer(String host, int port);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.md_5.bungee.protocol.packet.ClientSettings;
import net.md_5.bungee.protocol.packet.ClientStatus;
import net.md_5.bungee.protocol.packet.Commands;
import net.md_5.bungee.protocol.packet.CookieRequest;
import net.md_5.bungee.protocol.packet.CookieResponse;
import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.EncryptionResponse;
import net.md_5.bungee.protocol.packet.EntityStatus;
Expand Down Expand Up @@ -40,13 +42,15 @@
import net.md_5.bungee.protocol.packet.StartConfiguration;
import net.md_5.bungee.protocol.packet.StatusRequest;
import net.md_5.bungee.protocol.packet.StatusResponse;
import net.md_5.bungee.protocol.packet.StoreCookie;
import net.md_5.bungee.protocol.packet.Subtitle;
import net.md_5.bungee.protocol.packet.SystemChat;
import net.md_5.bungee.protocol.packet.TabCompleteRequest;
import net.md_5.bungee.protocol.packet.TabCompleteResponse;
import net.md_5.bungee.protocol.packet.Team;
import net.md_5.bungee.protocol.packet.Title;
import net.md_5.bungee.protocol.packet.TitleTimes;
import net.md_5.bungee.protocol.packet.Transfer;
import net.md_5.bungee.protocol.packet.ViewDistance;

public abstract class AbstractPacketHandler
Expand Down Expand Up @@ -243,4 +247,20 @@ public void handle(StartConfiguration startConfiguration) throws Exception
public void handle(FinishConfiguration finishConfiguration) throws Exception
{
}

public void handle(Transfer transfer) throws Exception
{
}

public void handle(StoreCookie storeCookie) throws Exception
{
}

public void handle(CookieRequest cookieRequest) throws Exception
{
}

public void handle(CookieResponse cookieResponse) throws Exception
{
}
}
Loading