|
6 | 6 | import net.minestom.server.network.packet.server.ServerPacket; |
7 | 7 | import org.jetbrains.annotations.NotNull; |
8 | 8 |
|
| 9 | +/** |
| 10 | + * The {@link TestConnection} represents a connection from a player to a test server instance. |
| 11 | + * It provides methods to connect a player to an instance and track incoming packets. |
| 12 | + * |
| 13 | + * @version 1.0.0 |
| 14 | + * @since 0.1.0 |
| 15 | + */ |
9 | 16 | public interface TestConnection { |
| 17 | + |
| 18 | + /** |
| 19 | + * Connects a player to the given instance at the specified position. |
| 20 | + * |
| 21 | + * @param instance the instance to connect to |
| 22 | + * @param pos the position to connect at |
| 23 | + * @return the connected player |
| 24 | + */ |
10 | 25 | @NotNull Player connect(@NotNull Instance instance, @NotNull Pos pos); |
11 | 26 |
|
| 27 | + /** |
| 28 | + * Connects a player to the given instance at the default position (0, 0, 0). |
| 29 | + * |
| 30 | + * @param instance the instance to connect to |
| 31 | + * @return the connected player |
| 32 | + */ |
| 33 | + default @NotNull Player connect(@NotNull Instance instance) { |
| 34 | + return connect(instance, Pos.ZERO); |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Tracks incoming packets of the specified type. |
| 39 | + * |
| 40 | + * @param type the class of the packet type to track |
| 41 | + * @param <T> the type of the packet |
| 42 | + * @return a collector for the specified packet type |
| 43 | + */ |
12 | 44 | <T extends ServerPacket> @NotNull Collector<T> trackIncoming(@NotNull Class<T> type); |
13 | 45 |
|
| 46 | + /** |
| 47 | + * Tracks incoming packets of the default type {@link ServerPacket}. |
| 48 | + * |
| 49 | + * @return a collector for the default packet type |
| 50 | + */ |
14 | 51 | default @NotNull Collector<ServerPacket> trackIncoming() { |
15 | 52 | return trackIncoming(ServerPacket.class); |
16 | 53 | } |
|
0 commit comments